Replace the pyagentx threaded version with a much simpler, non-threaded version.

This commit is contained in:
Pim van Pelt
2021-09-11 12:19:38 +00:00
parent 842bce9d6e
commit 8c9c1e2b4a
13 changed files with 507 additions and 1089 deletions

View File

@ -110,9 +110,12 @@ class VPPStats():
def connect(self):
'''Connect to stats segment'''
if self.connected:
return
sock = socket.socket(socket.AF_UNIX, socket.SOCK_SEQPACKET)
sock.connect(self.socketname)
return True
try:
sock = socket.socket(socket.AF_UNIX, socket.SOCK_SEQPACKET)
sock.connect(self.socketname)
except:
return False
# Get file descriptor for memory map
fds = array.array("i") # Array of ints
@ -133,9 +136,11 @@ class VPPStats():
if self.version != 2:
raise Exception('Incompatbile stat segment version {}'.format(
self.version))
return False
self.refresh()
self.connected = True
return True
def disconnect(self):
'''Disconnect from stats segment'''