diff options
author | Ryan Dahl <ry@tinyclouds.org> | 2011-12-21 12:17:23 -0800 |
---|---|---|
committer | Ryan Dahl <ry@tinyclouds.org> | 2011-12-21 12:17:23 -0800 |
commit | f7f8af842077be4e6cc580ddedcccea71e073bbb (patch) | |
tree | 2c2a6a881cd3cbcf04b0f338afb1c942d33bbb19 /lib/tls.js | |
parent | 4eaf4ce26a0e66179d199997d9e0290867557702 (diff) | |
parent | 73cf8e82e768af870964d6f3375ab758e774165c (diff) | |
download | nodejs-f7f8af842077be4e6cc580ddedcccea71e073bbb.tar.gz nodejs-f7f8af842077be4e6cc580ddedcccea71e073bbb.tar.bz2 nodejs-f7f8af842077be4e6cc580ddedcccea71e073bbb.zip |
Merge remote branch 'origin/v0.6'
Conflicts:
Makefile
lib/_debugger.js
Diffstat (limited to 'lib/tls.js')
-rw-r--r-- | lib/tls.js | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/lib/tls.js b/lib/tls.js index e4f332d41..47f2e0c54 100644 --- a/lib/tls.js +++ b/lib/tls.js @@ -576,7 +576,6 @@ function SecurePair(credentials, isServer, requestCert, rejectUnauthorized, requestCert = true; } - this._secureEstablished = false; this._rejectUnauthorized = rejectUnauthorized ? true : false; this._requestCert = requestCert ? true : false; @@ -721,6 +720,7 @@ SecurePair.prototype.maybeInitFinished = function() { SecurePair.prototype.destroy = function() { var self = this; + var error = this.ssl.error; if (!this._doneFlag) { this._doneFlag = true; @@ -736,6 +736,14 @@ SecurePair.prototype.destroy = function() { self.encrypted.emit('close'); self.cleartext.emit('close'); }); + + if (!this._secureEstablished) { + if (!error) { + error = new Error('socket hang up'); + error.code = 'ECONNRESET'; + } + this.emit('error', error); + } } }; @@ -905,6 +913,9 @@ function Server(/* [options], listener */) { } } }); + pair.on('error', function(err) { + self.emit('clientError', err); + }); }); if (listener) { @@ -1061,6 +1072,9 @@ exports.connect = function(port /* host, options, cb */) { cleartext.emit('secureConnect'); } }); + pair.on('error', function(err) { + cleartext.emit('error', err); + }); cleartext._controlReleased = true; return cleartext; |