diff --git a/aprsd/threads/__init__.py b/aprsd/threads/__init__.py index bf8cb23..9220a65 100644 --- a/aprsd/threads/__init__.py +++ b/aprsd/threads/__init__.py @@ -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) diff --git a/aprsd/threads/rx.py b/aprsd/threads/rx.py index 98e5054..7c8e422 100644 --- a/aprsd/threads/rx.py +++ b/aprsd/threads/rx.py @@ -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. diff --git a/aprsd/threads/tx.py b/aprsd/threads/tx.py index 708d263..84dd7dd 100644 --- a/aprsd/threads/tx.py +++ b/aprsd/threads/tx.py @@ -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.