Added table persist on local client disconnect

pull/154/head
Mark Qvist 2022-09-13 22:32:00 +02:00
rodzic 81e0989070
commit 921987c999
3 zmienionych plików z 7 dodań i 1 usunięć

Wyświetl plik

@ -110,7 +110,9 @@ class Identity:
def save_known_destinations():
# TODO: Improve the storage method so we don't have to
# deserialize and serialize the entire table on every
# save, but the only changes.
# save, but the only changes. It might be possible to
# simply overwrite on exit now that every local client
# disconnect triggers a data persist.
try:
if hasattr(Identity, "saving_known_destinations"):

Wyświetl plik

@ -246,6 +246,7 @@ class LocalClientInterface(Interface):
RNS.Transport.local_client_interfaces.remove(self)
if hasattr(self, "parent_interface") and self.parent_interface != None:
self.parent_interface.clients -= 1
RNS.Transport.owner._should_persist_data()
if nowarning == False:
RNS.log("The interface "+str(self)+" experienced an unrecoverable error and is being torn down. Restart Reticulum to attempt to open this interface again.", RNS.LOG_ERROR)

Wyświetl plik

@ -938,6 +938,9 @@ class Reticulum:
RNS.Transport.interfaces.append(interface)
def _should_persist_data(self):
self.__persist_data()
def __persist_data(self):
RNS.Transport.persist_data()
RNS.Identity.persist_data()