fix: a panic in one session's I/O ends that session cleanly
Every client's reader thread (Telnet/RAW, serial, local shell, IRC, VNC, RDP) and SSH's channel reader task now run under clients::guarded / guarded_task. A panic there, such as a decoder bug triggered by a hostile server, reports 'internal error: …' through the session's on_error and then closes it, so the tab shows the error (and auto-reconnect can run) instead of looking connected with nothing reading. Other sessions were already unaffected since the switch to parking_lot locks.
This commit is contained in:
@@ -82,7 +82,8 @@ impl Client {
|
||||
let (tx, rx) = mpsc::channel();
|
||||
*self.tx.lock() = Some(tx);
|
||||
let me = self.clone();
|
||||
std::thread::Builder::new().name("nexus-rdp".into()).spawn(move || {
|
||||
let (on_error, on_close) = (self.cfg.on_error.clone(), self.cfg.on_close.clone());
|
||||
std::thread::Builder::new().name("nexus-rdp".into()).spawn(super::guarded(on_error, on_close, move || {
|
||||
let r = me.run(framed, result, rx);
|
||||
let closing = me.tx.lock().take().is_none();
|
||||
if let Err(e) = r
|
||||
@@ -91,7 +92,7 @@ impl Client {
|
||||
(me.cfg.on_error)(e.to_string());
|
||||
}
|
||||
(me.cfg.on_close)();
|
||||
})?;
|
||||
}))?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user