This repository has been archived by the owner on Jul 21, 2023. It is now read-only.
Handle removing of peers #74
Labels
exp/novice
Someone with a little familiarity can pick up
help wanted
Seeking public contribution on this issue
kind/bug
A bug in existing code (including security flaws)
P1
High: Likely tackled by core team if no one steps up
status/ready
Ready to be worked
Not clear how I can handle this case.
Take following case:
This will generate following stack:
Error: No available transports to dial peer QmTxbrLsEBWjHgeK4kfJoRmfXDMeL9m1pD4E7hEKueJTFa!
at nextTransport (/home/radu/git/dcdn/p2p_service/node_modules/libp2p/node_modules/libp2p-switch/src/dial.js:369:27)
at switch.transport.dial (/home/radu/git/dcdn/p2p_service/node_modules/libp2p/node_modules/libp2p-switch/src/dial.js:382:18)
at dialer.dialMany (/home/radu/git/dcdn/p2p_service/node_modules/libp2p/node_modules/libp2p-switch/src/transport.js:69:16)
at f (/home/radu/git/dcdn/p2p_service/node_modules/once/once.js:25:25)
at map (/home/radu/git/dcdn/p2p_service/node_modules/libp2p/node_modules/libp2p-switch/src/limit-dialer/index.js:61:14)
at /home/radu/git/dcdn/p2p_service/node_modules/async/internal/map.js:32:9
at /home/radu/git/dcdn/p2p_service/node_modules/async/internal/once.js:12:16
at iteratorCallback (/home/radu/git/dcdn/p2p_service/node_modules/async/eachOf.js:60:13)
at /home/radu/git/dcdn/p2p_service/node_modules/async/internal/onlyOnce.js:12:16
at Object.callback (/home/radu/git/dcdn/p2p_service/node_modules/async/internal/map.js:29:13)
After killing node2 delete node2 from node1 peerBook and dht.routingTable like bellow:
node.on('peer:disconnect', (peerInfo) => {
supernode._dht.routingTable.remove(peerInfo.id, (err) => {
if (err)
console.log(err);
});
supernode.peerBook.remove(peerInfo); <<<- Just calling this should be enough
});
Problem now is that if I call findProviders(resource) on node1, it won't crash but I will still get that there is someone providing the resource, but has no address.
The text was updated successfully, but these errors were encountered: