File tree 1 file changed +3
-3
lines changed
1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change 1
1
use std:: collections:: HashMap ;
2
2
3
3
use netstat2:: * ;
4
- use sysinfo:: { Pid , System } ;
4
+ use sysinfo:: { Pid , ProcessesToUpdate , System } ;
5
5
6
6
use crate :: {
7
7
network:: { LocalSocket , Protocol } ,
@@ -13,7 +13,7 @@ pub(crate) fn get_open_sockets() -> OpenSockets {
13
13
let mut open_sockets = HashMap :: new ( ) ;
14
14
15
15
let mut sysinfo = System :: new_all ( ) ;
16
- sysinfo. refresh_processes ( ) ;
16
+ sysinfo. refresh_processes ( ProcessesToUpdate :: All ) ;
17
17
18
18
let af_flags = AddressFamilyFlags :: IPV4 | AddressFamilyFlags :: IPV6 ;
19
19
let proto_flags = ProtocolFlags :: TCP | ProtocolFlags :: UDP ;
@@ -25,7 +25,7 @@ pub(crate) fn get_open_sockets() -> OpenSockets {
25
25
. associated_pids
26
26
. into_iter ( )
27
27
. 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 ( ) ) )
29
29
. unwrap_or_default ( ) ;
30
30
31
31
match si. protocol_socket_info {
You can’t perform that action at this time.
0 commit comments