Changeset View
Changeset View
Standalone View
Standalone View
src/init.cpp
Show First 20 Lines • Show All 78 Lines • ▼ Show 20 Lines | |||||
#endif | #endif | ||||
#include <cstdint> | #include <cstdint> | ||||
#include <cstdio> | #include <cstdio> | ||||
static const bool DEFAULT_PROXYRANDOMIZE = true; | static const bool DEFAULT_PROXYRANDOMIZE = true; | ||||
static const bool DEFAULT_REST_ENABLE = false; | static const bool DEFAULT_REST_ENABLE = false; | ||||
static const bool DEFAULT_STOPAFTERBLOCKIMPORT = false; | static const bool DEFAULT_STOPAFTERBLOCKIMPORT = false; | ||||
// Dump addresses to banlist.dat every 15 minutes (900s) | |||||
static constexpr int DUMP_BANS_INTERVAL = 60 * 15; | |||||
#ifdef WIN32 | #ifdef WIN32 | ||||
// Win32 LevelDB doesn't use filedescriptors, and the ones used for accessing | // Win32 LevelDB doesn't use filedescriptors, and the ones used for accessing | ||||
// block files don't count towards the fd_set size limit anyway. | // block files don't count towards the fd_set size limit anyway. | ||||
#define MIN_CORE_FILEDESCRIPTORS 0 | #define MIN_CORE_FILEDESCRIPTORS 0 | ||||
#else | #else | ||||
#define MIN_CORE_FILEDESCRIPTORS 150 | #define MIN_CORE_FILEDESCRIPTORS 150 | ||||
#endif | #endif | ||||
▲ Show 20 Lines • Show All 2,024 Lines • ▼ Show 20 Lines | threadGroup.create_thread(std::bind(&TraceThread<CScheduler::Function>, | ||||
"scheduler", serviceLoop)); | "scheduler", serviceLoop)); | ||||
// Gather some entropy once per minute. | // Gather some entropy once per minute. | ||||
node.scheduler->scheduleEvery( | node.scheduler->scheduleEvery( | ||||
[] { | [] { | ||||
RandAddPeriodic(); | RandAddPeriodic(); | ||||
return true; | return true; | ||||
}, | }, | ||||
60000); | std::chrono::minutes{1}); | ||||
GetMainSignals().RegisterBackgroundSignalScheduler(*node.scheduler); | GetMainSignals().RegisterBackgroundSignalScheduler(*node.scheduler); | ||||
// Create client interfaces for wallets that are supposed to be loaded | // Create client interfaces for wallets that are supposed to be loaded | ||||
// according to -wallet and -disablewallet options. This only constructs | // according to -wallet and -disablewallet options. This only constructs | ||||
// the interfaces, it doesn't load wallet data. Wallets actually get loaded | // the interfaces, it doesn't load wallet data. Wallets actually get loaded | ||||
// when load() and start() interface methods are called below. | // when load() and start() interface methods are called below. | ||||
g_wallet_init_interface.Construct(node); | g_wallet_init_interface.Construct(node); | ||||
▲ Show 20 Lines • Show All 647 Lines • ▼ Show 20 Lines | #endif | ||||
} | } | ||||
BanMan *banman = node.banman.get(); | BanMan *banman = node.banman.get(); | ||||
node.scheduler->scheduleEvery( | node.scheduler->scheduleEvery( | ||||
[banman] { | [banman] { | ||||
banman->DumpBanlist(); | banman->DumpBanlist(); | ||||
return true; | return true; | ||||
}, | }, | ||||
DUMP_BANS_INTERVAL * 1000); | DUMP_BANS_INTERVAL); | ||||
// Start Avalanche's event loop. | // Start Avalanche's event loop. | ||||
g_avalanche->startEventLoop(*node.scheduler); | g_avalanche->startEventLoop(*node.scheduler); | ||||
return true; | return true; | ||||
} | } |