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 <benjamingr@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
  • Loading branch information
atlowChemi authored and ruyadorno committed Sep 16, 2023
1 parent 3dd82b1 commit f3c4300
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 @@ -144,8 +145,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 f3c4300

Please sign in to comment.