diff options
author | Toni Uhlig <matzeton@googlemail.com> | 2021-01-08 10:54:44 +0100 |
---|---|---|
committer | Toni Uhlig <matzeton@googlemail.com> | 2021-01-08 10:54:44 +0100 |
commit | b82a535a45c5eaadbbc558c6063e35dd1c99ce1f (patch) | |
tree | b6a709fe6cfed283e9cf66b77951ae8ec4876edb /dependencies/nDPIsrvd.py | |
parent | f637802c0aabb976d2a84bfdca9ff468536e4e5a (diff) |
Increased network buffer size for python scripts (and raise exception if capacity reached).
Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
Diffstat (limited to 'dependencies/nDPIsrvd.py')
-rw-r--r-- | dependencies/nDPIsrvd.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/dependencies/nDPIsrvd.py b/dependencies/nDPIsrvd.py index 8d0a09d3e..bdc7497ab 100644 --- a/dependencies/nDPIsrvd.py +++ b/dependencies/nDPIsrvd.py @@ -14,7 +14,7 @@ DEFAULT_PORT = 7000 DEFAULT_UNIX = '/tmp/ndpid-distributor.sock' NETWORK_BUFFER_MIN_SIZE = 5 -NETWORK_BUFFER_MAX_SIZE = 9216 # Please keep this value in sync with the one in config.h +NETWORK_BUFFER_MAX_SIZE = 9728 # Please keep this value in sync with the one in config.h PKT_TYPE_ETH_IP4 = 0x0800 PKT_TYPE_ETH_IP6 = 0x86DD @@ -59,6 +59,9 @@ class nDPIsrvdSocket: self.digitlen = 0 def receive(self): + if len(self.buffer) == NETWORK_BUFFER_MAX_SIZE: + raise RuntimeError('buffer capacity reached ({} bytes), check if it is in sync with nDPId\'s NETWORK_BUFFER_MAX_SIZE'.format(NETWORK_BUFFER_MAX_SIZE)) + recvd = self.sock.recv(NETWORK_BUFFER_MAX_SIZE - len(self.buffer)) if len(recvd) == 0: |