From 54c9a6b55a8a102d44109ae454b4c76240ae0780 Mon Sep 17 00:00:00 2001 From: Hemna Date: Mon, 30 Aug 2021 13:34:25 -0400 Subject: [PATCH] Rebased from master --- aprsd/kissclient.py | 2 ++ aprsd/main.py | 7 ++++--- aprsd/threads.py | 12 +++++++----- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/aprsd/kissclient.py b/aprsd/kissclient.py index e3e707a..9bd5d80 100644 --- a/aprsd/kissclient.py +++ b/aprsd/kissclient.py @@ -5,8 +5,10 @@ from aioax25 import frame as axframe from aioax25 import interface from aioax25 import kiss as kiss from aioax25.aprs import APRSInterface + from aprsd import trace + LOG = logging.getLogger("APRSD") diff --git a/aprsd/main.py b/aprsd/main.py index aa0674a..05099e7 100644 --- a/aprsd/main.py +++ b/aprsd/main.py @@ -37,7 +37,8 @@ import click_completion # local imports here import aprsd from aprsd import ( - client, flask, kissclient, messaging, packets, plugin, stats, threads, trace, utils, + client, flask, kissclient, messaging, packets, plugin, stats, threads, + trace, utils, ) @@ -500,12 +501,12 @@ def server( if kissclient.KISSClient.kiss_enabled(config): kcl = kissclient.KISSClient(config=config) + # This initializes the client object. kcl.client - kissrx_thread = threads.KISSRXThread(msg_queues=msg_queues, config=config) + kissrx_thread = threads.KISSRXThread(msg_queues=threads.msg_queues, config=config) kissrx_thread.start() - messaging.MsgTrack().restart() keepalive = threads.KeepAliveThread(config=config) diff --git a/aprsd/threads.py b/aprsd/threads.py index 8caaebf..bd7a4c5 100644 --- a/aprsd/threads.py +++ b/aprsd/threads.py @@ -8,7 +8,9 @@ import tracemalloc import aprslib -from aprsd import client, kissclient, messaging, packets, plugin, stats, utils +from aprsd import ( + client, kissclient, messaging, packets, plugin, stats, trace, utils, +) LOG = logging.getLogger("APRSD") @@ -363,10 +365,10 @@ class KISSRXThread(APRSDThread): def process_packet(self, interface, frame, match): """Process a packet recieved from aprs-is server.""" - LOG.debug("Got an APRS Frame '{}'".format(frame)) + LOG.debug(f"Got an APRS Frame '{frame}'") payload = str(frame.payload.decode()) - msg = "{}:{}".format(str(frame.header), payload) + msg = f"{str(frame.header)}:{payload}" packet = aprslib.parse(msg) LOG.debug(packet) @@ -418,7 +420,7 @@ class KISSRXThread(APRSDThread): # us that they processed the message correctly, but have # nothing to reply with, so we avoid replying with a usage string if reply is not messaging.NULL_MESSAGE: - LOG.debug("Sending '{}'".format(reply)) + LOG.debug(f"Sending '{reply}'") msg = messaging.TextMessage( self.config["aprs"]["login"], @@ -469,7 +471,7 @@ class KISSRXThread(APRSDThread): def process_ack_packet(self, packet): ack_num = packet.get("msgNo") - LOG.info("Got ack for message {}".format(ack_num)) + LOG.info(f"Got ack for message {ack_num}") messaging.log_message( "ACK", packet["raw"],