diff --git a/src/dialer/dial-request.js b/src/dialer/dial-request.js index 3f6fc18ae1..707f4e2171 100644 --- a/src/dialer/dial-request.js +++ b/src/dialer/dial-request.js @@ -1,11 +1,12 @@ 'use strict' const errCode = require('err-code') -const AbortController = require('abort-controller').default const { anySignal } = require('any-signal') // @ts-ignore p-fifo does not export types const FIFO = require('p-fifo') const pAny = require('p-any') +// @ts-expect-error setMaxListeners is missing from the types +const { setMaxListeners } = require('events') /** * @typedef {import('libp2p-interfaces/src/connection').Connection} Connection @@ -59,7 +60,12 @@ class DialRequest { const tokenHolder = new FIFO() tokens.forEach(token => tokenHolder.push(token)) - const dialAbortControllers = this.addrs.map(() => new AbortController()) + const dialAbortControllers = this.addrs.map(() => { + const controller = new AbortController() + setMaxListeners && setMaxListeners(Infinity, controller.signal) + + return controller + }) let completedDials = 0 try {