Changeset View
Changeset View
Standalone View
Standalone View
src/bitcoind.cpp
Show First 20 Lines • Show All 133 Lines • ▼ Show 20 Lines | try { | ||||
exit(EXIT_FAILURE); | exit(EXIT_FAILURE); | ||||
} | } | ||||
} | } | ||||
// -server defaults to true for bitcoind but not for the GUI so do this | // -server defaults to true for bitcoind but not for the GUI so do this | ||||
// here | // here | ||||
gArgs.SoftSetBoolArg("-server", true); | gArgs.SoftSetBoolArg("-server", true); | ||||
// Set this early so that parameter interactions go to console | // Set this early so that parameter interactions go to console | ||||
InitLogging(); | ParameterSetup(); | ||||
InitParameterInteraction(); | if (!AppInitBase(config, rpcServer)) { | ||||
if (!AppInitBasicSetup()) { | |||||
// InitError will have been called with detailed error, which ends | // InitError will have been called with detailed error, which ends | ||||
// up on console | // up on console | ||||
exit(1); | exit(EXIT_FAILURE); | ||||
} | |||||
if (!AppInitParameterInteraction(config, rpcServer)) { | |||||
// InitError will have been called with detailed error, which ends | |||||
// up on console | |||||
exit(1); | |||||
} | |||||
if (!AppInitSanityChecks()) { | |||||
// InitError will have been called with detailed error, which ends | |||||
// up on console | |||||
exit(1); | |||||
} | } | ||||
if (gArgs.GetBoolArg("-daemon", false)) { | if (gArgs.GetBoolArg("-daemon", false)) { | ||||
#if HAVE_DECL_DAEMON | #if HAVE_DECL_DAEMON | ||||
fprintf(stdout, "Bitcoin server starting\n"); | fprintf(stdout, "Bitcoin server starting\n"); | ||||
// Daemonize | // Daemonize | ||||
if (daemon(1, 0)) { | if (daemon(1, 0)) { | ||||
// don't chdir (1), do close FDs (0) | // don't chdir (1), do close FDs (0) | ||||
fprintf(stderr, "Error: daemon() failed: %s\n", | fprintf(stderr, "Error: daemon() failed: %s\n", | ||||
strerror(errno)); | strerror(errno)); | ||||
return false; | return false; | ||||
} | } | ||||
#else | #else | ||||
fprintf( | fprintf( | ||||
stderr, | stderr, | ||||
"Error: -daemon is not supported on this operating system\n"); | "Error: -daemon is not supported on this operating system\n"); | ||||
return false; | return false; | ||||
#endif // HAVE_DECL_DAEMON | #endif // HAVE_DECL_DAEMON | ||||
} | } | ||||
// Lock data directory after daemonization | |||||
Fabien: I don't know what the reason is for this comment, but the changes break this assumption.
Did… | |||||
schancelAuthorUnsubmitted Done Inline ActionsI don't see how this matters at all. deamonization does a double fork, and will inherit the lock. schancel: I don't see how this matters at all. deamonization does a double fork, and will inherit the… | |||||
if (!AppInitLockDataDirectory()) { | |||||
// If locking the data directory failed, exit immediately | |||||
exit(EXIT_FAILURE); | |||||
} | |||||
fRet = AppInitMain(config, httpRPCRequestProcessor, threadGroup, | fRet = AppInitMain(config, httpRPCRequestProcessor, threadGroup, | ||||
scheduler); | scheduler); | ||||
} catch (const std::exception &e) { | } catch (const std::exception &e) { | ||||
PrintExceptionContinue(&e, "AppInit()"); | PrintExceptionContinue(&e, "AppInit()"); | ||||
} catch (...) { | } catch (...) { | ||||
PrintExceptionContinue(nullptr, "AppInit()"); | PrintExceptionContinue(nullptr, "AppInit()"); | ||||
} | } | ||||
Show All 22 Lines |
I don't know what the reason is for this comment, but the changes break this assumption.
Did you look at the impact of moving the data dir lock before deamonization ?