mirror of
https://github.com/markqvist/Reticulum.git
synced 2025-05-03 15:14:53 -04:00
Added announce queue dropping to rnpath utility
This commit is contained in:
parent
1b50f5267a
commit
af1a05ff6a
4 changed files with 49 additions and 4 deletions
|
@ -30,7 +30,7 @@ import argparse
|
|||
from RNS._version import __version__
|
||||
|
||||
|
||||
def program_setup(configdir, table, drop, destination_hexhash, verbosity, timeout):
|
||||
def program_setup(configdir, table, drop, destination_hexhash, verbosity, timeout, drop_queues):
|
||||
if table:
|
||||
reticulum = RNS.Reticulum(configdir = configdir, loglevel = 3+verbosity)
|
||||
table = sorted(reticulum.get_path_table(), key=lambda e: (e["interface"], e["hops"]) )
|
||||
|
@ -43,6 +43,11 @@ def program_setup(configdir, table, drop, destination_hexhash, verbosity, timeou
|
|||
m_str = "s"
|
||||
print(RNS.prettyhexrep(path["hash"])+" is "+str(path["hops"])+" hop"+m_str+" away via "+RNS.prettyhexrep(path["via"])+" on "+path["interface"]+" expires "+RNS.timestamp_str(path["expires"]))
|
||||
|
||||
elif drop_queues:
|
||||
reticulum = RNS.Reticulum(configdir = configdir, loglevel = 3+verbosity)
|
||||
RNS.log("Dropping announce queues on all interfaces...")
|
||||
reticulum.drop_announce_queues()
|
||||
|
||||
elif drop:
|
||||
try:
|
||||
dest_len = (RNS.Reticulum.TRUNCATED_HASHLENGTH//8)*2
|
||||
|
@ -140,6 +145,14 @@ def main():
|
|||
default=False
|
||||
)
|
||||
|
||||
parser.add_argument(
|
||||
"-D",
|
||||
"--drop-announces",
|
||||
action="store_true",
|
||||
help="drop all queued announces",
|
||||
default=False
|
||||
)
|
||||
|
||||
parser.add_argument(
|
||||
"-w",
|
||||
action="store",
|
||||
|
@ -166,7 +179,7 @@ def main():
|
|||
else:
|
||||
configarg = None
|
||||
|
||||
if not args.table and not args.destination:
|
||||
if not args.drop_announces and not args.table and not args.destination:
|
||||
print("")
|
||||
parser.print_help()
|
||||
print("")
|
||||
|
@ -178,6 +191,7 @@ def main():
|
|||
destination_hexhash = args.destination,
|
||||
verbosity = args.verbose,
|
||||
timeout = args.w,
|
||||
drop_queues = args.drop_announces,
|
||||
)
|
||||
|
||||
except KeyboardInterrupt:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue