aboutsummaryrefslogtreecommitdiff
path: root/src/net.cpp
diff options
context:
space:
mode:
authorCory Fields <cory-nospam-@coryfields.com>2016-04-19 00:01:19 -0400
committerCory Fields <cory-nospam-@coryfields.com>2016-09-08 12:24:06 -0400
commitbe9c796dc51c05cab0b84d2e66c928973c6e5ed6 (patch)
tree5ee7a73b713fcdc8501db979e867782b56e8ac7f /src/net.cpp
parent63cafa6329e1a0a1daf2d324931aca42ba1cbb19 (diff)
net: move SendBufferSize/ReceiveFloodSize to CConnman
Diffstat (limited to 'src/net.cpp')
-rw-r--r--src/net.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/net.cpp b/src/net.cpp
index 0787b16ad6..2839474cb9 100644
--- a/src/net.cpp
+++ b/src/net.cpp
@@ -1181,7 +1181,7 @@ void CConnman::ThreadSocketHandler()
TRY_LOCK(pnode->cs_vRecvMsg, lockRecv);
if (lockRecv && (
pnode->vRecvMsg.empty() || !pnode->vRecvMsg.front().complete() ||
- pnode->GetTotalRecvSize() <= ReceiveFloodSize()))
+ pnode->GetTotalRecvSize() <= GetReceiveFloodSize()))
FD_SET(pnode->hSocket, &fdsetRecv);
}
}
@@ -1851,7 +1851,7 @@ void CConnman::ThreadMessageHandler()
if (!GetNodeSignals().ProcessMessages(pnode, *this))
pnode->CloseSocketDisconnect();
- if (pnode->nSendSize < SendBufferSize())
+ if (pnode->nSendSize < GetSendBufferSize())
{
if (!pnode->vRecvGetData.empty() || (!pnode->vRecvMsg.empty() && pnode->vRecvMsg[0].complete()))
{
@@ -2041,6 +2041,8 @@ CConnman::CConnman()
setBannedIsDirty = false;
fAddressesInitialized = false;
nLastNodeId = 0;
+ nSendBufferMaxSize = 0;
+ nReceiveFloodSize = 0;
}
bool StartNode(CConnman& connman, boost::thread_group& threadGroup, CScheduler& scheduler, std::string& strNodeError)
@@ -2066,6 +2068,9 @@ bool CConnman::Start(boost::thread_group& threadGroup, CScheduler& scheduler, st
nMaxOutboundTimeframe = 60*60*24; //1 day
nMaxOutboundCycleStartTime = 0;
+ nSendBufferMaxSize = 1000*GetArg("-maxsendbuffer", DEFAULT_MAXSENDBUFFER);
+ nReceiveFloodSize = 1000*GetArg("-maxreceivebuffer", DEFAULT_MAXRECEIVEBUFFER);
+
uiInterface.InitMessage(_("Loading addresses..."));
// Load addresses from peers.dat
int64_t nStart = GetTimeMillis();
@@ -2497,8 +2502,8 @@ void CNode::Fuzz(int nChance)
Fuzz(2);
}
-unsigned int ReceiveFloodSize() { return 1000*GetArg("-maxreceivebuffer", DEFAULT_MAXRECEIVEBUFFER); }
-unsigned int SendBufferSize() { return 1000*GetArg("-maxsendbuffer", DEFAULT_MAXSENDBUFFER); }
+unsigned int CConnman::GetReceiveFloodSize() const { return nReceiveFloodSize; }
+unsigned int CConnman::GetSendBufferSize() const{ return nSendBufferMaxSize; }
CNode::CNode(NodeId idIn, SOCKET hSocketIn, const CAddress& addrIn, const std::string& addrNameIn, bool fInboundIn) :
ssSend(SER_NETWORK, INIT_PROTO_VERSION),