Skip to content

Commit d33c4bf

Browse files
committed
tls: handle error events with _tlsError
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 <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
1 parent 2cfd7fd commit d33c4bf

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/_tls_wrap.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ function TLSSocket(socket, options) {
272272
// Proxy for API compatibility
273273
this.ssl = this._handle;
274274

275-
this.on('error', this._emitTLSError);
275+
this.on('error', this._tlsError);
276276

277277
this._init(socket, wrap);
278278

@@ -554,7 +554,7 @@ TLSSocket.prototype._releaseControl = function() {
554554
if (this._controlReleased)
555555
return false;
556556
this._controlReleased = true;
557-
this.removeListener('error', this._emitTLSError);
557+
this.removeListener('error', this._tlsError);
558558
return true;
559559
};
560560

0 commit comments

Comments
 (0)