Implemented transport for links

This commit is contained in:
Mark Qvist 2020-03-06 22:20:50 +01:00
parent 67b13bca25
commit d754ed989c
8 changed files with 110 additions and 35 deletions

View file

@ -96,7 +96,7 @@ def client(destination_hexhash, configpath, timeout=None):
# We override the loglevel to provide feedback when
# an announce is received
RNS.loglevel = RNS.LOG_DEBUG
RNS.loglevel = RNS.LOG_INFO
# Tell the user that the client is ready!
RNS.log("Echo client ready, hit enter to send echo request to "+destination_hexhash+" (Ctrl-C to quit)")

View file

@ -180,15 +180,16 @@ def client(destination_hexhash, configpath):
# We must first initialise Reticulum
reticulum = RNS.Reticulum(configpath)
# Check if we already know the destination
server_identity = RNS.Identity.recall(destination_hash)
# If not, we'll have to wait until an announce arrives
if server_identity == None:
RNS.log("Destination is not yet known, waiting for an announce to arrive... (Ctrl-C to cancel)")
while (server_identity == None):
# Check if we know a path to the destination
if not RNS.Transport.hasPath(destination_hash):
RNS.log("Destination is not yet known. Requesting path and waiting for announce to arrive...")
RNS.Transport.requestPath(destination_hash)
while not RNS.Transport.hasPath(destination_hash):
time.sleep(0.1)
server_identity = RNS.Identity.recall(destination_hash)
# Recall the server identity
server_identity = RNS.Identity.recall(destination_hash)
# Inform the user that we'll begin connecting
RNS.log("Establishing link with server...")