network: avoid GetPeers timeout to accelerate init

The GetPeers requests sent while crawling the network are randomly
load-balanced over available peers.  But at the very beginning, they may
be both routed to the same peer, causing network initialization to be
delayed while the second one times out (since zcashd only ever responds
to the first addr message).

Only sending one GetPeers request per candidate set update means we
crawl the network a little more slowly, but avoids hanging on start.
This commit is contained in:
Henry de Valence 2020-09-19 23:54:38 -07:00
parent b72c249b96
commit 6f3288814c
1 changed files with 1 additions and 1 deletions

View File

@ -106,7 +106,7 @@ where
// existing peers, but we don't make too many because update may be
// called while the peer set is already loaded.
let mut responses = FuturesUnordered::new();
for _ in 0..2usize {
for _ in 0..1usize {
self.peer_service.ready_and().await?;
responses.push(self.peer_service.call(Request::Peers));
}