From e008e8faba34d6e5bd760e68cdff1f3fe0e04514 Mon Sep 17 00:00:00 2001 From: Shigeki Ohtsu Date: Fri, 8 May 2015 13:30:50 +0900 Subject: [PATCH] tls: fix tls handshake check in ssl error In ssl.onerror event, `this` refers `ssl` so that `this._secureEstablished` is always undefined. Fix it to refer TLSSocket. PR-URL: https://github.com/nodejs/io.js/pull/1661 Reviewed-By: Fedor Indutny --- lib/_tls_wrap.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/_tls_wrap.js b/lib/_tls_wrap.js index 0a30cd3310c..5a35c3bd967 100644 --- a/lib/_tls_wrap.js +++ b/lib/_tls_wrap.js @@ -362,7 +362,7 @@ TLSSocket.prototype._init = function(socket, wrap) { self._writableState.errorEmitted = true; // Destroy socket if error happened before handshake's finish - if (!this._secureEstablished) { + if (!self._secureEstablished) { self._tlsError(err); self.destroy(); } else if (options.isServer &&