aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorfanquake <fanquake@gmail.com>2020-11-18 20:07:58 +0800
committerfanquake <fanquake@gmail.com>2020-11-18 20:45:46 +0800
commit5bcae7967f73353aff5e6d2f696bbf47ec6fdbb3 (patch)
tree5ad264620a8c2782881444c826ce9b3fa06a48cf /src
parenta64ff1c4d32c0458660426e4f40b45b8b7c13a87 (diff)
parent9d09132be4ff99f98ca905c342347d5f35f13350 (diff)
Merge #20408: CConnman: move initialization to declaration
9d09132be4ff99f98ca905c342347d5f35f13350 CConnman: initialise at declaration rather than in Start() (Anthony Towns) Pull request description: Ensure nMaxOutboundTotalBytesSentInCycle and nMaxOutboundCycleStartTime are initialized even if CConnman::Start() is not called. Prevents failures in test/fuzz/connman when run under valgrind. ACKs for top commit: practicalswift: ACK 9d09132be4ff99f98ca905c342347d5f35f13350: patch looks correct! MarcoFalke: review ACK 9d09132be4ff99f98ca905c342347d5f35f13350 , checked that we call Start only once and in the same scope where connman is constructed (AppInitMain) 💸 jnewbery: Code review ACK 9d09132be4 Tree-SHA512: 1c6c893e8c616a91947a8cc295b0ba508af3ecfcdcd94cdc5f95d808cc93c6d1a71fd24dcc194dc583854e9889fb522ca8523043367fb0263370fbcab08c6aaa
Diffstat (limited to 'src')
-rw-r--r--src/net.cpp11
-rw-r--r--src/net.h4
2 files changed, 2 insertions, 13 deletions
diff --git a/src/net.cpp b/src/net.cpp
index cf987b6995..20c1763ea6 100644
--- a/src/net.cpp
+++ b/src/net.cpp
@@ -2445,17 +2445,6 @@ bool CConnman::Start(CScheduler& scheduler, const Options& 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 (clientInterface) {
clientInterface->ThreadSafeMessageBox(
diff --git a/src/net.h b/src/net.h
index 77649247d9..a6dcf7f610 100644
--- a/src/net.h
+++ b/src/net.h
@@ -478,8 +478,8 @@ private:
uint64_t nTotalBytesSent GUARDED_BY(cs_totalBytesSent) {0};
// outbound limit & stats
- uint64_t nMaxOutboundTotalBytesSentInCycle GUARDED_BY(cs_totalBytesSent);
- uint64_t nMaxOutboundCycleStartTime GUARDED_BY(cs_totalBytesSent);
+ uint64_t nMaxOutboundTotalBytesSentInCycle GUARDED_BY(cs_totalBytesSent) {0};
+ uint64_t nMaxOutboundCycleStartTime GUARDED_BY(cs_totalBytesSent) {0};
uint64_t nMaxOutboundLimit GUARDED_BY(cs_totalBytesSent);
uint64_t nMaxOutboundTimeframe GUARDED_BY(cs_totalBytesSent);