diff --git a/src/rust/lqos_queue_tracker/src/tracking/all_queue_data.rs b/src/rust/lqos_queue_tracker/src/tracking/all_queue_data.rs index 95f245e7..dd9bfea5 100644 --- a/src/rust/lqos_queue_tracker/src/tracking/all_queue_data.rs +++ b/src/rust/lqos_queue_tracker/src/tracking/all_queue_data.rs @@ -4,7 +4,10 @@ use once_cell::sync::Lazy; use lqos_utils::units::{AtomicDownUp, DownUpOrder}; use crate::tracking::TrackedQueue; +/// Holds all of the CAKE queue summaries being tracked by the system. pub static ALL_QUEUE_SUMMARY: Lazy = Lazy::new(|| AllQueueData::new()); + +/// Tracks the total number of drops and marks across all queues. pub static TOTAL_QUEUE_STATS: TotalQueueStats = TotalQueueStats::new(); pub struct TotalQueueStats { diff --git a/src/rust/lqos_queue_tracker/src/tracking/mod.rs b/src/rust/lqos_queue_tracker/src/tracking/mod.rs index d3196270..63537f92 100644 --- a/src/rust/lqos_queue_tracker/src/tracking/mod.rs +++ b/src/rust/lqos_queue_tracker/src/tracking/mod.rs @@ -82,7 +82,8 @@ fn track_queues() { expire_watched_queues(); } -struct TrackedQueue { +/// Holds the CAKE marks/drops for a given queue/circuit. +pub struct TrackedQueue { circuit_id: String, drops: u64, marks: u64, diff --git a/src/rust/lqosd/src/node_manager/local_api/network_tree.rs b/src/rust/lqosd/src/node_manager/local_api/network_tree.rs index 2eaaac3c..b021df0a 100644 --- a/src/rust/lqosd/src/node_manager/local_api/network_tree.rs +++ b/src/rust/lqosd/src/node_manager/local_api/network_tree.rs @@ -1,8 +1,6 @@ use axum::extract::Path; use axum::Json; -use lqos_bus::BusResponse; use lqos_config::NetworkJsonTransport; -use crate::shaped_devices_tracker; use crate::shaped_devices_tracker::NETWORK_JSON; pub async fn get_network_tree( diff --git a/src/rust/lqosd/src/node_manager/local_api/support.rs b/src/rust/lqosd/src/node_manager/local_api/support.rs index b56ea448..af9fa94b 100644 --- a/src/rust/lqosd/src/node_manager/local_api/support.rs +++ b/src/rust/lqosd/src/node_manager/local_api/support.rs @@ -1,4 +1,3 @@ -use std::path::Path; use std::time::{SystemTime, UNIX_EPOCH}; use axum::body::Body; use axum::http::header; diff --git a/src/rust/lqosd/src/node_manager/ws/single_user_channels.rs b/src/rust/lqosd/src/node_manager/ws/single_user_channels.rs index 112e6322..8065ebac 100644 --- a/src/rust/lqosd/src/node_manager/ws/single_user_channels.rs +++ b/src/rust/lqosd/src/node_manager/ws/single_user_channels.rs @@ -2,16 +2,11 @@ mod circuit; mod ping_monitor; mod flows_by_circuit; -use std::sync::Arc; -use std::time::Duration; -use axum::Extension; use axum::extract::WebSocketUpgrade; use axum::extract::ws::{Message, WebSocket}; use axum::response::IntoResponse; use serde::{Deserialize, Serialize}; 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::flows_by_circuit::flows_by_circuit; 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( ws: WebSocketUpgrade, - Extension(channels): Extension>, ) -> impl IntoResponse { log::info!("WS Upgrade Called"); - let channels = channels.clone(); ws.on_upgrade(move |socket| async { - handle_socket(socket, channels).await; + handle_socket(socket).await; }) } -async fn handle_socket(mut socket: WebSocket, channels: Arc) { +async fn handle_socket(mut socket: WebSocket) { log::info!("Websocket connected"); let (tx, mut rx) = tokio::sync::mpsc::channel::(10); diff --git a/src/rust/lqosd/src/node_manager/ws/single_user_channels/flows_by_circuit.rs b/src/rust/lqosd/src/node_manager/ws/single_user_channels/flows_by_circuit.rs index 566dfdd6..2b77fc7f 100644 --- a/src/rust/lqosd/src/node_manager/ws/single_user_channels/flows_by_circuit.rs +++ b/src/rust/lqosd/src/node_manager/ws/single_user_channels/flows_by_circuit.rs @@ -2,9 +2,7 @@ use std::net::IpAddr; use std::time::Duration; use serde::Serialize; use tokio::time::MissedTickBehavior; -use lqos_sys::flowbee_data::FlowbeeKey; use lqos_utils::unix_time::time_since_boot; -use lqos_utils::XdpIpAddress; use crate::shaped_devices_tracker::SHAPED_DEVICES; 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 - let mut local_ip_str = String::new(); - let mut remote_ip_str = String::new(); - let mut device_name = String::new(); - let mut asn_name = String::new(); - let mut asn_country = String::new(); + let local_ip_str ; // Using late binding + let remote_ip_str ; + let device_name ; + let asn_name ; + let asn_country ; let local_ip = match key.local_ip.as_ip() { IpAddr::V4(ip) => ip.to_ipv6_mapped(), IpAddr::V6(ip) => ip, diff --git a/src/rust/lqosd/src/preflight_checks.rs b/src/rust/lqosd/src/preflight_checks.rs index 5b602e1a..6baf6d3a 100644 --- a/src/rust/lqosd/src/preflight_checks.rs +++ b/src/rust/lqosd/src/preflight_checks.rs @@ -46,7 +46,6 @@ fn check_queues(interface: &str) -> Result<()> { #[derive(Debug)] pub struct IpLinkInterface { pub name: String, - pub index: u32, pub operstate: String, pub link_type: String, pub master: Option, @@ -62,14 +61,12 @@ pub fn get_interfaces_from_ip_link() -> Result> { let mut interfaces = Vec::new(); for interface in output_json.as_array().unwrap() { 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 link_type = interface["link_type"].as_str().unwrap().to_string(); let master = interface["master"].as_str().map(|s| s.to_string()); interfaces.push(IpLinkInterface { name, - index, operstate, link_type, master, diff --git a/src/rust/lqosd/src/throughput_tracker/tracking_data.rs b/src/rust/lqosd/src/throughput_tracker/tracking_data.rs index 0f3ed329..7467269d 100644 --- a/src/rust/lqosd/src/throughput_tracker/tracking_data.rs +++ b/src/rust/lqosd/src/throughput_tracker/tracking_data.rs @@ -1,5 +1,5 @@ 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 dashmap::DashMap; use fxhash::FxHashMap;