mirror of
https://github.com/dogecoin/dogecoin.git
synced 2026-02-13 08:48:37 +00:00
net: avoid uninitialized reads on counters
Initialize CConnman byte counters during construction, so that GetTotalBytesRecv() and GetTotalBytesSent() methods don't return garbage before Start() is called, in QT. Backported from: 8313fa8e Original author: Russell Yanofsky <russ@yanofsky.org>
This commit is contained in:
parent
7019ead6a1
commit
39a476dcb2
@ -2217,8 +2217,6 @@ NodeId CConnman::GetNewNodeId()
|
||||
|
||||
bool CConnman::Start(CScheduler& scheduler, std::string& strNodeError, Options connOptions)
|
||||
{
|
||||
nTotalBytesRecv = 0;
|
||||
nTotalBytesSent = 0;
|
||||
nMaxOutboundTotalBytesSentInCycle = 0;
|
||||
nMaxOutboundCycleStartTime = 0;
|
||||
|
||||
|
||||
@ -339,8 +339,8 @@ private:
|
||||
// Network usage totals
|
||||
CCriticalSection cs_totalBytesRecv;
|
||||
CCriticalSection cs_totalBytesSent;
|
||||
uint64_t nTotalBytesRecv;
|
||||
uint64_t nTotalBytesSent;
|
||||
uint64_t nTotalBytesRecv = 0;
|
||||
uint64_t nTotalBytesSent = 0;
|
||||
|
||||
// outbound limit & stats
|
||||
uint64_t nMaxOutboundTotalBytesSentInCycle;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user