Skip to content
Prev Previous commit
Next Next commit
net: use internal addAbortListener
  • Loading branch information
atlowChemi committed Mar 15, 2024
commit 0169b22d59d1c5ce2b717b4ef7dfd974e235bc2f
5 changes: 3 additions & 2 deletions lib/net.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -1631,7 +1632,7 @@ function addClientAbortSignalOption(self, options) {
process.nextTick(onAbort);
} else {
process.nextTick(() => {
disposable = EventEmitter.addAbortListener(signal, onAbort);
disposable = addAbortListener(signal, onAbort);
});
}
}
Expand Down Expand Up @@ -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]);
}
}
Expand Down