revert the stream interface change; fix tunnel tests

This commit is contained in:
Mike Kinney
2021-12-31 08:49:13 -08:00
parent b92fff0da6
commit 177705aeff
4 changed files with 72 additions and 69 deletions

View File

@@ -39,10 +39,7 @@ class StreamInterface(MeshInterface):
self._wantExit = False
# FIXME, figure out why daemon=True causes reader thread to exit too early
if noProto:
self._rxThread = None
else:
self._rxThread = threading.Thread(target=self.__reader, args=(), daemon=True)
self._rxThread = threading.Thread(target=self.__reader, args=(), daemon=True)
MeshInterface.__init__(self, debugOut=debugOut, noProto=noProto)
@@ -68,8 +65,7 @@ class StreamInterface(MeshInterface):
if not self.noProto:
time.sleep(0.1) # wait 100ms to give device time to start running
if not self.noProto:
self._rxThread.start()
self._rxThread.start()
self._startConfig()
@@ -121,9 +117,8 @@ class StreamInterface(MeshInterface):
# pyserial cancel_read doesn't seem to work, therefore we ask the
# reader thread to close things for us
self._wantExit = True
if not self.noProto:
if self._rxThread != threading.current_thread():
self._rxThread.join() # wait for it to exit
if self._rxThread != threading.current_thread():
self._rxThread.join() # wait for it to exit
def __reader(self):
"""The reader thread that reads bytes from our stream"""