Skip to content

Commit

Permalink
Merge branch 'master' into feature/dtokenrestart
Browse files Browse the repository at this point in the history
  • Loading branch information
Bushstar authored Sep 6, 2024
2 parents 77d06e1 + ca158f5 commit e695e17
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions src/defid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -224,16 +224,16 @@ static bool AppInit(int argc, char* argv[])
// InitError will have been called with detailed error, which ends up on console
return false;
}
if (gArgs.GetBoolArg("-daemon", DEFAULT_DAEMON) || gArgs.GetBoolArg("-daemonnowait", DEFAULT_DAEMONNOWAIT))
if (gArgs.GetBoolArg("-daemon", false) || gArgs.GetBoolArg("-daemonwait", DEFAULT_DAEMONWAIT))
{
#if HAVE_DECL_FORK
tfm::format(std::cout, PACKAGE_NAME " starting\n");

// Daemonize
switch (fork_daemon(1, 0, daemon_ep)) { // don't chdir (1), do close FDs (0)
case 0: // Child: continue.
// If -daemon is not enabled, immediately send a success token the parent.
if (!gArgs.GetBoolArg("-daemon", DEFAULT_DAEMON)) {
// If -daemonwait is not enabled, immediately send a success token the parent.
if (!gArgs.GetBoolArg("-daemonwait", DEFAULT_DAEMONWAIT)) {
daemon_ep.TokenWrite(1);
daemon_ep.Close();
}
Expand Down
6 changes: 3 additions & 3 deletions src/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -682,11 +682,11 @@ void SetupServerArgs()


#if HAVE_DECL_FORK
gArgs.AddArg("-daemon", strprintf("Run in the background as a daemon and accept commands. Will wait until init is complete before returning. (default: %d)", DEFAULT_DAEMON), ArgsManager::ALLOW_BOOL, OptionsCategory::OPTIONS);
gArgs.AddArg("-daemonnowait", strprintf("Same as daemon but doesn't wait for init and returns immediately after forking (default: %d)", DEFAULT_DAEMONNOWAIT), ArgsManager::ALLOW_BOOL, OptionsCategory::OPTIONS);
gArgs.AddArg("-daemon", strprintf("Run in the background as a daemon and accept commands (default: %d)", DEFAULT_DAEMON), ArgsManager::ALLOW_BOOL, OptionsCategory::OPTIONS);
gArgs.AddArg("-daemonwait", strprintf("Wait for initialization to be finished before exiting. This implies -daemon (default: %d)", DEFAULT_DAEMONWAIT), ArgsManager::ALLOW_BOOL, OptionsCategory::OPTIONS);
#else
hidden_args.emplace_back("-daemon");
hidden_args.emplace_back("-daemonnowait");
hidden_args.emplace_back("-daemonwait");
#endif

RPCMetadata::SetupArgs(gArgs);
Expand Down
4 changes: 2 additions & 2 deletions src/init.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@

//! Default value for -daemon option
static constexpr bool DEFAULT_DAEMON = false;
//! Default value for -daemonnowait option
static constexpr bool DEFAULT_DAEMONNOWAIT = false;
//! Default value for -daemonwait option
static constexpr bool DEFAULT_DAEMONWAIT = false;

namespace interfaces {
class Chain;
Expand Down
2 changes: 1 addition & 1 deletion src/validation.h
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ static const int64_t DEFAULT_MAX_TIP_AGE = 10 * 60 * 60;
static const int64_t MAX_FEE_ESTIMATION_TIP_AGE = 10 * 60;

static const bool DEFAULT_CHECKPOINTS_ENABLED = true;
static const bool DEFAULT_TXINDEX = true;
static const bool DEFAULT_TXINDEX = false;
static const char *const DEFAULT_BLOCKFILTERINDEX = "0";
static const unsigned int DEFAULT_BANSCORE_THRESHOLD = 100;
/** Default for -persistmempool */
Expand Down

0 comments on commit e695e17

Please sign in to comment.