mirror of
https://github.com/chatmail/core.git
synced 2026-05-19 23:06:32 +03:00
fix(imap): only interrupt existing idle connection
This commit is contained in:
@@ -1027,15 +1027,19 @@ impl Imap {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn interrupt_idle(&self) {
|
pub fn interrupt_idle(&self) {
|
||||||
if let Some(ref mut stream) = self.session.lock().unwrap().1 {
|
// only kill the connection, if we are actually ideling
|
||||||
match stream.shutdown(net::Shutdown::Both) {
|
if self.session.lock().unwrap().0.is_none() {
|
||||||
Ok(_) => {}
|
if let Some(ref mut stream) = self.session.lock().unwrap().1 {
|
||||||
Err(err) => {
|
match stream.shutdown(net::Shutdown::Both) {
|
||||||
eprintln!("failed to disconnect: {}", err);
|
Ok(_) => {}
|
||||||
|
Err(err) => {
|
||||||
|
eprintln!("failed to disconnect: {}", err);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// interrupt fake idle
|
||||||
let &(ref lock, ref cvar) = &*self.watch.clone();
|
let &(ref lock, ref cvar) = &*self.watch.clone();
|
||||||
let mut watch = lock.lock().unwrap();
|
let mut watch = lock.lock().unwrap();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user