File tree Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -605,7 +605,6 @@ impl Session {
605605 Ok ( ( client, self ) )
606606 }
607607 _ => {
608- self . common . received_data = false ;
609608 let wants_reply = r. read_byte ( ) . map_err ( crate :: Error :: from) ?;
610609 if wants_reply == 1 {
611610 if let Some ( ref mut enc) = self . common . encrypted {
@@ -705,7 +704,6 @@ impl Session {
705704 push_packet ! ( enc. write, enc. write. push( msg:: REQUEST_FAILURE ) )
706705 }
707706 }
708- self . common . received_data = false ;
709707 Ok ( ( client, self ) )
710708 }
711709 Some ( & msg:: CHANNEL_SUCCESS ) => {
@@ -828,7 +826,6 @@ impl Session {
828826 Ok ( ( client, self ) )
829827 }
830828 _ => {
831- self . common . received_data = false ;
832829 info ! ( "Unhandled packet: {:?}" , buf) ;
833830 Ok ( ( client, self ) )
834831 }
Original file line number Diff line number Diff line change @@ -858,6 +858,14 @@ impl Session {
858858 }
859859 }
860860
861+ if self . common . received_data {
862+ // Reset the number of failed keepalive attempts. We don't
863+ // bother detecting keepalive response messages specifically
864+ // (OpenSSH_9.6p1 responds with REQUEST_FAILURE aka 82). Instead
865+ // we assume that the server is still alive if we receive any
866+ // data from it.
867+ self . common . alive_timeouts = 0 ;
868+ }
861869 if self . common . received_data || sent_keepalive {
862870 if let ( futures:: future:: Either :: Right ( ref mut sleep) , Some ( d) ) = (
863871 keepalive_timer. as_mut ( ) . as_pin_mut ( ) ,
You can’t perform that action at this time.
0 commit comments