Replace a sleep() with an MPSC channel

This commit is contained in:
2020-05-16 18:09:40 +01:00
parent 640948241a
commit e08ec6b476
3 changed files with 48 additions and 25 deletions

View File

@@ -122,11 +122,17 @@ impl telepathy::Connection for Connection {
fn disconnect(&self) -> Result<(), MethodErr> {
println!("Connection<{}>::disconnect()", self.id);
let ctx = self.ctx.read().unwrap();
let state = self.state.clone();
let mut w = state.write().unwrap();
*w = ConnState::Disconnected;
dc::job::interrupt_inbox_idle(&ctx);
dc::job::interrupt_smtp_idle(&ctx);
dc::job::interrupt_sentbox_idle(&ctx);
dc::job::interrupt_mvbox_idle(&ctx);
// FIXME: we need to signal to the CM that they should remove the
// connection from the active list