@@ -186,14 +186,16 @@ async fn ping_pong(
186186) {
187187 loop {
188188 let ( buf, len) = ProtoEvent :: Ping . into ( ) ;
189- if let Err ( _) = conn. send ( & buf[ ..len] ) . await {
189+ if let Err ( e) = conn. send ( & buf[ ..len] ) . await {
190+ log:: warn!( "send: {e}" ) ;
190191 disconnect ( & server, handle, addr, & conns) . await ;
191192 break ;
192193 }
193194
194195 tokio:: time:: sleep ( Duration :: from_millis ( 500 ) ) . await ;
195196
196197 if server. active_addr ( handle) . is_none ( ) {
198+ log:: warn!( "no active addr" ) ;
197199 disconnect ( & server, handle, addr, & conns) . await ;
198200 }
199201 }
@@ -211,11 +213,12 @@ async fn receive_loop(
211213 while let Ok ( _) = conn. recv ( & mut buf) . await {
212214 if let Ok ( event) = buf. try_into ( ) {
213215 match event {
214- ProtoEvent :: Pong => server. set_active_addr ( handle, None ) ,
216+ ProtoEvent :: Pong => server. set_active_addr ( handle, Some ( addr ) ) ,
215217 event => tx. send ( ( handle, event) ) . expect ( "channel closed" ) ,
216218 }
217219 }
218220 }
221+ log:: warn!( "recv error" ) ;
219222 disconnect ( & server, handle, addr, & conns) . await ;
220223}
221224
0 commit comments