mirror of
https://github.com/craigerl/aprsd.git
synced 2025-09-05 14:47:53 -04:00
Fixed small bug with packets get_packet_type
This fixes an issue with trying to decode the packet type. Also updated some of the log entries.
This commit is contained in:
parent
90a44bb5ed
commit
3d38402be2
@ -39,6 +39,7 @@ def get_packet_type(packet):
|
|||||||
|
|
||||||
msg_format = packet.get("format", None)
|
msg_format = packet.get("format", None)
|
||||||
msg_response = packet.get("response", None)
|
msg_response = packet.get("response", None)
|
||||||
|
packet_type = "unknown"
|
||||||
if msg_format == "message":
|
if msg_format == "message":
|
||||||
packet_type = PACKET_TYPE_MESSAGE
|
packet_type = PACKET_TYPE_MESSAGE
|
||||||
elif msg_response == "ack":
|
elif msg_response == "ack":
|
||||||
|
@ -192,11 +192,15 @@ class APRSDNotifyThread(APRSDThread):
|
|||||||
|
|
||||||
LOG.debug("Update last seen from {}".format(packet["from"]))
|
LOG.debug("Update last seen from {}".format(packet["from"]))
|
||||||
self.last_seen[packet["from"]] = now
|
self.last_seen[packet["from"]] = now
|
||||||
|
self.update_stats()
|
||||||
else:
|
else:
|
||||||
LOG.debug("Ignoring packet from {}".format(packet["from"]))
|
LOG.debug(
|
||||||
|
"Ignoring packet from '{}'. Not in watch list.".format(
|
||||||
|
packet["from"],
|
||||||
|
),
|
||||||
|
)
|
||||||
|
|
||||||
# Allows stats object to have latest info from the last_seen dict
|
# Allows stats object to have latest info from the last_seen dict
|
||||||
self.update_stats()
|
|
||||||
LOG.debug("Packet processing complete")
|
LOG.debug("Packet processing complete")
|
||||||
except queue.Empty:
|
except queue.Empty:
|
||||||
pass
|
pass
|
||||||
@ -342,7 +346,6 @@ class APRSDRXThread(APRSDThread):
|
|||||||
msg_id=msg_id,
|
msg_id=msg_id,
|
||||||
)
|
)
|
||||||
self.msg_queues["tx"].put(ack)
|
self.msg_queues["tx"].put(ack)
|
||||||
LOG.debug("Packet processing complete")
|
|
||||||
|
|
||||||
def process_packet(self, packet):
|
def process_packet(self, packet):
|
||||||
"""Process a packet recieved from aprs-is server."""
|
"""Process a packet recieved from aprs-is server."""
|
||||||
@ -376,14 +379,16 @@ class APRSDRXThread(APRSDThread):
|
|||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
LOG.debug(
|
LOG.debug(
|
||||||
"Packet wasn't meant for us '{}'. Ignoring packet to '{}'".format(
|
"Ignoring '{}' packet from '{}' to '{}'".format(
|
||||||
self.config["aprs"]["login"],
|
packets.get_packet_type(packet),
|
||||||
|
packet["from"],
|
||||||
tocall,
|
tocall,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
except (aprslib.ParseError, aprslib.UnknownFormat) as exp:
|
except (aprslib.ParseError, aprslib.UnknownFormat) as exp:
|
||||||
LOG.exception("Failed to parse packet from aprs-is", exp)
|
LOG.exception("Failed to parse packet from aprs-is", exp)
|
||||||
|
LOG.debug("Packet processing complete")
|
||||||
|
|
||||||
|
|
||||||
class APRSDTXThread(APRSDThread):
|
class APRSDTXThread(APRSDThread):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user