fix: on swarmInstance init, add every relay as an explicit peer
This commit is contained in:
parent
5117f381f6
commit
873bc3da52
|
@ -16,7 +16,7 @@ import { EventEmitter2 as EventEmitter } from "eventemitter2";
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import Protomux from "protomux";
|
import Protomux from "protomux";
|
||||||
import defer, { DeferredPromise } from "p-defer";
|
import defer, { DeferredPromise } from "p-defer";
|
||||||
import { concatBytes } from "@lumeweb/libkernel";
|
import { concatBytes, hexToBytes } from "@lumeweb/libweb";
|
||||||
|
|
||||||
const MAX_PEER_LISTENERS = 20;
|
const MAX_PEER_LISTENERS = 20;
|
||||||
|
|
||||||
|
@ -134,6 +134,9 @@ async function createSwarm(): Promise<number> {
|
||||||
|
|
||||||
swarmInstanceEvents.emit("connection", peer);
|
swarmInstanceEvents.emit("connection", peer);
|
||||||
});
|
});
|
||||||
|
swarmInstance.relays.forEach((relay) => {
|
||||||
|
swarmInstance.activeRelay.joinPeer(hexToBytes(relay));
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
swarmInstance.onSelf("close", (...args) => {
|
swarmInstance.onSelf("close", (...args) => {
|
||||||
|
|
Loading…
Reference in New Issue