Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F13711471
D1748.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Subscribers
None
D1748.diff
View Options
diff --git a/src/net.h b/src/net.h
--- a/src/net.h
+++ b/src/net.h
@@ -145,10 +145,28 @@
std::vector<CSubNet> vWhitelistedRange;
std::vector<CService> vBinds, vWhiteBinds;
};
+
+ void Init(const Options &connOptions) {
+ nLocalServices = connOptions.nLocalServices;
+ nRelevantServices = connOptions.nRelevantServices;
+ nMaxConnections = connOptions.nMaxConnections;
+ nMaxOutbound =
+ std::min(connOptions.nMaxOutbound, connOptions.nMaxConnections);
+ nMaxAddnode = connOptions.nMaxAddnode;
+ nMaxFeeler = connOptions.nMaxFeeler;
+ nBestHeight = connOptions.nBestHeight;
+ clientInterface = connOptions.uiInterface;
+ nSendBufferMaxSize = connOptions.nSendBufferMaxSize;
+ nReceiveFloodSize = connOptions.nReceiveFloodSize;
+ nMaxOutboundTimeframe = connOptions.nMaxOutboundTimeframe;
+ nMaxOutboundLimit = connOptions.nMaxOutboundLimit;
+ vWhitelistedRange = connOptions.vWhitelistedRange;
+ }
+
CConnman(const Config &configIn, uint64_t seed0, uint64_t seed1);
~CConnman();
- bool Start(CScheduler &scheduler, Options options);
+ bool Start(CScheduler &scheduler, const Options &options);
void Stop();
void Interrupt();
bool GetNetworkActive() const { return fNetworkActive; };
diff --git a/src/net.cpp b/src/net.cpp
--- a/src/net.cpp
+++ b/src/net.cpp
@@ -2362,12 +2362,10 @@
nReceiveFloodSize = 0;
semOutbound = nullptr;
semAddnode = nullptr;
- nMaxConnections = 0;
- nMaxOutbound = 0;
- nMaxAddnode = 0;
- nBestHeight = 0;
- clientInterface = nullptr;
flagInterruptMsgProc = false;
+
+ Options connOptions;
+ Init(connOptions);
}
NodeId CConnman::GetNewNodeId() {
@@ -2409,29 +2407,14 @@
return fBound;
}
-bool CConnman::Start(CScheduler &scheduler, Options connOptions) {
+bool CConnman::Start(CScheduler &scheduler, const Options &connOptions) {
+ Init(connOptions);
+
nTotalBytesRecv = 0;
nTotalBytesSent = 0;
nMaxOutboundTotalBytesSentInCycle = 0;
nMaxOutboundCycleStartTime = 0;
- nRelevantServices = connOptions.nRelevantServices;
- nLocalServices = connOptions.nLocalServices;
- nMaxConnections = connOptions.nMaxConnections;
- nMaxOutbound = std::min((connOptions.nMaxOutbound), nMaxConnections);
- nMaxAddnode = connOptions.nMaxAddnode;
- nMaxFeeler = connOptions.nMaxFeeler;
-
- nSendBufferMaxSize = connOptions.nSendBufferMaxSize;
- nReceiveFloodSize = connOptions.nReceiveFloodSize;
-
- nMaxOutboundLimit = connOptions.nMaxOutboundLimit;
- nMaxOutboundTimeframe = connOptions.nMaxOutboundTimeframe;
-
- SetBestHeight(connOptions.nBestHeight);
-
- clientInterface = connOptions.uiInterface;
-
if (fListen && !InitBinds(connOptions.vBinds, connOptions.vWhiteBinds)) {
if (clientInterface) {
clientInterface->ThreadSafeMessageBox(
@@ -2442,8 +2425,6 @@
return false;
}
- vWhitelistedRange = connOptions.vWhitelistedRange;
-
for (const auto &strDest : connOptions.vSeedNodes) {
AddOneShot(strDest);
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Apr 26, 12:08 (2 h, 50 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5573518
Default Alt Text
D1748.diff (3 KB)
Attached To
D1748: [net] Fix use of uninitialized value in getnetworkinfo(const JSONRPCRequest& request)
Event Timeline
Log In to Comment