summaryrefslogtreecommitdiffstats
path: root/src/bp_sim.cpp
diff options
context:
space:
mode:
authorimarom <imarom@cisco.com>2016-10-18 19:31:12 +0200
committerimarom <imarom@cisco.com>2016-10-18 19:32:52 +0200
commit4d095eb5834c6de0af01964b91f3f691e951bea5 (patch)
treeb0a71adaa6c46ce4a7a418bdcdd0319f24b93aed /src/bp_sim.cpp
parent1738989b489bf287abec6176cba1e9de837885f8 (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>
Diffstat (limited to 'src/bp_sim.cpp')
-rwxr-xr-xsrc/bp_sim.cpp27
1 files changed, 22 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;