diff --git a/LXMF/LXMRouter.py b/LXMF/LXMRouter.py index 82f141d..c1903cd 100644 --- a/LXMF/LXMRouter.py +++ b/LXMF/LXMRouter.py @@ -1365,20 +1365,24 @@ class LXMRouter: self.save_node_stats() def sigint_handler(self, signal, frame): - if not self.exit_handler_running: - RNS.log("Received SIGINT, shutting down now!", RNS.LOG_WARNING) - self.exit_handler() - RNS.exit(0) + if threading.current_thread() != threading.main_thread(): os._exit(0) else: - RNS.log("Received SIGINT, but exit handler is running, keeping process alive until storage persist is complete", RNS.LOG_WARNING) + if not self.exit_handler_running: + RNS.log("Received SIGINT, shutting down now!", RNS.LOG_WARNING) + self.exit_handler() + RNS.exit(0) + else: + RNS.log("Received SIGINT, but exit handler is running, keeping process alive until storage persist is complete", RNS.LOG_WARNING) def sigterm_handler(self, signal, frame): - if not self.exit_handler_running: - RNS.log("Received SIGTERM, shutting down now!", RNS.LOG_WARNING) - self.exit_handler() - RNS.exit(0) + if threading.current_thread() != threading.main_thread(): os._exit(0) else: - RNS.log("Received SIGTERM, but exit handler is running, keeping process alive until storage persist is complete", RNS.LOG_WARNING) + if not self.exit_handler_running: + RNS.log("Received SIGTERM, shutting down now!", RNS.LOG_WARNING) + self.exit_handler() + RNS.exit(0) + else: + RNS.log("Received SIGTERM, but exit handler is running, keeping process alive until storage persist is complete", RNS.LOG_WARNING) def __str__(self): return "" diff --git a/LXMF/Utilities/lxmd.py b/LXMF/Utilities/lxmd.py index ab8e30f..4838189 100644 --- a/LXMF/Utilities/lxmd.py +++ b/LXMF/Utilities/lxmd.py @@ -319,11 +319,8 @@ def program_setup(configdir = None, rnsconfigdir = None, run_pn = False, on_inbo storagedir = configdir+"/storage" lxmdir = storagedir+"/messages" - if not os.path.isdir(storagedir): - os.makedirs(storagedir) - - if not os.path.isdir(lxmdir): - os.makedirs(lxmdir) + if not os.path.isdir(storagedir): os.makedirs(storagedir) + if not os.path.isdir(lxmdir): os.makedirs(lxmdir) if not os.path.isfile(configpath): RNS.log("Could not load config file, creating default configuration file...") @@ -351,6 +348,7 @@ def program_setup(configdir = None, rnsconfigdir = None, run_pn = False, on_inbo # Start Reticulum RNS.log("Substantiating Reticulum...") reticulum = RNS.Reticulum(configdir=rnsconfigdir, loglevel=targetloglevel, logdest=targetlogdest) + if targetlogdest == RNS.LOG_FILE: RNS.logfile = configdir+"/logfile" # Generate or load primary identity if os.path.isfile(identitypath): @@ -971,7 +969,7 @@ autopeer = yes # The maximum peering depth (in hops) for # automatically peered nodes. -autopeer_maxdepth = 4 +autopeer_maxdepth = 6 # The maximum amount of storage to use for # the LXMF Propagation Node message store,