From 9979671b001ccb25917da7091d13ad3fc1096330 Mon Sep 17 00:00:00 2001 From: Quentin Dufour Date: Tue, 28 Jun 2022 15:52:55 +0200 Subject: [PATCH] Try my best to close the connection --- src/imap/session.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/imap/session.rs b/src/imap/session.rs index 2fa413e..30885d1 100644 --- a/src/imap/session.rs +++ b/src/imap/session.rs @@ -52,7 +52,7 @@ impl Manager { return async { Response::bad("Too fast! Send less pipelined requests.") }.boxed() } Err(TrySendError::Closed(_)) => { - return async { Response::bad("Session task has existed.") }.boxed() + return async { Err(BalError::Text("Terminated session".to_string())) }.boxed() } }; @@ -147,6 +147,10 @@ impl Instance { msg.tx.send(res).unwrap_or_else(|e| { tracing::warn!("failed to send imap response to manager: {:#?}", e) }); + + if let flow::State::Logout = &self.state { + break; + } } //@FIXME add more info about the runner