summaryrefslogtreecommitdiffstats
path: root/src/stateless/dp/trex_stateless_dp_core.cpp
diff options
context:
space:
mode:
authorHanoh Haim <hhaim@cisco.com>2015-11-21 18:22:55 +0200
committerHanoh Haim <hhaim@cisco.com>2015-11-21 18:22:55 +0200
commit8c1cf5d7690fd3e44d196fc6453a2bc5db5a3c9b (patch)
tree38d05ba22918242f27103c702fb66e9e1cb12e22 /src/stateless/dp/trex_stateless_dp_core.cpp
parentede162750d582cf1dd8c2d7cea3f30b008fb5d42 (diff)
fix crash in case of CNTL-C
Diffstat (limited to 'src/stateless/dp/trex_stateless_dp_core.cpp')
-rw-r--r--src/stateless/dp/trex_stateless_dp_core.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/stateless/dp/trex_stateless_dp_core.cpp b/src/stateless/dp/trex_stateless_dp_core.cpp
index c4fdd44b..a6fe3f56 100644
--- a/src/stateless/dp/trex_stateless_dp_core.cpp
+++ b/src/stateless/dp/trex_stateless_dp_core.cpp
@@ -126,7 +126,11 @@ bool TrexStatelessDpPerPort::update_number_of_active_streams(uint32_t d){
void TrexStatelessDpPerPort::stop_traffic(uint8_t port_id){
- assert(m_state==TrexStatelessDpPerPort::ppSTATE_TRANSMITTING);
+ /* there could be race of stop after stop */
+ if (m_state == TrexStatelessDpPerPort::ppSTATE_IDLE) {
+ assert(m_active_streams==0);
+ return;
+ }
for (auto dp_stream : m_active_nodes) {
CGenNodeStateless * node =dp_stream.m_node;
@@ -259,8 +263,10 @@ TrexStatelessDpCore::start_scheduler() {
double old_offset = 0.0;
m_core->m_node_gen.flush_file(-1, 0.0, false, m_core, old_offset);
- /* TBD do we need that ? */
- m_core->m_node_gen.close_file(m_core);
+ /* bail out in case of terminate */
+ if (m_state != TrexStatelessDpCore::STATE_TERMINATE) {
+ m_core->m_node_gen.close_file(m_core);
+ }
}