From fe7c12a45cfbe6dfb750e66d3d9be22fed22a65e Mon Sep 17 00:00:00 2001 From: Mario Fetka Date: Thu, 30 Jul 2026 02:24:12 +0200 Subject: [PATCH] Close active IMAP sessions during shutdown --- src/agents/imap/imapd.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/agents/imap/imapd.c b/src/agents/imap/imapd.c index a99afa1..b9bb58e 100644 --- a/src/agents/imap/imapd.c +++ b/src/agents/imap/imapd.c @@ -4623,6 +4623,15 @@ IMAPServer(void *unused) XplConsolePrintf("\rIMAPD: %d server threads outstanding; attempting forceful unload.\r\n", XplSafeRead(Imap.server.active) - 1); } + /* + * No listener can publish another accepted connection after this point. + * Close the client and Store sockets before waiting for session threads: + * an idle client may otherwise leave its worker blocked in ConnRead() + * until the normal command timeout expires. POP3 uses the same shutdown + * ordering. + */ + ConnCloseAll(); + #if VERBOSE XplConsolePrintf("\rIMAPD: Shutting down %d session threads\r\n", XplSafeRead(Imap.session.threads.inUse)); #endif