Skip to content

Commit

Permalink
tls_wrap: Unlink TLSWrap and SecureContext objects asap.
Browse files Browse the repository at this point in the history
  • Loading branch information
ChALkeR committed May 1, 2015
1 parent b4ad5d7 commit 7fa24d6
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions lib/_tls_wrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -289,15 +289,22 @@ TLSSocket.prototype._wrapHandle = function(handle) {
}
});

this.on('close', this._destroySSL);
this.on('close', function() {
this._destroySSL();
res = null;
});

return res;
};

TLSSocket.prototype._destroySSL = function _destroySSL() {
if (!this.ssl) return;
this.ssl.destroySSL();
if (this.ssl._secureContext.singleUse)
if (this.ssl._secureContext.singleUse) {
this.ssl._secureContext.context.close();
delete this.ssl._secureContext.context;
}
delete this.ssl;
};

TLSSocket.prototype._init = function(socket, wrap) {
Expand Down

0 comments on commit 7fa24d6

Please sign in to comment.