Browse Source

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 <fedor@indutny.com>
v2.3.1-release
Shigeki Ohtsu 10 years ago
committed by Fedor Indutny
parent
commit
e008e8faba
  1. 2
      lib/_tls_wrap.js

2
lib/_tls_wrap.js

@ -362,7 +362,7 @@ TLSSocket.prototype._init = function(socket, wrap) {
self._writableState.errorEmitted = true; self._writableState.errorEmitted = true;
// Destroy socket if error happened before handshake's finish // Destroy socket if error happened before handshake's finish
if (!this._secureEstablished) { if (!self._secureEstablished) {
self._tlsError(err); self._tlsError(err);
self.destroy(); self.destroy();
} else if (options.isServer && } else if (options.isServer &&

Loading…
Cancel
Save