-
Notifications
You must be signed in to change notification settings - Fork 603
Closed
Description
The error handler will cause an infinite loop. HandleSocketError method is attached as an error handler:
this.socket.on('error', this.handleSocketError.bind(this));The handler will destroy the socket with an error argument. But according to Node's documentation in this case the error handler is invoked. See here This will again invoke the handler ad infinitum.
WebSocketConnection.prototype.handleSocketError = function(error) {
this._debug('handleSocketError: %j', error);
if (this.state === STATE_CLOSED) {
// See https://github.com/theturtle32/WebSocket-Node/issues/288
this._debug(' --- Socket \'error\' after \'close\'');
return;
}
this.closeReasonCode = WebSocketConnection.CLOSE_REASON_ABNORMAL;
this.closeDescription = 'Socket Error: ' + error.syscall + ' ' + error.code;
this.connected = false;
this.state = STATE_CLOSED;
this.fragmentationSize = 0;
if (utils.eventEmitterListenerCount(this, 'error') > 0) {
this.emit('error', error);
}
this.socket.destroy(error); /* <== HERE */
this._debug.printOutput();
};Metadata
Metadata
Assignees
Labels
No labels