Merge pull request #3145

fd1dfac5 p2p: don't lookup seed IPs if using an exclusive peer (moneromooo-monero)
b50182ae p2p: don't connect to seeds if using an exclusive peer (moneromooo-monero)
This commit is contained in:
Riccardo Spagni 2018-01-27 17:25:47 -08:00
commit a4ae78a335
No known key found for this signature in database
GPG Key ID: 55432DF31CCD4FCD
1 changed files with 6 additions and 6 deletions

View File

@ -270,6 +270,7 @@ namespace nodetool
m_allow_local_ip = command_line::get_arg(vm, arg_p2p_allow_local_ip); m_allow_local_ip = command_line::get_arg(vm, arg_p2p_allow_local_ip);
m_no_igd = command_line::get_arg(vm, arg_no_igd); m_no_igd = command_line::get_arg(vm, arg_no_igd);
m_offline = command_line::get_arg(vm, cryptonote::arg_offline); m_offline = command_line::get_arg(vm, cryptonote::arg_offline);
m_testnet = command_line::get_arg(vm, cryptonote::arg_testnet_on);
if (command_line::has_arg(vm, arg_p2p_add_peer)) if (command_line::has_arg(vm, arg_p2p_add_peer))
{ {
@ -398,14 +399,16 @@ namespace nodetool
bool node_server<t_payload_net_handler>::init(const boost::program_options::variables_map& vm) bool node_server<t_payload_net_handler>::init(const boost::program_options::variables_map& vm)
{ {
std::set<std::string> full_addrs; std::set<std::string> full_addrs;
m_testnet = command_line::get_arg(vm, cryptonote::arg_testnet_on);
bool res = handle_command_line(vm);
CHECK_AND_ASSERT_MES(res, false, "Failed to handle command line");
if (m_testnet) if (m_testnet)
{ {
memcpy(&m_network_id, &::config::testnet::NETWORK_ID, 16); memcpy(&m_network_id, &::config::testnet::NETWORK_ID, 16);
full_addrs = get_seed_nodes(true); full_addrs = get_seed_nodes(true);
} }
else else if (m_exclusive_peers.empty())
{ {
memcpy(&m_network_id, &::config::NETWORK_ID, 16); memcpy(&m_network_id, &::config::NETWORK_ID, 16);
// for each hostname in the seed nodes list, attempt to DNS resolve and // for each hostname in the seed nodes list, attempt to DNS resolve and
@ -496,9 +499,6 @@ namespace nodetool
} }
MDEBUG("Number of seed nodes: " << m_seed_nodes.size()); MDEBUG("Number of seed nodes: " << m_seed_nodes.size());
bool res = handle_command_line(vm);
CHECK_AND_ASSERT_MES(res, false, "Failed to handle command line");
auto config_arg = m_testnet ? cryptonote::arg_testnet_data_dir : cryptonote::arg_data_dir; auto config_arg = m_testnet ? cryptonote::arg_testnet_data_dir : cryptonote::arg_data_dir;
m_config_folder = command_line::get_arg(vm, config_arg); m_config_folder = command_line::get_arg(vm, config_arg);
@ -1110,7 +1110,7 @@ namespace nodetool
template<class t_payload_net_handler> template<class t_payload_net_handler>
bool node_server<t_payload_net_handler>::connect_to_seed() bool node_server<t_payload_net_handler>::connect_to_seed()
{ {
if (m_seed_nodes.empty() || m_offline) if (m_seed_nodes.empty() || m_offline || !m_exclusive_peers.empty())
return true; return true;
size_t try_count = 0; size_t try_count = 0;