summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorToni Uhlig <matzeton@googlemail.com>2021-04-11 12:34:38 +0200
committerToni Uhlig <matzeton@googlemail.com>2021-04-11 12:34:38 +0200
commit514c4279170bde53a2969e1074a48ddd658d48ff (patch)
tree94d312fdb7a380b981435135e9a834c3881e12f9 /examples
parent131cf5385ba31108c131d36f366183a8ac813727 (diff)
Fixed nDPIsrvd.h flow end bug (flow end callback could never be called and caused some memory troubles).
Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
Diffstat (limited to 'examples')
-rw-r--r--examples/c-captured/c-captured.c23
1 files changed, 4 insertions, 19 deletions
diff --git a/examples/c-captured/c-captured.c b/examples/c-captured/c-captured.c
index a427a38fc..836cbd4c0 100644
--- a/examples/c-captured/c-captured.c
+++ b/examples/c-captured/c-captured.c
@@ -297,24 +297,6 @@ static enum nDPIsrvd_callback_return captured_json_callback(struct nDPIsrvd_sock
struct flow_user_data * const flow_user = (struct flow_user_data *)flow->flow_user_data;
-#ifdef VERBOSE
- struct nDPIsrvd_json_token * current_token = NULL;
- struct nDPIsrvd_json_token * jtmp = NULL;
-
- HASH_ITER(hh, sock->json.token_table, current_token, jtmp)
- {
- if (current_token->value != NULL)
- {
- printf("[%.*s : %.*s] ",
- current_token->key_length,
- current_token->key,
- current_token->value_length,
- current_token->value);
- }
- }
- printf("EoF\n");
-#endif
-
if (flow_user == NULL || flow_user->detection_finished != 0)
{
return CALLBACK_OK;
@@ -450,6 +432,9 @@ static void captured_flow_end_callback(struct nDPIsrvd_socket * const sock, stru
{
(void)sock;
+#ifdef VERBOSE
+ printf("flow %llu end, remaining flows: %u\n", flow->id_as_ull, sock->flow_table->hh.tbl->num_items);
+#endif
struct flow_user_data * const ud = (struct flow_user_data *)flow->flow_user_data;
if (ud != NULL && ud->packets != NULL)
{
@@ -633,7 +618,7 @@ int main(int argc, char ** argv)
{
return 1;
}
- openlog("c-captured", LOG_CONS, LOG_DAEMON);
+ openlog("nDPIsrvd-captured", LOG_CONS, LOG_DAEMON);
errno = 0;
if (user != NULL && change_user_group(user, group, pidfile, datadir /* :D */, NULL) != 0)