mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 10:59:27 +00:00
parent
e6b6075024
commit
b962ff35dd
38
lib/tls.js
38
lib/tls.js
@ -719,31 +719,33 @@ SecurePair.prototype.maybeInitFinished = function() {
|
||||
|
||||
|
||||
SecurePair.prototype.destroy = function() {
|
||||
if (this._doneFlag) {
|
||||
return;
|
||||
}
|
||||
|
||||
var self = this;
|
||||
var error = this.ssl.error;
|
||||
|
||||
if (!this._doneFlag) {
|
||||
this._doneFlag = true;
|
||||
this.ssl.error = null;
|
||||
this.ssl.close();
|
||||
this.ssl = null;
|
||||
this._doneFlag = true;
|
||||
this.ssl.error = null;
|
||||
this.ssl.close();
|
||||
this.ssl = null;
|
||||
|
||||
self.encrypted.writable = self.encrypted.readable = false;
|
||||
self.cleartext.writable = self.cleartext.readable = false;
|
||||
self.encrypted.writable = self.encrypted.readable = false;
|
||||
self.cleartext.writable = self.cleartext.readable = false;
|
||||
|
||||
process.nextTick(function() {
|
||||
self.cleartext.emit('end');
|
||||
self.encrypted.emit('close');
|
||||
self.cleartext.emit('close');
|
||||
});
|
||||
process.nextTick(function() {
|
||||
self.cleartext.emit('end');
|
||||
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);
|
||||
if (!this._secureEstablished) {
|
||||
if (!error) {
|
||||
error = new Error('socket hang up');
|
||||
error.code = 'ECONNRESET';
|
||||
}
|
||||
this.emit('error', error);
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user