Skip to content

Add owned async Socket.IO task lifecycle - #515

Open
senamakel wants to merge 2 commits into
1c3t3a:mainfrom
senamakel:epic-8089-socket-task-lifecycle
Open

senamakel wants to merge 2 commits into
1c3t3a:mainfrom
senamakel:epic-8089-socket-task-lifecycle

Conversation

@senamakel

Copy link
Copy Markdown

Add an additive managed async connection API that retains ownership of the Socket.IO poll/reconnect task until shutdown completes. ClientBuilder::connect_managed returns ManagedClient; callers can await shutdown to stop and join the owned task and nested Engine.IO callback tasks. Dropping the handle signals stop and aborts owned work. Existing connect behavior and reconnect defaults remain unchanged.

Engine.IO callback task controls now retain each task's JoinHandle while awaiting it, so cancellation or concurrent joins cannot lose proof of termination. The managed API and task control are documented in the README/API docs.

Validation used local fixtures only. Engine.IO async tests pass (41 unit tests and 1 doctest); Socket.IO async tests pass (42 unit tests and 34 doctests). New regressions demonstrate red against simulated handle-losing implementations and green with the fix: callback join cancellation during the actual JoinHandle await, and managed shutdown canceled while a local Engine.IO polling close POST is withheld, followed by peer release and retry. Other fixtures cover stalled connect, namespace readiness, reconnect/auth updates, shutdown during retry, and suppression of late work.

cargo check -p rust_engineio -p rust_socketio --all-targets --features async, cargo fmt --all -- --check, and git diff --check pass. Normal Clippy completed on the feature and canonical baseline with matching normalized warning diagnostics. Strict Clippy remains blocked before the Socket.IO crate by 80 existing Engine.IO diagnostics, reproduced on canonical baseline; this PR does not claim a strict Clippy pass.

@senamakel

Copy link
Copy Markdown
Author

The four Actions runs on head 698d70dedbc3ee0819f04875b0057688355cefef are waiting for maintainer approval (action_required), so no hosted build/test result is available yet. Could a maintainer approve the fork workflows, including Test and Build and code style?

Local fixture-backed tests pass: Engine.IO 41 unit tests + 1 doctest, Socket.IO 42 unit tests + 34 doctests. Independent review also exercised cancellation during callback joining, a withheld disconnect response, reconnect backoff shutdown, and drop during namespace acknowledgement. Normal Clippy has the same warning multiset as canonical base; strict -D warnings still fails on existing Engine.IO warnings, as noted in the PR validation.

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