Skip to content

Commit cfeee51

Browse files
atlowChemiruyadorno
authored andcommitted
dgram: use addAbortListener
PR-URL: #48550 Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
1 parent c44413d commit cfeee51

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

‎lib/dgram.js‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ const{
3030
ObjectDefineProperty,
3131
ObjectSetPrototypeOf,
3232
ReflectApply,
33+
SymbolDispose,
3334
}=primordials;
3435

3536
consterrors=require('internal/errors');
@@ -144,8 +145,8 @@ function Socket(type, listener){
144145
if(signal.aborted){
145146
onAborted();
146147
}else{
147-
signal.addEventListener('abort',onAborted);
148-
this.once('close',()=>signal.removeEventListener('abort',onAborted));
148+
constdisposable=EventEmitter.addAbortListener(signal,onAborted);
149+
this.once('close',disposable[SymbolDispose]);
149150
}
150151
}
151152
if(udpSocketChannel.hasSubscribers){

0 commit comments

Comments
(0)