A final(?) effort to reduce memory usage per flow (#1389)
Remove some unused fields and re-organize other ones. In particular: * Update the parameters of `ndpi_ssl_version2str()` function * Zattoo, Thunder: these timestamps aren't really used. * Ftp/mail: these protocols are dissected only over TCP. * Attention must be paid to TLS.Bittorrent flows to avoid invalid read/write to `flow->protos.bittorrent.hash` field. This is the last(?) commit of a long series (see22241a1d,227e586e,730c2360,a8ffcd8b) aiming to reduce library memory consumption. Before, at nDPI 4.0 (more precisly, ata6b10cf7, because memory stats were wrong until that commit): ``` nDPI Memory statistics: nDPI Memory (once): 221.15 KB Flow Memory (per flow): 2.94 KB ``` Now: ``` nDPI Memory statistics: nDPI Memory (once): 231.71 KB Flow Memory (per flow): 1008 B <--------- ``` i.e. memory usage per flow has been reduced by 66%, dropping below the psychological threshold of 1 KB. To further reduce this value, we probably need to look into #1279: let's fight this battle another day.
This commit is contained in:
@@ -47,30 +47,16 @@ u_int8_t ndpi_int_zattoo_user_agent_set(struct ndpi_detection_module_struct *ndp
|
||||
}
|
||||
|
||||
#define ZATTOO_DETECTED \
|
||||
if (src != NULL) \
|
||||
src->zattoo_ts = packet->current_time_ms; \
|
||||
if (dst != NULL) \
|
||||
dst->zattoo_ts = packet->current_time_ms; \
|
||||
\
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_ZATTOO, NDPI_PROTOCOL_UNKNOWN)
|
||||
|
||||
void ndpi_search_zattoo(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
{
|
||||
struct ndpi_packet_struct *packet = &ndpi_struct->packet;
|
||||
struct ndpi_id_struct *src = flow->src;
|
||||
struct ndpi_id_struct *dst = flow->dst;
|
||||
|
||||
u_int16_t i;
|
||||
|
||||
NDPI_LOG_DBG(ndpi_struct, "search ZATTOO\n");
|
||||
|
||||
if(flow->detected_protocol_stack[0] == NDPI_PROTOCOL_ZATTOO) {
|
||||
if(src != NULL && ((u_int32_t) (packet->current_time_ms - src->zattoo_ts) < ndpi_struct->zattoo_connection_timeout))
|
||||
src->zattoo_ts = packet->current_time_ms;
|
||||
if (dst != NULL && ((u_int32_t) (packet->current_time_ms - dst->zattoo_ts) < ndpi_struct->zattoo_connection_timeout))
|
||||
dst->zattoo_ts = packet->current_time_ms;
|
||||
return;
|
||||
}
|
||||
/* search over TCP */
|
||||
if(packet->tcp != NULL) {
|
||||
if(packet->payload_packet_len > 50 && memcmp(packet->payload, "GET /frontdoor/fd?brand=Zattoo&v=", 33) == 0) {
|
||||
|
||||
Reference in New Issue
Block a user