js-libp2p-noise icon indicating copy to clipboard operation
js-libp2p-noise copied to clipboard

fix: make handshake abortable

Open achingbrain opened this issue 1 year ago • 1 comments

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.

achingbrain avatar Aug 14 '24 14:08 achingbrain