kopia lustrzana https://github.com/glidernet/python-ogn-client
![]() When starting an AprsClient with AprsClient.run(...) the client enters a loop without an exit condition (i.e. a while True loop). If autoreconnect is set to True, it is impossible to exit the aforementioned loop even if AprsClient.disconnect() is called. This causes problems when running the client in a thread (or as a background service, etc.) as the process will not join nor terminate unless explicitly shutdown with SIGKILL. Minimal example: ``` import signal from ogn.client import AprsClient from ogn.parser import parse_aprs, parse_ogn_beacon, ParseError def process_beacon(raw_message): print('Received message') client = AprsClient(aprs_user='N0CALL') signal.signal(signal.SIGTERM, lambda signo, stackno: client.disconnect()) client.connect() client.run(callback=process_beacon, autoreconnect=True) ``` This commit fixes such issues by adding a kill flag that is raised when calling AprsClien.disconnect() to the while conditions of both loops inside AprsClient.run(). Note: the outermost loop could still remain a while True loop as the exit condition is checked at the end of the loop body. |
||
---|---|---|
.. | ||
client | ||
ddb | ||
parser | ||
__init__.py | ||
valid_beacons.txt |