aquadoggo
aquadoggo copied to clipboard
Determine re-dial strategy for network peers
Currently, peers are dialed as they are discovered (either via mDNS or the rendezvous server). These connection attempts either succeed or fail. Successful connection attempts will only last so long before the connection times-out.
How to track attempts and schedule redials?
This is where an address book or peer manager may be necessary.
Oha, is this our connection manager actually? Surprised that this is not handled by Swarm
I'm realising that our rendezvous and mDNS discovery mechanisms actually help with this.
Every time we learn about a peer by querying the rendezvous server, or by querying mDNS services, we attempt to dial them. In my latest round of testing with three peers (one rendezvous server and two rendezvous clients), the dial-on-discover approach is enough to keep connections opening and closing on an ongoing basis.
It could be useful to play around with the ttl
parameter for rendezvous server registrations (https://docs.rs/libp2p/latest/libp2p/rendezvous/client/struct.Behaviour.html#method.register). By increasing the ttl
, we increase the window of discoverability by another peer (the registration lives longer and is therefore more likely to be discovered by a querying peer).