mirror of
https://github.com/markqvist/LXMF.git
synced 2025-12-17 09:24:15 -05:00
Added more descriptive error if propagation node peers file is corrupt
This commit is contained in:
parent
a6f5a56a38
commit
694f2413ea
1 changed files with 10 additions and 3 deletions
|
|
@ -576,13 +576,20 @@ class LXMRouter:
|
||||||
RNS.log("Rebuilding peer synchronisation states...", RNS.LOG_NOTICE)
|
RNS.log("Rebuilding peer synchronisation states...", RNS.LOG_NOTICE)
|
||||||
st = time.time()
|
st = time.time()
|
||||||
|
|
||||||
if os.path.isfile(self.storagepath+"/peers"):
|
peers_storage_path = self.storagepath+"/peers"
|
||||||
peers_file = open(self.storagepath+"/peers", "rb")
|
if os.path.isfile(peers_storage_path):
|
||||||
|
peers_file = open(peers_storage_path, "rb")
|
||||||
peers_data = peers_file.read()
|
peers_data = peers_file.read()
|
||||||
peers_file.close()
|
peers_file.close()
|
||||||
|
|
||||||
if len(peers_data) > 0:
|
if len(peers_data) > 0:
|
||||||
serialised_peers = msgpack.unpackb(peers_data)
|
try: serialised_peers = msgpack.unpackb(peers_data)
|
||||||
|
except Exception as e:
|
||||||
|
RNS.log(f"Could not load propagation node peering data from storage. The contained exception was: {e}", RNS.LOG_ERROR)
|
||||||
|
RNS.log(f"The peering data file located at {peers_storage_path} is likely corrupt.", RNS.LOG_ERROR)
|
||||||
|
RNS.log(f"You can delete this file and attempt starting the propagation node again, but peer synchronization states will be lost.", RNS.LOG_ERROR)
|
||||||
|
raise e
|
||||||
|
|
||||||
del peers_data
|
del peers_data
|
||||||
|
|
||||||
while len(serialised_peers) > 0:
|
while len(serialised_peers) > 0:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue