Skip to content

Commit 297f56d

Browse files
committed
[minor] Remove unneeded if statement
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.
1 parent bcab373 commit 297f56d

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

lib/websocket.js

+2-4
Original file line numberDiff line numberDiff line change
@@ -893,8 +893,6 @@ function socketOnError() {
893893
this.removeListener('error', socketOnError);
894894
this.on('error', NOOP);
895895

896-
if (websocket) {
897-
websocket.readyState = WebSocket.CLOSING;
898-
this.destroy();
899-
}
896+
websocket.readyState = WebSocket.CLOSING;
897+
this.destroy();
900898
}

0 commit comments

Comments
 (0)