Changeset View
Changeset View
Standalone View
Standalone View
src/init.cpp
Show First 20 Lines • Show All 1,727 Lines • ▼ Show 20 Lines | bool AppInitSanityChecks() { | ||||
// Sanity check | // Sanity check | ||||
if (!InitSanityCheck()) { | if (!InitSanityCheck()) { | ||||
return InitError(strprintf( | return InitError(strprintf( | ||||
_("Initialization sanity check failed. %s is shutting down."), | _("Initialization sanity check failed. %s is shutting down."), | ||||
_(PACKAGE_NAME))); | _(PACKAGE_NAME))); | ||||
} | } | ||||
// Probe the data directory lock to give an early error message, if possible | // Probe the data directory lock to give an early error message, if possible | ||||
// We cannot hold the data directory lock here, as the forking for daemon() | |||||
// hasn't yet happened, and a fork will cause weird behavior to it. | |||||
return LockDataDirectory(true); | return LockDataDirectory(true); | ||||
} | } | ||||
bool AppInitMain(Config &config, | bool AppInitLockDataDirectory() { | ||||
HTTPRPCRequestProcessor &httpRPCRequestProcessor, | |||||
boost::thread_group &threadGroup, CScheduler &scheduler) { | |||||
const CChainParams &chainparams = config.GetChainParams(); | |||||
// Step 4a: application initialization | |||||
// After daemonization get the data directory lock again and hold on to it | // After daemonization get the data directory lock again and hold on to it | ||||
// until exit. This creates a slight window for a race condition to happen, | // until exit. This creates a slight window for a race condition to happen, | ||||
// however this condition is harmless: it will at most make us exit without | // however this condition is harmless: it will at most make us exit without | ||||
// printing a message to console. | // printing a message to console. | ||||
if (!LockDataDirectory(false)) { | if (!LockDataDirectory(false)) { | ||||
// Detailed error printed inside LockDataDirectory | // Detailed error printed inside LockDataDirectory | ||||
return false; | return false; | ||||
} | } | ||||
return true; | |||||
} | |||||
bool AppInitMain(Config &config, | |||||
HTTPRPCRequestProcessor &httpRPCRequestProcessor, | |||||
boost::thread_group &threadGroup, CScheduler &scheduler) { | |||||
// Step 4a: application initialization | |||||
const CChainParams &chainparams = config.GetChainParams(); | |||||
#ifndef WIN32 | #ifndef WIN32 | ||||
CreatePidFile(GetPidFile(), getpid()); | CreatePidFile(GetPidFile(), getpid()); | ||||
#endif | #endif | ||||
BCLog::Logger &logger = GetLogger(); | BCLog::Logger &logger = GetLogger(); | ||||
bool default_shrinkdebugfile = logger.DefaultShrinkDebugFile(); | bool default_shrinkdebugfile = logger.DefaultShrinkDebugFile(); | ||||
▲ Show 20 Lines • Show All 594 Lines • Show Last 20 Lines |