diff options
Diffstat (limited to 'ext/node/polyfills/dgram.ts')
-rw-r--r-- | ext/node/polyfills/dgram.ts | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/ext/node/polyfills/dgram.ts b/ext/node/polyfills/dgram.ts index 17ec4f2c3..99f4940ec 100644 --- a/ext/node/polyfills/dgram.ts +++ b/ext/node/polyfills/dgram.ts @@ -531,16 +531,17 @@ export class Socket extends EventEmitter { healthCheck(this); stopReceiving(this); - state.handle!.close(); + state.handle!.close(() => { + // Deviates from the Node implementation to avoid leaking the timer ops at 'close' event + defaultTriggerAsyncIdScope( + this[asyncIdSymbol], + nextTick, + socketCloseNT, + this, + ); + }); state.handle = null; - defaultTriggerAsyncIdScope( - this[asyncIdSymbol], - nextTick, - socketCloseNT, - this, - ); - return this; } |