diff options
author | Cory Fields <cory-nospam-@coryfields.com> | 2017-10-05 12:46:54 -0400 |
---|---|---|
committer | Carl Dong <accounts@carldong.me> | 2019-01-16 13:54:18 -0500 |
commit | 83c1ea2e5e66b8a83072e3d5ad6a4ced406eb1ba (patch) | |
tree | 97bb5ccc517aa543e278be31a6fb1254efce63cd /src/net.cpp | |
parent | 136bd7926c72659dd277a7b795ea17f72e523338 (diff) |
net: split up addresses/ban dumps in preparation for moving them
Diffstat (limited to 'src/net.cpp')
-rw-r--r-- | src/net.cpp | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/src/net.cpp b/src/net.cpp index 6f0d76ccf5..993efc3db9 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -41,8 +41,11 @@ #include <math.h> -// Dump addresses to peers.dat and banlist.dat every 15 minutes (900s) -#define DUMP_ADDRESSES_INTERVAL 900 +// Dump addresses to peers.dat every 15 minutes (900s) +static constexpr int DUMP_PEERS_INTERVAL = 15 * 60; + +// Dump addresses to banlist.dat every 15 minutes (900s) +static constexpr int DUMP_BANS_INTERVAL = 60 * 15; // We add a random period time (0 to 1 seconds) to feeler connections to prevent synchronization. #define FEELER_SLEEP_WINDOW 1 @@ -1768,12 +1771,6 @@ void CConnman::DumpAddresses() addrman.size(), GetTimeMillis() - nStart); } -void CConnman::DumpData() -{ - DumpAddresses(); - DumpBanlist(); -} - void CConnman::ProcessOneShot() { std::string strDest; @@ -2450,7 +2447,8 @@ bool CConnman::Start(CScheduler& scheduler, const Options& connOptions) threadMessageHandler = std::thread(&TraceThread<std::function<void()> >, "msghand", std::function<void()>(std::bind(&CConnman::ThreadMessageHandler, this))); // Dump network addresses - scheduler.scheduleEvery(std::bind(&CConnman::DumpData, this), DUMP_ADDRESSES_INTERVAL * 1000); + scheduler.scheduleEvery(std::bind(&CConnman::DumpAddresses, this), DUMP_PEERS_INTERVAL * 1000); + scheduler.scheduleEvery(std::bind(&CConnman::DumpBanlist, this), DUMP_BANS_INTERVAL * 1000); return true; } @@ -2509,7 +2507,8 @@ void CConnman::Stop() if (fAddressesInitialized) { - DumpData(); + DumpAddresses(); + DumpBanlist(); fAddressesInitialized = false; } |