@@ -158,10 +158,16 @@ class CConnman
158
158
m_msgproc = connOptions.m_msgproc ;
159
159
nSendBufferMaxSize = connOptions.nSendBufferMaxSize ;
160
160
nReceiveFloodSize = connOptions.nReceiveFloodSize ;
161
- nMaxOutboundTimeframe = connOptions.nMaxOutboundTimeframe ;
162
- nMaxOutboundLimit = connOptions.nMaxOutboundLimit ;
161
+ {
162
+ LOCK (cs_totalBytesSent);
163
+ nMaxOutboundTimeframe = connOptions.nMaxOutboundTimeframe ;
164
+ nMaxOutboundLimit = connOptions.nMaxOutboundLimit ;
165
+ }
163
166
vWhitelistedRange = connOptions.vWhitelistedRange ;
164
- vAddedNodes = connOptions.m_added_nodes ;
167
+ {
168
+ LOCK (cs_vAddedNodes);
169
+ vAddedNodes = connOptions.m_added_nodes ;
170
+ }
165
171
}
166
172
167
173
CConnman (uint64_t seed0, uint64_t seed1);
@@ -364,14 +370,14 @@ class CConnman
364
370
// Network usage totals
365
371
CCriticalSection cs_totalBytesRecv;
366
372
CCriticalSection cs_totalBytesSent;
367
- uint64_t nTotalBytesRecv;
368
- uint64_t nTotalBytesSent;
373
+ uint64_t nTotalBytesRecv GUARDED_BY (cs_totalBytesRecv) ;
374
+ uint64_t nTotalBytesSent GUARDED_BY (cs_totalBytesSent) ;
369
375
370
376
// outbound limit & stats
371
- uint64_t nMaxOutboundTotalBytesSentInCycle;
372
- uint64_t nMaxOutboundCycleStartTime;
373
- uint64_t nMaxOutboundLimit;
374
- uint64_t nMaxOutboundTimeframe;
377
+ uint64_t nMaxOutboundTotalBytesSentInCycle GUARDED_BY (cs_totalBytesSent) ;
378
+ uint64_t nMaxOutboundCycleStartTime GUARDED_BY (cs_totalBytesSent) ;
379
+ uint64_t nMaxOutboundLimit GUARDED_BY (cs_totalBytesSent) ;
380
+ uint64_t nMaxOutboundTimeframe GUARDED_BY (cs_totalBytesSent) ;
375
381
376
382
// Whitelisted ranges. Any node connecting from these is automatically
377
383
// whitelisted (as well as those connecting to whitelisted binds).
@@ -389,7 +395,7 @@ class CConnman
389
395
CAddrMan addrman;
390
396
std::deque<std::string> vOneShots;
391
397
CCriticalSection cs_vOneShots;
392
- std::vector<std::string> vAddedNodes;
398
+ std::vector<std::string> vAddedNodes GUARDED_BY (cs_vAddedNodes) ;
393
399
CCriticalSection cs_vAddedNodes;
394
400
std::vector<CNode*> vNodes;
395
401
std::list<CNode*> vNodesDisconnected;
0 commit comments