mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-04-19 13:36:54 +02:00
ran cargo fmt
This commit is contained in:
parent
cada04545e
commit
4f064dd389
1 changed files with 16 additions and 7 deletions
|
@ -14,7 +14,7 @@ use std::collections::hash_map::RandomState;
|
|||
use std::collections::HashMap;
|
||||
use std::hash::{BuildHasher, Hash, Hasher};
|
||||
use std::num::NonZeroU64;
|
||||
use std::sync::atomic::{AtomicI64, AtomicU64, AtomicUsize, Ordering, AtomicBool};
|
||||
use std::sync::atomic::{AtomicBool, AtomicI64, AtomicU64, AtomicUsize, Ordering};
|
||||
use std::sync::{Arc, Mutex, MutexGuard, RwLock, Weak};
|
||||
|
||||
use zerotier_crypto::aes::{Aes, AesGcm};
|
||||
|
@ -247,7 +247,6 @@ impl<Application: ApplicationLayer> Context<Application> {
|
|||
dead_pending.push(*id);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
// Only check for expiration if we have a pending packet.
|
||||
// This check is allowed to have false positives for simplicity's sake.
|
||||
|
@ -565,8 +564,12 @@ impl<Application: ApplicationLayer> Context<Application> {
|
|||
// generated counter value replaying it in time requires extreme amounts of network control.
|
||||
let mut slot0 = self.defrag[idx0].lock().unwrap();
|
||||
if slot0.0.counter() == hashed_counter {
|
||||
assembled = slot0.0.assemble(hashed_counter, incoming_physical_packet_buf, fragment_no, fragment_count);
|
||||
if assembled.is_some() { slot0.1 = i64::MAX }
|
||||
assembled = slot0
|
||||
.0
|
||||
.assemble(hashed_counter, incoming_physical_packet_buf, fragment_no, fragment_count);
|
||||
if assembled.is_some() {
|
||||
slot0.1 = i64::MAX
|
||||
}
|
||||
} else {
|
||||
let mut slot1 = self.defrag[idx1].lock().unwrap();
|
||||
if slot1.0.counter() == hashed_counter || slot1.0.counter() == 0 {
|
||||
|
@ -574,13 +577,19 @@ impl<Application: ApplicationLayer> Context<Application> {
|
|||
slot1.1 = current_time;
|
||||
self.defrag_has_pending.store(true, Ordering::Relaxed);
|
||||
}
|
||||
assembled = slot1.0.assemble(hashed_counter, incoming_physical_packet_buf, fragment_no, fragment_count);
|
||||
if assembled.is_some() { slot1.1 = i64::MAX }
|
||||
assembled = slot1
|
||||
.0
|
||||
.assemble(hashed_counter, incoming_physical_packet_buf, fragment_no, fragment_count);
|
||||
if assembled.is_some() {
|
||||
slot1.1 = i64::MAX
|
||||
}
|
||||
} else {
|
||||
// slot0 is either occupied or empty so we overwrite whatever is there to make more room.
|
||||
slot0.1 = current_time;
|
||||
self.defrag_has_pending.store(true, Ordering::Relaxed);
|
||||
assembled = slot0.0.assemble(hashed_counter, incoming_physical_packet_buf, fragment_no, fragment_count);
|
||||
assembled = slot0
|
||||
.0
|
||||
.assemble(hashed_counter, incoming_physical_packet_buf, fragment_no, fragment_count);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue