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

Discovery discovers self #171

Closed
kumavis opened this issue Apr 13, 2019 · 2 comments
Closed

Discovery discovers self #171

kumavis opened this issue Apr 13, 2019 · 2 comments

Comments

@kumavis
Copy link
Contributor

kumavis commented Apr 13, 2019

"libp2p-webrtc-star": "^0.15.8"

sometimes accidently discovers self

  // connect to all discovered nodes
  node.on('peer:discovery', (peer) => {
    // this happens i guess
    if (clientId === peer.id.toB58String()) return
    // ignore failures
    node.dial(peer, (err) => {})
  })

node config

 const wstar = new WStar()
  const node = new Libp2p({
    peerInfo,
    modules: {
      transport: [
        WS,
        wstar
      ],
      streamMuxer: [
        Mplex
      ],
      peerDiscovery: [
        wstar.discovery,
      ],
      dht: DHT,
    },
    config: {
      peerDiscovery: {
      },
      dht: {
        enabled: true,
        kBucketSize: 20,
      },
    }
  })
@jacobheun
Copy link
Contributor

Since transports don't always have access to their own PeerInfo instance (which we should probably correct by always passing the libp2p node in transport options), detecting itself on peer discovery is not reasonably possible. We should make the change at libp2p/js-libp2p#356 to avoid downstream users from getting the event.

@jacobheun
Copy link
Contributor

This has been resolved in js-libp2p

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants