Skip to content

Conversation

nighthawk
Copy link
Owner

@nighthawk nighthawk commented Jul 14, 2025

To avoid crash due to duplicate calls to resuming continuation.

Fixes modelcontextprotocol#137

@nighthawk nighthawk requested a review from Copilot July 14, 2025 09:45
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refactors the reconnection logic to use a unified retry loop with waitForReady() instead of the previous continuation-based handlers, preventing duplicate continuation resumes and crashes.

  • Introduces waitForReady() with a withCheckedThrowingContinuation wrapper
  • Replaces old handleConnectionReady/Failed/Cancelled and shared reconnection method with a retry loop in connect()
  • Removes connectionContinuationResumed tracking and streamlines exponential backoff

@nighthawk
Copy link
Owner Author

Testing looks good.

@nighthawk nighthawk marked this pull request as ready for review July 14, 2025 11:31
@nighthawk nighthawk merged commit f660b17 into main Jul 14, 2025
@nighthawk nighthawk deleted the 137-fix-crash-on-reconnect branch July 14, 2025 11:32
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.

Crash in NetworkTransport on reconnect

1 participant