CConnman: initialise at declaration rather than in Start()
Ensure nMaxOutboundTotalBytesSentInCycle and nMaxOutboundCycleStartTime are initialized even if CConnman::Start() is not called.
This commit is contained in:
1 parent
e7986c51bc
commit
9d09132be4
2 files changed
+2
-13
No files matched your search
-11
@@ -2445,17 +2445,6 @@ bool CConnman::Start(CScheduler& scheduler, const Options& connOptions)
|
|||||||
{
|
{
|
||||||
Init(connOptions);
|
Init(connOptions);
|
||||||
|
|
||||||
{
|
|
||||||
LOCK(cs_totalBytesRecv);
|
|
||||||
nTotalBytesRecv = 0;
|
|
||||||
}
|
|
||||||
{
|
|
||||||
LOCK(cs_totalBytesSent);
|
|
||||||
nTotalBytesSent = 0;
|
|
||||||
nMaxOutboundTotalBytesSentInCycle = 0;
|
|
||||||
nMaxOutboundCycleStartTime = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (fListen && !InitBinds(connOptions.vBinds, connOptions.vWhiteBinds, connOptions.onion_binds)) {
|
if (fListen && !InitBinds(connOptions.vBinds, connOptions.vWhiteBinds, connOptions.onion_binds)) {
|
||||||
if (clientInterface) {
|
if (clientInterface) {
|
||||||
clientInterface->ThreadSafeMessageBox(
|
clientInterface->ThreadSafeMessageBox(
|
||||||
|
|||||||
@@ -478,8 +478,8 @@ private:
|
|||||||
uint64_t nTotalBytesSent GUARDED_BY(cs_totalBytesSent) {0};
|
uint64_t nTotalBytesSent GUARDED_BY(cs_totalBytesSent) {0};
|
||||||
|
|
||||||
// outbound limit & stats
|
// outbound limit & stats
|
||||||
uint64_t nMaxOutboundTotalBytesSentInCycle GUARDED_BY(cs_totalBytesSent);
|
uint64_t nMaxOutboundTotalBytesSentInCycle GUARDED_BY(cs_totalBytesSent) {0};
|
||||||
uint64_t nMaxOutboundCycleStartTime GUARDED_BY(cs_totalBytesSent);
|
uint64_t nMaxOutboundCycleStartTime GUARDED_BY(cs_totalBytesSent) {0};
|
||||||
uint64_t nMaxOutboundLimit GUARDED_BY(cs_totalBytesSent);
|
uint64_t nMaxOutboundLimit GUARDED_BY(cs_totalBytesSent);
|
||||||
uint64_t nMaxOutboundTimeframe GUARDED_BY(cs_totalBytesSent);
|
uint64_t nMaxOutboundTimeframe GUARDED_BY(cs_totalBytesSent);
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user