From d33c4bf97b68dbae83a1d456f7b34a91b1583666 Mon Sep 17 00:00:00 2001 From: Fedor Indutny Date: Sat, 1 Oct 2016 21:17:51 +0200 Subject: [PATCH] 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: https://github.com/nodejs/node/pull/8889 Reviewed-By: Franziska Hinkelmann Reviewed-By: Colin Ihrig --- lib/_tls_wrap.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/_tls_wrap.js b/lib/_tls_wrap.js index c86239a7c9..6d07272c7c 100644 --- a/lib/_tls_wrap.js +++ b/lib/_tls_wrap.js @@ -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); @@ -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; };