holepunchto / hyperswarm-secret-stream

Secret stream backed by Noise and libsodium's secretstream
Apache License 2.0
33 stars 14 forks source link

failing test for end before piped #22

Closed gmaclennan closed 1 year ago

gmaclennan commented 1 year ago

Calling s.end() before the noise stream has been piped to another stream swallows the finish and close events (see failing test).

I would expect calling stream.end() to cause the finish and close events to be emitted like they do on other streams.

mafintosh commented 1 year ago

This is working as designed actually. You are telling the stream to end, it will wait for the handshake and then send an end. You are not piping the rawStream, so nothing happens. If you wanna forcefully teardown the stream do .destroy() instead