MCPcopy Create free account
hub / github.com/ElementsProject/elements / AppInitBasicSetup

Function AppInitBasicSetup

src/init.cpp:807–850  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

805};
806
807bool AppInitBasicSetup(const ArgsManager& args)
808{
809 // ********************************************************* Step 1: setup
810#ifdef _MSC_VER
811 // Turn off Microsoft heap dump noise
812 _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE);
813 _CrtSetReportFile(_CRT_WARN, CreateFileA("NUL", GENERIC_WRITE, 0, nullptr, OPEN_EXISTING, 0, 0));
814 // Disable confusing "helpful" text message on abort, Ctrl-C
815 _set_abort_behavior(0, _WRITE_ABORT_MSG | _CALL_REPORTFAULT);
816#endif
817#ifdef WIN32
818 // Enable heap terminate-on-corruption
819 HeapSetInformation(nullptr, HeapEnableTerminationOnCorruption, nullptr, 0);
820#endif
821 if (!InitShutdownState()) {
822 return InitError(Untranslated("Initializing wait-for-shutdown state failed."));
823 }
824
825 if (!SetupNetworking()) {
826 return InitError(Untranslated("Initializing networking failed."));
827 }
828
829#ifndef WIN32
830 if (!args.GetBoolArg("-sysperms", false)) {
831 umask(077);
832 }
833
834 // Clean shutdown on SIGTERM
835 registerSignalHandler(SIGTERM, HandleSIGTERM);
836 registerSignalHandler(SIGINT, HandleSIGTERM);
837
838 // Reopen debug.log on SIGHUP
839 registerSignalHandler(SIGHUP, HandleSIGHUP);
840
841 // Ignore SIGPIPE, otherwise it will bring the daemon down if the client closes unexpectedly
842 signal(SIGPIPE, SIG_IGN);
843#else
844 SetConsoleCtrlHandler(consoleCtrlHandler, true);
845#endif
846
847 std::set_new_handler(new_handler_terminate);
848
849 return true;
850}
851
852bool AppInitParameterInteraction(const ArgsManager& args)
853{

Callers 2

AppInitFunction · 0.85
baseInitializeMethod · 0.85

Calls 6

InitShutdownStateFunction · 0.85
InitErrorFunction · 0.85
UntranslatedFunction · 0.85
SetupNetworkingFunction · 0.85
registerSignalHandlerFunction · 0.85
GetBoolArgMethod · 0.80

Tested by

no test coverage detected