File tree Expand file tree Collapse file tree 1 file changed +9
-10
lines changed Expand file tree Collapse file tree 1 file changed +9
-10
lines changed Original file line number Diff line number Diff line change @@ -465,11 +465,9 @@ impl KcpEndpoint {
465
465
packet : & KcpPacket ,
466
466
output_sender : & KcpPakcetSender ,
467
467
) -> bool {
468
- if !packet. header ( ) . is_ping ( ) {
469
- return false ;
470
- }
468
+ let hdr = packet. header ( ) ;
471
469
472
- if !packet . header ( ) . is_pong ( ) {
470
+ if hdr . is_ping ( ) && !hdr . is_pong ( ) {
473
471
let conn_id = ConnId :: from ( packet) ;
474
472
let need_send_pong = data
475
473
. state_map
@@ -490,14 +488,15 @@ impl KcpEndpoint {
490
488
if let Err ( e) = ret {
491
489
tracing:: error!( ?e, "send pong packet failed" ) ;
492
490
}
493
- } else {
494
- let conv = ConnId :: from ( packet) ;
495
- if let Some ( mut state) = data. state_map . get_mut ( & conv) {
496
- state. notify_pong ( ) ;
497
- }
498
491
}
499
492
500
- true
493
+ // all incoming packet should update pong time
494
+ let conv = ConnId :: from ( packet) ;
495
+ if let Some ( mut state) = data. state_map . get_mut ( & conv) {
496
+ state. notify_pong ( ) ;
497
+ }
498
+
499
+ packet. header ( ) . is_ping ( )
501
500
}
502
501
503
502
pub async fn run ( & mut self ) {
You can’t perform that action at this time.
0 commit comments