mirror of
https://github.com/meshtastic/python.git
synced 2025-12-30 03:17:54 -05:00
mark our reader thread as daemon, so that closing devices is (kinda) optional
This commit is contained in:
@@ -740,7 +740,7 @@ class StreamInterface(MeshInterface):
|
||||
self._wantExit = False
|
||||
|
||||
# FIXME, figure out why daemon=True causes reader thread to exit too early
|
||||
self._rxThread = threading.Thread(target=self.__reader, args=())
|
||||
self._rxThread = threading.Thread(target=self.__reader, args=(), daemon=True)
|
||||
|
||||
MeshInterface.__init__(self, debugOut=debugOut, noProto=noProto)
|
||||
|
||||
|
||||
@@ -405,7 +405,10 @@ def subscribe():
|
||||
"""Subscribe to the topics the user probably wants to see, prints output to stdout"""
|
||||
pub.subscribe(onReceive, "meshtastic.receive")
|
||||
# pub.subscribe(onConnection, "meshtastic.connection")
|
||||
pub.subscribe(onConnected, "meshtastic.connection.established")
|
||||
|
||||
# We now call onConnected from main
|
||||
# pub.subscribe(onConnected, "meshtastic.connection.established")
|
||||
|
||||
# pub.subscribe(onNode, "meshtastic.node")
|
||||
|
||||
|
||||
@@ -464,6 +467,9 @@ def common():
|
||||
else:
|
||||
client = SerialInterface(
|
||||
args.port, debugOut=logfile, noProto=args.noproto)
|
||||
|
||||
# We assume client is fully connected now
|
||||
onConnected(client)
|
||||
|
||||
# don't call exit, background threads might be running still
|
||||
# sys.exit(0)
|
||||
|
||||
Reference in New Issue
Block a user