From 2ea9c69985e81e6858d3abdba15a2db37cd48617 Mon Sep 17 00:00:00 2001 From: Tim Flynn Date: Wed, 18 Jan 2017 10:23:49 -0500 Subject: [PATCH] Logging improvements (#1268) * Add default log messages when beginning asset sync * Added default log message for AskFor buffer full condition * Improve log message based on code review comments --- src/masternode-sync.cpp | 4 ++++ src/net.cpp | 5 ++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/masternode-sync.cpp b/src/masternode-sync.cpp index 834ae7b92..0f982fc8e 100644 --- a/src/masternode-sync.cpp +++ b/src/masternode-sync.cpp @@ -178,18 +178,22 @@ void CMasternodeSync::SwitchToNextAsset() case(MASTERNODE_SYNC_INITIAL): ClearFulfilledRequests(); nRequestedMasternodeAssets = MASTERNODE_SYNC_SPORKS; + LogPrintf("CMasternodeSync::SwitchToNextAsset -- Starting %s\n", GetAssetName()); break; case(MASTERNODE_SYNC_SPORKS): nTimeLastMasternodeList = GetTime(); nRequestedMasternodeAssets = MASTERNODE_SYNC_LIST; + LogPrintf("CMasternodeSync::SwitchToNextAsset -- Starting %s\n", GetAssetName()); break; case(MASTERNODE_SYNC_LIST): nTimeLastPaymentVote = GetTime(); nRequestedMasternodeAssets = MASTERNODE_SYNC_MNW; + LogPrintf("CMasternodeSync::SwitchToNextAsset -- Starting %s\n", GetAssetName()); break; case(MASTERNODE_SYNC_MNW): nTimeLastGovernanceItem = GetTime(); nRequestedMasternodeAssets = MASTERNODE_SYNC_GOVERNANCE; + LogPrintf("CMasternodeSync::SwitchToNextAsset -- Starting %s\n", GetAssetName()); break; case(MASTERNODE_SYNC_GOVERNANCE): LogPrintf("CMasternodeSync::SwitchToNextAsset -- Sync has finished\n"); diff --git a/src/net.cpp b/src/net.cpp index fdcbcf4cd..5266e94cd 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -2445,8 +2445,11 @@ CNode::~CNode() void CNode::AskFor(const CInv& inv) { - if (mapAskFor.size() > MAPASKFOR_MAX_SZ || setAskFor.size() > SETASKFOR_MAX_SZ) + if (mapAskFor.size() > MAPASKFOR_MAX_SZ || setAskFor.size() > SETASKFOR_MAX_SZ) { + LogPrintf("CNode::AskFor -- WARNING: inventory message dropped: mapAskFor.size = %d, setAskFor.size = %d, MAPASKFOR_MAX_SZ = %d, SETASKFOR_MAX_SZ = %d, peer=%d\n", + mapAskFor.size(), setAskFor.size(), MAPASKFOR_MAX_SZ, SETASKFOR_MAX_SZ, id); return; + } // a peer may not have multiple non-responded queue positions for a single inv item if (!setAskFor.insert(inv.hash).second) return;