net: use internal addAbortListener

PR-URL: https://github.com/nodejs/node/pull/52081
Refs: https://github.com/nodejs/node/pull/48596
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
This commit is contained in:
atlowChemi 2024-03-14 10:54:19 +02:00 committed by Node.js GitHub Bot
parent 8362caa7d8
commit d89fc73d45
1 changed files with 3 additions and 2 deletions

View File

@ -41,6 +41,7 @@ const {
} = primordials;
const EventEmitter = require('events');
const { addAbortListener } = require('internal/events/abort_listener');
const stream = require('stream');
let debug = require('internal/util/debuglog').debuglog('net', (fn) => {
debug = fn;
@ -1631,7 +1632,7 @@ function addClientAbortSignalOption(self, options) {
process.nextTick(onAbort);
} else {
process.nextTick(() => {
disposable = EventEmitter.addAbortListener(signal, onAbort);
disposable = addAbortListener(signal, onAbort);
});
}
}
@ -1723,7 +1724,7 @@ function addServerAbortSignalOption(self, options) {
if (signal.aborted) {
process.nextTick(onAborted);
} else {
const disposable = EventEmitter.addAbortListener(signal, onAborted);
const disposable = addAbortListener(signal, onAborted);
self.once('close', disposable[SymbolDispose]);
}
}