summaryrefslogtreecommitdiffstats
path: root/src/bp_sim.cpp
diff options
context:
space:
mode:
authorimarom <imarom@cisco.com>2016-08-01 16:20:03 +0300
committerimarom <imarom@cisco.com>2016-08-01 16:20:03 +0300
commit5add0c5625a0e46e1451806ca54070b5bcec7ccb (patch)
treea34fad49d774d0aec1bdbbe6088f34f84f22c06b /src/bp_sim.cpp
parentc3a0d7587699ff2a116fb6b5e2800c63e70306a0 (diff)
sync: unsafe to touch the node pointer, use a timestamp instead
Diffstat (limited to 'src/bp_sim.cpp')
-rwxr-xr-xsrc/bp_sim.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/bp_sim.cpp b/src/bp_sim.cpp
index c4f22195..d2b75122 100755
--- a/src/bp_sim.cpp
+++ b/src/bp_sim.cpp
@@ -3225,7 +3225,7 @@ bool CNodeGenerator::Create(CFlowGenListPerThread * parent){
m_socket_id =0;
m_is_realtime =CGlobalInfo::is_realtime();
m_realtime_his.Create();
- m_flow_sync_node = NULL;
+ m_last_sync_time_sec = 0;
return(true);
}
@@ -3840,7 +3840,7 @@ FORCE_NO_INLINE void CNodeGenerator::handle_time_strech(dsec_t cur_time,
CFlowGenListPerThread *thread) {
/* check if flow sync message was delayed too much */
- if ( (cur_time - m_flow_sync_node->m_time) > SYNC_TIME_OUT ) {
+ if ( (cur_time - m_last_sync_time_sec) > SYNC_TIME_OUT ) {
handle_maintenance(thread);
}
@@ -3975,6 +3975,9 @@ CNodeGenerator::handle_maintenance(CFlowGenListPerThread *thread) {
thread->tickle(); /* tickle the watchdog */
thread->check_msgs(); /* check messages */
m_v_if->flush_tx_queue(); /* flush pkt each timeout */
+
+ /* save last sync time as realtime */
+ m_last_sync_time_sec = now_sec();
}
@@ -4445,7 +4448,6 @@ void CFlowGenListPerThread::start_generate_stateful(std::string erf_file_name,
node->m_type = CGenNode::FLOW_SYNC;
node->m_time = m_cur_time_sec + SYNC_TIME_OUT ;
- m_node_gen.m_flow_sync_node = node;
m_node_gen.add_node(node);
#ifdef _DEBUG