mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-11 22:50:59 +01:00
net: move SendBufferSize/ReceiveFloodSize to CConnman
This commit is contained in:
13
src/net.cpp
13
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),
|
||||
|
||||
Reference in New Issue
Block a user