Skip to content

Commit

Permalink
dgram: use addAbortListener
Browse files Browse the repository at this point in the history
PR-URL: #48550
Reviewed-By: Benjamin Gruenbaum <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
  • Loading branch information
atlowChemi authored and juanarbol committed Jul 13, 2023
1 parent 5a382d0 commit 002ce31
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/dgram.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ const {
ObjectDefineProperty,
ObjectSetPrototypeOf,
ReflectApply,
SymbolDispose,
} = primordials;

const errors = require('internal/errors');
Expand Down Expand Up @@ -143,8 +144,8 @@ function Socket(type, listener) {
if (signal.aborted) {
onAborted();
} else {
signal.addEventListener('abort', onAborted);
this.once('close', () => signal.removeEventListener('abort', onAborted));
const disposable = EventEmitter.addAbortListener(signal, onAborted);
this.once('close', disposable[SymbolDispose]);
}
}
if (udpSocketChannel.hasSubscribers) {
Expand Down

0 comments on commit 002ce31

Please sign in to comment.