Added some missing classes to threads

Added new APRSDupeThread
This commit is contained in:
Hemna 2024-02-24 14:26:55 -05:00
parent b14307270c
commit e89f8a805b
3 changed files with 14 additions and 4 deletions

View File

@ -4,7 +4,7 @@ import queue
# aprsd.threads
from .aprsd import APRSDThread, APRSDThreadList # noqa: F401
from .keep_alive import KeepAliveThread # noqa: F401
from .rx import APRSDRXThread # noqa: F401
from .rx import APRSDRXThread, APRSDDupeRXThread, APRSDProcessPacketThread # noqa: F401
packet_queue = queue.Queue(maxsize=20)

View File

@ -58,12 +58,13 @@ class APRSDRXThread(APRSDThread):
pass
class APRSDPluginRXThread(APRSDRXThread):
class APRSDDupeRXThread(APRSDRXThread):
"""Process received packets.
This is the main APRSD Server command thread that
receives packets from APRIS and then sends them for
processing in the PluginProcessPacketThread.
receives packets and makes sure the packet
hasn't been seen previously before sending it on
to be processed.
"""
def process_packet(self, *args, **kwargs):
@ -118,6 +119,13 @@ class APRSDPluginRXThread(APRSDRXThread):
self.packet_queue.put(packet)
class APRSDPluginRXThread(APRSDDupeRXThread):
""""Process received packets.
For backwards compatibility, we keep the APRSDPluginRXThread.
"""
class APRSDProcessPacketThread(APRSDThread):
"""Base class for processing received packets.

View File

@ -37,6 +37,8 @@ msg_throttle_decorator = decorator.ThrottleDecorator(throttle=msg_t)
ack_throttle_decorator = decorator.ThrottleDecorator(throttle=ack_t)
@msg_throttle_decorator.sleep_and_retry
def send(packet: core.Packet, direct=False, aprs_client=None):
"""Send a packet either in a thread or directly to the client."""
# prepare the packet for sending.