holepunchto / hyperswarm

A distributed networking stack for connecting peers.
https://docs.holepunch.to
MIT License
1.04k stars 84 forks source link

Can't connect on two topics to same peer #14

Closed bplaster closed 4 years ago

bplaster commented 5 years ago

I noticed that in Queue.push, the id is defined as const id = peer.host + ':' + peer.port, which means that a peer can't connect to the same peer on two different topics. Is there anyway, similar to discovery-swarm, that we can make it such that the id is based on the topic?

Something like: const id = peer.host + ':' + peer.port + '@' + peer.topic.toString('hex')

fedpettinella commented 5 years ago

This is a fair point. Alternatively the ports could be cycled for different topics

On Fri, 16 Nov 2018, 00:38 bplaster <notifications@github.com wrote:

I noticed that in Queue.push, the id is defined as const id = peer.host + ':' + peer.port, which means that a peer can't connect to the same peer on two different topics. Is there anyway, similar to discovery-swarm, that we can make it such that the id is based on the topic?

Something like: const id = peer.host + ':' + peer.port + '@' + peer.topic.toString('hex')

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/hyperswarm/network/issues/14, or mute the thread https://github.com/notifications/unsubscribe-auth/AQpGzy2dwk2XdgCXeNqtnfG-vmBnXg7jks5uvgkIgaJpZM4YkKiL .

mafintosh commented 4 years ago

This is fixed