Don't try creating LXMF peer destination until identity is resolved. Fixes #19.

This commit is contained in:
Mark Qvist 2024-10-04 11:22:39 +02:00
parent eefb1c8349
commit 19f0fa7724
2 changed files with 8 additions and 4 deletions

View File

@ -108,7 +108,10 @@ class LXMPeer:
self.router = router self.router = router
self.destination_hash = destination_hash self.destination_hash = destination_hash
self.identity = RNS.Identity.recall(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): def sync(self):
RNS.log("Initiating LXMF Propagation Node sync with peer "+RNS.prettyhexrep(self.destination_hash), RNS.LOG_DEBUG) RNS.log("Initiating LXMF Propagation Node sync with peer "+RNS.prettyhexrep(self.destination_hash), RNS.LOG_DEBUG)
@ -126,9 +129,10 @@ class LXMPeer:
else: else:
if self.identity == None: if self.identity == None:
self.identity = RNS.Identity.recall(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")
if self.identity != None: if self.destination != None:
if len(self.unhandled_messages) > 0: if len(self.unhandled_messages) > 0:
if self.state == LXMPeer.IDLE: if self.state == LXMPeer.IDLE:
RNS.log("Establishing link for sync to peer "+RNS.prettyhexrep(self.destination_hash)+"...", RNS.LOG_DEBUG) RNS.log("Establishing link for sync to peer "+RNS.prettyhexrep(self.destination_hash)+"...", RNS.LOG_DEBUG)

View File

@ -1 +1 @@
__version__ = "0.5.4" __version__ = "0.5.5"