Compare commits
2 Commits
eebc09bee5
...
f3edce42fa
Author | SHA1 | Date |
---|---|---|
Derrick Hammer | f3edce42fa | |
Derrick Hammer | e77eaac0a0 |
|
@ -20,7 +20,7 @@ let swarm;
|
||||||
let proxy: HandshakeProxy;
|
let proxy: HandshakeProxy;
|
||||||
|
|
||||||
function resolveWithPeers(resolve: Function) {
|
function resolveWithPeers(resolve: Function) {
|
||||||
if (proxy.node.peers.list.size === 0) {
|
if (!proxy.node.pool.peers.head()) {
|
||||||
proxy.node.pool.once("peer", () => {
|
proxy.node.pool.once("peer", () => {
|
||||||
resolve(null);
|
resolve(null);
|
||||||
});
|
});
|
||||||
|
@ -48,14 +48,16 @@ async function handleReady(aq: ActiveQuery) {
|
||||||
return resolveWithPeers(resolve);
|
return resolveWithPeers(resolve);
|
||||||
}
|
}
|
||||||
|
|
||||||
proxy.node.pool.on("full", resolveWithPeers);
|
proxy.node.pool.once("full", () => {
|
||||||
|
resolveWithPeers(resolve);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
aq.respond();
|
aq.respond();
|
||||||
}
|
}
|
||||||
|
|
||||||
async function handleQuery(aq: ActiveQuery) {
|
async function handleQuery(aq: ActiveQuery) {
|
||||||
if (!proxy.node.chain.synced || proxy.node.peers.list.size === 0) {
|
if (!proxy.node.chain.synced || !proxy.node.pool.peers.head()) {
|
||||||
aq.reject("not ready");
|
aq.reject("not ready");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue