diff options
author | Fedor Indutny <fedor@indutny.com> | 2015-09-22 02:22:26 +0300 |
---|---|---|
committer | James M Snell <jasnell@gmail.com> | 2015-10-12 20:32:14 +0300 |
commit | af10df6108513464b2c30587e53738905763d291 (patch) | |
tree | ea1eceb4a0c120a690637e1caef88e339d54f770 | |
parent | 01cb3fc36b0ca5f6e24ccb47915487e7c6a0e609 (diff) |
tls: use parent handle's close callback
When closing the child TLSWrap handle - wait for the proper parent's
handle close callback invocation. `uv_close_cb` may be invoked much
later than the next libuv tick, depending on the platform.
The only platform that currently seem to defer `uv_close_cb` is Windows
XP. This behavior was not observed on other Windows systems, and is not
possible on Unixes.
Fix: https://github.com/nodejs/node/issues/2979
PR-URL: https://github.com/nodejs/node/pull/2991
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
-rw-r--r-- | lib/_tls_wrap.js | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/_tls_wrap.js b/lib/_tls_wrap.js index 1bff7579fc2..ae88bf6c18e 100644 --- a/lib/_tls_wrap.js +++ b/lib/_tls_wrap.js @@ -296,7 +296,7 @@ proxiedMethods.forEach(function(name) { tls_wrap.TLSWrap.prototype.close = function closeProxy(cb) { if (this._parentWrap && this._parentWrap._handle === this._parent) { - setImmediate(cb); + this._parentWrap.once('close', cb); return this._parentWrap.destroy(); } return this._parent.close(cb); |