Commit Graph

82 Commits

Author SHA1 Message Date
Hemna 93a9cce0c0 Put an upper bound on the QueueHandler queue
This patch overrides the base QueueHandler class
from logging to ensure that the queue doesn't grow
infinitely.  That can be a problem when there is
no consumer pulling items out of the queue.
the queue is now capped at 200 entries max.
2024-05-07 20:00:17 -04:00
Hemna bef32059f4 Call packet collecter after prepare during tx.
We have to call the packet collector.tx() only after
a packet has been prepared for tx, because that's when the
new msgNo is assigned.
2024-04-19 13:02:58 -04:00
Hemna 717db6083e Added PacketTrack to packet collector
Now the PacketTrack object is a packet collector as well.
2024-04-17 16:54:08 -04:00
Hemna a656d93263 Added new PacketCollector
this patch adds the new PacketCollector class.
It's a single point for collecting information about
packets sent and recieved from the APRS client.
Basically instead of having the packetlist call the seen list
when we get a packet, we simply call the PacketCollector.rx(),
which in turn calls each registered PacketMonitor class.

This allows us to decouple the packet stats like classses inside
of APRSD.  More importantly, it allows extensions to append their
own PacketMonitor class to the chain without modifying ARPSD.
2024-04-16 14:34:14 -04:00
Hemna cb0cfeea0b Fixed Keepalive access to email stats
this patch fixes a potential issue accessing an email stat
that might not be set yet.
2024-04-16 13:09:33 -04:00
Hemna 8d86764c23 Added support for RX replyacks
This patch adds support for processing incoming packets that have
the 'new' acks embedded in messages called replyacks as described here:

http://www.aprs.org/aprs11/replyacks.txt
2024-04-16 11:39:46 -04:00
Hemna 3e8716365e another fix for tx send 2024-04-15 11:29:26 -04:00
Hemna 758ea432ed removed Packet.last_send_attempt and just use send_count 2024-04-15 10:00:35 -04:00
Hemna 8392d6b8ef Added new config optons for PacketList
This allows the admin to set the number of packets to store
in the PacketList object for tracking.  For apps like IRC,
we need to store lots more packets to detect dupes.
2024-04-14 12:48:09 -04:00
Hemna 66e4850353 Fixed issue with APRSDThreadList stats()
the stats method was setting the key to the classname
and not the thread name, giving an inacurate list
of actual running threads.
2024-04-12 15:08:39 -04:00
Hemna 40c028c844 Added new default_ack_send_count config option
There may be applications where the admin might not want a hard
coded 3 acks sent for every RX'd packet.  This patch adds the
ability to change the number of acks sent per RX'd packet.
The default is still 3.
2024-04-12 14:36:27 -04:00
Hemna 4c2a40b7a7 Remove packet from tracker after max attempts 2024-04-12 11:12:57 -04:00
Hemna 026dc6e376 syncronize the add for StatsStore 2024-04-11 22:55:01 -04:00
Hemna f34120c2df Another fix for ACK packets 2024-04-11 17:28:47 -04:00
Hemna 3bef1314f8 Fix issue not tracking RX Ack packets for stats
This patch updates the RX tracking for packets.  Every
packet we get into the rx thread, we now will track
every packet we RX so the stats are acurate.
2024-04-11 16:54:46 -04:00
Hemna 80705cb341 Ensure StatsStore has empty data
This patch ensures that the StatsStore object has a default
empty dict for data.
2024-04-09 06:59:22 -04:00
Hemna da882b4f9b LOG failed requests post to admin ui 2024-04-08 13:07:15 -04:00
Hemna 333feee805 Removed RPC Server and client.
This patch removes the need for the RPC Server from aprsd.

APRSD Now saves it's stats to a pickled file on disk in the
aprsd.conf configured save_location.  The web admin UI
will depickle that file to fetch the stats.  The aprsd server
will periodically pickle and save the stats to disk.

The Logmonitor will not do a url post to the web admin ui
to send it the latest log entries.

Updated the healthcheck app to use the pickled stats file
and the fetch-stats command to make a url request to the running
admin ui to fetch the stats of the remote aprsd server.
2024-04-05 12:50:01 -04:00
Hemna 71d72adf06 Allow stats collector to serialize upon creation
This does some cleanup with the stats collector and
usage of the stats.  The patch adds a new optional
param to the collector's collect() method to tell
the object to provide serializable stats.  This is
used for the webchat app that sends stats to the
browser.
2024-04-02 14:07:37 -04:00
Hemna a270c75263 Fixed pep8 errors and missing files 2024-04-02 09:30:45 -04:00
Hemna bd005f628d Reworked the stats making the rpc server obsolete.
This patch implements a new stats collector paradigm
which uses the typing Protocol.  Any object that wants to
supply stats to the collector has to implement the
aprsd.stats.collector.StatsProducer protocol, which at the
current time is implementing a stats() method on the object.

Then register the stats singleton producer with the collector by
calling collector.Collector().register_producer()

This only works if the stats producer object is a singleton.
2024-04-02 09:30:43 -04:00
Hemna a62e490353 Update client.py to add consumer in the API.
This adds a layer between the client object and the
actual client instance, so we can reset the actual
client object instance upon failure of connection.
2024-03-28 16:51:56 -04:00
Hemna 1e6c483002 Completely redo logging of packets!!
refactored all logging of packets.

