net: No need to export DumpBanlist

This commit is contained in:
Cory Fields 2016-04-18 17:59:31 -04:00
parent 8b8f87714d
commit e9ed6206b3
2 changed files with 20 additions and 22 deletions

View File

@ -422,6 +422,26 @@ CNode* ConnectNode(CAddress addrConnect, const char *pszDest)
return NULL; return NULL;
} }
static void DumpBanlist()
{
CNode::SweepBanned(); // clean unused entries (if bantime has expired)
if (!CNode::BannedSetIsDirty())
return;
int64_t nStart = GetTimeMillis();
CBanDB bandb;
banmap_t banmap;
CNode::SetBannedSetDirty(false);
CNode::GetBanned(banmap);
if (!bandb.Write(banmap))
CNode::SetBannedSetDirty(true);
LogPrint("net", "Flushed %d banned node ips/subnets to banlist.dat %dms\n",
banmap.size(), GetTimeMillis() - nStart);
}
void CNode::CloseSocketDisconnect() void CNode::CloseSocketDisconnect()
{ {
fDisconnect = true; fDisconnect = true;
@ -2607,26 +2627,6 @@ bool CBanDB::Read(banmap_t& banSet)
return true; return true;
} }
void DumpBanlist()
{
CNode::SweepBanned(); // clean unused entries (if bantime has expired)
if (!CNode::BannedSetIsDirty())
return;
int64_t nStart = GetTimeMillis();
CBanDB bandb;
banmap_t banmap;
CNode::SetBannedSetDirty(false);
CNode::GetBanned(banmap);
if (!bandb.Write(banmap))
CNode::SetBannedSetDirty(true);
LogPrint("net", "Flushed %d banned node ips/subnets to banlist.dat %dms\n",
banmap.size(), GetTimeMillis() - nStart);
}
int64_t PoissonNextSend(int64_t nNow, int average_interval_seconds) { int64_t PoissonNextSend(int64_t nNow, int average_interval_seconds) {
return nNow + (int64_t)(log1p(GetRand(1ULL << 48) * -0.0000000000000035527136788 /* -1/2^48 */) * average_interval_seconds * -1000000.0 + 0.5); return nNow + (int64_t)(log1p(GetRand(1ULL << 48) * -0.0000000000000035527136788 /* -1/2^48 */) * average_interval_seconds * -1000000.0 + 0.5);
} }

View File

@ -807,8 +807,6 @@ public:
bool Read(banmap_t& banSet); bool Read(banmap_t& banSet);
}; };
void DumpBanlist();
/** Return a timestamp in the future (in microseconds) for exponentially distributed events. */ /** Return a timestamp in the future (in microseconds) for exponentially distributed events. */
int64_t PoissonNextSend(int64_t nNow, int average_interval_seconds); int64_t PoissonNextSend(int64_t nNow, int average_interval_seconds);