mirror of
https://github.com/markqvist/LXMF.git
synced 2025-03-21 22:36:34 -04:00
Added automatic path requests. Bumped version to 0.0.4.
This commit is contained in:
parent
4215bd186e
commit
5f578f93b3
17
LXMF/LXMF.py
17
LXMF/LXMF.py
@ -455,7 +455,7 @@ class LXMRouter:
|
|||||||
MAX_DELIVERY_ATTEMPTS = 3
|
MAX_DELIVERY_ATTEMPTS = 3
|
||||||
PROCESSING_INTERVAL = 5
|
PROCESSING_INTERVAL = 5
|
||||||
DELIVERY_RETRY_WAIT = 15
|
DELIVERY_RETRY_WAIT = 15
|
||||||
LINK_MAX_INACTIVITY = 30
|
LINK_MAX_INACTIVITY = 10*60
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.pending_inbound = []
|
self.pending_inbound = []
|
||||||
@ -597,7 +597,8 @@ class LXMRouter:
|
|||||||
closed_links.append(link_hash)
|
closed_links.append(link_hash)
|
||||||
|
|
||||||
for link_hash in closed_links:
|
for link_hash in closed_links:
|
||||||
self.direct_links.pop(link_hash)
|
cleaned_link = self.direct_links.pop(link_hash)
|
||||||
|
RNS.log("Cleaned link "+str(cleaned_link), RNS.LOG_DEBUG)
|
||||||
|
|
||||||
def fail_message(self, lxmessage):
|
def fail_message(self, lxmessage):
|
||||||
RNS.log(str(lxmessage)+" failed to send", RNS.LOG_DEBUG)
|
RNS.log(str(lxmessage)+" failed to send", RNS.LOG_DEBUG)
|
||||||
@ -665,10 +666,14 @@ class LXMRouter:
|
|||||||
lxmessage.delivery_attempts += 1
|
lxmessage.delivery_attempts += 1
|
||||||
lxmessage.next_delivery_attempt = time.time() + LXMRouter.DELIVERY_RETRY_WAIT
|
lxmessage.next_delivery_attempt = time.time() + LXMRouter.DELIVERY_RETRY_WAIT
|
||||||
if lxmessage.delivery_attempts < LXMRouter.MAX_DELIVERY_ATTEMPTS:
|
if lxmessage.delivery_attempts < LXMRouter.MAX_DELIVERY_ATTEMPTS:
|
||||||
RNS.log("Establishing link to "+RNS.prettyhexrep(lxmessage.get_destination().hash)+" for delivery attempt "+str(lxmessage.delivery_attempts)+" to "+RNS.prettyhexrep(lxmessage.get_destination().hash), RNS.LOG_DEBUG)
|
if RNS.Transport.has_path(lxmessage.get_destination().hash):
|
||||||
delivery_link = RNS.Link(lxmessage.get_destination())
|
RNS.log("Establishing link to "+RNS.prettyhexrep(lxmessage.get_destination().hash)+" for delivery attempt "+str(lxmessage.delivery_attempts)+" to "+RNS.prettyhexrep(lxmessage.get_destination().hash), RNS.LOG_DEBUG)
|
||||||
delivery_link.link_established_callback(self.process_outbound)
|
delivery_link = RNS.Link(lxmessage.get_destination())
|
||||||
self.direct_links[delivery_destination_hash] = delivery_link
|
delivery_link.link_established_callback(self.process_outbound)
|
||||||
|
self.direct_links[delivery_destination_hash] = delivery_link
|
||||||
|
else:
|
||||||
|
RNS.log("No path known for delivery attempt "+str(lxmessage.delivery_attempts)+" to "+RNS.prettyhexrep(lxmessage.get_destination().hash)+". Requesting path...", RNS.LOG_DEBUG)
|
||||||
|
RNS.Transport.request_path(lxmessage.get_destination().hash)
|
||||||
else:
|
else:
|
||||||
RNS.log("Max delivery attempts reached for direct "+str(lxmessage)+" to "+RNS.prettyhexrep(lxmessage.get_destination().hash), RNS.LOG_DEBUG)
|
RNS.log("Max delivery attempts reached for direct "+str(lxmessage)+" to "+RNS.prettyhexrep(lxmessage.get_destination().hash), RNS.LOG_DEBUG)
|
||||||
self.fail_message(lxmessage)
|
self.fail_message(lxmessage)
|
||||||
|
4
setup.py
4
setup.py
@ -5,7 +5,7 @@ with open("README.md", "r") as fh:
|
|||||||
|
|
||||||
setuptools.setup(
|
setuptools.setup(
|
||||||
name="lxmf",
|
name="lxmf",
|
||||||
version="0.0.2",
|
version="0.0.4",
|
||||||
author="Mark Qvist",
|
author="Mark Qvist",
|
||||||
author_email="mark@unsigned.io",
|
author_email="mark@unsigned.io",
|
||||||
description="Lightweight Extensible Message Format for Reticulum",
|
description="Lightweight Extensible Message Format for Reticulum",
|
||||||
@ -18,6 +18,6 @@ setuptools.setup(
|
|||||||
"License :: OSI Approved :: MIT License",
|
"License :: OSI Approved :: MIT License",
|
||||||
"Operating System :: OS Independent",
|
"Operating System :: OS Independent",
|
||||||
],
|
],
|
||||||
install_requires=['rns'],
|
install_requires=['rns>=0.2.0'],
|
||||||
python_requires='>=3.6',
|
python_requires='>=3.6',
|
||||||
)
|
)
|
Loading…
x
Reference in New Issue
Block a user