summaryrefslogtreecommitdiff
path: root/examples/py-schema-validation
diff options
context:
space:
mode:
authorToni Uhlig <matzeton@googlemail.com>2021-02-23 14:46:47 +0100
committerToni Uhlig <matzeton@googlemail.com>2021-02-23 14:46:47 +0100
commit0b5b177c14582dcaff854dda98db93c8d001682d (patch)
treeab1a2dffe19f0f03e0ff70e9da9360edb7a0f016 /examples/py-schema-validation
parent0a6d44dc60fb44c8aa59397d29b1f6cbb134d47d (diff)
Extended nDPIsrvd.h with address parsing.
* nDPId supports looading of custom nDPI protocol/category files * extended JSON schemas according to nDPI / nDPId JSON serializing * removed memory holes in nDPId * extended examples/c-captured Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
Diffstat (limited to 'examples/py-schema-validation')
-rwxr-xr-xexamples/py-schema-validation/py-schema-validation.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/examples/py-schema-validation/py-schema-validation.py b/examples/py-schema-validation/py-schema-validation.py
index 407c7b814..ca269e0c3 100755
--- a/examples/py-schema-validation/py-schema-validation.py
+++ b/examples/py-schema-validation/py-schema-validation.py
@@ -10,7 +10,7 @@ from nDPIsrvd import nDPIsrvdSocket, TermColor
class Stats:
lines_processed = 0
print_dot_every = 10
- next_lines_print = print_dot_every
+ print_nmb_every = print_dot_every * 5
def onJsonLineRecvd(json_dict, current_flow, global_user_data):
validation_done = nDPIsrvd.validateAgainstSchema(json_dict)
@@ -19,8 +19,8 @@ def onJsonLineRecvd(json_dict, current_flow, global_user_data):
if global_user_data.lines_processed % global_user_data.print_dot_every == 0:
sys.stdout.write('.')
sys.stdout.flush()
- if global_user_data.lines_processed == global_user_data.next_lines_print:
- global_user_data.next_lines_print *= 2
+ print_nmb_every = global_user_data.print_nmb_every + (len(str(global_user_data.lines_processed)) * global_user_data.print_dot_every)
+ if global_user_data.lines_processed % print_nmb_every == 0:
sys.stdout.write(str(global_user_data.lines_processed))
sys.stdout.flush()