Skip to content

Commit

Permalink
Show queued invs in getpeerinfo
Browse files Browse the repository at this point in the history
  • Loading branch information
sipa committed Apr 6, 2016
1 parent 223fdd1 commit 115157b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/net.cpp
Expand Up @@ -628,6 +628,7 @@ void CNode::copyStats(CNodeStats &stats)
X(mapRecvBytesPerMsgCmd);
X(fWhitelisted);

stats.nInvsQueued = vInventoryToSend.size();
// It is common for nodes with good ping times to suddenly become lagged,
// due to a new block arriving or other large transfer.
// Merely reporting pingtime might fool the caller into thinking the node was still responsive,
Expand Down
1 change: 1 addition & 0 deletions src/net.h
Expand Up @@ -208,6 +208,7 @@ class CNodeStats
double dPingWait;
double dPingMin;
std::string addrLocal;
size_t nInvsQueued;
};


Expand Down
2 changes: 2 additions & 0 deletions src/rpc/net.cpp
Expand Up @@ -107,6 +107,7 @@ UniValue getpeerinfo(const UniValue& params, bool fHelp)
" \"banscore\": n, (numeric) The ban score\n"
" \"synced_headers\": n, (numeric) The last header we have in common with this peer\n"
" \"synced_blocks\": n, (numeric) The last block we have in common with this peer\n"
" \"invs_queued\": n, (numeric) Inventory items queued\n"
" \"inflight\": [\n"
" n, (numeric) The heights of blocks we're currently asking from this peer\n"
" ...\n"
Expand Down Expand Up @@ -172,6 +173,7 @@ UniValue getpeerinfo(const UniValue& params, bool fHelp)
obj.push_back(Pair("inflight", heights));
}
obj.push_back(Pair("whitelisted", stats.fWhitelisted));
obj.push_back(Pair("invs_queued", stats.nInvsQueued));

UniValue sendPerMsgCmd(UniValue::VOBJ);
BOOST_FOREACH(const mapMsgCmdSize::value_type &i, stats.mapSendBytesPerMsgCmd) {
Expand Down

0 comments on commit 115157b

Please sign in to comment.