ensure we don't try to join a thread that wasn't created

(in the event of a timeout error)
This commit is contained in:
onyx-and-iris 2023-10-21 07:48:09 +01:00
parent f863723a4e
commit 87a1d62414
2 changed files with 5 additions and 3 deletions

View File

@ -1,6 +1,6 @@
[tool.poetry] [tool.poetry]
name = "vban-cmd" name = "vban-cmd"
version = "2.4.9" version = "2.4.10"
description = "Python interface for the VBAN RT Packet Service (Sendtext)" description = "Python interface for the VBAN RT Packet Service (Sendtext)"
authors = ["onyx-and-iris <code@onyxandiris.online>"] authors = ["onyx-and-iris <code@onyxandiris.online>"]
license = "MIT" license = "MIT"

View File

@ -51,6 +51,7 @@ class VbanCmd(metaclass=ABCMeta):
self._ldirty = False self._ldirty = False
self._script = str() self._script = str()
self.stop_event = None self.stop_event = None
self.producer = None
@abstractmethod @abstractmethod
def __str__(self): def __str__(self):
@ -231,6 +232,7 @@ class VbanCmd(metaclass=ABCMeta):
if not self.stopped(): if not self.stopped():
self.logger.debug("events thread shutdown started") self.logger.debug("events thread shutdown started")
self.stop_event.set() self.stop_event.set()
if self.producer is not None:
for t in (self.producer, self.subscriber): for t in (self.producer, self.subscriber):
t.join() t.join()
[sock.close() for sock in self.socks] [sock.close() for sock in self.socks]