From 078d76c6f38f13741cc240e17f922b1e1ccff952 Mon Sep 17 00:00:00 2001 From: R4SAS Date: Sun, 26 Jun 2022 01:38:42 +0300 Subject: [PATCH] fix tabulation, remove long description (to be moved to documentation) Signed-off-by: R4SAS --- daemon/UnixDaemon.cpp | 60 +++++++++++++++++++++---------------------- libi2pd/Config.cpp | 16 ++++-------- 2 files changed, 35 insertions(+), 41 deletions(-) diff --git a/daemon/UnixDaemon.cpp b/daemon/UnixDaemon.cpp index ba5dec90..e6bad5a0 100644 --- a/daemon/UnixDaemon.cpp +++ b/daemon/UnixDaemon.cpp @@ -55,15 +55,15 @@ void handle_signal(int sig) case SIGPIPE: LogPrint(eLogInfo, "SIGPIPE received"); break; - case SIGTSTP: - LogPrint(eLogInfo, "Daemon: Got SIGTSTP, disconnecting from network..."); - i2p::transport::transports.SetOnline(false); - break; - case SIGCONT: - LogPrint(eLogInfo, "Daemon: Got SIGCONT, restoring connection to network..."); - i2p::transport::transports.SetOnline(true); - break; - } + case SIGTSTP: + LogPrint(eLogInfo, "Daemon: Got SIGTSTP, disconnecting from network..."); + i2p::transport::transports.SetOnline(false); + break; + case SIGCONT: + LogPrint(eLogInfo, "Daemon: Got SIGCONT, restoring connection to network..."); + i2p::transport::transports.SetOnline(true); + break; + } } namespace i2p @@ -180,27 +180,27 @@ namespace i2p } gracefulShutdownInterval = 0; // not specified - // handle signal TSTP - bool handleTSTP; i2p::config::GetOption("unix.handle_sigtstp", handleTSTP); - - // Signal handler - struct sigaction sa; - sa.sa_handler = handle_signal; - sigemptyset(&sa.sa_mask); - sa.sa_flags = SA_RESTART; - sigaction(SIGHUP, &sa, 0); - sigaction(SIGUSR1, &sa, 0); - sigaction(SIGABRT, &sa, 0); - sigaction(SIGTERM, &sa, 0); - sigaction(SIGINT, &sa, 0); - sigaction(SIGPIPE, &sa, 0); - if (handleTSTP) - { - sigaction(SIGTSTP, &sa, 0); - sigaction(SIGCONT, &sa, 0); - } - - return Daemon_Singleton::start(); + // handle signal TSTP + bool handleTSTP; i2p::config::GetOption("unix.handle_sigtstp", handleTSTP); + + // Signal handler + struct sigaction sa; + sa.sa_handler = handle_signal; + sigemptyset(&sa.sa_mask); + sa.sa_flags = SA_RESTART; + sigaction(SIGHUP, &sa, 0); + sigaction(SIGUSR1, &sa, 0); + sigaction(SIGABRT, &sa, 0); + sigaction(SIGTERM, &sa, 0); + sigaction(SIGINT, &sa, 0); + sigaction(SIGPIPE, &sa, 0); + if (handleTSTP) + { + sigaction(SIGTSTP, &sa, 0); + sigaction(SIGCONT, &sa, 0); + } + + return Daemon_Singleton::start(); } bool DaemonLinux::stop() diff --git a/libi2pd/Config.cpp b/libi2pd/Config.cpp index 16ee6503..56da9b7c 100644 --- a/libi2pd/Config.cpp +++ b/libi2pd/Config.cpp @@ -312,18 +312,12 @@ namespace config { ; #ifdef __linux__ - options_description unix_specific("UNIX-specific options"); - unix_specific.add_options() - ("unix.handle_sigtstp", bool_switch()->default_value(false), - "Switch to offline mode if received signal TSTP (SIGTSTP)" - "(you can send it by pressing CTRL+Z in terminal or with" - " help commapnd kill and others, a.e pkill, if i2pd in " - "daemon mode). If you need to switch to online mode, send" - " signal CONT (SIGCONT)") - ; + options_description unix_specific("UNIX-specific options"); + unix_specific.add_options() + ("unix.handle_sigtstp", bool_switch()->default_value(false), "Handle SIGTSTP and SIGCONT signals (default: disabled)") + ; #endif - m_OptionsDesc .add(general) .add(limits) @@ -348,7 +342,7 @@ namespace config { .add(cpuext) .add(meshnets) #ifdef __linux__ - .add(unix_specific) + .add(unix_specific) #endif ; }