This patch includes a completely reworked client structure.
There is now only 1 client object, that loads the appropriate
drivers. The drivers are fake, aprsis and tcpkiss.
The TCPKISS client was written from scratch to avoid using asyncio.
Asyncion is nothing but a pain in the ass.
This patch adds the new PacketFilter class as a generic mechanism
for doing packet filtering during the packet processing phase of
recieving packets.
The packet phases are:
1. reception and stats collection
2. packet processing.
Each phase has a single thread for handling that phase.
Phase 1:
The ARPSDRXThread connects to the APRS client, and gets packets
from the client. Then it puts the packet through the Collector
for stats and tracking. Then the packet is put into the packet_queue.
Phase 2:
Packets are pulled from the packet_queue. Then packets are run
through the PacketFilter mechanism, then processed depending
on the command being run.
By default there is 1 loaded packet filter, which is the
DupePacketFilter which removes "duplicate" packets that aprsd has
already seen and processed within the configured time frame.
This PacketFilter mechanism allows an external extension or plugin
to add/remove packet filters at will depending on the function
of the extension or plugin. For example, this allows an extension
to get a packet and push the packet into an MQTT queue.
This patch fixes an issue when the KISS connection fails to start
and or goes away during the lifetime of the active connection.
Aprsd would runaway in a tight loop eating 100% cpu. We now detect
when the underlying asyncio connection has failed and raise, which
induces a sleep in the consumer to try again.
We had a bottleneck of pulling down packets as fast as possible,
which was caused by the time.sleep(1) call in the main RX
thread that used to be needed.
This adds a try block around the aprslib.parse() for packets incoming
on the KISS interface. Often times we'll get invalid packets and
this prevents stack dumps to the log.