Added Transport Instance uptime to rnstatut output

This commit is contained in:
Mark Qvist 2023-09-18 15:45:55 +02:00
parent 7497e7aa0c
commit 874d76b343
3 changed files with 7 additions and 4 deletions

View File

@ -1146,6 +1146,7 @@ class Reticulum:
stats["interfaces"] = interfaces
if Reticulum.transport_enabled():
stats["transport_id"] = RNS.Transport.identity.hash
stats["transport_uptime"] = time.time()-RNS.Transport.start_time
return stats

View File

@ -115,9 +115,10 @@ class Transport:
pending_local_path_requests = {}
jobs_locked = False
jobs_running = False
job_interval = 0.250
start_time = None
jobs_locked = False
jobs_running = False
job_interval = 0.250
links_last_checked = 0.0
links_check_interval = 1.0
receipts_last_checked = 0.0
@ -270,6 +271,7 @@ class Transport:
RNS.log("Could not load tunnel table from storage, the contained exception was: "+str(e), RNS.LOG_ERROR)
RNS.log("Transport instance "+str(Transport.identity)+" started", RNS.LOG_VERBOSE)
Transport.start_time = time.time()
# Synthesize tunnels for any interfaces wanting it
for interface in Transport.interfaces:

View File

@ -176,7 +176,7 @@ def program_setup(configdir, dispall=False, verbosity=0, name_filter=None,json=F
print(" Traffic : {txb}\n {rxb}".format(rxb=size_str(ifstat["rxb"]), txb=size_str(ifstat["txb"])))
if "transport_id" in stats and stats["transport_id"] != None:
print("\n Reticulum Transport Instance "+RNS.prettyhexrep(stats["transport_id"])+" is running")
print("\n Reticulum Transport Instance "+RNS.prettyhexrep(stats["transport_id"])+" running, uptime is "+RNS.prettytime(stats["transport_uptime"]))
print("")