python-ogn-client/tests
Anze Kolar 182f9518a4 Add kill flag to AprsClient
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.
2017-07-20 11:12:04 +02:00
..
client Add kill flag to AprsClient 2017-07-20 11:12:04 +02:00
ddb Add submodule ddb 2016-03-29 12:02:00 +02:00
parser Release v0.7.1 2017-06-05 10:07:04 +02:00
__init__.py Initial commit; Import from ogn-python 2016-02-28 12:11:16 +01:00
valid_beacons.txt Added tests for 0.2.6 2017-05-07 11:34:11 +02:00