js-libp2p icon indicating copy to clipboard operation
js-libp2p copied to clipboard

Duplicate connections can occur when dnsaddr addresses resolve to multiple addresses

Open achingbrain opened this issue 2 years ago • 1 comments

A dnsaddr multiaddr that resolves to, for example, both dns4 and dns6 addresses can result in two connections to the same peer.

For example connecting to /dnsaddr/bootstrap.libp2p.io/p2p/QmQCU2EcMqAqQPR2i9bChDtGNJchTbq5TbXJJ16u19uLTa results in connection to:

  • /dns4/ny5.bootstrap.libp2p.io/tcp/443/wss/p2p/QmQCU2EcMqAqQPR2i9bChDtGNJchTbq5TbXJJ16u19uLTa
  • /dns6/ny5.bootstrap.libp2p.io/tcp/443/wss/p2p/QmQCU2EcMqAqQPR2i9bChDtGNJchTbq5TbXJJ16u19uLTa

libp2p should dial all addresses that the original dnsaddr resolves to, but it should only keep one connection open.

achingbrain avatar Mar 16 '23 14:03 achingbrain

We should write a test to verify this.

maschad avatar May 23 '23 15:05 maschad