|
|
@ -144,6 +144,8 @@ function TLSSocket(socket, options) { |
|
|
|
this.authorized = false; |
|
|
|
this.authorizationError = null; |
|
|
|
|
|
|
|
this.on('error', this._tlsError); |
|
|
|
|
|
|
|
if (!this._handle) |
|
|
|
this.once('connect', this._init.bind(this)); |
|
|
|
else |
|
|
@ -234,6 +236,13 @@ TLSSocket.prototype._tlsError = function(err) { |
|
|
|
this.emit('error', err); |
|
|
|
}; |
|
|
|
|
|
|
|
TLSSocket.prototype._releaseControl = function() { |
|
|
|
if (this._controlReleased) |
|
|
|
return; |
|
|
|
this._controlReleased = true; |
|
|
|
this.removeListener('error', this._tlsError); |
|
|
|
}; |
|
|
|
|
|
|
|
TLSSocket.prototype._finishInit = function() { |
|
|
|
if (process.features.tls_npn) { |
|
|
|
this.npnProtocol = this.ssl.getNegotiatedProtocol(); |
|
|
@ -454,7 +463,7 @@ function Server(/* [options], listener */) { |
|
|
|
} |
|
|
|
|
|
|
|
if (!socket.destroyed) { |
|
|
|
socket._controlReleased = true; |
|
|
|
socket._releaseControl(); |
|
|
|
self.emit('secureConnection', socket); |
|
|
|
} |
|
|
|
}); |
|
|
@ -604,7 +613,7 @@ exports.connect = function(/* [port, host], options, cb */) { |
|
|
|
}); |
|
|
|
|
|
|
|
function onHandle() { |
|
|
|
socket._controlReleased = true; |
|
|
|
socket._releaseControl(); |
|
|
|
|
|
|
|
if (options.session) |
|
|
|
socket.setSession(options.session); |
|
|
|