diff --git a/src-tauri/src/clientinfo.rs b/src-tauri/src/clientinfo.rs index 4cff73d..bb3dbb8 100644 --- a/src-tauri/src/clientinfo.rs +++ b/src-tauri/src/clientinfo.rs @@ -34,59 +34,3 @@ pub fn get_process_parent_info(pid: u32) -> Result { Ok(Client { pid: parent_pid_sys.as_u32(), exe }) } - - -// async fn get_associated_pids(local_port: u16) -> Result, netstat2::error::Error> { -// let state = APP.get().unwrap().state::(); -// let AppConfig { -// listen_addr: app_listen_addr, -// listen_port: app_listen_port, -// .. -// } = *state.config.read().await; - -// let sockets_iter = netstat2::iterate_sockets_info( -// AddressFamilyFlags::IPV4, -// ProtocolFlags::TCP -// )?; -// for item in sockets_iter { -// let sock_info = item?; -// let proto_info = match sock_info.protocol_socket_info { -// ProtocolSocketInfo::Tcp(tcp_info) => tcp_info, -// ProtocolSocketInfo::Udp(_) => {continue;} -// }; - -// if proto_info.local_port == local_port -// && proto_info.remote_port == app_listen_port -// && proto_info.local_addr == app_listen_addr -// && proto_info.remote_addr == app_listen_addr -// { -// return Ok(sock_info.associated_pids) -// } -// } -// Ok(vec![]) -// } - - -// Theoretically, on some systems, multiple processes can share a socket -// pub async fn get_clients(local_port: u16) -> Result>, ClientInfoError> { -// let mut clients = Vec::new(); -// let mut sys = System::new(); -// for p in get_associated_pids(local_port).await? { -// let pid = Pid::from_u32(p); -// sys.refresh_process(pid); -// let proc = sys.process(pid) -// .ok_or(ClientInfoError::ProcessNotFound)?; - -// let client = Client { -// pid: p, -// exe: proc.exe().to_path_buf(), -// }; -// clients.push(Some(client)); -// } - -// if clients.is_empty() { -// clients.push(None); -// } - -// Ok(clients) -// }