Some cleanups

This commit is contained in:
Nils Andreas Svee committed 2022-09-28 01:41:51 +02:00
1 parent f20ff59e78
commit cf14fcd5f8
5 files changed
+6 -15

No files matched your search

-5
View File
@@ -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 log::{Level, LevelFilter, Metadata, Record, SetLoggerError};
+2 -4
View File
@@ -14,9 +14,8 @@ mod reflector_selector;
mod utils;
use crate::baseliner::{Baseliner, ReflectorStats};
use ::log::{debug, error, info, Level, LevelFilter};
use ::log::{debug, error, info};
use std::collections::HashMap;
use std::error::Error;
use std::net::IpAddr;
use std::process::ExitCode;
use std::str::FromStr;
@@ -27,8 +26,7 @@ use std::time::Duration;
use std::{panic, process, thread};
use crate::config::{Config, MeasurementType};
use crate::log::SimpleLogger;
use crate::netlink::{Netlink, Qdisc};
use crate::netlink::Netlink;
use crate::pinger::{PingListener, PingSender, SocketType};
use crate::pinger_icmp::{PingerICMPEchoListener, PingerICMPEchoSender};
use crate::pinger_icmp_ts::{PingerICMPTimestampListener, PingerICMPTimestampSender};
+1 -2
View File
@@ -83,7 +83,7 @@ pub trait PingListener {
continue;
}
let reply = match self.parse_packet(id, addr, buf, size) {
let reply = match self.parse_packet(id, addr, buf) {
Ok(val) => val,
Err(e) => {
error!(
@@ -104,7 +104,6 @@ pub trait PingListener {
id: u16,
reflector: IpAddr,
buf: &[u8],
len: usize,
) -> Result<PingReply, Box<dyn Error>>;
}
-1
View File
@@ -21,7 +21,6 @@ impl PingListener for PingerICMPTimestampListener {
id: u16,
reflector: IpAddr,
buf: &[u8],
len: usize,
) -> Result<PingReply, Box<dyn Error>> {
match SlicedPacket::from_ip(buf) {
Err(value) => warn!("Error parsing packet: {:?}", value),
+3 -3
View File
@@ -75,7 +75,7 @@ impl Ratecontroller {
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 (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_t = lastchg_s - start_s + lastchg_ns / 1e9;
let mut lastdump_t = lastchg_t - 310.0;
@@ -179,8 +179,8 @@ impl Ratecontroller {
mut next_ul_rate,
mut rx_load,
mut tx_load,
mut up_utilisation,
mut down_utilisation,
up_utilisation,
down_utilisation,
): (f64, f64, f64, f64, f64, f64);
rx_load = -1.0;