From 8b9adca4461d0cb6bdfca7b74228d430b9b9d116 Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Fri, 20 Dec 2013 11:48:22 +0100 Subject: Allow `-noserver` with bitcoind Allow running bitcoind without server. - Default to -server mode (of course) for bitcoind with SoftSetBoolArg - Remove fForceServer argument from AppInit2 - Move fDaemon to a static variable in bitcoind --- src/bitcoind.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/bitcoind.cpp') diff --git a/src/bitcoind.cpp b/src/bitcoind.cpp index de71fde9b..5d8721884 100644 --- a/src/bitcoind.cpp +++ b/src/bitcoind.cpp @@ -30,6 +30,8 @@ * Use the buttons Namespaces, Classes or Files at the top of the page to start navigating the code. */ +static bool fDaemon; + void DetectShutdownThread(boost::thread_group* threadGroup) { bool fShutdown = ShutdownRequested(); @@ -108,6 +110,8 @@ bool AppInit(int argc, char* argv[]) fDaemon = GetBoolArg("-daemon", false); if (fDaemon) { + fprintf(stdout, "Bitcoin server starting\n"); + // Daemonize pid_t pid = fork(); if (pid < 0) @@ -127,9 +131,10 @@ bool AppInit(int argc, char* argv[]) fprintf(stderr, "Error: setsid() returned %d errno %d\n", sid, errno); } #endif + SoftSetBoolArg("-server", true); detectShutdownThread = new boost::thread(boost::bind(&DetectShutdownThread, &threadGroup)); - fRet = AppInit2(threadGroup, true); + fRet = AppInit2(threadGroup); } catch (std::exception& e) { PrintExceptionContinue(&e, "AppInit()"); -- cgit v1.2.3