From e7a0c381b98f11741d970bc170e5e4fc02f99b60 Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Sun, 19 Mar 2023 07:19:19 -0400 Subject: [PATCH] *Set the max event listeners via const on the peer object --- src/index.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/index.ts b/src/index.ts index 18438fb..768b055 100644 --- a/src/index.ts +++ b/src/index.ts @@ -8,6 +8,8 @@ import * as ed from "@noble/ed25519"; import b4a from "b4a"; import { pubKeyToIpv6 } from "./addr.js"; +const MAX_PEER_LISTENERS = 20; + interface SwarmConnection { swarm: number; conn: any; @@ -310,6 +312,7 @@ async function handleListenConnections(aq: ActiveQuery) { const swarm = await getSwarm(aq); const listener = (peer: any) => { + peer.setMaxListeners(MAX_PEER_LISTENERS); aq.sendUpdate(getSwarmToSocketConnectionId(peer)); };