mirror of
https://github.com/optim-enterprises-bv/nDPId.git
synced 2025-11-01 10:47:47 +00:00
nDPIsrvd.(h|py): Added socket read/recv timeout.
* nDPIsrvd.h: support for O_NONBLOCK nDPIsrvd_socket Signed-off-by: lns <matzeton@googlemail.com>
This commit is contained in:
@@ -426,8 +426,16 @@ if __name__ == '__main__':
|
||||
|
||||
nsock = nDPIsrvdSocket()
|
||||
nsock.connect(address)
|
||||
nsock.timeout(1.0)
|
||||
stats = Stats(nsock)
|
||||
try:
|
||||
nsock.loop(onJsonLineRecvd, onFlowCleanup, stats)
|
||||
except KeyboardInterrupt:
|
||||
print('\n\nKeyboard Interrupt: cleaned up {} flows.'.format(len(nsock.shutdown())))
|
||||
|
||||
while True:
|
||||
try:
|
||||
nsock.loop(onJsonLineRecvd, onFlowCleanup, stats)
|
||||
except KeyboardInterrupt:
|
||||
print('\n\nKeyboard Interrupt: cleaned up {} flows.'.format(len(nsock.shutdown())))
|
||||
break
|
||||
except TimeoutError:
|
||||
stats.updateSpinner()
|
||||
stats.resetStatus()
|
||||
stats.printStatus()
|
||||
|
||||
Reference in New Issue
Block a user