Packet class now doesn't do logging.
the format of the packet log now lives on a single line with
colors.

Created a new packet property called human_info, which
creates a string for the payload of each packet type
in a human readable format.

TODO: need to create a config option to allow showing the
older style of multiline logs for packets.
2024-03-22 23:20:16 -04:00
Hemna d80277c9d8 Moved Threads list for mypy
This patch moves the APRSDThreadList to the bottom
of the file so that we can specify the type in the
threads_list member for mypy.
2024-03-20 15:39:18 -04:00
Hemna 2e9c9d40e1 Fixed registry url post 2024-03-08 11:49:10 -05:00
Hemna 66004f639f Changed processpkt message
this includes the pkt.key in the log entry
2024-03-08 11:25:46 -05:00
Hemna 0b0afd39ed Fixed RegistryThread not sending requests 2024-03-08 09:18:28 -05:00
Hemna 5d3f42f411 Make registry thread sleep
This patch adds a required sleep of 1 second in each
registry thread loop to prevent runaway cpu usage
2024-03-07 08:37:09 -05:00
Hemna a4630c15be Add log info for Beacon and Registry threads 2024-02-27 16:01:15 -05:00
Hemna 7a5b55fa77 fixed references to conf 2024-02-27 15:48:58 -05:00
Hemna e9c48c1914 fix pep8 failures 2024-02-27 14:21:04 -05:00
Hemna 38fe408c82 Don't send uptime to registry 2024-02-27 13:40:39 -05:00
Hemna 8264c94bd6 Added sending software string to registry
This patch adds sending the APRSD signature and url
along with the regsitry request.
2024-02-27 11:05:41 -05:00
Hemna 1e4f0ca65a Added the new APRS Registry thread
This patch adds the new APRSRegistryThread,
which enabled in config, will send a small
packet of information to the as yet deployed
APRS service registry every 900 seconds.

The data that this thread will send is
the service callsign, a description of the service,
a website url for the service.

The idea being that the registry website that this thread
sends information to, will show all the services that are
running on the ARPS network, so Ham operators can discover
them and try them out.
2024-02-26 18:28:52 -05:00
Hemna 11f1e9533e Added BeaconPacket
This patch adds the BeaconPacket and BeaconSendThread.
This will enable APRSD server to send a beacon if enabled in
the config.
2024-02-25 14:21:17 -05:00
Hemna e89f8a805b Added some missing classes to threads
Added new APRSDupeThread
2024-02-24 14:26:55 -05:00
Hemna fe1ebf2ec1 Test new packet serialization 2023-11-17 11:39:42 -05:00
Hemna bf905a0e9f Update the packet_dupe_timeout warning
The warning text was hardcoded at the old 60 second value,
instead of using the config option.
2023-10-06 16:06:41 -04:00
Hemna f41488b48a Added packet_dupe_timeout conf
This patch adds the new packet_dump_timeout config option, defaulting to
60 seconds.   If the same packet matching the from, to, msgNo is RX'd
within that timeout the packet is considered a dupe and will be
dropped.  Ack packets are not subject to dupe checking.
2023-10-05 13:56:02 -04:00
Hemna 544600a96b Make Packet objects hashable
This patch makes the packet key a property of the Packet object and
makes packet objects comparable and hashable.
2023-10-03 16:01:43 -04:00
Hemna 59cec1317d Don't process AckPackets as dupes
If we RX an AckPacket, then send it on for processing.  There is no need
to check for a dupe.
2023-10-02 08:42:00 -04:00
Hemna 99a0f877f4 pep8 fixes 2023-09-28 12:34:01 -04:00
Hemna 4f87d5da12 rewrote packet_list and drop dupe packets
This patch rewrites the packet_list internally to be a dictionary
instead of a list for very fast lookups.  This was needed to test for
duplicate packets already in the list.

This patch drops packets that have the same data and are < 60 seconds
in age from the last time we got the packet.   On RF based clients
we can get dupes!!
2023-09-28 12:19:18 -04:00
Hemna 0d7e50d2ba Log a warning on dupe
This patch logs a warning if we detect a dupe packet inbound.
2023-09-27 15:45:39 -04:00
Hemna 1f6c55d2bf Fix for dupe packets.
Sometimes over KISS clients (RF), we can get duplicate packets
due to having many digipeters in range of the TNC that aprsd is
connected to.   We will now filter out any dupe packets that aprsd
is still in the process of doing it's 3 acks.
2023-09-27 14:55:47 -04:00
Hemna c9dc4f67d4 minor cleanup prior to release 2023-09-26 15:27:51 -04:00
Hemna ef206b1283 Ensure Keepalive doesn't reset client at startup
This patch ensures that the keepalive thread doesn't try and
reset/restart the aprs connection at startup.
2023-09-14 16:46:00 -04:00
Hemna e0c3c5cbbf remove loop log 2023-07-25 20:45:55 -04:00
Hemna 26f354b3a9 Max out the client reconnect backoff to 5
This patch adjusts the backoff mechanism for aprs client
reconnect to a max backoff sleep of 5 seconds.   This prevents
an exponential backoff when connection retrying.
2023-07-24 17:03:29 -04:00
Hemna d3a93b735d Added timing after each thread loop
This is to help keep track of which non-blocking threads are still
alive.

The RPC Server thread blocks, so the time will always increase.
2023-07-20 14:44:46 -04:00