Added link stats to object details
parent
f006f0d71a
commit
63030a6f48
|
@ -1838,6 +1838,72 @@ class SidebandCore():
|
|||
RNS.log(ed, RNS.LOG_DEBUG)
|
||||
return None
|
||||
|
||||
def _get_destination_mtu(self, destination_hash):
|
||||
try:
|
||||
mr = self.message_router
|
||||
oh = destination_hash
|
||||
ol = None
|
||||
if oh in mr.direct_links:
|
||||
ol = mr.direct_links[oh]
|
||||
elif oh in mr.backchannel_links:
|
||||
ol = mr.backchannel_links[oh]
|
||||
|
||||
if ol != None:
|
||||
return ol.get_mtu()
|
||||
|
||||
return None
|
||||
|
||||
except Exception as e:
|
||||
RNS.trace_exception(e)
|
||||
return None
|
||||
|
||||
def get_destination_mtu(self, destination_hash):
|
||||
if not RNS.vendor.platformutils.is_android():
|
||||
return self._get_destination_mtu(destination_hash)
|
||||
else:
|
||||
if self.is_service:
|
||||
return self._get_destination_mtu(destination_hash)
|
||||
else:
|
||||
try:
|
||||
return self.service_rpc_request({"get_destination_mtu": destination_hash})
|
||||
except Exception as e:
|
||||
ed = "Error while getting destination link MTU over RPC: "+str(e)
|
||||
RNS.log(ed, RNS.LOG_DEBUG)
|
||||
return None
|
||||
|
||||
def _get_destination_edr(self, destination_hash):
|
||||
try:
|
||||
mr = self.message_router
|
||||
oh = destination_hash
|
||||
ol = None
|
||||
if oh in mr.direct_links:
|
||||
ol = mr.direct_links[oh]
|
||||
elif oh in mr.backchannel_links:
|
||||
ol = mr.backchannel_links[oh]
|
||||
|
||||
if ol != None:
|
||||
return ol.get_expected_rate()
|
||||
|
||||
return None
|
||||
|
||||
except Exception as e:
|
||||
RNS.trace_exception(e)
|
||||
return None
|
||||
|
||||
def get_destination_edr(self, destination_hash):
|
||||
if not RNS.vendor.platformutils.is_android():
|
||||
return self._get_destination_edr(destination_hash)
|
||||
else:
|
||||
if self.is_service:
|
||||
return self._get_destination_edr(destination_hash)
|
||||
else:
|
||||
try:
|
||||
return self.service_rpc_request({"get_destination_edr": destination_hash})
|
||||
except Exception as e:
|
||||
ed = "Error while getting destination link EIFR over RPC: "+str(e)
|
||||
RNS.log(ed, RNS.LOG_DEBUG)
|
||||
return None
|
||||
|
||||
def __start_rpc_listener(self):
|
||||
try:
|
||||
RNS.log("Starting RPC listener", RNS.LOG_DEBUG)
|
||||
|
@ -1882,6 +1948,10 @@ class SidebandCore():
|
|||
connection.send(self._get_plugins_info())
|
||||
elif "get_destination_establishment_rate" in call:
|
||||
connection.send(self._get_destination_establishment_rate(call["get_destination_establishment_rate"]))
|
||||
elif "get_destination_mtu" in call:
|
||||
connection.send(self._get_destination_mtu(call["get_destination_mtu"]))
|
||||
elif "get_destination_edr" in call:
|
||||
connection.send(self._get_destination_edr(call["get_destination_edr"]))
|
||||
elif "send_message" in call:
|
||||
args = call["send_message"]
|
||||
send_result = self.send_message(
|
||||
|
|
|
@ -822,17 +822,23 @@ class RVDetails(MDRecycleView):
|
|||
if nhi and nhi != "None":
|
||||
self.entries.append({"icon": "routes", "text": f"Current path on [b]{nhi}[/b]", "on_release": pass_job})
|
||||
|
||||
try:
|
||||
ler = self.delegate.app.sideband.get_destination_establishment_rate(self.delegate.object_hash)
|
||||
if ler:
|
||||
lers = RNS.prettyspeed(ler, "b")
|
||||
self.entries.append({"icon": "lock-check-outline", "text": f"Direct link established, LER is [b]{lers}[/b]", "on_release": pass_job})
|
||||
except Exception as e:
|
||||
RNS.trace_exception(e)
|
||||
|
||||
if nh != RNS.Transport.PATHFINDER_M:
|
||||
hs = "hop" if nh == 1 else "hops"
|
||||
self.entries.append({"icon": "atom-variant", "text": f"Network distance is [b]{nh} {hs}[/b]", "on_release": pass_job})
|
||||
|
||||
try:
|
||||
ler = self.delegate.app.sideband.get_destination_establishment_rate(self.delegate.object_hash)
|
||||
mtu = self.delegate.app.sideband.get_destination_mtu(self.delegate.object_hash) or RNS.Reticulum.MTU
|
||||
edr = self.delegate.app.sideband.get_destination_edr(self.delegate.object_hash)
|
||||
if ler:
|
||||
lers = RNS.prettyspeed(ler, "b")
|
||||
mtus = RNS.prettysize(mtu)
|
||||
edrs = f"{RNS.prettyspeed(edr)}" if edr != None else ""
|
||||
self.entries.append({"icon": "lock-check-outline", "text": f"Link established, LER is [b]{lers}[/b], MTU is [b]{mtus}[/b]", "on_release": pass_job})
|
||||
if edr: self.entries.append({"icon": "approximately-equal", "text": f"Expected data rate is [b]{edrs}[/b]", "on_release": pass_job})
|
||||
except Exception as e:
|
||||
RNS.trace_exception(e)
|
||||
|
||||
except Exception as e:
|
||||
RNS.trace_exception(e)
|
||||
|
||||
|
|
Loading…
Reference in New Issue