js-libp2p-noise
js-libp2p-noise copied to clipboard
fix: make handshake abortable
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.