From 6414d01cc36e5a10bfb914737ea1e2ac11d88ad4 Mon Sep 17 00:00:00 2001 From: DJ2LS Date: Tue, 4 Jul 2023 06:42:12 +0200 Subject: [PATCH] reset attempts if already ack or failed --- tnc/mesh.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/tnc/mesh.py b/tnc/mesh.py index 8da7e786..c6c8ed42 100644 --- a/tnc/mesh.py +++ b/tnc/mesh.py @@ -445,7 +445,13 @@ class MeshRouter(): for _, item in enumerate(MESH_SIGNALLING_TABLE): # update entry if exists if destination in item[1] and "PING" in item[3]: - update_entry = [item[0], destination, "", "PING", "", item[5], status] + # reset attempts if entry exists and it failed or is acknowledged + if item[6] in ["failed", "acknowledged"]: + attempt = 0 + else: + attempt = item[5] + + update_entry = [item[0], destination, "", "PING", "",attempt, status] #print(f"UPDATE {MESH_SIGNALLING_TABLE[_]} >>> {update_entry}") self.log.info(f"[MESH] [SIGNALLING TABLE] [UPDATE]: {MESH_SIGNALLING_TABLE[_]} >>> ", update=update_entry) @@ -472,7 +478,12 @@ class MeshRouter(): for _, item in enumerate(MESH_SIGNALLING_TABLE): # update entry if exists if destination in item[1] and "PING" in item[3]: - update_entry = [item[0], destination, "", "PING-ACK", "", item[5], status] + # reset attempts if entry exists and it failed or is acknowledged + if item[6] in ["failed", "acknowledged"]: + attempt = 0 + else: + attempt = item[5] + update_entry = [item[0], destination, "", "PING-ACK", "", attempt, status] #print(f"UPDATE {MESH_SIGNALLING_TABLE[_]} >>> {update_entry}") self.log.info(f"[MESH] [SIGNALLING TABLE] [UPDATE]: {MESH_SIGNALLING_TABLE[_]} >>> ", update=update_entry)