aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMarko Bencun <marko.bencun@monetas.net>2017-05-27 12:00:37 +0200
committerMarko Bencun <marko.bencun@monetas.net>2017-05-30 09:21:47 +0200
commit5d67526026cd41845e06e93e5ae216bc1a7b9596 (patch)
treef559badaaefa0126c881c4d8451d88615357c772 /src
parent5c63d665e51ed0cd5d29275a5d63b07a64300ac8 (diff)
add SeedNodes to CConnman::Options
Start of a series of changes to clean up the instantiation of connman by decoupling the command line arguments.
Diffstat (limited to 'src')
-rw-r--r--src/init.cpp9
-rw-r--r--src/net.cpp8
-rw-r--r--src/net.h4
3 files changed, 12 insertions, 9 deletions
diff --git a/src/init.cpp b/src/init.cpp
index 3bbdb16c3b..f343f1d965 100644
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -1386,11 +1386,6 @@ bool AppInitMain(boost::thread_group& threadGroup, CScheduler& scheduler)
}
}
- if (gArgs.IsArgSet("-seednode")) {
- BOOST_FOREACH(const std::string& strDest, gArgs.GetArgs("-seednode"))
- connman.AddOneShot(strDest);
- }
-
#if ENABLE_ZMQ
pzmqNotificationInterface = CZMQNotificationInterface::Create();
@@ -1659,6 +1654,10 @@ bool AppInitMain(boost::thread_group& threadGroup, CScheduler& scheduler)
connOptions.nMaxOutboundTimeframe = nMaxOutboundTimeframe;
connOptions.nMaxOutboundLimit = nMaxOutboundLimit;
+ if (gArgs.IsArgSet("-seednode")) {
+ connOptions.vSeedNodes = gArgs.GetArgs("-seednode");
+ }
+
if (!connman.Start(scheduler, strNodeError, connOptions))
return InitError(strNodeError);
diff --git a/src/net.cpp b/src/net.cpp
index 198d8f5fff..bac9b5732a 100644
--- a/src/net.cpp
+++ b/src/net.cpp
@@ -1743,9 +1743,9 @@ void CConnman::ThreadOpenConnections()
// * Increase the number of connectable addresses in the tried table.
//
// Method:
- // * Choose a random address from new and attempt to connect to it if we can connect
+ // * Choose a random address from new and attempt to connect to it if we can connect
// successfully it is added to tried.
- // * Start attempting feeler connections only after node finishes making outbound
+ // * Start attempting feeler connections only after node finishes making outbound
// connections.
// * Only make a feeler connection once every few minutes.
//
@@ -2212,6 +2212,10 @@ bool CConnman::Start(CScheduler& scheduler, std::string& strNodeError, Options c
SetBestHeight(connOptions.nBestHeight);
+ for (const auto& strDest : connOptions.vSeedNodes) {
+ AddOneShot(strDest);
+ }
+
clientInterface = connOptions.uiInterface;
if (clientInterface) {
clientInterface->InitMessage(_("Loading P2P addresses..."));
diff --git a/src/net.h b/src/net.h
index bea04bc580..7f9ec1a57b 100644
--- a/src/net.h
+++ b/src/net.h
@@ -144,6 +144,7 @@ public:
unsigned int nReceiveFloodSize = 0;
uint64_t nMaxOutboundTimeframe = 0;
uint64_t nMaxOutboundLimit = 0;
+ std::vector<std::string> vSeedNodes;
};
CConnman(uint64_t seed0, uint64_t seed1);
~CConnman();
@@ -233,8 +234,6 @@ public:
void GetBanned(banmap_t &banmap);
void SetBanned(const banmap_t &banmap);
- void AddOneShot(const std::string& strDest);
-
bool AddNode(const std::string& node);
bool RemoveAddedNode(const std::string& node);
std::vector<AddedNodeInfo> GetAddedNodeInfo();
@@ -292,6 +291,7 @@ private:
};
void ThreadOpenAddedConnections();
+ void AddOneShot(const std::string& strDest);
void ProcessOneShot();
void ThreadOpenConnections();
void ThreadMessageHandler();