*use once to prevent memory leaks
This commit is contained in:
parent
e9e25b2573
commit
065934461e
|
@ -116,7 +116,7 @@ export default class RpcNetwork {
|
||||||
|
|
||||||
this._swarm.on("connection", async (relay: any) => {
|
this._swarm.on("connection", async (relay: any) => {
|
||||||
const pubkey = b4a.from(relay.remotePublicKey).toString("hex");
|
const pubkey = b4a.from(relay.remotePublicKey).toString("hex");
|
||||||
relay.on("close", () => {
|
relay.once("close", () => {
|
||||||
this._methods.forEach((item) => {
|
this._methods.forEach((item) => {
|
||||||
if (item.has(pubkey)) {
|
if (item.has(pubkey)) {
|
||||||
item.delete(pubkey);
|
item.delete(pubkey);
|
||||||
|
|
Loading…
Reference in New Issue