Skip to content

Commit

Permalink
fix loops
Browse files Browse the repository at this point in the history
  • Loading branch information
adgaultier committed Oct 19, 2024
1 parent 3d28905 commit 2b264bc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
4 changes: 1 addition & 3 deletions maps.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from functools import partial

def hex2int(hex):
return int(hex.replace("0x", ""), 16)
return int(hex, 16)


def parse_ipv4(rule):
Expand Down Expand Up @@ -33,8 +33,6 @@ def parse_ipv6(rule):
return {k: v}




filter_idx_map = dict(
transport={0: "tcp", 1: "udp"},
network={0: "ipv4", 1: "ipv6", 2: "icmp"},
Expand Down
8 changes: 3 additions & 5 deletions oryx-tui/src/pid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -185,13 +185,11 @@ impl ConnectionsInfo {
let udp_map: Arc<Mutex<IpMap>> = Arc::new(Mutex::new(IpMap::new()));
thread::spawn({
let tcp_map = tcp_map.clone();

let mut fd_tcp = File::open("/proc/net/tcp").unwrap();
let mut fd_tcp6 = File::open("/proc/net/tcp6").unwrap();
move || {
thread::sleep(Duration::from_millis(250));
let mut fd_tcp = File::open("/proc/net/tcp").unwrap();
let mut fd_tcp6 = File::open("/proc/net/tcp6").unwrap();

loop {
thread::sleep(Duration::from_millis(250));
fd_tcp.seek(std::io::SeekFrom::Start(0)).unwrap();
fd_tcp6.seek(std::io::SeekFrom::Start(0)).unwrap();

Expand Down

0 comments on commit 2b264bc

Please sign in to comment.