Skip to content
This repository has been archived by the owner on Jul 21, 2023. It is now read-only.

Handle removing of peers #74

Open
raduiliescu83 opened this issue Jan 11, 2019 · 1 comment
Open

Handle removing of peers #74

raduiliescu83 opened this issue Jan 11, 2019 · 1 comment
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

Comments

@raduiliescu83
Copy link

Not clear how I can handle this case.

Take following case:

  1. Add two nodes - node1 & node2.
  2. node2 provides resource via dht;
  3. kill node2;
  4. call findProviders(resource) on node1

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)

  1. 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
    });

  2. 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.

@vasco-santos vasco-santos added kind/bug A bug in existing code (including security flaws) help wanted Seeking public contribution on this issue exp/novice Someone with a little familiarity can pick up P1 High: Likely tackled by core team if no one steps up labels Feb 7, 2019
@vasco-santos
Copy link
Member

Thanks for reporting the issue @raduiliescu83

Would you like to submit a PR for that?

@vasco-santos vasco-santos added the status/ready Ready to be worked label Feb 11, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
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
Projects
None yet
Development

No branches or pull requests

2 participants