From ba39a69175a0ecd3e8634d5b15ac5a560e2fefc5 Mon Sep 17 00:00:00 2001 From: Mark Qvist Date: Sun, 5 Dec 2021 11:45:13 +0100 Subject: [PATCH] Timeout default structure updated --- RNS/Link.py | 6 +----- RNS/Packet.py | 4 +--- RNS/Reticulum.py | 8 ++++++++ 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/RNS/Link.py b/RNS/Link.py index 5a93ef3..b16874f 100644 --- a/RNS/Link.py +++ b/RNS/Link.py @@ -45,11 +45,7 @@ class Link: MDU = math.floor((RNS.Reticulum.MTU-RNS.Reticulum.HEADER_MINSIZE-RNS.Identity.FERNET_OVERHEAD)/RNS.Identity.AES128_BLOCKSIZE)*RNS.Identity.AES128_BLOCKSIZE - 1 - # This value is set at a reasonable level for a 1 Kb/s channel. - # - # TODO: Find a way to automatically raise or lower this according to - # channel bandwidth and utilisation. - ESTABLISHMENT_TIMEOUT_PER_HOP = 5 + ESTABLISHMENT_TIMEOUT_PER_HOP = RNS.Reticulum.DEFAULT_PER_HOP_TIMEOUT """ Default timeout for link establishment in seconds per hop to destination. """ diff --git a/RNS/Packet.py b/RNS/Packet.py index 5aca955..77b1c9a 100755 --- a/RNS/Packet.py +++ b/RNS/Packet.py @@ -75,9 +75,7 @@ class Packet: The maximum size of the payload data in a single unencrypted packet """ - # This value is set at a reasonable - # level for a 1 Kb/s channel. - TIMEOUT_PER_HOP = 5 + TIMEOUT_PER_HOP = RNS.Reticulum.DEFAULT_PER_HOP_TIMEOUT def __init__(self, destination, data, packet_type = DATA, context = NONE, transport_type = RNS.Transport.BROADCAST, header_type = HEADER_1, transport_id = None, attached_interface = None, create_receipt = True): if destination != None: diff --git a/RNS/Reticulum.py b/RNS/Reticulum.py index 47770a0..2723077 100755 --- a/RNS/Reticulum.py +++ b/RNS/Reticulum.py @@ -59,6 +59,14 @@ class Reticulum: the default value. """ + # TODO: To reach the 300bps level without unreasonably impacting + # performance on faster links, we need a mechanism for setting + # this value more intelligently. One option could be inferring it + # from interface speed, but a better general approach would most + # probably be to let Reticulum somehow continously build a map of + # per-hop latencies and use this map for the timeout calculation. + DEFAULT_PER_HOP_TIMEOUT = 5 + # Length of truncated hashes in bits. TRUNCATED_HASHLENGTH = 80