Some cleanups
This commit is contained in:
1 parent
f20ff59e78
commit
cf14fcd5f8
5 files changed
+6
-15
No files matched your search
@@ -1,8 +1,3 @@
|
|||||||
use static_init::dynamic;
|
|
||||||
use std::error::Error;
|
|
||||||
use std::fmt;
|
|
||||||
use std::str::FromStr;
|
|
||||||
use std::sync::{Arc, RwLock};
|
|
||||||
use std::time::SystemTime;
|
use std::time::SystemTime;
|
||||||
|
|
||||||
use log::{Level, LevelFilter, Metadata, Record, SetLoggerError};
|
use log::{Level, LevelFilter, Metadata, Record, SetLoggerError};
|
||||||
|
|||||||
+2
-4
@@ -14,9 +14,8 @@ mod reflector_selector;
|
|||||||
mod utils;
|
mod utils;
|
||||||
|
|
||||||
use crate::baseliner::{Baseliner, ReflectorStats};
|
use crate::baseliner::{Baseliner, ReflectorStats};
|
||||||
use ::log::{debug, error, info, Level, LevelFilter};
|
use ::log::{debug, error, info};
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::error::Error;
|
|
||||||
use std::net::IpAddr;
|
use std::net::IpAddr;
|
||||||
use std::process::ExitCode;
|
use std::process::ExitCode;
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
@@ -27,8 +26,7 @@ use std::time::Duration;
|
|||||||
use std::{panic, process, thread};
|
use std::{panic, process, thread};
|
||||||
|
|
||||||
use crate::config::{Config, MeasurementType};
|
use crate::config::{Config, MeasurementType};
|
||||||
use crate::log::SimpleLogger;
|
use crate::netlink::Netlink;
|
||||||
use crate::netlink::{Netlink, Qdisc};
|
|
||||||
use crate::pinger::{PingListener, PingSender, SocketType};
|
use crate::pinger::{PingListener, PingSender, SocketType};
|
||||||
use crate::pinger_icmp::{PingerICMPEchoListener, PingerICMPEchoSender};
|
use crate::pinger_icmp::{PingerICMPEchoListener, PingerICMPEchoSender};
|
||||||
use crate::pinger_icmp_ts::{PingerICMPTimestampListener, PingerICMPTimestampSender};
|
use crate::pinger_icmp_ts::{PingerICMPTimestampListener, PingerICMPTimestampSender};
|
||||||
|
|||||||
+1
-2
@@ -83,7 +83,7 @@ pub trait PingListener {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
let reply = match self.parse_packet(id, addr, buf, size) {
|
let reply = match self.parse_packet(id, addr, buf) {
|
||||||
Ok(val) => val,
|
Ok(val) => val,
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
error!(
|
error!(
|
||||||
@@ -104,7 +104,6 @@ pub trait PingListener {
|
|||||||
id: u16,
|
id: u16,
|
||||||
reflector: IpAddr,
|
reflector: IpAddr,
|
||||||
buf: &[u8],
|
buf: &[u8],
|
||||||
len: usize,
|
|
||||||
) -> Result<PingReply, Box<dyn Error>>;
|
) -> Result<PingReply, Box<dyn Error>>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ impl PingListener for PingerICMPTimestampListener {
|
|||||||
id: u16,
|
id: u16,
|
||||||
reflector: IpAddr,
|
reflector: IpAddr,
|
||||||
buf: &[u8],
|
buf: &[u8],
|
||||||
len: usize,
|
|
||||||
) -> Result<PingReply, Box<dyn Error>> {
|
) -> Result<PingReply, Box<dyn Error>> {
|
||||||
match SlicedPacket::from_ip(buf) {
|
match SlicedPacket::from_ip(buf) {
|
||||||
Err(value) => warn!("Error parsing packet: {:?}", value),
|
Err(value) => warn!("Error parsing packet: {:?}", value),
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ impl Ratecontroller {
|
|||||||
let sleep_time_ns = ((self.config.min_change_interval % 1.0) * 1e9) as u32;
|
let sleep_time_ns = ((self.config.min_change_interval % 1.0) * 1e9) as u32;
|
||||||
let sleep_time = Duration::new(sleep_time_s, sleep_time_ns);
|
let sleep_time = Duration::new(sleep_time_s, sleep_time_ns);
|
||||||
|
|
||||||
let (start_s, start_ns) = Utils::get_current_time();
|
let (start_s, _) = Utils::get_current_time();
|
||||||
let (mut lastchg_s, mut lastchg_ns) = Utils::get_current_time();
|
let (mut lastchg_s, mut lastchg_ns) = Utils::get_current_time();
|
||||||
let mut lastchg_t = lastchg_s - start_s + lastchg_ns / 1e9;
|
let mut lastchg_t = lastchg_s - start_s + lastchg_ns / 1e9;
|
||||||
let mut lastdump_t = lastchg_t - 310.0;
|
let mut lastdump_t = lastchg_t - 310.0;
|
||||||
@@ -179,8 +179,8 @@ impl Ratecontroller {
|
|||||||
mut next_ul_rate,
|
mut next_ul_rate,
|
||||||
mut rx_load,
|
mut rx_load,
|
||||||
mut tx_load,
|
mut tx_load,
|
||||||
mut up_utilisation,
|
up_utilisation,
|
||||||
mut down_utilisation,
|
down_utilisation,
|
||||||
): (f64, f64, f64, f64, f64, f64);
|
): (f64, f64, f64, f64, f64, f64);
|
||||||
|
|
||||||
rx_load = -1.0;
|
rx_load = -1.0;
|
||||||
|
|||||||
Reference in new issue
Block a user