Link: reset watchdog if exception happens in receive

This commit is contained in:
JRG authored and Mark Qvist committed 2026-08-19 13:38:18 +02:00
1 parent 6cd5be18ec
commit 39e3854dac
1 file changed
+7 -2
+7 -2
View File
@@ -928,6 +928,13 @@ class Link:
def receive(self, packet):
self.watchdog_lock = True
try: self.__receive(packet)
except Exception as e:
RNS.log(f"Error while receiving a packet: {e}", RNS.LOG_ERROR)
RNS.trace_exception(e)
finally: self.watchdog_lock = False
def __receive(self, packet):
if not self.status == Link.CLOSED and not (self.initiator and packet.context == RNS.Packet.KEEPALIVE and packet.data == bytes([0xFF])):
if packet.receiving_interface != self.attached_interface:
RNS.log(f"Link-associated packet received on unexpected interface {packet.receiving_interface} instead of {self.attached_interface}! Someone might be trying to manipulate your communication!", RNS.LOG_ERROR)
@@ -1156,8 +1163,6 @@ class Link:
threading.Thread(target=job, daemon=True).start()
self.__update_phy_stats(packet, query_shared=True)
self.watchdog_lock = False
def encrypt(self, plaintext):
try:
if not self.token: