mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-05-04 17:00:52 +02:00
Clean PushMessage and ProcessMessages
This brings PushMessage and ProcessMessages further in line with the style guide by fixing their if statements. LogMessage is later called, inside an if statement, inside both of these methods.
This commit is contained in:
parent
bc51b99bd5
commit
dbf779d5de
12
src/net.cpp
12
src/net.cpp
@ -2879,18 +2879,14 @@ void CConnman::PushMessage(CNode* pnode, CSerializedNetMsg&& msg)
|
||||
pnode->mapSendBytesPerMsgCmd[msg.m_type] += nTotalSize;
|
||||
pnode->nSendSize += nTotalSize;
|
||||
|
||||
if (pnode->nSendSize > nSendBufferMaxSize)
|
||||
pnode->fPauseSend = true;
|
||||
if (pnode->nSendSize > nSendBufferMaxSize) pnode->fPauseSend = true;
|
||||
pnode->vSendMsg.push_back(std::move(serializedHeader));
|
||||
if (nMessageSize)
|
||||
pnode->vSendMsg.push_back(std::move(msg.data));
|
||||
if (nMessageSize) pnode->vSendMsg.push_back(std::move(msg.data));
|
||||
|
||||
// If write queue empty, attempt "optimistic write"
|
||||
if (optimisticSend == true)
|
||||
nBytesSent = SocketSendData(*pnode);
|
||||
if (optimisticSend) nBytesSent = SocketSendData(*pnode);
|
||||
}
|
||||
if (nBytesSent)
|
||||
RecordBytesSent(nBytesSent);
|
||||
if (nBytesSent) RecordBytesSent(nBytesSent);
|
||||
}
|
||||
|
||||
bool CConnman::ForNode(NodeId id, std::function<bool(CNode* pnode)> func)
|
||||
|
@ -4028,14 +4028,12 @@ bool PeerManagerImpl::ProcessMessages(CNode* pfrom, std::atomic<bool>& interrupt
|
||||
}
|
||||
|
||||
// Don't bother if send buffer is too full to respond anyway
|
||||
if (pfrom->fPauseSend)
|
||||
return false;
|
||||
if (pfrom->fPauseSend) return false;
|
||||
|
||||
std::list<CNetMessage> msgs;
|
||||
{
|
||||
LOCK(pfrom->cs_vProcessMsg);
|
||||
if (pfrom->vProcessMsg.empty())
|
||||
return false;
|
||||
if (pfrom->vProcessMsg.empty()) return false;
|
||||
// Just take one message
|
||||
msgs.splice(msgs.begin(), pfrom->vProcessMsg, pfrom->vProcessMsg.begin());
|
||||
pfrom->nProcessQueueSize -= msgs.front().m_raw_message_size;
|
||||
|
Loading…
x
Reference in New Issue
Block a user