mirror of
https://github.com/markqvist/LXMF.git
synced 2025-03-01 11:31:26 -05:00
Added path request retry on link initial link failure
This commit is contained in:
parent
5e8b2d87af
commit
137db1e6a3
23
LXMF/LXMF.py
23
LXMF/LXMF.py
@ -796,14 +796,16 @@ class LXMPeer:
|
|||||||
return "<Unknown>"
|
return "<Unknown>"
|
||||||
|
|
||||||
class LXMRouter:
|
class LXMRouter:
|
||||||
MAX_DELIVERY_ATTEMPTS = 3
|
MAX_DELIVERY_ATTEMPTS = 4
|
||||||
PROCESSING_INTERVAL = 5
|
PROCESSING_INTERVAL = 5
|
||||||
DELIVERY_RETRY_WAIT = 15
|
DELIVERY_RETRY_WAIT = 12
|
||||||
PATH_REQUEST_WAIT = 5
|
PATH_REQUEST_WAIT = 5
|
||||||
LINK_MAX_INACTIVITY = 10*60
|
LINK_MAX_INACTIVITY = 10*60
|
||||||
|
|
||||||
MESSAGE_EXPIRY = 30*24*60*60
|
MESSAGE_EXPIRY = 30*24*60*60
|
||||||
|
|
||||||
|
NODE_ANNOUNCE_DELAY = 20
|
||||||
|
|
||||||
AUTOPEER = True
|
AUTOPEER = True
|
||||||
AUTOPEER_MAXDEPTH = 4
|
AUTOPEER_MAXDEPTH = 4
|
||||||
|
|
||||||
@ -1228,9 +1230,15 @@ class LXMRouter:
|
|||||||
self.announce_propagation_node()
|
self.announce_propagation_node()
|
||||||
|
|
||||||
def announce_propagation_node(self):
|
def announce_propagation_node(self):
|
||||||
|
def delayed_announce():
|
||||||
|
time.sleep(LXMRouter.NODE_ANNOUNCE_DELAY)
|
||||||
data = msgpack.packb([self.propagation_node, int(time.time())])
|
data = msgpack.packb([self.propagation_node, int(time.time())])
|
||||||
self.propagation_destination.announce(app_data=data)
|
self.propagation_destination.announce(app_data=data)
|
||||||
|
|
||||||
|
da_thread = threading.Thread(target=delayed_announce)
|
||||||
|
da_thread.setDaemon(True)
|
||||||
|
da_thread.start()
|
||||||
|
|
||||||
def offer_request(self, path, data, request_id, remote_identity, requested_at):
|
def offer_request(self, path, data, request_id, remote_identity, requested_at):
|
||||||
if remote_identity == None:
|
if remote_identity == None:
|
||||||
return LXMPeer.ERROR_NO_IDENTITY
|
return LXMPeer.ERROR_NO_IDENTITY
|
||||||
@ -1629,7 +1637,18 @@ class LXMRouter:
|
|||||||
else:
|
else:
|
||||||
RNS.log("Waiting for proof for "+str(lxmessage)+" sent as link packet", RNS.LOG_DEBUG)
|
RNS.log("Waiting for proof for "+str(lxmessage)+" sent as link packet", RNS.LOG_DEBUG)
|
||||||
elif direct_link.status == RNS.Link.CLOSED:
|
elif direct_link.status == RNS.Link.CLOSED:
|
||||||
|
if direct_link.activated_at != None:
|
||||||
RNS.log("The link to "+RNS.prettyhexrep(lxmessage.get_destination().hash)+" was closed", RNS.LOG_DEBUG)
|
RNS.log("The link to "+RNS.prettyhexrep(lxmessage.get_destination().hash)+" was closed", RNS.LOG_DEBUG)
|
||||||
|
else:
|
||||||
|
if not hasattr(lxmessage, "path_request_retried"):
|
||||||
|
RNS.log("The link to "+RNS.prettyhexrep(lxmessage.get_destination().hash)+" was never activated, retrying path request...", RNS.LOG_DEBUG)
|
||||||
|
RNS.Transport.request_path(lxmessage.get_destination().hash)
|
||||||
|
lxmessage.path_request_retried = True
|
||||||
|
else:
|
||||||
|
RNS.log("The link to "+RNS.prettyhexrep(lxmessage.get_destination().hash)+" was never activated", RNS.LOG_DEBUG)
|
||||||
|
|
||||||
|
lxmessage.next_delivery_attempt = time.time() + LXMRouter.PATH_REQUEST_WAIT
|
||||||
|
|
||||||
lxmessage.set_delivery_destination(None)
|
lxmessage.set_delivery_destination(None)
|
||||||
self.direct_links.pop(delivery_destination_hash)
|
self.direct_links.pop(delivery_destination_hash)
|
||||||
lxmessage.next_delivery_attempt = time.time() + LXMRouter.DELIVERY_RETRY_WAIT
|
lxmessage.next_delivery_attempt = time.time() + LXMRouter.DELIVERY_RETRY_WAIT
|
||||||
|
Loading…
x
Reference in New Issue
Block a user