this.authorized = false;
this.authorizationError = null;
+ this.on('error', this._tlsError);
+
if (!this._handle)
this.once('connect', this._init.bind(this));
else
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();
}
if (!socket.destroyed) {
- socket._controlReleased = true;
+ socket._releaseControl();
self.emit('secureConnection', socket);
}
});
});
function onHandle() {
- socket._controlReleased = true;
+ socket._releaseControl();
if (options.session)
socket.setSession(options.session);