diff options
author | Vratko Polak <vrpolak@cisco.com> | 2019-05-27 18:36:23 +0200 |
---|---|---|
committer | Ole Trøan <otroan@employees.org> | 2019-05-28 08:49:26 +0000 |
commit | 94e4531a02099eb017e84f42a1d5ed0a43c32dd0 (patch) | |
tree | 4954b62e74a28dcecfdcdaeb81b6c80836c8e7a4 /src/vpp-api/python/vpp_papi/vpp_papi.py | |
parent | 3f340175aebaf84ed3994799e819e0801c7e3212 (diff) |
papi: avoid IOError on disconnect
Change-Id: I331efb20b98a7e3c507d9158d0221ee7d5353b18
Signed-off-by: Vratko Polak <vrpolak@cisco.com>
Diffstat (limited to 'src/vpp-api/python/vpp_papi/vpp_papi.py')
-rw-r--r-- | src/vpp-api/python/vpp_papi/vpp_papi.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/vpp-api/python/vpp_papi/vpp_papi.py b/src/vpp-api/python/vpp_papi/vpp_papi.py index f29c250744d..cd1f2e549de 100644 --- a/src/vpp-api/python/vpp_papi/vpp_papi.py +++ b/src/vpp-api/python/vpp_papi/vpp_papi.py @@ -465,6 +465,8 @@ class VPPApiClient(object): target=self.thread_msg_handler) self.event_thread.daemon = True self.event_thread.start() + else: + self.event_thread = None return rv def connect(self, name, chroot_prefix=None, do_async=False, rx_qlen=32): @@ -495,7 +497,8 @@ class VPPApiClient(object): def disconnect(self): """Detach from VPP.""" rv = self.transport.disconnect() - self.message_queue.put("terminate event thread") + if self.event_thread is not None: + self.message_queue.put("terminate event thread") return rv def msg_handler_sync(self, msg): |