*use once to prevent memory leaks

This commit is contained in:
Derrick Hammer 2023-03-18 14:49:05 -04:00
parent e9e25b2573
commit 065934461e
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 1 additions and 1 deletions

View File

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