1
0
mirror of https://github.com/craigerl/aprsd.git synced 2025-03-23 04:44:31 -04:00

Allow disabling sending all AckPackets

This patch adds a new config option 'enable_sending_ack_packets', which
is by default set to True.  This allows the admin to disable sending Ack
Packets for MessagePackets entirely.
This commit is contained in:
Hemna 2024-11-06 17:59:10 -05:00
parent d0018a8cd3
commit 6e62ac14b8
3 changed files with 15 additions and 1 deletions

View File

@ -136,6 +136,12 @@ aprsd_opts = [
default=True,
help="Set this to False, to disable logging of packets to the log file.",
),
cfg.BoolOpt(
"enable_sending_ack_packets",
default=True,
help="Set this to False, to disable sending of ack packets. This will entirely stop"
"APRSD from sending ack packets.",
),
]
watch_list_opts = [

View File

@ -151,6 +151,11 @@ class APRSDProcessPacketThread(APRSDThread):
def __init__(self, packet_queue):
self.packet_queue = packet_queue
super().__init__("ProcessPKT")
if not CONF.enable_sending_ack_packets:
LOG.warning(
"Sending ack packets is disabled, messages "
"will not be acknowledged.",
)
def process_ack_packet(self, packet):
"""We got an ack for a message, no need to resend it."""

View File

@ -53,7 +53,10 @@ def send(packet: core.Packet, direct=False, aprs_client=None):
# After prepare, as prepare assigns the msgNo
collector.PacketCollector().tx(packet)
if isinstance(packet, core.AckPacket):
_send_ack(packet, direct=direct, aprs_client=aprs_client)
if CONF.enable_sending_ack_packets:
_send_ack(packet, direct=direct, aprs_client=aprs_client)
else:
LOG.info("Sending ack packets is disabled. Not sending AckPacket.")
else:
_send_packet(packet, direct=direct, aprs_client=aprs_client)