mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-06-08 13:33:44 +02:00
WHOIS retry fix.
This commit is contained in:
parent
dea30c69a7
commit
2b3862fdde
2 changed files with 13 additions and 6 deletions
|
@ -425,7 +425,7 @@ pub(crate) mod v1 {
|
|||
pub(crate) const PACKET_RESPONSE_COUNTER_DELTA_MAX: u64 = 256;
|
||||
|
||||
/// Frequency for WHOIS retries in milliseconds.
|
||||
pub(crate) const WHOIS_RETRY_INTERVAL: i64 = 1500;
|
||||
pub(crate) const WHOIS_RETRY_INTERVAL: i64 = 3000;
|
||||
|
||||
/// Maximum number of WHOIS retries
|
||||
pub(crate) const WHOIS_RETRY_COUNT_MAX: u16 = 3;
|
||||
|
|
|
@ -202,6 +202,7 @@ struct BackgroundTaskIntervals {
|
|||
|
||||
struct WhoisQueueItem<HostSystemImpl: HostSystem> {
|
||||
waiting_packets: RingBuffer<(Weak<Path<HostSystemImpl>>, PooledPacketBuffer), WHOIS_MAX_WAITING_PACKETS>,
|
||||
last_retry_time: i64,
|
||||
retry_count: u16,
|
||||
}
|
||||
|
||||
|
@ -596,8 +597,11 @@ impl<HostSystemImpl: HostSystem> Node<HostSystemImpl> {
|
|||
let mut whois_queue = self.whois_queue.lock();
|
||||
whois_queue.retain(|_, qi| qi.retry_count <= WHOIS_RETRY_COUNT_MAX);
|
||||
for (address, qi) in whois_queue.iter_mut() {
|
||||
qi.retry_count += 1;
|
||||
need_whois.push(*address);
|
||||
if (time_ticks - qi.last_retry_time) >= WHOIS_RETRY_INTERVAL {
|
||||
qi.retry_count += 1;
|
||||
qi.last_retry_time = time_ticks;
|
||||
need_whois.push(*address);
|
||||
}
|
||||
}
|
||||
need_whois
|
||||
};
|
||||
|
@ -791,15 +795,18 @@ impl<HostSystemImpl: HostSystem> Node<HostSystemImpl> {
|
|||
debug_event!(host_system, "[vl1] [v1] WHOIS {}", address.to_string());
|
||||
{
|
||||
let mut whois_queue = self.whois_queue.lock();
|
||||
let qi = whois_queue
|
||||
.entry(address)
|
||||
.or_insert_with(|| WhoisQueueItem::<HostSystemImpl> { waiting_packets: RingBuffer::new(), retry_count: 0 });
|
||||
let qi = whois_queue.entry(address).or_insert_with(|| WhoisQueueItem::<HostSystemImpl> {
|
||||
waiting_packets: RingBuffer::new(),
|
||||
last_retry_time: 0,
|
||||
retry_count: 0,
|
||||
});
|
||||
if let Some(p) = waiting_packet {
|
||||
qi.waiting_packets.add(p);
|
||||
}
|
||||
if qi.retry_count > 0 {
|
||||
return;
|
||||
} else {
|
||||
qi.last_retry_time = time_ticks;
|
||||
qi.retry_count += 1;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue