Skip to content

Conversation

@frankmcsherry
Copy link
Member

This PR updates the networking setup to allow the --hostfile to list multiple addr:port on each line, separated by whitespace, and then to listen on each and await the connections from any of them.

The main change this introduces for folks who don't use this feature is that the the awaiting happens without blocking, and has a 1s sleep between each accept() call that doesn't return a socket. This is not unlike the other end of the set-up, where connection attempts are re-attempted each second. In the worst case, this could delay the full connection by a second, where the existing code would by blocking connect as soon as sockets arrive.

It wouldn't be too hard to leave the old behavior when there is a single address to listen on, by keeping both methods.

One risk of the PR is that there may be a ToSocketAddrs for &str that allows whitespace, and the documentation is a bit confusing to me:

the string should be either a string representation of a SocketAddr as expected by its FromStr implementation or a string like <host_name>:<port> pair where <port> is a u16 value.

The "as expected by its FromStr implementation ..." fragment is .. idk.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant