Open m4gpi opened 4 years ago
The swarm internally doesn’t know which incoming connections map to which topic, so unfortunately it’s up for the user to close existing ones when you leave a topic.
Leave stops announcing to the dht and stops connecting to people found on the corresponding topic
Great okay, so I should just be able to close the stream and it'll drop the peer connection. Thanks!
I'm attempting to use a single hyperswarm instance for multiple connections on different topics and want to be able to drop and re-start connections in a granular fashion so I can schedule replication.
@KrishnaPG mentioned a similar question in a previous issue, so forgive me if I've missed the obvious answer there:
Is it possible for me to use hyperswarm in such a manner at the moment? It seems I can create multiple open connections, but I'm unable to drop a connection once its been opened, which is the behaviour I'd expect after calling
swarm.leave(topic)
. At the moment, when I callswarm.leave(topic)
it appears not to drop existing peer connections. Do I need to manually force disconnecting / cancel auto-reconnect with each peer as you mentioned, doing something like...my code: https://ledger-git.dyne.org/CoBox/cobox-group-base/src/commit/e6fc3e4ab8668c151cc155d9c43b46485ca3293a/index.js#L79
Thanks!