Merge #15078: rpc: Document bytessent_per_msg and bytesrecv_per_msg
fab3f14678
rpc: Document bytessent_per_msg and bytesrecv_per_msg (MarcoFalke)
Pull request description:
Tree-SHA512: 11af7502933b3dae203d90e36b35019e0ebe67ee09aa77360a27547487bd2b6bcaa18c5f60bc21966291d2ccf44dfedebf40103c4db70a359400f535a66abb23
This commit is contained in:
commit
fcc618d508
3 changed files with 15 additions and 10 deletions
|
@ -1,5 +1,5 @@
|
|||
// Copyright (c) 2009-2010 Satoshi Nakamoto
|
||||
// Copyright (c) 2009-2018 The Bitcoin Core developers
|
||||
// Copyright (c) 2009-2019 The Bitcoin Core developers
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
|
@ -80,7 +80,7 @@ enum BindFlags {
|
|||
// The sleep time needs to be small to avoid new sockets stalling
|
||||
static const uint64_t SELECT_TIMEOUT_MILLISECONDS = 50;
|
||||
|
||||
const static std::string NET_MESSAGE_COMMAND_OTHER = "*other*";
|
||||
const std::string NET_MESSAGE_COMMAND_OTHER = "*other*";
|
||||
|
||||
static const uint64_t RANDOMIZER_ID_NETGROUP = 0x6c0edd8036ef4036ULL; // SHA256("netgroup")[0:8]
|
||||
static const uint64_t RANDOMIZER_ID_LOCALHOSTNONCE = 0xd93e69e2bbfa5735ULL; // SHA256("localhostnonce")[0:8]
|
||||
|
@ -787,7 +787,6 @@ bool CNode::ReceiveMsgBytes(const char *pch, unsigned int nBytes, bool& complete
|
|||
nBytes -= handled;
|
||||
|
||||
if (msg.complete()) {
|
||||
|
||||
//store received bytes per message command
|
||||
//to prevent a memory DOS, only allow valid commands
|
||||
mapMsgCmdSize::iterator i = mapRecvBytesPerMsgCmd.find(msg.hdr.pchCommand);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// Copyright (c) 2009-2010 Satoshi Nakamoto
|
||||
// Copyright (c) 2009-2018 The Bitcoin Core developers
|
||||
// Copyright (c) 2009-2019 The Bitcoin Core developers
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
|
@ -550,6 +550,8 @@ struct LocalServiceInfo {
|
|||
|
||||
extern CCriticalSection cs_mapLocalHost;
|
||||
extern std::map<CNetAddr, LocalServiceInfo> mapLocalHost GUARDED_BY(cs_mapLocalHost);
|
||||
|
||||
extern const std::string NET_MESSAGE_COMMAND_OTHER;
|
||||
typedef std::map<std::string, uint64_t> mapMsgCmdSize; //command, total bytes
|
||||
|
||||
class CNodeStats
|
||||
|
@ -696,8 +698,8 @@ public:
|
|||
const uint64_t nKeyedNetGroup;
|
||||
std::atomic_bool fPauseRecv;
|
||||
std::atomic_bool fPauseSend;
|
||||
protected:
|
||||
|
||||
protected:
|
||||
mapMsgCmdSize mapSendBytesPerMsgCmd;
|
||||
mapMsgCmdSize mapRecvBytesPerMsgCmd GUARDED_BY(cs_vRecv);
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2009-2018 The Bitcoin Core developers
|
||||
// Copyright (c) 2009-2019 The Bitcoin Core developers
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
|
@ -109,11 +109,15 @@ static UniValue getpeerinfo(const JSONRPCRequest& request)
|
|||
" \"whitelisted\": true|false, (boolean) Whether the peer is whitelisted\n"
|
||||
" \"minfeefilter\": n, (numeric) The minimum fee rate for transactions this peer accepts\n"
|
||||
" \"bytessent_per_msg\": {\n"
|
||||
" \"addr\": n, (numeric) The total bytes sent aggregated by message type\n"
|
||||
" \"msg\": n, (numeric) The total bytes sent aggregated by message type\n"
|
||||
" When a message type is not listed in this json object, the bytes sent are 0.\n"
|
||||
" Only known message types can appear as keys in the object.\n"
|
||||
" ...\n"
|
||||
" },\n"
|
||||
" \"bytesrecv_per_msg\": {\n"
|
||||
" \"addr\": n, (numeric) The total bytes received aggregated by message type\n"
|
||||
" \"msg\": n, (numeric) The total bytes received aggregated by message type\n"
|
||||
" When a message type is not listed in this json object, the bytes received are 0.\n"
|
||||
" Only known message types can appear as keys in the object and all bytes received of unknown message types are listed under '"+NET_MESSAGE_COMMAND_OTHER+"'.\n"
|
||||
" ...\n"
|
||||
" }\n"
|
||||
" }\n"
|
||||
|
@ -178,14 +182,14 @@ static UniValue getpeerinfo(const JSONRPCRequest& request)
|
|||
obj.pushKV("minfeefilter", ValueFromAmount(stats.minFeeFilter));
|
||||
|
||||
UniValue sendPerMsgCmd(UniValue::VOBJ);
|
||||
for (const mapMsgCmdSize::value_type &i : stats.mapSendBytesPerMsgCmd) {
|
||||
for (const auto& i : stats.mapSendBytesPerMsgCmd) {
|
||||
if (i.second > 0)
|
||||
sendPerMsgCmd.pushKV(i.first, i.second);
|
||||
}
|
||||
obj.pushKV("bytessent_per_msg", sendPerMsgCmd);
|
||||
|
||||
UniValue recvPerMsgCmd(UniValue::VOBJ);
|
||||
for (const mapMsgCmdSize::value_type &i : stats.mapRecvBytesPerMsgCmd) {
|
||||
for (const auto& i : stats.mapRecvBytesPerMsgCmd) {
|
||||
if (i.second > 0)
|
||||
recvPerMsgCmd.pushKV(i.first, i.second);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue