Added timeout to rnprobe

This commit is contained in:
Mark Qvist 2023-09-22 10:04:37 +02:00
parent 8f6c6b76de
commit 5872108da3

View File

@ -110,7 +110,7 @@ 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=" ")
i = 0 i = 0
while not receipt.status == RNS.PacketReceipt.DELIVERED: while receipt.status == RNS.PacketReceipt.SENT:
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()
@ -119,6 +119,7 @@ def program_setup(configdir, destination_hexhash, size=None, full_name = None, v
print("\b\b ") print("\b\b ")
sys.stdout.flush() sys.stdout.flush()
if receipt.status == RNS.PacketReceipt.DELIVERED:
hops = RNS.Transport.hops_to(destination_hash) hops = RNS.Transport.hops_to(destination_hash)
if hops != 1: if hops != 1:
ms = "s" ms = "s"
@ -160,6 +161,9 @@ def program_setup(configdir, destination_hexhash, size=None, full_name = None, v
reception_stats reception_stats
) )
else:
print("Probe timed out")
def main(): def main():