summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorToni Uhlig <matzeton@googlemail.com>2022-11-12 23:06:37 +0100
committerToni Uhlig <matzeton@googlemail.com>2022-11-16 23:06:37 +0100
commit57c5d8532bfe581df2730137ea8d2282041067a2 (patch)
tree4ad2d8327028e44d28097cc630748c0716e3934f /examples
parent869d4de27185e84988617188882e555efdb81531 (diff)
Test for diff's in flow-analyse CSV generator daemon.
Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
Diffstat (limited to 'examples')
-rw-r--r--examples/c-analysed/c-analysed.c5
-rwxr-xr-xexamples/py-flow-info/flow-info.py3
2 files changed, 7 insertions, 1 deletions
diff --git a/examples/c-analysed/c-analysed.c b/examples/c-analysed/c-analysed.c
index 5d86acfb6..e7aa865db 100644
--- a/examples/c-analysed/c-analysed.c
+++ b/examples/c-analysed/c-analysed.c
@@ -150,7 +150,7 @@ static void csv_buf_add(csv_buf_t buf, size_t * const csv_buf_used, char const *
if (siz_len > 0 && str != NULL)
{
- len = MIN(BUFFER_REMAINING(*csv_buf_used), siz_len - 1);
+ len = MIN(BUFFER_REMAINING(*csv_buf_used), siz_len);
if (len == 0)
{
return;
@@ -621,5 +621,8 @@ int main(int argc, char ** argv)
daemonize_shutdown(pidfile);
closelog();
+ fflush(csv_fp);
+ fclose(csv_fp);
+
return retval;
}
diff --git a/examples/py-flow-info/flow-info.py b/examples/py-flow-info/flow-info.py
index d9354e7ad..b7de8c951 100755
--- a/examples/py-flow-info/flow-info.py
+++ b/examples/py-flow-info/flow-info.py
@@ -512,6 +512,9 @@ if __name__ == '__main__':
while True:
try:
nsock.loop(onJsonLineRecvd, onFlowCleanup, stats)
+ except nDPIsrvd.SocketConnectionBroken as err:
+ sys.stderr.write('\n{}\n'.format(err))
+ break
except KeyboardInterrupt:
print('\n\nKeyboard Interrupt: cleaned up {} flows.'.format(len(nsock.shutdown())))
break