aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Kaufmann <phil.kaufmann@t-online.de>2015-07-03 09:46:17 +0200
committerPhilip Kaufmann <phil.kaufmann@t-online.de>2015-10-02 11:38:16 +0200
commit2977c243efc9f122328de1bcfe12364498e0e2b6 (patch)
tree788bebee38de10ff9c0142bd4b38890676918bd1
parentce479aaadaab296f0d06808fe230c4b13523cc28 (diff)
downloadbitcoin-2977c243efc9f122328de1bcfe12364498e0e2b6.tar.xz
banlist: add more banlist infos to log / add GUI signal
- to match the peers.dat handling also supply a debug.log entry for how many entries were loaded from banlist.dat and how long it took - add a GUI init message for loading the banlist (same as with peers.dat) - move the same message for peers.dat upwards in the code, to be able to reuse the timing variable nStart and also just log, if our read from peers.dat didn't fail
-rw-r--r--src/net.cpp16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/net.cpp b/src/net.cpp
index 6d39ccecdc..88a8edebc3 100644
--- a/src/net.cpp
+++ b/src/net.cpp
@@ -35,7 +35,7 @@
#include <boost/filesystem.hpp>
#include <boost/thread.hpp>
-// Dump addresses to peers.dat every 15 minutes (900s)
+// Dump addresses to peers.dat and banlist.dat every 15 minutes (900s)
#define DUMP_ADDRESSES_INTERVAL 900
#if !defined(HAVE_MSG_NOSIGNAL) && !defined(MSG_NOSIGNAL)
@@ -555,11 +555,13 @@ void CNode::SweepBanned()
banmap_t::iterator it = setBanned.begin();
while(it != setBanned.end())
{
+ CSubNet subNet = (*it).first;
CBanEntry banEntry = (*it).second;
if(now > banEntry.nBanUntil)
{
setBanned.erase(it++);
setBannedIsDirty = true;
+ LogPrint("net", "%s: Removed banned node ip/subnet from banlist.dat: %s\n", __func__, subNet.ToString());
}
else
++it;
@@ -1898,15 +1900,19 @@ void static Discover(boost::thread_group& threadGroup)
void StartNode(boost::thread_group& threadGroup, CScheduler& scheduler)
{
uiInterface.InitMessage(_("Loading addresses..."));
- // Load addresses for peers.dat
+ // Load addresses from peers.dat
int64_t nStart = GetTimeMillis();
{
CAddrDB adb;
- if (!adb.Read(addrman))
+ if (adb.Read(addrman))
+ LogPrintf("Loaded %i addresses from peers.dat %dms\n", addrman.size(), GetTimeMillis() - nStart);
+ else
LogPrintf("Invalid or missing peers.dat; recreating\n");
}
- //try to read stored banlist
+ uiInterface.InitMessage(_("Loading banlist..."));
+ // Load addresses from banlist.dat
+ nStart = GetTimeMillis();
CBanDB bandb;
banmap_t banmap;
if (bandb.Read(banmap)) {
@@ -1923,7 +1929,7 @@ void StartNode(boost::thread_group& threadGroup, CScheduler& scheduler)
if (semOutbound == NULL) {
// initialize semaphore
- int nMaxOutbound = min(MAX_OUTBOUND_CONNECTIONS, nMaxConnections);
+ int nMaxOutbound = std::min(MAX_OUTBOUND_CONNECTIONS, nMaxConnections);
semOutbound = new CSemaphore(nMaxOutbound);
}