node-eversocket icon indicating copy to clipboard operation
node-eversocket copied to clipboard

Readable state not reset after close

Open moll opened this issue 11 years ago • 0 comments

Hey,

It's not exactly straight-forward to reuse an existing Socket between connects. It does tend to work mostly, but I just spent some time trying to figure out why pipes failed to reattach (as an error on a ReadableStream causes it to drop all of its pipe partners) between reconnect attempts. Finally tracked it down to socket._readableState.endEmitted being true in the window between a close (e.g. one for a failed connect attempt) and calling Socket.prototype.connect, something which EverSocket does with a timeout.

You might want to either document these idiosyncrasies or figure out a way to reset the socket after a failed connect attempt, so it'll behave similarly to a socket that has never been connected.

moll avatar Jan 26 '15 12:01 moll