mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 10:59:27 +00:00
dgram: use addAbortListener
PR-URL: https://github.com/nodejs/node/pull/48550 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
This commit is contained in:
parent
f6fc2dde95
commit
bb031cbe2c
@ -30,6 +30,7 @@ const {
|
||||
ObjectDefineProperty,
|
||||
ObjectSetPrototypeOf,
|
||||
ReflectApply,
|
||||
SymbolDispose,
|
||||
} = primordials;
|
||||
|
||||
const errors = require('internal/errors');
|
||||
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user