@@ -192,14 +192,19 @@ impl NodeMap {
192192 }
193193 }
194194
195- pub ( super ) fn notify_ping_timeout ( & self , id : usize , tx_id : stun_rs:: TransactionId ) {
195+ pub ( super ) fn notify_ping_timeout (
196+ & self ,
197+ id : usize ,
198+ tx_id : stun_rs:: TransactionId ,
199+ metrics : & Metrics ,
200+ ) {
196201 if let Some ( ep) = self
197202 . inner
198203 . lock ( )
199204 . expect ( "poisoned" )
200205 . get_mut ( NodeStateKey :: Idx ( id) )
201206 {
202- ep. ping_timeout ( tx_id, Instant :: now ( ) ) ;
207+ ep. ping_timeout ( tx_id, Instant :: now ( ) , metrics ) ;
203208 }
204209 }
205210
@@ -228,11 +233,17 @@ impl NodeMap {
228233 . handle_ping ( sender, src, tx_id)
229234 }
230235
231- pub ( super ) fn handle_pong ( & self , sender : PublicKey , src : & transports:: Addr , pong : Pong ) {
236+ pub ( super ) fn handle_pong (
237+ & self ,
238+ sender : PublicKey ,
239+ src : & transports:: Addr ,
240+ pong : Pong ,
241+ metrics : & Metrics ,
242+ ) {
232243 self . inner
233244 . lock ( )
234245 . expect ( "poisoned" )
235- . handle_pong ( sender, src, pong)
246+ . handle_pong ( sender, src, pong, metrics )
236247 }
237248
238249 #[ must_use = "actions must be handled" ]
@@ -268,11 +279,11 @@ impl NodeMap {
268279 Some ( ( public_key, udp_addr, relay_url, ping_actions) )
269280 }
270281
271- pub ( super ) fn reset_node_states ( & self ) {
282+ pub ( super ) fn reset_node_states ( & self , metrics : & Metrics ) {
272283 let now = Instant :: now ( ) ;
273284 let mut inner = self . inner . lock ( ) . expect ( "poisoned" ) ;
274285 for ( _, ep) in inner. node_states_mut ( ) {
275- ep. note_connectivity_change ( now) ;
286+ ep. note_connectivity_change ( now, metrics ) ;
276287 }
277288 }
278289
@@ -518,9 +529,15 @@ impl NodeMapInner {
518529 . and_then ( |ep| ep. latency ( ) )
519530 }
520531
521- fn handle_pong ( & mut self , sender : NodeId , src : & transports:: Addr , pong : Pong ) {
532+ fn handle_pong (
533+ & mut self ,
534+ sender : NodeId ,
535+ src : & transports:: Addr ,
536+ pong : Pong ,
537+ metrics : & Metrics ,
538+ ) {
522539 if let Some ( ns) = self . get_mut ( NodeStateKey :: NodeId ( sender) ) . as_mut ( ) {
523- let insert = ns. handle_pong ( & pong, src. clone ( ) . into ( ) ) ;
540+ let insert = ns. handle_pong ( & pong, src. clone ( ) . into ( ) , metrics ) ;
524541 if let Some ( ( src, key) ) = insert {
525542 self . set_node_key_for_ip_port ( src, & key) ;
526543 }
@@ -553,7 +570,7 @@ impl NodeMapInner {
553570 Some ( ns) => {
554571 debug ! ( endpoints = ?cm. my_numbers, "received call-me-maybe" ) ;
555572
556- ns. handle_call_me_maybe ( cm)
573+ ns. handle_call_me_maybe ( cm, metrics )
557574 }
558575 }
559576 }
0 commit comments