Skip to content

Commit

Permalink
refactor: commented unused packet_count
Browse files Browse the repository at this point in the history
  • Loading branch information
SkuldNorniern committed Mar 13, 2024
1 parent 7e592ee commit 2b60d63
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/net/live_fluereflow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ pub async fn online_packet_capture(arg: Args) {
let recent_flows: Arc<Mutex<Vec<FlowSummary>>> = Arc::new(Mutex::new(Vec::new()));
let active_flow = Arc::new(Mutex::new(HashMap::new()));

let mut packet_count = 0;
// let mut packet_count = 0;

enable_raw_mode().expect("Unable to enable raw mode");
let mut stdout = io::stdout();
Expand Down Expand Up @@ -268,7 +268,7 @@ pub async fn online_packet_capture(arg: Args) {
}
}

packet_count += 1;
// packet_count += 1;
// slow down the loop for windows to avoid random shutdown
// if packet_count % sleep_windows == 0 && cfg!(target_os = "windows") {
// println!("Slow down the loop for windows");
Expand All @@ -280,7 +280,7 @@ pub async fn online_packet_capture(arg: Args) {
let mut last_export_unix_time_guard = last_export_unix_time.lock().await;
if last_export_guard.elapsed() >= Duration::from_millis(interval) && interval != 0 {
let mut expired_flows = vec![];
packet_count = 0;
// packet_count = 0;
for (key, flow) in active_flow_guard.iter() {
if flow_timeout > 0 && flow.last < (time - (flow_timeout * 1000)) {
trace!("flow expired");
Expand Down
6 changes: 3 additions & 3 deletions src/net/online_fluereflow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ pub async fn packet_capture(arg: Args) {

let mut records: Vec<FluereRecord> = Vec::new();
let mut active_flow: HashMap<Key, FluereRecord> = HashMap::new();
let mut packet_count = 0;
// let mut packet_count = 0;

loop {
match cap.next_packet() {
Expand Down Expand Up @@ -167,7 +167,7 @@ pub async fn packet_capture(arg: Args) {
}
}

packet_count += 1;
// packet_count += 1;
// slow down the loop for windows to avoid random shutdown
// if packet_count % sleep_windows == 0 && cfg!(target_os = "windows") {
// if verbose >= 3 {
Expand All @@ -179,7 +179,7 @@ pub async fn packet_capture(arg: Args) {
// Export flows if the interval has been reached
if last_export.elapsed() >= Duration::from_millis(interval) && interval != 0 {
let mut expired_flows = vec![];
packet_count = 0;
// packet_count = 0;
for (key, flow) in active_flow.iter() {
if flow_timeout > 0 && flow.last < (time - (flow_timeout * 1000)) {
trace!("flow expired");
Expand Down

0 comments on commit 2b60d63

Please sign in to comment.