From 08d6780c73ae9c8e6181bfe22dc3af09f33411b8 Mon Sep 17 00:00:00 2001 From: Mark Qvist Date: Fri, 8 May 2026 01:13:49 +0200 Subject: [PATCH] Tuned default IC params. Show burst status in rnstatus. --- RNS/Interfaces/Interface.py | 8 +++---- RNS/Reticulum.py | 2 ++ RNS/Utilities/rnstatus.py | 29 +++++++++++++++---------- docs/manual/_sources/interfaces.rst.txt | 14 +++++++----- 4 files changed, 32 insertions(+), 21 deletions(-) diff --git a/RNS/Interfaces/Interface.py b/RNS/Interfaces/Interface.py index 3bc59fb5..ed2648c1 100755 --- a/RNS/Interfaces/Interface.py +++ b/RNS/Interfaces/Interface.py @@ -66,11 +66,11 @@ class Interface: # considered to be newly created. Two # hours by default. IC_NEW_TIME = 2*60*60 - IC_BURST_FREQ_NEW = 6 - IC_BURST_FREQ = 35 - IC_BURST_HOLD = 1*60 + IC_BURST_FREQ_NEW = 3 + IC_BURST_FREQ = 10 + IC_BURST_HOLD = 15 IC_BURST_PENALTY = 15 - IC_HELD_RELEASE_INTERVAL = 2 + IC_HELD_RELEASE_INTERVAL = 5 IC_DEQUE_MIN_SAMPLE = 32 # Default announce rate targets diff --git a/RNS/Reticulum.py b/RNS/Reticulum.py index cb5fb712..a1b9d0fd 100755 --- a/RNS/Reticulum.py +++ b/RNS/Reticulum.py @@ -1382,6 +1382,8 @@ class Reticulum: ifstats["announce_rate_penalty"] = interface.announce_rate_penalty ifstats["announce_rate_grace"] = interface.announce_rate_grace ifstats["held_announces"] = len(interface.held_announces) + ifstats["burst_active"] = interface.ic_burst_active + ifstats["burst_activated"] = interface.ic_burst_activated ifstats["status"] = interface.online ifstats["mode"] = interface.mode diff --git a/RNS/Utilities/rnstatus.py b/RNS/Utilities/rnstatus.py index 5b185b5b..cba8928a 100644 --- a/RNS/Utilities/rnstatus.py +++ b/RNS/Utilities/rnstatus.py @@ -542,26 +542,33 @@ def program_setup(configdir, dispall=False, verbosity=0, name_filter=None, json= elif art and arp != None: art_str = f"(t:{RNS.prettytime(art)}/p:{RNS.prettytime(arp)})" elif art: art_str = f"(t:{RNS.prettytime(art)})" else: art_str = "" + + burst_str = "" + if "burst_active" in ifstat and ifstat["burst_active"]: + for_str = RNS.prettytime(time.time()-ifstat["burst_activated"]) + burst_str = f" burst for {for_str}" rxb_str = "↓"+RNS.prettysize(ifstat["rxb"]) txb_str = "↑"+RNS.prettysize(ifstat["txb"]) - strdiff = len(rxb_str)-len(txb_str) - if strdiff > 0: txb_str += " "*strdiff - elif strdiff < 0: rxb_str += " "*-strdiff - + + asr = False if astats and "incoming_announce_frequency" in ifstat and ifstat["incoming_announce_frequency"] != None: oaf = RNS.prettyfrequency(ifstat["outgoing_announce_frequency"])+"↑" iaf = RNS.prettyfrequency(ifstat["incoming_announce_frequency"])+"↓" if clients != None and clients > 0: pc_str = f"{RNS.prettyfrequency(ifstat['outgoing_announce_frequency']/clients)}/c" else: pc_str = "" - strdiff = len(oaf)-len(iaf) - if strdiff > 0: iaf += " "*strdiff - elif strdiff < 0: oaf += " "*-strdiff - strdiff = len(rxb_str)-len(oaf) - if strdiff > 0: oaf += " "*strdiff - elif strdiff < 0: txb_str += " "*-strdiff; rxb_str += " "*-strdiff + asr = True + + if not asr: iaf = ""; oaf = "" + mlen = max(len(iaf), len(oaf), len(rxb_str), len(txb_str)) + iaf += (mlen-len(iaf))*" " + oaf += (mlen-len(oaf))*" " + rxb_str += (mlen-len(rxb_str))*" " + txb_str += (mlen-len(txb_str))*" " + + if asr: print(f" Announces : {oaf} {pc_str}") - print(f" {iaf} {art_str}") + print(f" {iaf} {art_str}{burst_str}") rxstat = rxb_str txstat = txb_str diff --git a/docs/manual/_sources/interfaces.rst.txt b/docs/manual/_sources/interfaces.rst.txt index 1270dda7..25e9699c 100644 --- a/docs/manual/_sources/interfaces.rst.txt +++ b/docs/manual/_sources/interfaces.rst.txt @@ -1393,11 +1393,11 @@ but all the parameters are exposed for configuration if needed. sub-interfaces when a new client connects. * | The ``ic_burst_freq_new`` option sets the maximum announce ingress - frequency for newly spawned interfaces. Defaults to ``3.5`` + frequency for newly spawned interfaces. Defaults to ``3.0`` announces per second. * | The ``ic_burst_freq`` option sets the maximum announce ingress - frequency for other interfaces. Defaults to ``12`` announces + frequency for other interfaces. Defaults to ``10.0`` announces per second. *If an interface exceeds its burst frequency, incoming announces @@ -1410,15 +1410,17 @@ but all the parameters are exposed for configuration if needed. * | The ``ic_burst_hold`` option sets how much time (in seconds) must pass after the burst frequency drops below its threshold, for the - announce burst to be considered cleared. Defaults to ``60`` + announce burst to be considered cleared. Defaults to ``15.0`` seconds. * | The ``ic_burst_penalty`` option sets how much time (in seconds) must pass after the burst is considered cleared, before held announces can - start being released from the queue. Defaults to ``5*60`` - seconds. + start being released from the queue. Defaults to ``15.0`` seconds. * | The ``ic_held_release_interval`` option sets how much time (in seconds) must pass between releasing each held announce from the queue. Defaults - to ``30`` seconds. + to ``5.0`` seconds. +All the ingress control parameters can be set as defaults in the ``[reticulum]`` +section of the configuration file. Interface-specific configuration will +override the defaults.