Skip to content

Commit

Permalink
[minor] Remove unneeded if statement
Browse files Browse the repository at this point in the history
The `'error'` event can be emitted after the `'close'` event only if
`socket.write()` is called on a closed socket. If this happens, it's
a bug.
  • Loading branch information
lpinca committed Mar 21, 2019
1 parent bcab373 commit 297f56d
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions lib/websocket.js
Original file line number Diff line number Diff line change
Expand Up @@ -893,8 +893,6 @@ function socketOnError() {
this.removeListener('error', socketOnError);
this.on('error', NOOP);

if (websocket) {
websocket.readyState = WebSocket.CLOSING;
this.destroy();
}
websocket.readyState = WebSocket.CLOSING;
this.destroy();
}

0 comments on commit 297f56d

Please sign in to comment.