Added minimum link traffic timeout

This commit is contained in:
Mark Qvist 2024-09-12 17:52:40 +02:00
parent 7b7ebbec90
commit a666bb6e73
2 changed files with 2 additions and 1 deletions

View File

@ -68,6 +68,7 @@ class Link:
Timeout for link establishment in seconds per hop to destination. Timeout for link establishment in seconds per hop to destination.
""" """
TRAFFIC_TIMEOUT_MIN_MS = 5
TRAFFIC_TIMEOUT_FACTOR = 6 TRAFFIC_TIMEOUT_FACTOR = 6
KEEPALIVE_TIMEOUT_FACTOR = 4 KEEPALIVE_TIMEOUT_FACTOR = 4
""" """

View File

@ -381,7 +381,7 @@ class PacketReceipt:
self.proof_packet = None self.proof_packet = None
if packet.destination.type == RNS.Destination.LINK: if packet.destination.type == RNS.Destination.LINK:
self.timeout = packet.destination.rtt * packet.destination.traffic_timeout_factor self.timeout = max(packet.destination.rtt * packet.destination.traffic_timeout_factor, RNS.Link.TRAFFIC_TIMEOUT_MIN_MS/1000)
else: else:
self.timeout = RNS.Reticulum.get_instance().get_first_hop_timeout(self.destination.hash) self.timeout = RNS.Reticulum.get_instance().get_first_hop_timeout(self.destination.hash)
self.timeout += Packet.TIMEOUT_PER_HOP * RNS.Transport.hops_to(self.destination.hash) self.timeout += Packet.TIMEOUT_PER_HOP * RNS.Transport.hops_to(self.destination.hash)