fix: have setup hang until we have a connected peer
This commit is contained in:
parent
6c76768fe0
commit
dcc72b9cec
|
@ -53,6 +53,8 @@ async function handlePresentKey(aq: ActiveQuery) {
|
||||||
async function setup() {
|
async function setup() {
|
||||||
swarm = createSwarmClient();
|
swarm = createSwarmClient();
|
||||||
|
|
||||||
|
const peerConnectedDefer = defer();
|
||||||
|
|
||||||
const db = new Level<string, Uint8Array>("s5");
|
const db = new Level<string, Uint8Array>("s5");
|
||||||
await db.open();
|
await db.open();
|
||||||
let config = {
|
let config = {
|
||||||
|
@ -90,7 +92,10 @@ async function setup() {
|
||||||
|
|
||||||
await s5peer.init();
|
await s5peer.init();
|
||||||
node.services.p2p.onNewPeer(s5peer, true);
|
node.services.p2p.onNewPeer(s5peer, true);
|
||||||
|
peerConnectedDefer.resolve();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
return peerConnectedDefer.promise;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function ready(aq: ActiveQuery) {
|
async function ready(aq: ActiveQuery) {
|
||||||
|
|
Loading…
Reference in New Issue