mirror of
https://github.com/markqvist/Reticulum.git
synced 2024-11-26 23:40:18 +00:00
Added table persist on local client disconnect
This commit is contained in:
parent
81e0989070
commit
921987c999
@ -110,7 +110,9 @@ class Identity:
|
|||||||
def save_known_destinations():
|
def save_known_destinations():
|
||||||
# TODO: Improve the storage method so we don't have to
|
# TODO: Improve the storage method so we don't have to
|
||||||
# deserialize and serialize the entire table on every
|
# 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:
|
try:
|
||||||
if hasattr(Identity, "saving_known_destinations"):
|
if hasattr(Identity, "saving_known_destinations"):
|
||||||
|
@ -246,6 +246,7 @@ class LocalClientInterface(Interface):
|
|||||||
RNS.Transport.local_client_interfaces.remove(self)
|
RNS.Transport.local_client_interfaces.remove(self)
|
||||||
if hasattr(self, "parent_interface") and self.parent_interface != None:
|
if hasattr(self, "parent_interface") and self.parent_interface != None:
|
||||||
self.parent_interface.clients -= 1
|
self.parent_interface.clients -= 1
|
||||||
|
RNS.Transport.owner._should_persist_data()
|
||||||
|
|
||||||
if nowarning == False:
|
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)
|
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)
|
||||||
|
@ -938,6 +938,9 @@ class Reticulum:
|
|||||||
|
|
||||||
RNS.Transport.interfaces.append(interface)
|
RNS.Transport.interfaces.append(interface)
|
||||||
|
|
||||||
|
def _should_persist_data(self):
|
||||||
|
self.__persist_data()
|
||||||
|
|
||||||
def __persist_data(self):
|
def __persist_data(self):
|
||||||
RNS.Transport.persist_data()
|
RNS.Transport.persist_data()
|
||||||
RNS.Identity.persist_data()
|
RNS.Identity.persist_data()
|
||||||
|
Loading…
Reference in New Issue
Block a user