p2pcf: bug: peerclose fires without emitting peerconnect

If a peer fails to connect [not sure why that happens yet], it will emit close, without ever emitting peerconnect

This case needs to be considered

code:

const map = {}
p2pcf.on('peerconnect', peer => {
  map[peer.id] = true
})
p2pcf.on('peerclose', peer => {
  if (map[peer.id]) {
    // handle
  } else {
    // this should never occur but does
  }
})

should there be a separate event for failed to init peer?

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 15 (14 by maintainers)

Most upvoted comments

can you describe in more detail what change is occurring that is triggering it and why?

console.error('network change', newUdpEnabled !== this.udpEnabled, newIsSymmetric !== this.isSymmetric, newDtlsFingerprint !== this.dtlsFingerprint, !retainedAnyReflexiveIps)

yielded true, false, false, true, but this is a sample size 1 of 10, so take it with a grain of salt the end user was doing nothing, just sitting there watching console, no interactions with the app or OS, no other [significant] apps in the background etc

Oh and we can probably not drop the peers that are connected via TURN. Is the peer whose IP changed on a symmetric NAT?

Their IP didn’t change, and I’m not sure

The reason I wanted a peerstart or peercreate event is because there’s no way for me to listen to ice state events from p2pcf without modifying it