Changeset View
Changeset View
Standalone View
Standalone View
src/bitcoind.cpp
Show First 20 Lines • Show All 118 Lines • ▼ Show 20 Lines | try { | ||||
// Error out when loose non-argument tokens are encountered on command | // Error out when loose non-argument tokens are encountered on command | ||||
// line | // line | ||||
for (int i = 1; i < argc; i++) { | for (int i = 1; i < argc; i++) { | ||||
if (!IsSwitchChar(argv[i][0])) { | if (!IsSwitchChar(argv[i][0])) { | ||||
fprintf(stderr, | fprintf(stderr, | ||||
"Error: Command line contains unexpected token '%s', " | "Error: Command line contains unexpected token '%s', " | ||||
"see bitcoind -h for a list of options.\n", | "see bitcoind -h for a list of options.\n", | ||||
argv[i]); | argv[i]); | ||||
exit(EXIT_FAILURE); | return false; | ||||
} | } | ||||
} | } | ||||
// -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(); | InitLogging(); | ||||
InitParameterInteraction(); | InitParameterInteraction(); | ||||
if (!AppInitBasicSetup()) { | 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); | return false; | ||||
} | } | ||||
if (!AppInitParameterInteraction(config, rpcServer)) { | if (!AppInitParameterInteraction(config, rpcServer)) { | ||||
// 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); | return false; | ||||
} | } | ||||
if (!AppInitSanityChecks()) { | if (!AppInitSanityChecks()) { | ||||
// 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); | return false; | ||||
} | } | ||||
if (gArgs.GetBoolArg("-daemon", false)) { | if (gArgs.GetBoolArg("-daemon", false)) { | ||||
#if HAVE_DECL_DAEMON | #if HAVE_DECL_DAEMON | ||||
#if defined(MAC_OSX) | #if defined(MAC_OSX) | ||||
#pragma GCC diagnostic push | #pragma GCC diagnostic push | ||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations" | #pragma GCC diagnostic ignored "-Wdeprecated-declarations" | ||||
#endif | #endif | ||||
fprintf(stdout, "Bitcoin server starting\n"); | fprintf(stdout, "Bitcoin server starting\n"); | ||||
Show All 14 Lines | #else | ||||
"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 | // Lock data directory after daemonization | ||||
if (!AppInitLockDataDirectory()) { | if (!AppInitLockDataDirectory()) { | ||||
// If locking the data directory failed, exit immediately | // If locking the data directory failed, exit immediately | ||||
exit(EXIT_FAILURE); | return false; | ||||
} | } | ||||
fRet = AppInitMain(config, httpRPCRequestProcessor); | fRet = AppInitMain(config, httpRPCRequestProcessor); | ||||
} 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 18 Lines |