ssh remoting: Fix hang when activity channel gets dropped (#19275)

When the SSH command dies or the server, the channel gets dropped and
the heartbeat method went into an infinite loop causing a hang.

Oversight from yesterday. Fixed now.

Release Notes:

- N/A
This commit is contained in:
Thorsten Ball 2024-10-16 15:57:58 +02:00 committed by GitHub
parent 84018d7a2d
commit eb76065ad3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -743,7 +743,11 @@ impl SshRemoteClient {
loop {
select_biased! {
_ = connection_activity_rx.next().fuse() => {
result = connection_activity_rx.next().fuse() => {
if result.is_none() {
log::warn!("ssh heartbeat: connection activity channel has been dropped. stopping.");
return Ok(());
}
keepalive_timer.set(cx.background_executor().timer(HEARTBEAT_INTERVAL).fuse());
}
_ = keepalive_timer => {