diff options
author | imarom <imarom@cisco.com> | 2016-10-18 19:31:12 +0200 |
---|---|---|
committer | imarom <imarom@cisco.com> | 2016-10-18 19:32:52 +0200 |
commit | 4d095eb5834c6de0af01964b91f3f691e951bea5 (patch) | |
tree | b0a71adaa6c46ce4a7a418bdcdd0319f24b93aed | |
parent | 1738989b489bf287abec6176cba1e9de837885f8 (diff) |
severe crash when time strech push a node in the top of the priority queue
between TOP and POP
it was obsereved during execution of the command
push -r -f /auto/avc-devtest/CS-NBAR/SR_639103737/PcapPerIp.pcap -a -n 10000000 -s 1000
when two adject ports exists
Signed-off-by: imarom <imarom@cisco.com>
-rwxr-xr-x | src/bp_sim.cpp | 27 | ||||
-rwxr-xr-x | src/bp_sim.h | 1 |
2 files changed, 23 insertions, 5 deletions
diff --git a/src/bp_sim.cpp b/src/bp_sim.cpp index 7b345a81..c4cb0927 100755 --- a/src/bp_sim.cpp +++ b/src/bp_sim.cpp @@ -3775,17 +3775,34 @@ inline int CNodeGenerator::flush_file_realtime(dsec_t max_time, cur_time = now_sec(); { dsec_t dt = cur_time - n_time ; - if (dt>0) { - state=scWORK; - if (dt > BURST_OFFSET_DTIME) { - handle_time_strech(cur_time, dt, offset, thread); - } + + if (dt > BURST_OFFSET_DTIME) { + state = scSTRECH; + } else if (dt > 0) { + state = scWORK; } else { state = scWAIT; } + } break; + /* a case called when a time strech happens */ + case scSTRECH: + { + dsec_t dt = cur_time - n_time; + handle_time_strech(cur_time, dt, offset, thread); + + /* re-read the top of the queue - it might have changed with messaging */ + node = m_p_queue.top(); + n_time = node->m_time + offset; + + /* go back to INIT */ + state = scINIT; + + } + break; + case scWORK: { int node_count = 0; diff --git a/src/bp_sim.h b/src/bp_sim.h index 67aa6d79..0af27b95 100755 --- a/src/bp_sim.h +++ b/src/bp_sim.h @@ -2024,6 +2024,7 @@ public: typedef enum { scINIT = 0x17, scWORK , scWAIT , + scSTRECH, scTERMINATE } sch_state_t; |