Merge pull request #6280

b818522d p2p: fix spurious warning when we're connected to at last one seed (moneromooo-monero)
This commit is contained in:
Alexander Blair 2020-03-27 12:17:53 -07:00
commit c038cc8b79
No known key found for this signature in database
GPG Key ID: C64552D877C32479

View File

@ -1533,6 +1533,7 @@ namespace nodetool
return true; return true;
size_t try_count = 0; size_t try_count = 0;
bool is_connected_to_at_least_one_seed_node = false;
size_t current_index = crypto::rand_idx(m_seed_nodes.size()); size_t current_index = crypto::rand_idx(m_seed_nodes.size());
const net_server& server = m_network_zones.at(epee::net_utils::zone::public_).m_net_server; const net_server& server = m_network_zones.at(epee::net_utils::zone::public_).m_net_server;
while(true) while(true)
@ -1540,7 +1541,11 @@ namespace nodetool
if(server.is_stop_signal_sent()) if(server.is_stop_signal_sent())
return false; return false;
if(try_to_connect_and_handshake_with_new_peer(m_seed_nodes[current_index], true)) peerlist_entry pe_seed{};
pe_seed.adr = m_seed_nodes[current_index];
if (is_peer_used(pe_seed))
is_connected_to_at_least_one_seed_node = true;
else if (try_to_connect_and_handshake_with_new_peer(m_seed_nodes[current_index], true))
break; break;
if(++try_count > m_seed_nodes.size()) if(++try_count > m_seed_nodes.size())
{ {
@ -1563,6 +1568,7 @@ namespace nodetool
} }
else else
{ {
if (!is_connected_to_at_least_one_seed_node)
MWARNING("Failed to connect to any of seed peers, continuing without seeds"); MWARNING("Failed to connect to any of seed peers, continuing without seeds");
break; break;
} }