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
1925d0f98e
commit
8ddc054cfb
2 changed files with 4 additions and 6 deletions
|
@ -58,7 +58,6 @@ impl<Fragment, const MAX_FRAGMENTS: usize> Fragged<Fragment, MAX_FRAGMENTS> {
|
|||
#[inline(always)]
|
||||
pub fn assemble(&mut self, counter: u64, fragment: Fragment, fragment_no: u8, fragment_count: u8) -> Option<Assembled<Fragment, MAX_FRAGMENTS>> {
|
||||
if fragment_no < fragment_count && (fragment_count as usize) <= MAX_FRAGMENTS {
|
||||
|
||||
// If the counter has changed, reset the structure to receive a new packet.
|
||||
if counter != self.counter {
|
||||
if needs_drop::<Fragment>() {
|
||||
|
@ -94,7 +93,6 @@ impl<Fragment, const MAX_FRAGMENTS: usize> Fragged<Fragment, MAX_FRAGMENTS> {
|
|||
return Some(Assembled(unsafe { std::mem::transmute_copy(&self.frags) }, fragment_count as usize));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return None;
|
||||
}
|
||||
|
|
|
@ -11,8 +11,8 @@
|
|||
|
||||
use std::collections::hash_map::RandomState;
|
||||
//use std::collections::hash_map::DefaultHasher;
|
||||
use std::hash::{BuildHasher, Hash, Hasher};
|
||||
use std::collections::HashMap;
|
||||
use std::hash::{BuildHasher, Hash, Hasher};
|
||||
use std::num::NonZeroU64;
|
||||
use std::sync::atomic::{AtomicI64, AtomicU64, AtomicUsize, Ordering};
|
||||
use std::sync::{Arc, Mutex, MutexGuard, RwLock, Weak};
|
||||
|
@ -533,8 +533,8 @@ impl<Application: ApplicationLayer> Context<Application> {
|
|||
source.hash(&mut hasher);
|
||||
hasher.write_u64(incoming_counter);
|
||||
let hashed_counter = hasher.finish();
|
||||
let idx0 = (hashed_counter as usize)%MAX_INCOMPLETE_SESSION_QUEUE_SIZE;
|
||||
let idx1 = (hashed_counter as usize)/MAX_INCOMPLETE_SESSION_QUEUE_SIZE%MAX_INCOMPLETE_SESSION_QUEUE_SIZE;
|
||||
let idx0 = (hashed_counter as usize) % MAX_INCOMPLETE_SESSION_QUEUE_SIZE;
|
||||
let idx1 = (hashed_counter as usize) / MAX_INCOMPLETE_SESSION_QUEUE_SIZE % MAX_INCOMPLETE_SESSION_QUEUE_SIZE;
|
||||
|
||||
// Open hash lookup of just 2 slots.
|
||||
// By only checking 2 slots we avoid a full table lookup while also minimizing the chance that 2 offers collide.
|
||||
|
@ -571,7 +571,7 @@ impl<Application: ApplicationLayer> Context<Application> {
|
|||
&mut check_allow_incoming_session,
|
||||
&mut check_accept_session,
|
||||
data_buf,
|
||||
1,// The incoming_counter on init packets is only meant for DOS resistant defragmentation, we do not want to use it for anything noise related.
|
||||
1, // The incoming_counter on init packets is only meant for DOS resistant defragmentation, we do not want to use it for anything noise related.
|
||||
incoming_packet,
|
||||
packet_type,
|
||||
None,
|
||||
|
|
Loading…
Add table
Reference in a new issue