Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve promise cancellation and close underlying socket connection #89

Merged
merged 1 commit into from
Jan 14, 2019

Conversation

clue
Copy link
Member

@clue clue commented Jan 13, 2019

This PR ensures that calling cancel() on a pending connection attempt will properly cancel() the underlying socket connection attempt or close() the underlying socket connection when the WebSocket handshake is pending.

This can also be used as a basis for connection timeouts in the future (e.g. friends-of-reactphp/mysql#86) like this:

$connecting = $pawlConnector('ws://localhost');

$loop->addTimer(10.0, function () use ($connecting) {
    $connecting->cancel();
});

Builds on top of clue/reactphp-socks#82

@mbonneau mbonneau merged commit 3a7d5b7 into ratchetphp:master Jan 14, 2019
@mbonneau
Copy link
Member

Thank you @clue!

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.

2 participants