mirror of
https://github.com/optim-enterprises-bv/nDPId.git
synced 2025-10-30 17:57:48 +00:00
Increased network buffer size for python scripts (and raise exception if capacity reached).
Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
This commit is contained in:
4
config.h
4
config.h
@@ -7,6 +7,10 @@
|
|||||||
#define DISTRIBUTOR_HOST "127.0.0.1"
|
#define DISTRIBUTOR_HOST "127.0.0.1"
|
||||||
#define DISTRIBUTOR_PORT 7000
|
#define DISTRIBUTOR_PORT 7000
|
||||||
|
|
||||||
|
/*
|
||||||
|
* NOTE: Buffer size needs to keep in sync with other implementations
|
||||||
|
* e.g. dependencies/nDPIsrvd.py
|
||||||
|
*/
|
||||||
#define NETWORK_BUFFER_MAX_SIZE 9728 /* 8192 + 1024 + 512 */
|
#define NETWORK_BUFFER_MAX_SIZE 9728 /* 8192 + 1024 + 512 */
|
||||||
|
|
||||||
/* nDPId default config options */
|
/* nDPId default config options */
|
||||||
|
|||||||
5
dependencies/nDPIsrvd.py
vendored
5
dependencies/nDPIsrvd.py
vendored
@@ -14,7 +14,7 @@ DEFAULT_PORT = 7000
|
|||||||
DEFAULT_UNIX = '/tmp/ndpid-distributor.sock'
|
DEFAULT_UNIX = '/tmp/ndpid-distributor.sock'
|
||||||
|
|
||||||
NETWORK_BUFFER_MIN_SIZE = 5
|
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_IP4 = 0x0800
|
||||||
PKT_TYPE_ETH_IP6 = 0x86DD
|
PKT_TYPE_ETH_IP6 = 0x86DD
|
||||||
@@ -59,6 +59,9 @@ class nDPIsrvdSocket:
|
|||||||
self.digitlen = 0
|
self.digitlen = 0
|
||||||
|
|
||||||
def receive(self):
|
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))
|
recvd = self.sock.recv(NETWORK_BUFFER_MAX_SIZE - len(self.buffer))
|
||||||
|
|
||||||
if len(recvd) == 0:
|
if len(recvd) == 0:
|
||||||
|
|||||||
Reference in New Issue
Block a user