From 065934461e28212e86caa262f3d408c21cef621b Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Sat, 18 Mar 2023 14:49:05 -0400 Subject: [PATCH] *use once to prevent memory leaks --- src/network.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/network.ts b/src/network.ts index 349f2d9..bc0a23b 100644 --- a/src/network.ts +++ b/src/network.ts @@ -116,7 +116,7 @@ export default class RpcNetwork { this._swarm.on("connection", async (relay: any) => { const pubkey = b4a.from(relay.remotePublicKey).toString("hex"); - relay.on("close", () => { + relay.once("close", () => { this._methods.forEach((item) => { if (item.has(pubkey)) { item.delete(pubkey);