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

fix: make handshake abortable #442

Merged
merged 1 commit into from
Aug 29, 2024
Merged

Conversation

achingbrain
Copy link
Collaborator

To allow doing things like having a single AbortSignal that can be used as a timeout for incoming connection establishment, allow passing it as an option to the ConnectionEncrypter secureOutbound and secureInbound methods.

Previously we'd wrap the stream to be secured in an AbortableSource, however this has some serious performance implications and it's generally better to just use a signal to cancel an ongoing operation instead of racing every chunk that comes out of the source.

To allow doing things like having a single `AbortSignal` that can be
used as a timeout for incoming connection establishment, allow passing
it as an option to the `ConnectionEncrypter` `secureOutbound` and
`secureInbound` methods.

Previously we'd wrap the stream to be secured in an `AbortableSource`,
however this has some [serious performance implications](ChainSafe/js-libp2p-gossipsub#361)
and it's generally better to just use a signal to cancel an ongoing
operation instead of racing every chunk that comes out of the source.
@achingbrain achingbrain requested a review from a team as a code owner August 14, 2024 14:09
@achingbrain
Copy link
Collaborator Author

This PR changes the method signatures compatible with the as-yet unreleased [email protected] similar to #440

The corresponding changes to take advantage of this PR are in libp2p/js-libp2p#2662 and that PR is blocked on release of this one.

@achingbrain achingbrain merged commit 35ce15d into master Aug 29, 2024
16 checks passed
@achingbrain achingbrain deleted the fix/make-handshake-abortable branch August 29, 2024 15:20
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