mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 12:02:48 +01:00
merge bitcoin#26888: simplify the call to vProcessMsg.splice()
This commit is contained in:
parent
d9e56f3e78
commit
d3f5b3881b
@ -2097,15 +2097,14 @@ size_t CConnman::SocketRecvData(CNode *pnode)
|
|||||||
RecordBytesRecv(nBytes);
|
RecordBytesRecv(nBytes);
|
||||||
if (notify) {
|
if (notify) {
|
||||||
size_t nSizeAdded = 0;
|
size_t nSizeAdded = 0;
|
||||||
auto it(pnode->vRecvMsg.begin());
|
for (const auto& msg : pnode->vRecvMsg) {
|
||||||
for (; it != pnode->vRecvMsg.end(); ++it) {
|
|
||||||
// vRecvMsg contains only completed CNetMessage
|
// vRecvMsg contains only completed CNetMessage
|
||||||
// the single possible partially deserialized message are held by TransportDeserializer
|
// the single possible partially deserialized message are held by TransportDeserializer
|
||||||
nSizeAdded += it->m_raw_message_size;
|
nSizeAdded += msg.m_raw_message_size;
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
LOCK(pnode->cs_vProcessMsg);
|
LOCK(pnode->cs_vProcessMsg);
|
||||||
pnode->vProcessMsg.splice(pnode->vProcessMsg.end(), pnode->vRecvMsg, pnode->vRecvMsg.begin(), it);
|
pnode->vProcessMsg.splice(pnode->vProcessMsg.end(), pnode->vRecvMsg);
|
||||||
pnode->nProcessQueueSize += nSizeAdded;
|
pnode->nProcessQueueSize += nSizeAdded;
|
||||||
pnode->fPauseRecv = pnode->nProcessQueueSize > nReceiveFloodSize;
|
pnode->fPauseRecv = pnode->nProcessQueueSize > nReceiveFloodSize;
|
||||||
}
|
}
|
||||||
|
@ -69,15 +69,14 @@ void ConnmanTestMsg::NodeReceiveMsgBytes(CNode& node, Span<const uint8_t> msg_by
|
|||||||
assert(node.ReceiveMsgBytes(msg_bytes, complete));
|
assert(node.ReceiveMsgBytes(msg_bytes, complete));
|
||||||
if (complete) {
|
if (complete) {
|
||||||
size_t nSizeAdded = 0;
|
size_t nSizeAdded = 0;
|
||||||
auto it(node.vRecvMsg.begin());
|
for (const auto& msg : node.vRecvMsg) {
|
||||||
for (; it != node.vRecvMsg.end(); ++it) {
|
|
||||||
// vRecvMsg contains only completed CNetMessage
|
// vRecvMsg contains only completed CNetMessage
|
||||||
// the single possible partially deserialized message are held by TransportDeserializer
|
// the single possible partially deserialized message are held by TransportDeserializer
|
||||||
nSizeAdded += it->m_raw_message_size;
|
nSizeAdded += msg.m_raw_message_size;
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
LOCK(node.cs_vProcessMsg);
|
LOCK(node.cs_vProcessMsg);
|
||||||
node.vProcessMsg.splice(node.vProcessMsg.end(), node.vRecvMsg, node.vRecvMsg.begin(), it);
|
node.vProcessMsg.splice(node.vProcessMsg.end(), node.vRecvMsg);
|
||||||
node.nProcessQueueSize += nSizeAdded;
|
node.nProcessQueueSize += nSizeAdded;
|
||||||
node.fPauseRecv = node.nProcessQueueSize > nReceiveFloodSize;
|
node.fPauseRecv = node.nProcessQueueSize > nReceiveFloodSize;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user