Skip to content

Close sockets when client message loops end - #225

Merged
mattt merged 1 commit into
mainfrom
mattt/fix-pasted-issue
Sep 17, 2026
Merged

mattt merged 1 commit into
mainfrom
mattt/fix-pasted-issue

Conversation

@mattt

@mattt mattt commented Sep 17, 2026

Copy link
Copy Markdown
Owner

When a bridge disconnects, the app keeps its side of the socket open until the health poll detects the closed connection. The resulting CLOSE_WAIT sockets can accumulate, as reported in #178 and from the bridge side in #217 and #218.

Observe the end of each server's message loop and remove its connection immediately. Keep the health poll as a fallback and guard against repeated stops when loop completion overlaps with app shutdown.

Fixes #178.

The SDK ends its message loop when a client disconnects but leaves the socket open until the health poll detects it. Await loop completion to release the connection immediately, and guard against repeated stops during app shutdown.
@mattt
mattt merged commit a48258b into main Sep 17, 2026
1 check passed
@mattt
mattt deleted the mattt/fix-pasted-issue branch September 17, 2026 18:23
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.

Claude won't reconnect with iMCP server following re-start

1 participant