mirror of
https://github.com/markqvist/LXMF
synced 2026-11-23 15:30:42 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
137db1e6a3 | ||
|
|
5e8b2d87af | ||
|
|
38b6f7651c | ||
|
|
6aa793252f | ||
|
|
1ca2493c36 | ||
|
|
38bbf19421 | ||
|
|
776e72d0ba | ||
|
|
29f6089967 |
No files matched your search
+36
-9
@@ -796,14 +796,16 @@ class LXMPeer:
|
||||
return "<Unknown>"
|
||||
|
||||
class LXMRouter:
|
||||
MAX_DELIVERY_ATTEMPTS = 3
|
||||
MAX_DELIVERY_ATTEMPTS = 4
|
||||
PROCESSING_INTERVAL = 5
|
||||
DELIVERY_RETRY_WAIT = 15
|
||||
DELIVERY_RETRY_WAIT = 12
|
||||
PATH_REQUEST_WAIT = 5
|
||||
LINK_MAX_INACTIVITY = 10*60
|
||||
|
||||
MESSAGE_EXPIRY = 30*24*60*60
|
||||
|
||||
NODE_ANNOUNCE_DELAY = 20
|
||||
|
||||
AUTOPEER = True
|
||||
AUTOPEER_MAXDEPTH = 4
|
||||
|
||||
@@ -814,8 +816,9 @@ class LXMRouter:
|
||||
PR_LINK_ESTABLISHING = 0x02
|
||||
PR_LINK_ESTABLISHED = 0x03
|
||||
PR_REQUEST_SENT = 0x04
|
||||
PR_RESPONSE_RECEIVED = 0x05
|
||||
PR_COMPLETE = 0x06
|
||||
PR_RECEIVING = 0x05
|
||||
PR_RESPONSE_RECEIVED = 0x06
|
||||
PR_COMPLETE = 0x07
|
||||
|
||||
PR_ALL_MESSAGES = 0x00
|
||||
|
||||
@@ -973,6 +976,7 @@ class LXMRouter:
|
||||
response_callback=self.message_list_response,
|
||||
failed_callback=self.message_get_failed
|
||||
)
|
||||
self.propagation_transfer_state = LXMRouter.PR_REQUEST_SENT
|
||||
else:
|
||||
if self.outbound_propagation_link == None:
|
||||
if RNS.Transport.has_path(self.outbound_propagation_node):
|
||||
@@ -1057,6 +1061,7 @@ class LXMRouter:
|
||||
self.propagation_transfer_last_result = 0
|
||||
|
||||
def message_get_progress(self, request_receipt):
|
||||
self.propagation_transfer_state = LXMRouter.PR_RECEIVING
|
||||
self.propagation_transfer_progress = request_receipt.get_progress()
|
||||
|
||||
def message_get_response(self, request_receipt):
|
||||
@@ -1225,8 +1230,14 @@ class LXMRouter:
|
||||
self.announce_propagation_node()
|
||||
|
||||
def announce_propagation_node(self):
|
||||
data = msgpack.packb([self.propagation_node, int(time.time())])
|
||||
self.propagation_destination.announce(app_data=data)
|
||||
def delayed_announce():
|
||||
time.sleep(LXMRouter.NODE_ANNOUNCE_DELAY)
|
||||
data = msgpack.packb([self.propagation_node, int(time.time())])
|
||||
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):
|
||||
if remote_identity == None:
|
||||
@@ -1562,7 +1573,12 @@ class LXMRouter:
|
||||
|
||||
for peer in culled_peers:
|
||||
RNS.log("Removing peer "+RNS.prettyhexrep(peer)+" due to excessive unreachability", RNS.LOG_WARNING)
|
||||
self.peers.pop(peer_id)
|
||||
try:
|
||||
# TODO: Check this
|
||||
if peer_id in self.peers:
|
||||
self.peers.pop(peer_id)
|
||||
except Exception as e:
|
||||
RNS.log("Error while removing peer "+RNS.prettyhexrep(peer_id)+". The contained exception was: "+str(e), RNS.LOG_ERROR)
|
||||
|
||||
|
||||
def fail_message(self, lxmessage):
|
||||
@@ -1621,7 +1637,18 @@ class LXMRouter:
|
||||
else:
|
||||
RNS.log("Waiting for proof for "+str(lxmessage)+" sent as link packet", RNS.LOG_DEBUG)
|
||||
elif direct_link.status == RNS.Link.CLOSED:
|
||||
RNS.log("The link to "+RNS.prettyhexrep(lxmessage.get_destination().hash)+" was closed", RNS.LOG_DEBUG)
|
||||
if direct_link.activated_at != None:
|
||||
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)
|
||||
self.direct_links.pop(delivery_destination_hash)
|
||||
lxmessage.next_delivery_attempt = time.time() + LXMRouter.DELIVERY_RETRY_WAIT
|
||||
@@ -1704,4 +1731,4 @@ class LXMRouter:
|
||||
|
||||
else:
|
||||
RNS.log("Max delivery attempts reached for propagated "+str(lxmessage)+" to "+RNS.prettyhexrep(lxmessage.get_destination().hash), RNS.LOG_DEBUG)
|
||||
self.fail_message(lxmessage)
|
||||
self.fail_message(lxmessage)
|
||||
@@ -0,0 +1,23 @@
|
||||
all: release
|
||||
|
||||
clean:
|
||||
@echo Cleaning...
|
||||
-rm -r ./build
|
||||
-rm -r ./dist
|
||||
|
||||
remove_symlinks:
|
||||
@echo Removing symlinks for build...
|
||||
-rm ./RNS
|
||||
|
||||
create_symlinks:
|
||||
@echo Creating symlinks...
|
||||
-ln -s ../Reticulum/RNS ./
|
||||
|
||||
build_wheel:
|
||||
python3 setup.py sdist bdist_wheel
|
||||
|
||||
release: remove_symlinks build_wheel create_symlinks
|
||||
|
||||
upload:
|
||||
@echo Uploading to PyPi...
|
||||
twine upload dist/*
|
||||
@@ -5,7 +5,7 @@ with open("README.md", "r") as fh:
|
||||
|
||||
setuptools.setup(
|
||||
name="lxmf",
|
||||
version="0.1.1",
|
||||
version="0.1.3",
|
||||
author="Mark Qvist",
|
||||
author_email="mark@unsigned.io",
|
||||
description="Lightweight Extensible Message Format for Reticulum",
|
||||
@@ -18,6 +18,6 @@ setuptools.setup(
|
||||
"License :: OSI Approved :: MIT License",
|
||||
"Operating System :: OS Independent",
|
||||
],
|
||||
install_requires=['rns>=0.2.8'],
|
||||
install_requires=['rns>=0.3.0'],
|
||||
python_requires='>=3.6',
|
||||
)
|
||||
)
|
||||
Reference in new issue
Block a user