summaryrefslogtreecommitdiffstats
path: root/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_async_client.py
diff options
context:
space:
mode:
authorimarom <imarom@cisco.com>2016-05-10 14:20:30 +0300
committerimarom <imarom@cisco.com>2016-05-10 14:21:39 +0300
commit6daea438c392fda4c765d2afa46a34d691799bd7 (patch)
tree91ae19c924d7dd7d588974b6670d13148a538e0c /scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_async_client.py
parentdc622bd308ae9ba17eda57881e809dbbc5d2dd01 (diff)
wait_on_traffic might get stuck if the async thread unexpectedly crashed
or exited
Diffstat (limited to 'scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_async_client.py')
-rw-r--r--scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_async_client.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_async_client.py b/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_async_client.py
index 022077a9..5c9faf0f 100644
--- a/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_async_client.py
+++ b/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_async_client.py
@@ -194,11 +194,13 @@ class CTRexAsyncClient():
if not self.connected:
return
+ # mark for join
+ self.active = False
+
# signal that the context was destroyed (exit the thread loop)
self.context.term()
- # mark for join and join
- self.active = False
+ # join
self.t.join()
# done
@@ -239,6 +241,7 @@ class CTRexAsyncClient():
except zmq.ContextTerminated:
# outside thread signaled us to exit
+ assert(not self.active)
break
msg = json.loads(line)
@@ -256,6 +259,8 @@ class CTRexAsyncClient():
# closing of socket must be from the same thread
self.socket.close(linger = 0)
+ def is_thread_alive (self):
+ return self.t.is_alive()
# did we get info for the last 3 seconds ?
def is_alive (self):