|
@ -922,9 +922,13 @@ SecurePair.prototype.error = function(returnOnly) { |
|
|
this.ssl.error = null; |
|
|
this.ssl.error = null; |
|
|
|
|
|
|
|
|
if (!this._secureEstablished) { |
|
|
if (!this._secureEstablished) { |
|
|
if (!err) { |
|
|
// Emit ECONNRESET instead of zero return
|
|
|
err = new Error('socket hang up'); |
|
|
if (!err || err.message === 'ZERO_RETURN') { |
|
|
err.code = 'ECONNRESET'; |
|
|
var connReset = new Error('socket hang up'); |
|
|
|
|
|
connReset.code = 'ECONNRESET'; |
|
|
|
|
|
connReset.sslError = err && err.message; |
|
|
|
|
|
|
|
|
|
|
|
err = connReset; |
|
|
} |
|
|
} |
|
|
this.destroy(); |
|
|
this.destroy(); |
|
|
if (!returnOnly) this.emit('error', err); |
|
|
if (!returnOnly) this.emit('error', err); |
|
|