From 19f0fa77242cfdf2f3a05b1fc52cd4ad4ccdf68d Mon Sep 17 00:00:00 2001 From: Mark Qvist Date: Fri, 4 Oct 2024 11:22:39 +0200 Subject: [PATCH] Don't try creating LXMF peer destination until identity is resolved. Fixes #19. --- LXMF/LXMPeer.py | 10 +++++++--- LXMF/_version.py | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/LXMF/LXMPeer.py b/LXMF/LXMPeer.py index a0b61a5..0962b26 100644 --- a/LXMF/LXMPeer.py +++ b/LXMF/LXMPeer.py @@ -108,7 +108,10 @@ class LXMPeer: self.router = router self.destination_hash = destination_hash self.identity = RNS.Identity.recall(destination_hash) - self.destination = RNS.Destination(self.identity, RNS.Destination.OUT, RNS.Destination.SINGLE, APP_NAME, "propagation") + if self.identity != None: + self.destination = RNS.Destination(self.identity, RNS.Destination.OUT, RNS.Destination.SINGLE, APP_NAME, "propagation") + else: + RNS.log(f"Could not recall identity for LXMF propagation peer {RNS.prettyhexrep(self.destination_hash)}, will retry identity resolution on next sync", RNS.LOG_WARNING) def sync(self): RNS.log("Initiating LXMF Propagation Node sync with peer "+RNS.prettyhexrep(self.destination_hash), RNS.LOG_DEBUG) @@ -126,9 +129,10 @@ class LXMPeer: else: if self.identity == None: self.identity = RNS.Identity.recall(destination_hash) - self.destination = RNS.Destination(self.identity, RNS.Destination.OUT, RNS.Destination.SINGLE, APP_NAME, "propagation") + if self.identity != None: + self.destination = RNS.Destination(self.identity, RNS.Destination.OUT, RNS.Destination.SINGLE, APP_NAME, "propagation") - if self.identity != None: + if self.destination != None: if len(self.unhandled_messages) > 0: if self.state == LXMPeer.IDLE: RNS.log("Establishing link for sync to peer "+RNS.prettyhexrep(self.destination_hash)+"...", RNS.LOG_DEBUG) diff --git a/LXMF/_version.py b/LXMF/_version.py index 6b27eee..86716a7 100644 --- a/LXMF/_version.py +++ b/LXMF/_version.py @@ -1 +1 @@ -__version__ = "0.5.4" +__version__ = "0.5.5"