mirror of
https://github.com/markqvist/Reticulum.git
synced 2025-02-19 22:57:40 +00:00
Compare commits
4 Commits
27c5af3bbc
...
0a188a2d39
Author | SHA1 | Date | |
---|---|---|---|
![]() |
0a188a2d39 | ||
![]() |
036abb28fe | ||
![]() |
a732767a28 | ||
![]() |
32a1261d98 |
@ -1049,7 +1049,7 @@ class Transport:
|
|||||||
Transport.local_client_rssi_cache.append([packet.packet_hash, packet.rssi])
|
Transport.local_client_rssi_cache.append([packet.packet_hash, packet.rssi])
|
||||||
|
|
||||||
while len(Transport.local_client_rssi_cache) > Transport.LOCAL_CLIENT_CACHE_MAXSIZE:
|
while len(Transport.local_client_rssi_cache) > Transport.LOCAL_CLIENT_CACHE_MAXSIZE:
|
||||||
Transport.local_client_rssi_cache.pop()
|
Transport.local_client_rssi_cache.pop(0)
|
||||||
|
|
||||||
if hasattr(interface, "r_stat_snr"):
|
if hasattr(interface, "r_stat_snr"):
|
||||||
if interface.r_stat_rssi != None:
|
if interface.r_stat_rssi != None:
|
||||||
@ -1058,7 +1058,7 @@ class Transport:
|
|||||||
Transport.local_client_snr_cache.append([packet.packet_hash, packet.snr])
|
Transport.local_client_snr_cache.append([packet.packet_hash, packet.snr])
|
||||||
|
|
||||||
while len(Transport.local_client_snr_cache) > Transport.LOCAL_CLIENT_CACHE_MAXSIZE:
|
while len(Transport.local_client_snr_cache) > Transport.LOCAL_CLIENT_CACHE_MAXSIZE:
|
||||||
Transport.local_client_snr_cache.pop()
|
Transport.local_client_snr_cache.pop(0)
|
||||||
|
|
||||||
if len(Transport.local_client_interfaces) > 0:
|
if len(Transport.local_client_interfaces) > 0:
|
||||||
if Transport.is_local_client_interface(interface):
|
if Transport.is_local_client_interface(interface):
|
||||||
|
@ -321,7 +321,7 @@ def fetch(configdir, verbosity = 0, quietness = 0, destination = None, file = No
|
|||||||
if silent:
|
if silent:
|
||||||
print("Establishing link with "+RNS.prettyhexrep(destination_hash))
|
print("Establishing link with "+RNS.prettyhexrep(destination_hash))
|
||||||
else:
|
else:
|
||||||
print("\r \rEstablishing link with "+RNS.prettyhexrep(destination_hash)+" ", end=" ")
|
print("\r \rEstablishing link with "+RNS.prettyhexrep(destination_hash)+" ", end=" ")
|
||||||
|
|
||||||
listener_identity = RNS.Identity.recall(destination_hash)
|
listener_identity = RNS.Identity.recall(destination_hash)
|
||||||
listener_destination = RNS.Destination(
|
listener_destination = RNS.Destination(
|
||||||
|
@ -31,8 +31,9 @@ import argparse
|
|||||||
from RNS._version import __version__
|
from RNS._version import __version__
|
||||||
|
|
||||||
DEFAULT_PROBE_SIZE = 16
|
DEFAULT_PROBE_SIZE = 16
|
||||||
|
DEFAULT_TIMEOUT = 15
|
||||||
|
|
||||||
def program_setup(configdir, destination_hexhash, size=None, full_name = None, verbosity = 0):
|
def program_setup(configdir, destination_hexhash, size=None, full_name = None, verbosity = 0, timeout=None):
|
||||||
if size == None: size = DEFAULT_PROBE_SIZE
|
if size == None: size = DEFAULT_PROBE_SIZE
|
||||||
if full_name == None:
|
if full_name == None:
|
||||||
print("The full destination name including application name aspects must be specified for the destination")
|
print("The full destination name including application name aspects must be specified for the destination")
|
||||||
@ -72,14 +73,19 @@ def program_setup(configdir, destination_hexhash, size=None, full_name = None, v
|
|||||||
print("Path to "+RNS.prettyhexrep(destination_hash)+" requested ", end=" ")
|
print("Path to "+RNS.prettyhexrep(destination_hash)+" requested ", end=" ")
|
||||||
sys.stdout.flush()
|
sys.stdout.flush()
|
||||||
|
|
||||||
|
_timeout = time.time() + (timeout or DEFAULT_TIMEOUT)
|
||||||
i = 0
|
i = 0
|
||||||
syms = "⢄⢂⢁⡁⡈⡐⡠"
|
syms = "⢄⢂⢁⡁⡈⡐⡠"
|
||||||
while not RNS.Transport.has_path(destination_hash):
|
while not RNS.Transport.has_path(destination_hash) and not time.time() > _timeout:
|
||||||
time.sleep(0.1)
|
time.sleep(0.1)
|
||||||
print(("\b\b"+syms[i]+" "), end="")
|
print(("\b\b"+syms[i]+" "), end="")
|
||||||
sys.stdout.flush()
|
sys.stdout.flush()
|
||||||
i = (i+1)%len(syms)
|
i = (i+1)%len(syms)
|
||||||
|
|
||||||
|
if time.time() > _timeout:
|
||||||
|
print("\r \rPath request timed out")
|
||||||
|
exit(2)
|
||||||
|
|
||||||
server_identity = RNS.Identity.recall(destination_hash)
|
server_identity = RNS.Identity.recall(destination_hash)
|
||||||
|
|
||||||
request_destination = RNS.Destination(
|
request_destination = RNS.Destination(
|
||||||
@ -109,13 +115,18 @@ def program_setup(configdir, destination_hexhash, size=None, full_name = None, v
|
|||||||
|
|
||||||
print("\rSent "+str(size)+" byte probe to "+RNS.prettyhexrep(destination_hash)+more+" ", end=" ")
|
print("\rSent "+str(size)+" byte probe to "+RNS.prettyhexrep(destination_hash)+more+" ", end=" ")
|
||||||
|
|
||||||
|
_timeout = time.time() + (timeout or DEFAULT_TIMEOUT)
|
||||||
i = 0
|
i = 0
|
||||||
while receipt.status == RNS.PacketReceipt.SENT:
|
while receipt.status == RNS.PacketReceipt.SENT and not time.time() > _timeout:
|
||||||
time.sleep(0.1)
|
time.sleep(0.1)
|
||||||
print(("\b\b"+syms[i]+" "), end="")
|
print(("\b\b"+syms[i]+" "), end="")
|
||||||
sys.stdout.flush()
|
sys.stdout.flush()
|
||||||
i = (i+1)%len(syms)
|
i = (i+1)%len(syms)
|
||||||
|
|
||||||
|
if time.time() > _timeout:
|
||||||
|
print("\r \rProbe timed out")
|
||||||
|
exit(2)
|
||||||
|
|
||||||
print("\b\b ")
|
print("\b\b ")
|
||||||
sys.stdout.flush()
|
sys.stdout.flush()
|
||||||
|
|
||||||
@ -162,7 +173,7 @@ def program_setup(configdir, destination_hexhash, size=None, full_name = None, v
|
|||||||
)
|
)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
print("Probe timed out")
|
print("\r \rProbe timed out")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -172,6 +183,7 @@ def main():
|
|||||||
|
|
||||||
parser.add_argument("--config", action="store", default=None, help="path to alternative Reticulum config directory", type=str)
|
parser.add_argument("--config", action="store", default=None, help="path to alternative Reticulum config directory", type=str)
|
||||||
parser.add_argument("-s", "--size", action="store", default=None, help="size of probe packet payload in bytes", type=int)
|
parser.add_argument("-s", "--size", action="store", default=None, help="size of probe packet payload in bytes", type=int)
|
||||||
|
parser.add_argument("-t", "--timeout", metavar="seconds", action="store", default=None, help="timeout before giving up", type=float)
|
||||||
parser.add_argument("--version", action="version", version="rnprobe {version}".format(version=__version__))
|
parser.add_argument("--version", action="version", version="rnprobe {version}".format(version=__version__))
|
||||||
parser.add_argument("full_name", nargs="?", default=None, help="full destination name in dotted notation", type=str)
|
parser.add_argument("full_name", nargs="?", default=None, help="full destination name in dotted notation", type=str)
|
||||||
parser.add_argument("destination_hash", nargs="?", default=None, help="hexadecimal hash of the destination", type=str)
|
parser.add_argument("destination_hash", nargs="?", default=None, help="hexadecimal hash of the destination", type=str)
|
||||||
|
Binary file not shown.
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user