When a node is first launched it attempts to connect to any configured relay or direct node addresses, the steps are as follows:
1) register at all relay/rendezvous nodes for peer discovery and connections
2) connect to and initiate a replication sessions with all relay/rendezvous nodes
3) connect to and initiate a replication sessions with all direct nodes
If the device where a node is running is offline when the app starts, all of these steps will fail and no further connection attempts are made. Similarly, if the node loses connectivity after it started, connections will be dropped for good.
This PR implements a modest solution for points 2) an 3) above by adding a polling service to the EventLoop which attempts to (re)connect to all known peer addresses (relay or otherwise) every x seconds. A connection is only established if none already exist to the address in question. Replication sessions will be initiated with any peers that we successfully (re)connect to.
Finding a solution in the same situation for point 1) above is a little more involved, these changes seemed like easy low hanging fruit which brings greatly improved UX to node users, especially in situations where nodes run for long periods and connections may drop.
📋 Checklist
[x] Add tests that cover your changes
[x] Add this PR to the Unreleased section in CHANGELOG.md
When a node is first launched it attempts to connect to any configured relay or direct node addresses, the steps are as follows:
1) register at all relay/rendezvous nodes for peer discovery and connections 2) connect to and initiate a replication sessions with all relay/rendezvous nodes 3) connect to and initiate a replication sessions with all direct nodes
If the device where a node is running is offline when the app starts, all of these steps will fail and no further connection attempts are made. Similarly, if the node loses connectivity after it started, connections will be dropped for good.
This PR implements a modest solution for points
2)
an3)
above by adding a polling service to theEventLoop
which attempts to (re)connect to all known peer addresses (relay or otherwise) every x seconds. A connection is only established if none already exist to the address in question. Replication sessions will be initiated with any peers that we successfully (re)connect to.Finding a solution in the same situation for point
1)
above is a little more involved, these changes seemed like easy low hanging fruit which brings greatly improved UX to node users, especially in situations where nodes run for long periods and connections may drop.📋 Checklist
Add tests that cover your changesCHANGELOG.md