Added error handling to lxmf.delivery announce handler. Fixes #30. Hopefully.

pull/34/head
Mark Qvist 2023-08-13 20:37:44 +02:00
parent b6e6c4bd3d
commit 3d0043499c
2 changed files with 14 additions and 9 deletions

View File

@ -34,16 +34,21 @@ class Directory:
aspect_filter = "nomadnetwork.node"
@staticmethod
def received_announce(destination_hash, announced_identity, app_data):
app = nomadnet.NomadNetworkApp.get_shared_instance()
try:
app = nomadnet.NomadNetworkApp.get_shared_instance()
if not destination_hash in app.ignored_list:
associated_peer = RNS.Destination.hash_from_name_and_identity("lxmf.delivery", announced_identity)
if not destination_hash in app.ignored_list:
associated_peer = RNS.Destination.hash_from_name_and_identity("lxmf.delivery", announced_identity)
app.directory.node_announce_received(destination_hash, app_data, associated_peer)
app.autoselect_propagation_node()
else:
RNS.log("Ignored announce from "+RNS.prettyhexrep(destination_hash), RNS.LOG_DEBUG)
app.directory.node_announce_received(destination_hash, app_data, associated_peer)
app.autoselect_propagation_node()
else:
RNS.log("Ignored announce from "+RNS.prettyhexrep(destination_hash), RNS.LOG_DEBUG)
except Exception as e:
RNS.log("Error while evaluating LXMF destination announce, ignoring announce.", RNS.LOG_DEBUG)
RNS.log("The contained exception was: "+str(e), RNS.LOG_DEBUG)
def __init__(self, app):

View File

@ -30,6 +30,6 @@ setuptools.setup(
entry_points= {
'console_scripts': ['nomadnet=nomadnet.nomadnet:main']
},
install_requires=["rns>=0.5.5", "lxmf>=0.3.2", "urwid>=2.1.2", "qrcode"],
install_requires=["rns>=0.5.7", "lxmf>=0.3.2", "urwid>=2.1.2", "qrcode"],
python_requires=">=3.6",
)