A bit finer grained timeout interval in get_peers loop

This commit is contained in:
Igor Katson 2023-12-01 08:53:05 +00:00
parent b3ab2c4d4c
commit 21b1bd9e7d
No known key found for this signature in database
GPG key ID: B4EC22B66D61A3F5

View file

@ -287,7 +287,7 @@ impl RecursiveRequest<RecursiveRequestCallbacksGetPeers> {
trace!("iteration {}", iteration);
let sleep = match this.get_peers_root() {
Ok(0) => Duration::from_secs(1),
Ok(n) if n < 8 => REQUERY_INTERVAL / 2,
Ok(n) if n < 8 => REQUERY_INTERVAL / 8 * (n as u32),
Ok(_) => REQUERY_INTERVAL,
Err(e) => {
error!("error in get_peers_root(): {e:?}");
@ -313,7 +313,9 @@ impl RecursiveRequest<RecursiveRequestCallbacksGetPeers> {
);
}
Some(_) = futs.next(), if !futs.is_empty() => {}
_ = &mut looper => {}
r = &mut looper => {
return r
}
}
}
},