Skip to content

Commit

Permalink
[minor] Fix misleading comment
Browse files Browse the repository at this point in the history
  • Loading branch information
lpinca committed Jun 28, 2021
1 parent 145480a commit c3fdc99
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/stream.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,13 @@ function createWebSocketStream(ws, options) {

// Prevent `ws.terminate()` from being called by `duplex._destroy()`.
//
// - If the state of the `WebSocket` connection is `CONNECTING`,
// `ws.terminate()` is a noop as no socket was assigned.
// - Otherwise, the error was re-emitted from the listener of the `'error'`
// - If the `'error'` event is emitted before the `'open'` event, then
// `ws.terminate()` is a noop as no socket is assigned.
// - Otherwise, the error is re-emitted by the listener of the `'error'`
// event of the `Receiver` object. The listener already closes the
// connection by calling `ws.close()`. This allows a close frame to be
// sent to the other peer. If `ws.terminate()` is called right after this,
// the close frame might not be sent.
// then the close frame might not be sent.
terminateOnDestroy = false;
duplex.destroy(err);
});
Expand Down

0 comments on commit c3fdc99

Please sign in to comment.