*add getActivePeers api method
This commit is contained in:
parent
cad93cbb21
commit
fd2d66d2c4
|
@ -68,6 +68,7 @@ addHandler("stat", handleStat);
|
|||
addHandler("ls", handleLs, { receiveUpdates: true });
|
||||
addHandler("cat", handleCat, { receiveUpdates: true });
|
||||
addHandler("ipnsResolve", handleIpnsResolve);
|
||||
addHandler("getActivePeers", handleGetActivePeers);
|
||||
|
||||
async function handlePresentSeed() {
|
||||
swarm = createClient();
|
||||
|
@ -329,6 +330,12 @@ async function handleIpnsResolve(aq: ActiveQuery) {
|
|||
}
|
||||
}
|
||||
|
||||
async function handleGetActivePeers(aq: ActiveQuery) {
|
||||
await ready();
|
||||
|
||||
aq.respond(PeerManager.instance.ipfs.libp2p.getPeers());
|
||||
}
|
||||
|
||||
async function ready() {
|
||||
await moduleDefer.promise;
|
||||
await PeerManager.instance.ipfsReady;
|
||||
|
|
Loading…
Reference in New Issue