mirror of
https://github.com/kvazar-network/kevacoin.git
synced 2025-01-25 22:34:27 +00:00
net: Add missing locks in net.{cpp,h}
* writing variable 'nTotalBytesRecv' requires holding mutex 'cs_totalBytesRecv' exclusively * writing variables 'nTotalBytesSent'/'nMaxOutboundTotalBytesSentInCycle'/'nMaxOutboundCycleStartTime' require holding mutex 'cs_totalBytesSent' exclusively * writing variable 'nMaxOutboundTimeframe'/'nMaxOutboundLimit' require holding mutex 'cs_totalBytesSent' exclusively * writing variable 'vAddedNodes' requires holding mutex 'cs_vAddedNodes' exclusively
This commit is contained in:
parent
d4267a3ab2
commit
63f21d27ee
@ -2269,10 +2269,16 @@ bool CConnman::Start(CScheduler& scheduler, const Options& connOptions)
|
|||||||
{
|
{
|
||||||
Init(connOptions);
|
Init(connOptions);
|
||||||
|
|
||||||
|
{
|
||||||
|
LOCK(cs_totalBytesRecv);
|
||||||
nTotalBytesRecv = 0;
|
nTotalBytesRecv = 0;
|
||||||
|
}
|
||||||
|
{
|
||||||
|
LOCK(cs_totalBytesSent);
|
||||||
nTotalBytesSent = 0;
|
nTotalBytesSent = 0;
|
||||||
nMaxOutboundTotalBytesSentInCycle = 0;
|
nMaxOutboundTotalBytesSentInCycle = 0;
|
||||||
nMaxOutboundCycleStartTime = 0;
|
nMaxOutboundCycleStartTime = 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (fListen && !InitBinds(connOptions.vBinds, connOptions.vWhiteBinds)) {
|
if (fListen && !InitBinds(connOptions.vBinds, connOptions.vWhiteBinds)) {
|
||||||
if (clientInterface) {
|
if (clientInterface) {
|
||||||
|
@ -158,11 +158,17 @@ public:
|
|||||||
m_msgproc = connOptions.m_msgproc;
|
m_msgproc = connOptions.m_msgproc;
|
||||||
nSendBufferMaxSize = connOptions.nSendBufferMaxSize;
|
nSendBufferMaxSize = connOptions.nSendBufferMaxSize;
|
||||||
nReceiveFloodSize = connOptions.nReceiveFloodSize;
|
nReceiveFloodSize = connOptions.nReceiveFloodSize;
|
||||||
|
{
|
||||||
|
LOCK(cs_totalBytesSent);
|
||||||
nMaxOutboundTimeframe = connOptions.nMaxOutboundTimeframe;
|
nMaxOutboundTimeframe = connOptions.nMaxOutboundTimeframe;
|
||||||
nMaxOutboundLimit = connOptions.nMaxOutboundLimit;
|
nMaxOutboundLimit = connOptions.nMaxOutboundLimit;
|
||||||
|
}
|
||||||
vWhitelistedRange = connOptions.vWhitelistedRange;
|
vWhitelistedRange = connOptions.vWhitelistedRange;
|
||||||
|
{
|
||||||
|
LOCK(cs_vAddedNodes);
|
||||||
vAddedNodes = connOptions.m_added_nodes;
|
vAddedNodes = connOptions.m_added_nodes;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
CConnman(uint64_t seed0, uint64_t seed1);
|
CConnman(uint64_t seed0, uint64_t seed1);
|
||||||
~CConnman();
|
~CConnman();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user