Skip to content

Commit

Permalink
tls: fix tls handshake check in ssl error
Browse files Browse the repository at this point in the history
In ssl.onerror event, `this` refers `ssl` so that
`this._secureEstablished` is always undefined. Fix it to refer
TLSSocket.

PR-URL: #1661
Reviewed-By: Fedor Indutny <fedor@indutny.com>
  • Loading branch information
Shigeki Ohtsu authored and indutny committed May 16, 2015
1 parent d4726cd commit e008e8f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/_tls_wrap.js
Expand Up @@ -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 &&
Expand Down

0 comments on commit e008e8f

Please sign in to comment.