summaryrefslogtreecommitdiff
path: root/lib/_tls_wrap.js
diff options
context:
space:
mode:
authorFedor Indutny <fedor@indutny.com>2016-02-09 16:00:24 -0500
committerFedor Indutny <fedor@indutny.com>2016-02-16 14:12:45 -0500
commitaa0526972a8d87abd5f1a665dbbcc74ca76169f1 (patch)
treecfeda9ef7db8bbbf2cdc2f6059f4ed8f81d92e9c /lib/_tls_wrap.js
parenta06066ca3180c86fa93b4f220867c1fd0c54f678 (diff)
downloadnode-new-aa0526972a8d87abd5f1a665dbbcc74ca76169f1.tar.gz
tls: nullify `.ssl` on handle close
This is an intermediate fix for an issue of accessing `TLSWrap` fields after the parent handle was destroyed. While `close` listener cleans up this field automatically, it can be done even earlier at the `TLSWrap.close` call. Proper fix is going to be submitted and landed after this one. Fix: #5108 PR-URL: https://github.com/nodejs/node/pull/5168 Reviewed-By: Shigeki Ohtsu <ohtsu@iij.ad.jp>
Diffstat (limited to 'lib/_tls_wrap.js')
-rw-r--r--lib/_tls_wrap.js3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/_tls_wrap.js b/lib/_tls_wrap.js
index a888dc1554..69e197ca46 100644
--- a/lib/_tls_wrap.js
+++ b/lib/_tls_wrap.js
@@ -299,6 +299,9 @@ proxiedMethods.forEach(function(name) {
});
tls_wrap.TLSWrap.prototype.close = function closeProxy(cb) {
+ if (this.owner)
+ this.owner.ssl = null;
+
if (this._parentWrap && this._parentWrap._handle === this._parent) {
this._parentWrap.once('close', cb);
return this._parentWrap.destroy();