Changeset View
Changeset View
Standalone View
Standalone View
src/net.cpp
Show All 34 Lines | |||||
#include <miniupnpc/upnpcommands.h> | #include <miniupnpc/upnpcommands.h> | ||||
#include <miniupnpc/upnperrors.h> | #include <miniupnpc/upnperrors.h> | ||||
#endif | #endif | ||||
#include <unordered_map> | #include <unordered_map> | ||||
#include <cmath> | #include <cmath> | ||||
// Dump addresses to peers.dat every 15 minutes (900s) | // How often to dump addresses to peers.dat | ||||
static constexpr int DUMP_PEERS_INTERVAL = 15 * 60; | static constexpr std::chrono::minutes DUMP_PEERS_INTERVAL{15}; | ||||
// We add a random period time (0 to 1 seconds) to feeler connections to prevent | // We add a random period time (0 to 1 seconds) to feeler connections to prevent | ||||
// synchronization. | // synchronization. | ||||
#define FEELER_SLEEP_WINDOW 1 | #define FEELER_SLEEP_WINDOW 1 | ||||
// MSG_NOSIGNAL is not available on some platforms, if it doesn't exist define | // MSG_NOSIGNAL is not available on some platforms, if it doesn't exist define | ||||
// it as 0 | // it as 0 | ||||
#if !defined(MSG_NOSIGNAL) | #if !defined(MSG_NOSIGNAL) | ||||
▲ Show 20 Lines • Show All 2,475 Lines • ▼ Show 20 Lines | threadMessageHandler = | ||||
std::bind(&CConnman::ThreadMessageHandler, this))); | std::bind(&CConnman::ThreadMessageHandler, this))); | ||||
// Dump network addresses | // Dump network addresses | ||||
scheduler.scheduleEvery( | scheduler.scheduleEvery( | ||||
[this]() { | [this]() { | ||||
this->DumpAddresses(); | this->DumpAddresses(); | ||||
return true; | return true; | ||||
}, | }, | ||||
DUMP_PEERS_INTERVAL * 1000); | DUMP_PEERS_INTERVAL); | ||||
return true; | return true; | ||||
} | } | ||||
class CNetCleanup { | class CNetCleanup { | ||||
public: | public: | ||||
CNetCleanup() {} | CNetCleanup() {} | ||||
▲ Show 20 Lines • Show All 494 Lines • Show Last 20 Lines |