aboutsummaryrefslogtreecommitdiff
path: root/src/p2p/net_node.inl
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2018-04-29 14:57:08 +0100
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2018-04-29 14:58:42 +0100
commit159018396556968416d932591877e8aaf4c34354 (patch)
tree3e5ef13caaefbd06f0dd0dab3dd63e59c742b3ad /src/p2p/net_node.inl
parentMerge pull request #3709 (diff)
downloadmonero-159018396556968416d932591877e8aaf4c34354.tar.xz
p2p: fix fallback seed node usage
Those were added to the seed nodes list even when they had already been added. Moreover, the current index was not reset after they were added, typically causing previous seeds to be used, and some of those fallback seeds to not be tried.
Diffstat (limited to 'src/p2p/net_node.inl')
-rw-r--r--src/p2p/net_node.inl13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/p2p/net_node.inl b/src/p2p/net_node.inl
index 9b21705ec..07f369d40 100644
--- a/src/p2p/net_node.inl
+++ b/src/p2p/net_node.inl
@@ -405,6 +405,7 @@ namespace nodetool
bool res = handle_command_line(vm);
CHECK_AND_ASSERT_MES(res, false, "Failed to handle command line");
+ m_fallback_seed_nodes_added = false;
if (m_nettype == cryptonote::TESTNET)
{
memcpy(&m_network_id, &::config::testnet::NETWORK_ID, 16);
@@ -498,6 +499,7 @@ namespace nodetool
for (const auto &peer: get_seed_nodes(cryptonote::MAINNET))
full_addrs.insert(peer);
+ m_fallback_seed_nodes_added = true;
}
}
}
@@ -1134,7 +1136,6 @@ namespace nodetool
size_t try_count = 0;
size_t current_index = crypto::rand<size_t>()%m_seed_nodes.size();
- bool fallback_nodes_added = false;
while(true)
{
if(m_net_server.is_stop_signal_sent())
@@ -1144,15 +1145,21 @@ namespace nodetool
break;
if(++try_count > m_seed_nodes.size())
{
- if (!fallback_nodes_added)
+ if (!m_fallback_seed_nodes_added)
{
MWARNING("Failed to connect to any of seed peers, trying fallback seeds");
+ current_index = m_seed_nodes.size();
for (const auto &peer: get_seed_nodes(m_nettype))
{
MDEBUG("Fallback seed node: " << peer);
append_net_address(m_seed_nodes, peer);
}
- fallback_nodes_added = true;
+ m_fallback_seed_nodes_added = true;
+ if (current_index == m_seed_nodes.size())
+ {
+ MWARNING("No fallback seeds, continuing without seeds");
+ break;
+ }
// continue for another few cycles
}
else