Move the process that pings ourselves and creates a last_seen field
for each of our external addresses into a custom child process of
InboundSession, and remove from ProtocolSeed and ProtocolAddr.
This reverts commit 8a01a59b063b3d0dca1eae3963a83dcb52427487.
This commit was wrong because the channel gets shutdown after the receive loop returns Error::ChannelStopped in handle_stop()
Setting this to 0 disables inbound sessions by default, even if we have
configured a inbound address.
If we have a inbound address configured, it should be assumed we want to accept inbound sessions.
InboundSession::start() must happen in this order:
* create the Acceptor
* activate acceptor subscriber
* finally we are ready to start accepting inbound connections.
Previously the flow was like this:
* create the acceptor
* starting accepting inbound connections
* activate the subscriber
This means that inbound connections would potentially be dropped in between
creating the acceptor and activating the subscriber. This is only
obvious in low latency conditions, like refinery::ping_node().
This commit refactors the ping_node method to use a system function
called run_until_completion(), which ensures a task will safely complete even
if it's parent task has been cancelled.
This happens in ping_node() in the case the handshake is ongoing but the
p2p network has been destroyed.
We also introduce a timeout for ping_node() to prevent
perform_handshake_protocols from running forever and blocking
channel.stop() from being safely invoked.
Previously when we called whitelist_fetch_[...](), it would call
greylist_fetch_[...]() inside that method if insufficient whitelist
entries were found.
This was confusing and non-intuitive.
This commit removes this nesting. Now we call
whitelist_fetch_[...] followed by greylist_fetch_[...] in ProtocolAddr
and OutboundSession explicitly.
This commit also fixes a bug in the refinery.
this would mean that if the first external addr in our list is invalid
it will exit the function. instead, continue to check each addr, and if
they are all invalid just broadcast an empty vector inside the AddrsMessage.