we reduce this in light of 4bf43ec521.
Hostlist sharing now works as follows:
* Start node
* wait 5 sec
* start greylist refinery
* send whitelisted entry to peers
This commit forces all whitelisted peers through the greylist each time
we start a node, thus ensuring that whitelisted peers are in fact
reachable.
Otherwise, our whitelist risks getting polluted with unreachable
whitelisted peers. While the greylist has a refinery process to deal
with this, the whitelist has no such process.
downgrade_host() is costly (reads through many vectors) and redundant
because it repeats the behavior that should be handled by the greylist
refinery.
what we need is a way to avoid instantly reconnecting to hosts that we
have just failed to connect to.
this commit introduces a simple fix- we write to a vector called
`rejected` and avoid trying to reconnect to its entries once a
connection has failed.
however, this is not ideal as it means we will never connect to that
host- see TODO.
previously we were checking whether the entry is in any of the hostlists
(hostlist_contains) prior to storing entries in the greylist.
this creates a logic error which we have now fixed.
the impact is we will now likely have duplicate connections between the
greylist and other lists. however, it shouldn't be a problem.
make a standalone function that removes the address from the white or
greylist and adds it to the anchorlist. call it inside outbound and
manual session.
this commit also removes a redundant Result<()> from
[hostlist]_store_or_upgrade() method and updates its usage.
We also add various debug statements and cleanup.
* don't fetch addresses with lock in a nested way- first fetch the
address, then apply the locking checks
* delete blocking function get_active_connect_count. instead, just use
slots rather that active connections to avoid deadlock on p2p channels.
TODO: there seems to be another deadlock that occurs more rarely. From
preliminary investigations, it doesn't seem to be related to p2p channels.
if we don't have any hosts on the anchorlist, chose from the whitelist.
if we don't have any on the whitelist, chose from the greylist.
same principle for whitelist_fetch_with_schemes (each method has a
different selection priority)