From bd1ed390963351f1c7db42cc41ebd86ac582a590 Mon Sep 17 00:00:00 2001 From: Badr Date: Thu, 17 Oct 2024 14:50:57 +0200 Subject: [PATCH] fix hangin issue --- oryx-tui/src/handler.rs | 6 +++++- oryx-tui/src/section/stats.rs | 5 +++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/oryx-tui/src/handler.rs b/oryx-tui/src/handler.rs index 42d704b..6a1a7be 100644 --- a/oryx-tui/src/handler.rs +++ b/oryx-tui/src/handler.rs @@ -1,4 +1,7 @@ -use std::{thread, time::Duration}; +use std::{ + thread::{self, sleep}, + time::Duration, +}; use crate::{ app::{ActivePopup, App, AppResult}, @@ -25,6 +28,7 @@ pub fn handle_key_events( app.filter .start(event_sender.clone(), app.data_channel_sender.clone())?; + sleep(Duration::from_millis(100)); app.start_sniffing = true; } } diff --git a/oryx-tui/src/section/stats.rs b/oryx-tui/src/section/stats.rs index 5d8dd31..0f813d2 100644 --- a/oryx-tui/src/section/stats.rs +++ b/oryx-tui/src/section/stats.rs @@ -49,8 +49,9 @@ impl Stats { move || { let mut last_index = 0; loop { - thread::sleep(Duration::from_millis(160)); - let packets = packets.lock().unwrap(); + thread::sleep(Duration::from_millis(500)); + + let packets = { packets.lock().unwrap().clone() }; if packets.is_empty() { continue;