diff --git a/RNS/Identity.py b/RNS/Identity.py index 343fe48..390ddba 100644 --- a/RNS/Identity.py +++ b/RNS/Identity.py @@ -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"): diff --git a/RNS/Interfaces/LocalInterface.py b/RNS/Interfaces/LocalInterface.py index e0425d3..fb0f4cf 100644 --- a/RNS/Interfaces/LocalInterface.py +++ b/RNS/Interfaces/LocalInterface.py @@ -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) diff --git a/RNS/Reticulum.py b/RNS/Reticulum.py index 2e307ee..ce820b5 100755 --- a/RNS/Reticulum.py +++ b/RNS/Reticulum.py @@ -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()