aboutsummaryrefslogtreecommitdiff
path: root/src/net.h
diff options
context:
space:
mode:
authorPieter Wuille <pieter.wuille@gmail.com>2013-03-01 01:41:28 +0100
committerPieter Wuille <sipa@ulyssis.org>2013-03-29 23:56:26 +0100
commit967f24590b43f0f84148f669d886b40fe45aa978 (patch)
tree5e0116b462a5433907d5400456d0006e14d332ee /src/net.h
parentb9ff2970b9fbb24e2fffc449b4ef478d019633d8 (diff)
Some fixes to CNetMessage processing
* Change CNode::vRecvMsg to be a deque instead of a vector (less copying) * Make sure to acquire cs_vRecvMsg in CNode::CloseSocketDisconnect (as it may be called without that lock).
Diffstat (limited to 'src/net.h')
-rw-r--r--src/net.h10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/net.h b/src/net.h
index 03d32526bc..d779265b79 100644
--- a/src/net.h
+++ b/src/net.h
@@ -176,7 +176,7 @@ public:
CDataStream vSend;
CCriticalSection cs_vSend;
- std::vector<CNetMessage> vRecvMsg;
+ std::deque<CNetMessage> vRecvMsg;
CCriticalSection cs_vRecvMsg;
int nRecvVersion;
@@ -297,8 +297,8 @@ public:
unsigned int GetTotalRecvSize()
{
unsigned int total = 0;
- for (unsigned int i = 0; i < vRecvMsg.size(); i++)
- total += vRecvMsg[i].vRecv.size();
+ BOOST_FOREACH(const CNetMessage &msg, vRecvMsg)
+ total += msg.vRecv.size() + 24;
return total;
}
@@ -309,8 +309,8 @@ public:
void SetRecvVersion(int nVersionIn)
{
nRecvVersion = nVersionIn;
- for (unsigned int i = 0; i < vRecvMsg.size(); i++)
- vRecvMsg[i].SetVersion(nVersionIn);
+ BOOST_FOREACH(CNetMessage &msg, vRecvMsg)
+ msg.SetVersion(nVersionIn);
}
CNode* AddRef(int64 nTimeout=0)