Skip to content

Commit

Permalink
net: use internal addAbortListener
Browse files Browse the repository at this point in the history
PR-URL: #52081
Refs: #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>
  • Loading branch information
atlowChemi authored and marco-ippolito committed May 3, 2024
1 parent 27d3644 commit 37abad8
Showing 1 changed file with 3 additions and 2 deletions.
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

0 comments on commit 37abad8

Please sign in to comment.