Skip to content

Commit 18ba984

Browse files
committed
Merge #10467: add SeedNodes to CConnman::Options
5d67526 add SeedNodes to CConnman::Options (Marko Bencun) Tree-SHA512: d732ab08697419f896d9598fa3c30030ddbe3b82a99a398d813ebcd5e1fc610ad1043fe0f4c51a7ec5c4d70ce93a9ac5a5c7a91fcaae046ec4f1f7c41523a360
2 parents 5dd69ce + 5d67526 commit 18ba984

File tree

3 files changed

+12
-9
lines changed

3 files changed

+12
-9
lines changed

src/init.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1386,11 +1386,6 @@ bool AppInitMain(boost::thread_group& threadGroup, CScheduler& scheduler)
13861386
}
13871387
}
13881388

1389-
if (gArgs.IsArgSet("-seednode")) {
1390-
BOOST_FOREACH(const std::string& strDest, gArgs.GetArgs("-seednode"))
1391-
connman.AddOneShot(strDest);
1392-
}
1393-
13941389
#if ENABLE_ZMQ
13951390
pzmqNotificationInterface = CZMQNotificationInterface::Create();
13961391

@@ -1659,6 +1654,10 @@ bool AppInitMain(boost::thread_group& threadGroup, CScheduler& scheduler)
16591654
connOptions.nMaxOutboundTimeframe = nMaxOutboundTimeframe;
16601655
connOptions.nMaxOutboundLimit = nMaxOutboundLimit;
16611656

1657+
if (gArgs.IsArgSet("-seednode")) {
1658+
connOptions.vSeedNodes = gArgs.GetArgs("-seednode");
1659+
}
1660+
16621661
if (!connman.Start(scheduler, strNodeError, connOptions))
16631662
return InitError(strNodeError);
16641663

src/net.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1743,9 +1743,9 @@ void CConnman::ThreadOpenConnections()
17431743
// * Increase the number of connectable addresses in the tried table.
17441744
//
17451745
// Method:
1746-
// * Choose a random address from new and attempt to connect to it if we can connect
1746+
// * Choose a random address from new and attempt to connect to it if we can connect
17471747
// successfully it is added to tried.
1748-
// * Start attempting feeler connections only after node finishes making outbound
1748+
// * Start attempting feeler connections only after node finishes making outbound
17491749
// connections.
17501750
// * Only make a feeler connection once every few minutes.
17511751
//
@@ -2212,6 +2212,10 @@ bool CConnman::Start(CScheduler& scheduler, std::string& strNodeError, Options c
22122212

22132213
SetBestHeight(connOptions.nBestHeight);
22142214

2215+
for (const auto& strDest : connOptions.vSeedNodes) {
2216+
AddOneShot(strDest);
2217+
}
2218+
22152219
clientInterface = connOptions.uiInterface;
22162220
if (clientInterface) {
22172221
clientInterface->InitMessage(_("Loading P2P addresses..."));

src/net.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ class CConnman
144144
unsigned int nReceiveFloodSize = 0;
145145
uint64_t nMaxOutboundTimeframe = 0;
146146
uint64_t nMaxOutboundLimit = 0;
147+
std::vector<std::string> vSeedNodes;
147148
};
148149
CConnman(uint64_t seed0, uint64_t seed1);
149150
~CConnman();
@@ -233,8 +234,6 @@ class CConnman
233234
void GetBanned(banmap_t &banmap);
234235
void SetBanned(const banmap_t &banmap);
235236

236-
void AddOneShot(const std::string& strDest);
237-
238237
bool AddNode(const std::string& node);
239238
bool RemoveAddedNode(const std::string& node);
240239
std::vector<AddedNodeInfo> GetAddedNodeInfo();
@@ -292,6 +291,7 @@ class CConnman
292291
};
293292

294293
void ThreadOpenAddedConnections();
294+
void AddOneShot(const std::string& strDest);
295295
void ProcessOneShot();
296296
void ThreadOpenConnections();
297297
void ThreadMessageHandler();

0 commit comments

Comments
 (0)