Added config for enable_seen_list

This patch allows the admin to disable the callsign seen list
packet tracking feature.
This commit is contained in:
Hemna 2024-04-20 19:54:02 -04:00
parent 29d97d9f0c
commit c43652dbea
4 changed files with 20 additions and 0 deletions

View File

@ -19,6 +19,7 @@ from aprsd import cli_helper, client, packets, plugin, threads
from aprsd.main import cli
from aprsd.packets import collector as packet_collector
from aprsd.packets import log as packet_log
from aprsd.packets import seen_list
from aprsd.stats import collector
from aprsd.threads import keep_alive, rx
from aprsd.threads import stats as stats_thread
@ -195,6 +196,10 @@ def listen(
keepalive = keep_alive.KeepAliveThread()
# keepalive.start()
if not CONF.enable_seen_list:
# just deregister the class from the packet collector
packet_collector.PacketCollector().unregister(seen_list.SeenList)
pm = None
pm = plugin.PluginManager()
if load_plugins:

View File

@ -10,6 +10,8 @@ from aprsd import cli_helper, client
from aprsd import main as aprsd_main
from aprsd import packets, plugin, threads, utils
from aprsd.main import cli
from aprsd.packets import collector as packet_collector
from aprsd.packets import seen_list
from aprsd.threads import keep_alive, log_monitor, registry, rx
from aprsd.threads import stats as stats_thread
from aprsd.threads import tx
@ -108,6 +110,10 @@ def server(ctx, flush):
keepalive = keep_alive.KeepAliveThread()
keepalive.start()
if not CONF.enable_seen_list:
# just deregister the class from the packet collector
packet_collector.PacketCollector().unregister(seen_list.SeenList)
stats_store_thread = stats_thread.APRSDStatsStoreThread()
stats_store_thread.start()

View File

@ -125,6 +125,12 @@ aprsd_opts = [
default=20,
help="The maximum number of packets to send in the stats dict for admin ui.",
),
cfg.BoolOpt(
"enable_seen_list",
default=True,
help="Enable the Callsign seen list tracking feature. This allows aprsd to keep track of "
"callsigns that have been seen and when they were last seen.",
),
]
watch_list_opts = [

View File

@ -29,6 +29,9 @@ class PacketCollector:
def register(self, monitor: Callable) -> None:
self.monitors.append(monitor)
def unregister(self, monitor: Callable) -> None:
self.monitors.remove(monitor)
def rx(self, packet: type[core.Packet]) -> None:
for name in self.monitors:
cls = name()