Skip to content

Commit

Permalink
tls: use parent handle's close callback
Browse files Browse the repository at this point in the history
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: #2979
PR-URL: #2991
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
  • Loading branch information
indutny committed Oct 12, 2015
1 parent a713024 commit 51325c0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/_tls_wrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 51325c0

Please sign in to comment.