MCPcopy Create free account
hub / github.com/ElementsProject/elements / get_socket_inodes

Function get_socket_inodes

test/functional/test_framework/netutil.py:28–38  ·  view source on GitHub ↗

Get list of socket inodes for process pid.

(pid)

Source from the content-addressed store, hash-verified

26# STATE_CLOSING = '0B'
27
28def get_socket_inodes(pid):
29 '''
30 Get list of socket inodes for process pid.
31 '''
32 base = '/proc/%i/fd' % pid
33 inodes = []
34 for item in os.listdir(base):
35 target = os.readlink(os.path.join(base, item))
36 if target.startswith('socket:'):
37 inodes.append(int(target[8:-1]))
38 return inodes
39
40def _remove_empty(array):
41 return [x for x in array if x !='']

Callers 1

get_bind_addrsFunction · 0.70

Calls 1

joinMethod · 0.45

Tested by

no test coverage detected