holepunchto / hyperswarm

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

`connection` fired even if not looking up #19

Closed bplaster closed 4 years ago

bplaster commented 5 years ago

Is it intentional that the swarm will attempt to connect with peers as a client if it's only set to announce and not to lookup? I.e. ondht will emit peers, and the swarm will connect to them as a client even when lookup is set to false.

If this isn't intentional, we could store the lookup option on the topic, and when the peer is emitted we only try to connect if the topic has lookup set to true.

Thanks!

mafintosh commented 4 years ago

if you announce, you are in "server" mode, ie peers will connect to you firing the connection event. lookup means you are in client mode as well, ie actively looking for peers and connecting to them