From af5c2f0bdc49794335589a0222a811bc85e2572c Mon Sep 17 00:00:00 2001 From: SanderBaan Date: Mon, 30 Mar 2026 10:08:03 +0200 Subject: [PATCH 1/2] Calling noop by run_command_and_check function instead of noop command, so that better is checked if the command executed correctly --- src/modules/imap/pool.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/modules/imap/pool.rs b/src/modules/imap/pool.rs index 1fe7432..ba41823 100644 --- a/src/modules/imap/pool.rs +++ b/src/modules/imap/pool.rs @@ -25,7 +25,10 @@ impl bb8::ManageConnection for ImapConnectionManager { } // call this function before using the connection async fn is_valid(&self, conn: &mut Self::Connection) -> RustMailerResult<()> { - match tokio::time::timeout(Duration::from_secs(5), conn.noop()).await { + if conn.is_bad { + return Err(raise_error!(format!("Connection marked broken"), ErrorCode::ImapCommandFailed)); + } + match tokio::time::timeout(Duration::from_secs(5), conn.run_command_and_check_ok("NOOP")).await { Ok(Ok(_)) => Ok(()), Ok(Err(e)) => { error!("IMAP connection validation failed: {:?}", e); From 91615df6196b85cc6a0a23fef6134e0374fd0ba8 Mon Sep 17 00:00:00 2001 From: SanderBaan Date: Mon, 30 Mar 2026 18:19:32 +0200 Subject: [PATCH 2/2] Increase connection timeout time to half and hour --- src/modules/utils/net.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/utils/net.rs b/src/modules/utils/net.rs index f43f8f0..6a6b90b 100644 --- a/src/modules/utils/net.rs +++ b/src/modules/utils/net.rs @@ -16,7 +16,7 @@ use tokio_io_timeout::TimeoutStream; use tokio_socks::tcp::Socks5Stream; use tracing::error; -pub(crate) const TIMEOUT: Duration = Duration::from_secs(60); +pub(crate) const TIMEOUT: Duration = Duration::from_secs(3600); pub(crate) async fn establish_tcp_connection_with_timeout( address: SocketAddr,