feat: update procfs

This commit is contained in:
2022-07-29 23:54:43 +08:00
parent fe2a02c043
commit f617bfbab2

View File

@@ -42,8 +42,9 @@ pub fn get_process(port: u16) -> Option<Process> {
} }
Ok(tcp) => tcp, Ok(tcp) => tcp,
}; };
let local_ip = std::net::Ipv4Addr::LOCALHOST;
for entry in tcp.into_iter() { for entry in tcp.into_iter() {
if port == entry.local_address.port() { if local_ip == entry.local_address.ip() && port == entry.local_address.port() {
if let Some((stat, exec)) = map.get(&entry.inode) { if let Some((stat, exec)) = map.get(&entry.inode) {
return Some(Process { return Some(Process {
pid: stat.pid, pid: stat.pid,