aquadoggo icon indicating copy to clipboard operation
aquadoggo copied to clipboard

Determine re-dial strategy for network peers

Open mycognosist opened this issue 1 year ago • 2 comments

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.

mycognosist avatar Mar 28 '23 12:03 mycognosist

Oha, is this our connection manager actually? Surprised that this is not handled by Swarm

adzialocha avatar Mar 28 '23 13:03 adzialocha

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).

mycognosist avatar Mar 30 '23 13:03 mycognosist