severe crash when time strech push a node in the top of the priority queue
authorimarom <[email protected]>
Tue, 18 Oct 2016 17:31:12 +0000 (19:31 +0200)
committerimarom <[email protected]>
Tue, 18 Oct 2016 17:32:52 +0000 (19:32 +0200)
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 <[email protected]>
src/bp_sim.cpp
src/bp_sim.h

index 7b345a8..c4cb092 100755 (executable)
@@ -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;
index 67aa6d7..0af27b9 100755 (executable)
@@ -2024,6 +2024,7 @@ public:
      typedef enum { scINIT = 0x17,
                     scWORK ,
                     scWAIT , 
+                    scSTRECH,
                     scTERMINATE 
                    } sch_state_t;