Skip to content

Commit 51325c0

Browse files
committed
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: #2979 PR-URL: #2991 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
1 parent a713024 commit 51325c0

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/_tls_wrap.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ proxiedMethods.forEach(function(name) {
296296

297297
tls_wrap.TLSWrap.prototype.close = function closeProxy(cb) {
298298
if (this._parentWrap && this._parentWrap._handle === this._parent) {
299-
setImmediate(cb);
299+
this._parentWrap.once('close', cb);
300300
return this._parentWrap.destroy();
301301
}
302302
return this._parent.close(cb);

0 commit comments

Comments
 (0)