From d89fc73d4597fff5d3b37c8c56cd986686bca59f Mon Sep 17 00:00:00 2001 From: atlowChemi Date: Thu, 14 Mar 2024 10:54:19 +0200 Subject: [PATCH] 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 Reviewed-By: Benjamin Gruenbaum Reviewed-By: Antoine du Hamel Reviewed-By: Luigi Pinca --- lib/net.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/net.js b/lib/net.js index de2cd517eb4580..c72beaaef34f65 100644 --- a/lib/net.js +++ b/lib/net.js @@ -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]); } }