fest: add stop method
This commit is contained in:
parent
90c0614773
commit
dfe9e3f082
|
@ -69,6 +69,10 @@ export class S5Node {
|
||||||
await p2p.start();
|
await p2p.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async stop() {
|
||||||
|
await this.services.p2p.stop();
|
||||||
|
}
|
||||||
|
|
||||||
async readStorageLocationsFromDB(
|
async readStorageLocationsFromDB(
|
||||||
hash: Multihash,
|
hash: Multihash,
|
||||||
): Promise<Map<number, Map<string, Map<number, any>>>> {
|
): Promise<Map<number, Map<string, Map<number, any>>>> {
|
||||||
|
|
|
@ -97,6 +97,9 @@ export class P2PService extends EventEmitter {
|
||||||
this.connectToNode([new URL(p)]);
|
this.connectToNode([new URL(p)]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
async stop() {
|
||||||
|
[...this.node.services.p2p.peers.values()].forEach((peer) => peer.end());
|
||||||
|
}
|
||||||
|
|
||||||
async onNewPeer(peer: Peer, verifyId: boolean): Promise<void> {
|
async onNewPeer(peer: Peer, verifyId: boolean): Promise<void> {
|
||||||
peer.challenge = crypto.randomBytes(32);
|
peer.challenge = crypto.randomBytes(32);
|
||||||
|
|
Loading…
Reference in New Issue