snarkOS icon indicating copy to clipboard operation
snarkOS copied to clipboard

Allow the node to start listening at any given time

Open ljedrz opened this issue 2 years ago • 2 comments

This PR allows the node to begin listening for connection requests at a specified point in time (rather than at the point of creation of Tcp), allowing it to have greater control over its startup. This also allows Tcp::new to no longer be async or fallible.

Router::initialize_routing was chosen as the point where the node starts listening; more specifically, this now happens right after all the TCP protocols are enabled.

In order to reflect the fact that listening can start at any point in time, some objects that used to be able to rely on a predefined listening address now need to instead rely on Tcp (which can be cloned around freely).

ljedrz avatar Dec 07 '22 12:12 ljedrz

Sorry, I just realized CI was not checking the tcp crate, and as this PR modifies it, I have added it in here.

For those reading this, I have previously been running all tests locally for each PR in addition to relying on CI, so we are safe.

howardwu avatar Dec 08 '22 22:12 howardwu

I updated the PR; it was rebased, I added some missing calls to enable_listener in Router tests (it seems that those were just added), and I proposed an alternative way of handling the local_ip field in Sync that doesn't require it to hold Tcp.

ljedrz avatar Dec 09 '22 09:12 ljedrz