Browse Source

net: make vRecvMsg a list so that we can use splice()

0.14
Cory Fields 8 years ago
parent
commit
e5bcd9c84f
  1. 2
      src/net.cpp
  2. 2
      src/net.h
  3. 2
      src/net_processing.cpp

2
src/net.cpp

@ -1859,7 +1859,7 @@ void CConnman::ThreadMessageHandler()
if (pnode->nSendSize < GetSendBufferSize()) if (pnode->nSendSize < GetSendBufferSize())
{ {
if (!pnode->vRecvGetData.empty() || (!pnode->vRecvMsg.empty() && pnode->vRecvMsg[0].complete())) if (!pnode->vRecvGetData.empty() || (!pnode->vRecvMsg.empty() && pnode->vRecvMsg.front().complete()))
{ {
fSleep = false; fSleep = false;
} }

2
src/net.h

@ -605,7 +605,7 @@ public:
CCriticalSection cs_vSend; CCriticalSection cs_vSend;
std::deque<CInv> vRecvGetData; std::deque<CInv> vRecvGetData;
std::deque<CNetMessage> vRecvMsg; std::list<CNetMessage> vRecvMsg;
CCriticalSection cs_vRecvMsg; CCriticalSection cs_vRecvMsg;
uint64_t nRecvBytes; uint64_t nRecvBytes;
int nRecvVersion; int nRecvVersion;

2
src/net_processing.cpp

@ -2471,7 +2471,7 @@ bool ProcessMessages(CNode* pfrom, CConnman& connman, std::atomic<bool>& interru
// this maintains the order of responses // this maintains the order of responses
if (!pfrom->vRecvGetData.empty()) return fOk; if (!pfrom->vRecvGetData.empty()) return fOk;
std::deque<CNetMessage>::iterator it = pfrom->vRecvMsg.begin(); auto it = pfrom->vRecvMsg.begin();
while (!pfrom->fDisconnect && it != pfrom->vRecvMsg.end()) { while (!pfrom->fDisconnect && it != pfrom->vRecvMsg.end()) {
// Don't bother if send buffer is too full to respond anyway // Don't bother if send buffer is too full to respond anyway
if (pfrom->nSendSize >= nMaxSendBufferSize) if (pfrom->nSendSize >= nMaxSendBufferSize)

Loading…
Cancel
Save