Skip to content

Commit e5bcd9c

Browse files
committed
net: make vRecvMsg a list so that we can use splice()
1 parent 53ad9a1 commit e5bcd9c

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

src/net.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1859,7 +1859,7 @@ void CConnman::ThreadMessageHandler()
18591859

18601860
if (pnode->nSendSize < GetSendBufferSize())
18611861
{
1862-
if (!pnode->vRecvGetData.empty() || (!pnode->vRecvMsg.empty() && pnode->vRecvMsg[0].complete()))
1862+
if (!pnode->vRecvGetData.empty() || (!pnode->vRecvMsg.empty() && pnode->vRecvMsg.front().complete()))
18631863
{
18641864
fSleep = false;
18651865
}

src/net.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -605,7 +605,7 @@ class CNode
605605
CCriticalSection cs_vSend;
606606

607607
std::deque<CInv> vRecvGetData;
608-
std::deque<CNetMessage> vRecvMsg;
608+
std::list<CNetMessage> vRecvMsg;
609609
CCriticalSection cs_vRecvMsg;
610610
uint64_t nRecvBytes;
611611
int nRecvVersion;

src/net_processing.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2471,7 +2471,7 @@ bool ProcessMessages(CNode* pfrom, CConnman& connman, std::atomic<bool>& interru
24712471
// this maintains the order of responses
24722472
if (!pfrom->vRecvGetData.empty()) return fOk;
24732473

2474-
std::deque<CNetMessage>::iterator it = pfrom->vRecvMsg.begin();
2474+
auto it = pfrom->vRecvMsg.begin();
24752475
while (!pfrom->fDisconnect && it != pfrom->vRecvMsg.end()) {
24762476
// Don't bother if send buffer is too full to respond anyway
24772477
if (pfrom->nSendSize >= nMaxSendBufferSize)

0 commit comments

Comments
 (0)