clean up warnings in network hypervisor

Signed-off-by: Erik Hollensbe <git@hollensbe.org>
This commit is contained in:
Erik Hollensbe 2022-06-22 17:24:02 -07:00
parent 10eb2edd82
commit 9e60404847
No known key found for this signature in database
GPG key ID: 4BB0E241A863B389
5 changed files with 18 additions and 0 deletions

View file

@ -43,11 +43,13 @@ impl<const FREQ: i64> Default for AtomicIntervalGate<FREQ> {
impl<const FREQ: i64> AtomicIntervalGate<FREQ> { impl<const FREQ: i64> AtomicIntervalGate<FREQ> {
#[inline(always)] #[inline(always)]
#[allow(unused)]
pub fn new(initial_ts: i64) -> Self { pub fn new(initial_ts: i64) -> Self {
Self(AtomicI64::new(initial_ts)) Self(AtomicI64::new(initial_ts))
} }
#[inline(always)] #[inline(always)]
#[allow(unused)]
pub fn gate(&self, mut time: i64) -> bool { pub fn gate(&self, mut time: i64) -> bool {
let prev_time = self.0.load(Ordering::Acquire); let prev_time = self.0.load(Ordering::Acquire);
if (time - prev_time) < FREQ { if (time - prev_time) < FREQ {

View file

@ -381,6 +381,7 @@ impl<SI: SystemInterface> Peer<SI> {
/// ///
/// This will go directly if there is an active path, or otherwise indirectly /// This will go directly if there is an active path, or otherwise indirectly
/// via a root or some other route. /// via a root or some other route.
#[allow(unused)]
pub(crate) async fn send(&self, si: &SI, node: &Node<SI>, time_ticks: i64, packet: &PacketBuffer) -> bool { pub(crate) async fn send(&self, si: &SI, node: &Node<SI>, time_ticks: i64, packet: &PacketBuffer) -> bool {
if let Some(path) = self.path(node) { if let Some(path) = self.path(node) {
if self.internal_send(si, &path.endpoint, Some(&path.local_socket), Some(&path.local_interface), if path.endpoint.requires_fragmentation() { UDP_DEFAULT_MTU } else { usize::MAX }, packet).await { if self.internal_send(si, &path.endpoint, Some(&path.local_socket), Some(&path.local_interface), if path.endpoint.requires_fragmentation() { UDP_DEFAULT_MTU } else { usize::MAX }, packet).await {
@ -529,8 +530,10 @@ impl<SI: SystemInterface> Peer<SI> {
} }
} }
#[allow(unused)]
async fn handle_incoming_hello(&self, si: &SI, node: &Node<SI>, time_ticks: i64, source_path: &Arc<Path<SI>>, payload: &PacketBuffer) {} async fn handle_incoming_hello(&self, si: &SI, node: &Node<SI>, time_ticks: i64, source_path: &Arc<Path<SI>>, payload: &PacketBuffer) {}
#[allow(unused)]
async fn handle_incoming_error<PH: InnerProtocolInterface>(&self, si: &SI, ph: &PH, node: &Node<SI>, time_ticks: i64, source_path: &Arc<Path<SI>>, forward_secrecy: bool, extended_authentication: bool, payload: &PacketBuffer) { async fn handle_incoming_error<PH: InnerProtocolInterface>(&self, si: &SI, ph: &PH, node: &Node<SI>, time_ticks: i64, source_path: &Arc<Path<SI>>, forward_secrecy: bool, extended_authentication: bool, payload: &PacketBuffer) {
let mut cursor: usize = 1; let mut cursor: usize = 1;
if let Ok(error_header) = payload.read_struct::<message_component_structs::ErrorHeader>(&mut cursor) { if let Ok(error_header) = payload.read_struct::<message_component_structs::ErrorHeader>(&mut cursor) {
@ -546,6 +549,7 @@ impl<SI: SystemInterface> Peer<SI> {
} }
} }
#[allow(unused)]
async fn handle_incoming_ok<PH: InnerProtocolInterface>(&self, si: &SI, ph: &PH, node: &Node<SI>, time_ticks: i64, source_path: &Arc<Path<SI>>, path_is_known: bool, forward_secrecy: bool, extended_authentication: bool, payload: &PacketBuffer) { async fn handle_incoming_ok<PH: InnerProtocolInterface>(&self, si: &SI, ph: &PH, node: &Node<SI>, time_ticks: i64, source_path: &Arc<Path<SI>>, path_is_known: bool, forward_secrecy: bool, extended_authentication: bool, payload: &PacketBuffer) {
let mut cursor: usize = 1; let mut cursor: usize = 1;
if let Ok(ok_header) = payload.read_struct::<message_component_structs::OkHeader>(&mut cursor) { if let Ok(ok_header) = payload.read_struct::<message_component_structs::OkHeader>(&mut cursor) {
@ -603,14 +607,19 @@ impl<SI: SystemInterface> Peer<SI> {
} }
} }
#[allow(unused)]
async fn handle_incoming_whois(&self, si: &SI, node: &Node<SI>, time_ticks: i64, source_path: &Arc<Path<SI>>, payload: &PacketBuffer) {} async fn handle_incoming_whois(&self, si: &SI, node: &Node<SI>, time_ticks: i64, source_path: &Arc<Path<SI>>, payload: &PacketBuffer) {}
#[allow(unused)]
async fn handle_incoming_rendezvous(&self, si: &SI, node: &Node<SI>, time_ticks: i64, source_path: &Arc<Path<SI>>, payload: &PacketBuffer) {} async fn handle_incoming_rendezvous(&self, si: &SI, node: &Node<SI>, time_ticks: i64, source_path: &Arc<Path<SI>>, payload: &PacketBuffer) {}
#[allow(unused)]
async fn handle_incoming_echo(&self, si: &SI, node: &Node<SI>, time_ticks: i64, source_path: &Arc<Path<SI>>, payload: &PacketBuffer) {} async fn handle_incoming_echo(&self, si: &SI, node: &Node<SI>, time_ticks: i64, source_path: &Arc<Path<SI>>, payload: &PacketBuffer) {}
#[allow(unused)]
async fn handle_incoming_push_direct_paths(&self, si: &SI, node: &Node<SI>, time_ticks: i64, source_path: &Arc<Path<SI>>, payload: &PacketBuffer) {} async fn handle_incoming_push_direct_paths(&self, si: &SI, node: &Node<SI>, time_ticks: i64, source_path: &Arc<Path<SI>>, payload: &PacketBuffer) {}
#[allow(unused)]
async fn handle_incoming_user_message(&self, si: &SI, node: &Node<SI>, time_ticks: i64, source_path: &Arc<Path<SI>>, payload: &PacketBuffer) {} async fn handle_incoming_user_message(&self, si: &SI, node: &Node<SI>, time_ticks: i64, source_path: &Arc<Path<SI>>, payload: &PacketBuffer) {}
} }

View file

@ -45,6 +45,7 @@ impl SymmetricSecret {
/// An ephemeral symmetric secret with usage timers and counters. /// An ephemeral symmetric secret with usage timers and counters.
pub(crate) struct EphemeralSymmetricSecret { pub(crate) struct EphemeralSymmetricSecret {
pub secret: SymmetricSecret, pub secret: SymmetricSecret,
#[allow(unused)]
pub encrypt_uses: AtomicUsize, pub encrypt_uses: AtomicUsize,
} }

View file

@ -53,11 +53,13 @@ impl WhoisQueue {
} }
/// Remove a WHOIS request from the queue and call the supplied function for all queued packets. /// Remove a WHOIS request from the queue and call the supplied function for all queued packets.
#[allow(unused)]
pub fn response_received_get_packets<F: FnMut(&mut QueuedPacket)>(&self, address: Address, packet_handler: F) { pub fn response_received_get_packets<F: FnMut(&mut QueuedPacket)>(&self, address: Address, packet_handler: F) {
let mut qi = self.0.lock().remove(&address); let mut qi = self.0.lock().remove(&address);
let _ = qi.map(|mut qi| qi.packet_queue.iter_mut().for_each(packet_handler)); let _ = qi.map(|mut qi| qi.packet_queue.iter_mut().for_each(packet_handler));
} }
#[allow(unused)]
fn send_whois<SI: SystemInterface>(&self, node: &Node<SI>, si: &SI, targets: &[Address]) { fn send_whois<SI: SystemInterface>(&self, node: &Node<SI>, si: &SI, targets: &[Address]) {
todo!() todo!()
} }

View file

@ -12,10 +12,12 @@ pub struct Switch {}
#[async_trait] #[async_trait]
impl InnerProtocolInterface for Switch { impl InnerProtocolInterface for Switch {
#[allow(unused)]
async fn handle_packet<SI: SystemInterface>(&self, peer: &Peer<SI>, source_path: &Path<SI>, forward_secrecy: bool, extended_authentication: bool, verb: u8, payload: &PacketBuffer) -> bool { async fn handle_packet<SI: SystemInterface>(&self, peer: &Peer<SI>, source_path: &Path<SI>, forward_secrecy: bool, extended_authentication: bool, verb: u8, payload: &PacketBuffer) -> bool {
false false
} }
#[allow(unused)]
async fn handle_error<SI: SystemInterface>( async fn handle_error<SI: SystemInterface>(
&self, &self,
peer: &Peer<SI>, peer: &Peer<SI>,
@ -31,10 +33,12 @@ impl InnerProtocolInterface for Switch {
false false
} }
#[allow(unused)]
async fn handle_ok<SI: SystemInterface>(&self, peer: &Peer<SI>, source_path: &Path<SI>, forward_secrecy: bool, extended_authentication: bool, in_re_verb: u8, in_re_message_id: u64, payload: &PacketBuffer, cursor: &mut usize) -> bool { async fn handle_ok<SI: SystemInterface>(&self, peer: &Peer<SI>, source_path: &Path<SI>, forward_secrecy: bool, extended_authentication: bool, in_re_verb: u8, in_re_message_id: u64, payload: &PacketBuffer, cursor: &mut usize) -> bool {
false false
} }
#[allow(unused)]
fn has_trust_relationship(&self, id: &Identity) -> bool { fn has_trust_relationship(&self, id: &Identity) -> bool {
true true
} }