Remove the majority of simple warnings for unused imports and/or variables.

This commit is contained in:
Herbert Wolverson 2024-07-16 09:43:32 -05:00
parent 149237e1b8
commit 362671d454
8 changed files with 13 additions and 24 deletions

View File

@ -4,7 +4,10 @@ use once_cell::sync::Lazy;
use lqos_utils::units::{AtomicDownUp, DownUpOrder}; use lqos_utils::units::{AtomicDownUp, DownUpOrder};
use crate::tracking::TrackedQueue; use crate::tracking::TrackedQueue;
/// Holds all of the CAKE queue summaries being tracked by the system.
pub static ALL_QUEUE_SUMMARY: Lazy<AllQueueData> = Lazy::new(|| AllQueueData::new()); pub static ALL_QUEUE_SUMMARY: Lazy<AllQueueData> = Lazy::new(|| AllQueueData::new());
/// Tracks the total number of drops and marks across all queues.
pub static TOTAL_QUEUE_STATS: TotalQueueStats = TotalQueueStats::new(); pub static TOTAL_QUEUE_STATS: TotalQueueStats = TotalQueueStats::new();
pub struct TotalQueueStats { pub struct TotalQueueStats {

View File

@ -82,7 +82,8 @@ fn track_queues() {
expire_watched_queues(); expire_watched_queues();
} }
struct TrackedQueue { /// Holds the CAKE marks/drops for a given queue/circuit.
pub struct TrackedQueue {
circuit_id: String, circuit_id: String,
drops: u64, drops: u64,
marks: u64, marks: u64,

View File

@ -1,8 +1,6 @@
use axum::extract::Path; use axum::extract::Path;
use axum::Json; use axum::Json;
use lqos_bus::BusResponse;
use lqos_config::NetworkJsonTransport; use lqos_config::NetworkJsonTransport;
use crate::shaped_devices_tracker;
use crate::shaped_devices_tracker::NETWORK_JSON; use crate::shaped_devices_tracker::NETWORK_JSON;
pub async fn get_network_tree( pub async fn get_network_tree(

View File

@ -1,4 +1,3 @@
use std::path::Path;
use std::time::{SystemTime, UNIX_EPOCH}; use std::time::{SystemTime, UNIX_EPOCH};
use axum::body::Body; use axum::body::Body;
use axum::http::header; use axum::http::header;

View File

@ -2,16 +2,11 @@ mod circuit;
mod ping_monitor; mod ping_monitor;
mod flows_by_circuit; mod flows_by_circuit;
use std::sync::Arc;
use std::time::Duration;
use axum::Extension;
use axum::extract::WebSocketUpgrade; use axum::extract::WebSocketUpgrade;
use axum::extract::ws::{Message, WebSocket}; use axum::extract::ws::{Message, WebSocket};
use axum::response::IntoResponse; use axum::response::IntoResponse;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use tokio::spawn; use tokio::spawn;
use tokio::time::MissedTickBehavior;
use crate::node_manager::ws::publish_subscribe::PubSub;
use crate::node_manager::ws::single_user_channels::circuit::circuit_watcher; use crate::node_manager::ws::single_user_channels::circuit::circuit_watcher;
use crate::node_manager::ws::single_user_channels::flows_by_circuit::flows_by_circuit; use crate::node_manager::ws::single_user_channels::flows_by_circuit::flows_by_circuit;
use crate::node_manager::ws::single_user_channels::ping_monitor::ping_monitor; use crate::node_manager::ws::single_user_channels::ping_monitor::ping_monitor;
@ -25,16 +20,14 @@ enum PrivateChannel {
pub(super) async fn private_channel_ws_handler( pub(super) async fn private_channel_ws_handler(
ws: WebSocketUpgrade, ws: WebSocketUpgrade,
Extension(channels): Extension<Arc<PubSub>>,
) -> impl IntoResponse { ) -> impl IntoResponse {
log::info!("WS Upgrade Called"); log::info!("WS Upgrade Called");
let channels = channels.clone();
ws.on_upgrade(move |socket| async { ws.on_upgrade(move |socket| async {
handle_socket(socket, channels).await; handle_socket(socket).await;
}) })
} }
async fn handle_socket(mut socket: WebSocket, channels: Arc<PubSub>) { async fn handle_socket(mut socket: WebSocket) {
log::info!("Websocket connected"); log::info!("Websocket connected");
let (tx, mut rx) = tokio::sync::mpsc::channel::<String>(10); let (tx, mut rx) = tokio::sync::mpsc::channel::<String>(10);

View File

@ -2,9 +2,7 @@ use std::net::IpAddr;
use std::time::Duration; use std::time::Duration;
use serde::Serialize; use serde::Serialize;
use tokio::time::MissedTickBehavior; use tokio::time::MissedTickBehavior;
use lqos_sys::flowbee_data::FlowbeeKey;
use lqos_utils::unix_time::time_since_boot; use lqos_utils::unix_time::time_since_boot;
use lqos_utils::XdpIpAddress;
use crate::shaped_devices_tracker::SHAPED_DEVICES; use crate::shaped_devices_tracker::SHAPED_DEVICES;
use crate::throughput_tracker::flow_data::{ALL_FLOWS, FlowAnalysis, FlowbeeLocalData, get_asn_name_and_country}; use crate::throughput_tracker::flow_data::{ALL_FLOWS, FlowAnalysis, FlowbeeLocalData, get_asn_name_and_country};
@ -27,11 +25,11 @@ fn recent_flows_by_circuit(circuit_id: &str) -> Vec<(FlowbeeKeyTransit, FlowbeeL
} }
// Don't show flows that don't belong to the circuit // Don't show flows that don't belong to the circuit
let mut local_ip_str = String::new(); let local_ip_str ; // Using late binding
let mut remote_ip_str = String::new(); let remote_ip_str ;
let mut device_name = String::new(); let device_name ;
let mut asn_name = String::new(); let asn_name ;
let mut asn_country = String::new(); let asn_country ;
let local_ip = match key.local_ip.as_ip() { let local_ip = match key.local_ip.as_ip() {
IpAddr::V4(ip) => ip.to_ipv6_mapped(), IpAddr::V4(ip) => ip.to_ipv6_mapped(),
IpAddr::V6(ip) => ip, IpAddr::V6(ip) => ip,

View File

@ -46,7 +46,6 @@ fn check_queues(interface: &str) -> Result<()> {
#[derive(Debug)] #[derive(Debug)]
pub struct IpLinkInterface { pub struct IpLinkInterface {
pub name: String, pub name: String,
pub index: u32,
pub operstate: String, pub operstate: String,
pub link_type: String, pub link_type: String,
pub master: Option<String>, pub master: Option<String>,
@ -62,14 +61,12 @@ pub fn get_interfaces_from_ip_link() -> Result<Vec<IpLinkInterface>> {
let mut interfaces = Vec::new(); let mut interfaces = Vec::new();
for interface in output_json.as_array().unwrap() { for interface in output_json.as_array().unwrap() {
let name = interface["ifname"].as_str().unwrap().to_string(); let name = interface["ifname"].as_str().unwrap().to_string();
let index = interface["ifindex"].as_u64().unwrap() as u32;
let operstate = interface["operstate"].as_str().unwrap().to_string(); let operstate = interface["operstate"].as_str().unwrap().to_string();
let link_type = interface["link_type"].as_str().unwrap().to_string(); let link_type = interface["link_type"].as_str().unwrap().to_string();
let master = interface["master"].as_str().map(|s| s.to_string()); let master = interface["master"].as_str().map(|s| s.to_string());
interfaces.push(IpLinkInterface { interfaces.push(IpLinkInterface {
name, name,
index,
operstate, operstate,
link_type, link_type,
master, master,

View File

@ -1,5 +1,5 @@
use std::{sync::atomic::AtomicU64, time::Duration}; use std::{sync::atomic::AtomicU64, time::Duration};
use crate::{shaped_devices_tracker::{NETWORK_JSON, SHAPED_DEVICES}, stats::HIGH_WATERMARK, throughput_tracker::flow_data::{expire_rtt_flows, flowbee_rtt_map}}; use crate::{shaped_devices_tracker::SHAPED_DEVICES, stats::HIGH_WATERMARK, throughput_tracker::flow_data::{expire_rtt_flows, flowbee_rtt_map}};
use super::{flow_data::{get_flowbee_event_count_and_reset, FlowAnalysis, FlowbeeLocalData, RttData, ALL_FLOWS}, throughput_entry::ThroughputEntry, RETIRE_AFTER_SECONDS}; use super::{flow_data::{get_flowbee_event_count_and_reset, FlowAnalysis, FlowbeeLocalData, RttData, ALL_FLOWS}, throughput_entry::ThroughputEntry, RETIRE_AFTER_SECONDS};
use dashmap::DashMap; use dashmap::DashMap;
use fxhash::FxHashMap; use fxhash::FxHashMap;