*Set the max event listeners via const on the peer object

This commit is contained in:
Derrick Hammer 2023-03-19 07:19:19 -04:00
parent 6e61420bfd
commit e7a0c381b9
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 3 additions and 0 deletions

View File

@ -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));
};