Implemented duplicate signalling on PN message download

This commit is contained in:
Mark Qvist 2025-11-02 02:27:57 +01:00
parent d0f3385f75
commit 747ddbddd5
3 changed files with 15 additions and 6 deletions

View file

@ -54,7 +54,7 @@ class LXMFPropagationAnnounceHandler:
metadata = data[6]
if destination_hash in self.lxmrouter.static_peers:
static_peer = self.lxmrouter.static_peers[destination_hash]
static_peer = self.lxmrouter.peers[destination_hash]
if not is_path_response or static_peer.last_heard == 0:
self.lxmrouter.peer(destination_hash=destination_hash,
timestamp=node_timebase,

View file

@ -75,6 +75,8 @@ class LXMRouter:
PR_ALL_MESSAGES = 0x00
DUPLICATE_SIGNAL = "lxmf_duplicate"
STATS_GET_PATH = "/pn/get/stats"
SYNC_REQUEST_PATH = "/pn/peer/sync"
UNPEER_REQUEST_PATH = "/pn/peer/unpeer"
@ -1537,10 +1539,12 @@ class LXMRouter:
self.propagation_transfer_state = LXMRouter.PR_NO_ACCESS
else:
duplicates = 0
if request_receipt.response != None and len(request_receipt.response) > 0:
haves = []
for lxmf_data in request_receipt.response:
self.lxmf_propagation(lxmf_data)
result = self.lxmf_propagation(lxmf_data, signal_duplicate=LXMRouter.DUPLICATE_SIGNAL)
if result == LXMRouter.DUPLICATE_SIGNAL: duplicates += 1
haves.append(RNS.Identity.full_hash(lxmf_data))
# Return a list of successfully received messages to the node.
@ -1556,6 +1560,7 @@ class LXMRouter:
self.propagation_transfer_state = LXMRouter.PR_COMPLETE
self.propagation_transfer_progress = 1.0
self.propagation_transfer_last_duplicates = duplicates
self.propagation_transfer_last_result = len(request_receipt.response)
self.save_locally_delivered_transient_ids()
@ -1674,11 +1679,14 @@ class LXMRouter:
def get_outbound_lxm_stamp_cost(self, lxm_hash):
for lxm in self.pending_outbound:
if lxm.hash == lxm_hash:
return lxm.stamp_cost
if lxm.outbound_ticket: return None
else: return lxm.stamp_cost
for lxm_id in self.pending_deferred_stamps:
if self.pending_deferred_stamps[lxm_id].hash == lxm_hash:
return self.pending_deferred_stamps[lxm_id].stamp_cost
lxm = self.pending_deferred_stamps[lxm_id]
if lxm.outbound_ticket: return None
else: return lxm.stamp_cost
return None
@ -1689,7 +1697,7 @@ class LXMRouter:
for lxm_id in self.pending_deferred_stamps:
if self.pending_deferred_stamps[lxm_id].hash == lxm_hash:
return self.pending_deferred_stamps[lxm_id].stamp_cost
return self.pending_deferred_stamps[lxm_id].propagation_target_cost
return None

View file

@ -758,7 +758,8 @@ def get_status(remote=None, configdir=None, rnsconfigdir=None, verbosity=0, quie
ls = "never synced"
sstr = RNS.prettyspeed(p["str"]); sler = RNS.prettyspeed(p["ler"])
stl = RNS.prettysize(p["transfer_limit"]*1000); ssl = RNS.prettysize(p["sync_limit"]*1000)
stl = RNS.prettysize(p["transfer_limit"]*1000) if p["transfer_limit"] else "Unknown"
ssl = RNS.prettysize(p["sync_limit"]*1000) if p["sync_limit"] else "unknown"
srxb = RNS.prettysize(p["rx_bytes"]); stxb = RNS.prettysize(p["tx_bytes"]); pmo = pm["offered"]; pmout = pm["outgoing"]
pmi = pm["incoming"]; pmuh = pm["unhandled"]; ar = round(p["acceptance_rate"]*100, 2)
if p["name"] == None: nn = ""