mirror of https://github.com/craigerl/aprsd.git
Compare commits
2 Commits
813bc7ea29
...
c43652dbea
Author | SHA1 | Date |
---|---|---|
Hemna | c43652dbea | |
Hemna | 29d97d9f0c |
|
@ -19,6 +19,7 @@ from aprsd import cli_helper, client, packets, plugin, threads
|
||||||
from aprsd.main import cli
|
from aprsd.main import cli
|
||||||
from aprsd.packets import collector as packet_collector
|
from aprsd.packets import collector as packet_collector
|
||||||
from aprsd.packets import log as packet_log
|
from aprsd.packets import log as packet_log
|
||||||
|
from aprsd.packets import seen_list
|
||||||
from aprsd.stats import collector
|
from aprsd.stats import collector
|
||||||
from aprsd.threads import keep_alive, rx
|
from aprsd.threads import keep_alive, rx
|
||||||
from aprsd.threads import stats as stats_thread
|
from aprsd.threads import stats as stats_thread
|
||||||
|
@ -195,6 +196,10 @@ def listen(
|
||||||
keepalive = keep_alive.KeepAliveThread()
|
keepalive = keep_alive.KeepAliveThread()
|
||||||
# keepalive.start()
|
# 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 = None
|
||||||
pm = plugin.PluginManager()
|
pm = plugin.PluginManager()
|
||||||
if load_plugins:
|
if load_plugins:
|
||||||
|
|
|
@ -10,6 +10,8 @@ from aprsd import cli_helper, client
|
||||||
from aprsd import main as aprsd_main
|
from aprsd import main as aprsd_main
|
||||||
from aprsd import packets, plugin, threads, utils
|
from aprsd import packets, plugin, threads, utils
|
||||||
from aprsd.main import cli
|
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 keep_alive, log_monitor, registry, rx
|
||||||
from aprsd.threads import stats as stats_thread
|
from aprsd.threads import stats as stats_thread
|
||||||
from aprsd.threads import tx
|
from aprsd.threads import tx
|
||||||
|
@ -108,6 +110,10 @@ def server(ctx, flush):
|
||||||
keepalive = keep_alive.KeepAliveThread()
|
keepalive = keep_alive.KeepAliveThread()
|
||||||
keepalive.start()
|
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 = stats_thread.APRSDStatsStoreThread()
|
||||||
stats_store_thread.start()
|
stats_store_thread.start()
|
||||||
|
|
||||||
|
|
|
@ -125,6 +125,12 @@ aprsd_opts = [
|
||||||
default=20,
|
default=20,
|
||||||
help="The maximum number of packets to send in the stats dict for admin ui.",
|
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 = [
|
watch_list_opts = [
|
||||||
|
|
|
@ -29,6 +29,9 @@ class PacketCollector:
|
||||||
def register(self, monitor: Callable) -> None:
|
def register(self, monitor: Callable) -> None:
|
||||||
self.monitors.append(monitor)
|
self.monitors.append(monitor)
|
||||||
|
|
||||||
|
def unregister(self, monitor: Callable) -> None:
|
||||||
|
self.monitors.remove(monitor)
|
||||||
|
|
||||||
def rx(self, packet: type[core.Packet]) -> None:
|
def rx(self, packet: type[core.Packet]) -> None:
|
||||||
for name in self.monitors:
|
for name in self.monitors:
|
||||||
cls = name()
|
cls = name()
|
||||||
|
|
|
@ -14,6 +14,7 @@ class APRSDStats:
|
||||||
"""The AppStats class is used to collect stats from the application."""
|
"""The AppStats class is used to collect stats from the application."""
|
||||||
|
|
||||||
_instance = None
|
_instance = None
|
||||||
|
start_time = None
|
||||||
|
|
||||||
def __new__(cls, *args, **kwargs):
|
def __new__(cls, *args, **kwargs):
|
||||||
"""Have to override the new method to make this a singleton
|
"""Have to override the new method to make this a singleton
|
||||||
|
@ -22,11 +23,9 @@ class APRSDStats:
|
||||||
"""
|
"""
|
||||||
if not cls._instance:
|
if not cls._instance:
|
||||||
cls._instance = super().__new__(cls)
|
cls._instance = super().__new__(cls)
|
||||||
|
cls._instance.start_time = datetime.datetime.now()
|
||||||
return cls._instance
|
return cls._instance
|
||||||
|
|
||||||
def __init__(self):
|
|
||||||
self.start_time = datetime.datetime.now()
|
|
||||||
|
|
||||||
def uptime(self):
|
def uptime(self):
|
||||||
return datetime.datetime.now() - self.start_time
|
return datetime.datetime.now() - self.start_time
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue