papi: make socket disconnect more robust

Previusly, read error could happen before message_thread starts,
so do not attempt to join in that case.

Change-Id: Ie119916831e320e38eb02e48515b4c6a9cb937e5
Signed-off-by: Vratko Polak <vrpolak@cisco.com>
This commit is contained in:
Vratko Polak
2019-06-12 16:43:06 +02:00
committed by Ole Trøan
parent 7a99823c0b
commit c83311ddff

View File

@ -149,7 +149,7 @@ class VppTransport(object):
self.socket.close()
if self.sque is not None:
self.sque.put(True) # Terminate listening thread
if self.message_thread is not None:
if self.message_thread is not None and self.message_thread.is_alive():
# Allow additional connect() calls.
self.message_thread.join()
# Collect garbage.