mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-06-22 14:52:41 +02:00
[net] Add CNode helper for send byte accounting
This commit is contained in:
parent
60441a3432
commit
3eac5e7cd1
@ -2860,7 +2860,7 @@ void CConnman::PushMessage(CNode* pnode, CSerializedNetMsg&& msg)
|
|||||||
bool optimisticSend(pnode->vSendMsg.empty());
|
bool optimisticSend(pnode->vSendMsg.empty());
|
||||||
|
|
||||||
//log total amount of bytes per message type
|
//log total amount of bytes per message type
|
||||||
pnode->mapSendBytesPerMsgType[msg.m_type] += nTotalSize;
|
pnode->AccountForSentBytes(msg.m_type, nTotalSize);
|
||||||
pnode->nSendSize += nTotalSize;
|
pnode->nSendSize += nTotalSize;
|
||||||
|
|
||||||
if (pnode->nSendSize > nSendBufferMaxSize) pnode->fPauseSend = true;
|
if (pnode->nSendSize > nSendBufferMaxSize) pnode->fPauseSend = true;
|
||||||
|
@ -430,6 +430,13 @@ public:
|
|||||||
std::optional<std::pair<CNetMessage, bool>> PollMessage(size_t recv_flood_size)
|
std::optional<std::pair<CNetMessage, bool>> PollMessage(size_t recv_flood_size)
|
||||||
EXCLUSIVE_LOCKS_REQUIRED(!m_msg_process_queue_mutex);
|
EXCLUSIVE_LOCKS_REQUIRED(!m_msg_process_queue_mutex);
|
||||||
|
|
||||||
|
/** Account for the total size of a sent message in the per msg type connection stats. */
|
||||||
|
void AccountForSentBytes(const std::string& msg_type, size_t sent_bytes)
|
||||||
|
EXCLUSIVE_LOCKS_REQUIRED(cs_vSend)
|
||||||
|
{
|
||||||
|
mapSendBytesPerMsgType[msg_type] += sent_bytes;
|
||||||
|
}
|
||||||
|
|
||||||
bool IsOutboundOrBlockRelayConn() const {
|
bool IsOutboundOrBlockRelayConn() const {
|
||||||
switch (m_conn_type) {
|
switch (m_conn_type) {
|
||||||
case ConnectionType::OUTBOUND_FULL_RELAY:
|
case ConnectionType::OUTBOUND_FULL_RELAY:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user