From 4d095eb5834c6de0af01964b91f3f691e951bea5 Mon Sep 17 00:00:00 2001 From: imarom Date: Tue, 18 Oct 2016 19:31:12 +0200 Subject: 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 --- src/bp_sim.cpp | 27 ++++++++++++++++++++++----- 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; -- cgit 1.2.3-korg