Skip to content

COR-173 - Add IMAP interrupt command support - #105

Merged
dbezverkhnii merged 1 commit into
spark2from
feature/COR-173-imap-interrup-command-support
Sep 1, 2026
Merged

COR-173 - Add IMAP interrupt command support#105
dbezverkhnii merged 1 commit into
spark2from
feature/COR-173-imap-interrup-command-support

Conversation

@dbezverkhnii

@dbezverkhnii dbezverkhnii commented Sep 1, 2026

Copy link
Copy Markdown
Collaborator

Note

Medium Risk
Changes threaded operation-queue state and cancels live IMAP streams; misuse could drop connections or cause extra reconnects, though the API is scoped to the running operation and documented as abandon-only.

Overview
Adds a way to abort the IMAP command already running on an operation’s connection so blocked socket reads return immediately instead of waiting for the session timeout—mainly so teardown (e.g. disconnect queued behind a stuck command) can proceed without sitting behind a hung read.

The stack is wired from OperationQueue (tracks mRunningOperation, interruptRunningOperation under the queue lock) through IMAPOperation::interrupt() / interruptCurrentCommand(), IMAPAsyncConnection, and IMAPSession::interruptCurrentCommand() (mailstream_cancel while the session lock is held). The call is synchronous and bypasses the operation queue so it can unblock the operation currently in main(). It only affects the operation that is actually running; queued operations get false. Docs stress teardown-only: the stream stays cancelled and the connection must be rebuilt on next use—unlike cancel(), which only sets a flag before main().

interruptCurrentCommand is exposed on the C bridge and Swift IMAPBaseOperation. Darwin-only IMAPInterruptCurrentCommandTests use a silent TCP listener to simulate a blocked connect and assert interrupt behavior vs queued operations.

Reviewed by Cursor Bugbot for commit da8a75b. Bugbot is set up for automated code reviews on this repo. Configure here.

@dbezverkhnii
dbezverkhnii merged commit 60946bb into spark2 Sep 1, 2026
9 of 10 checks passed
@dbezverkhnii
dbezverkhnii deleted the feature/COR-173-imap-interrup-command-support branch September 1, 2026 17:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant