File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed
Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change 11use std:: collections:: HashMap ;
22
33use netstat2:: * ;
4- use sysinfo:: { Pid , System } ;
4+ use sysinfo:: { Pid , ProcessesToUpdate , System } ;
55
66use crate :: {
77 network:: { LocalSocket , Protocol } ,
@@ -13,7 +13,7 @@ pub(crate) fn get_open_sockets() -> OpenSockets {
1313 let mut open_sockets = HashMap :: new ( ) ;
1414
1515 let mut sysinfo = System :: new_all ( ) ;
16- sysinfo. refresh_processes ( ) ;
16+ sysinfo. refresh_processes ( ProcessesToUpdate :: All ) ;
1717
1818 let af_flags = AddressFamilyFlags :: IPV4 | AddressFamilyFlags :: IPV6 ;
1919 let proto_flags = ProtocolFlags :: TCP | ProtocolFlags :: UDP ;
@@ -25,7 +25,7 @@ pub(crate) fn get_open_sockets() -> OpenSockets {
2525 . associated_pids
2626 . into_iter ( )
2727 . find_map ( |pid| sysinfo. process ( Pid :: from_u32 ( pid) ) )
28- . map ( |p| ProcessInfo :: new ( p. name ( ) , p. pid ( ) . as_u32 ( ) ) )
28+ . map ( |p| ProcessInfo :: new ( & p. name ( ) . to_string_lossy ( ) , p. pid ( ) . as_u32 ( ) ) )
2929 . unwrap_or_default ( ) ;
3030
3131 match si. protocol_socket_info {
You can’t perform that action at this time.
0 commit comments