Skip to content

Commit

Permalink
tls: handle error events with _tlsError
Browse files Browse the repository at this point in the history
Previously `TLSSocket#_emitTLSError` was used as an `error` event
handler. However that function can emit `error` event itself, so it is
not suitable for such use. Luckily the event can be emitted only when
the control is released, so this looping-error can't happen.

Replace the error handler for clarity and correctness.

PR-URL: #8889
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
  • Loading branch information
indutny authored and Fishrock123 committed Oct 11, 2016
1 parent c36c8dc commit bee1955
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/_tls_wrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ function TLSSocket(socket, options) {
// Proxy for API compatibility
this.ssl = this._handle;

this.on('error', this._emitTLSError);
this.on('error', this._tlsError);

this._init(socket, wrap);

Expand Down Expand Up @@ -554,7 +554,7 @@ TLSSocket.prototype._releaseControl = function() {
if (this._controlReleased)
return false;
this._controlReleased = true;
this.removeListener('error', this._emitTLSError);
this.removeListener('error', this._tlsError);
return true;
};

Expand Down

0 comments on commit bee1955

Please sign in to comment.