Close any remaining connections once the tui exits

This commit is contained in:
Dreaded_X 2025-04-20 21:21:07 +02:00
parent 0fe043acb5
commit dc1f75aee3
Signed by: Dreaded_X
GPG Key ID: FA5F485356B0D2D4

View File

@ -330,6 +330,26 @@ impl russh::server::Handler for Handler {
Ok(session.channel_success(channel)?)
}
async fn channel_close(
&mut self,
channel: ChannelId,
session: &mut Session,
) -> Result<(), Self::Error> {
if let Some(pty_channel) = self.pty_channel
&& pty_channel == channel
{
debug!("Pty channel closed");
session.disconnect(
russh::Disconnect::ByApplication,
"Remaining active connections have been closed",
"EN",
)?;
}
Ok(())
}
async fn tcpip_forward(
&mut self,
address: &str,