aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/p2p/net_node.h5
-rw-r--r--src/p2p/net_node.inl23
2 files changed, 23 insertions, 5 deletions
diff --git a/src/p2p/net_node.h b/src/p2p/net_node.h
index 3a659dcd8..7030d93f7 100644
--- a/src/p2p/net_node.h
+++ b/src/p2p/net_node.h
@@ -149,7 +149,10 @@ namespace nodetool
virtual void for_each_connection(std::function<bool(typename t_payload_net_handler::connection_context&, peerid_type)> f);
//-----------------------------------------------------------------------------------------------
bool parse_peer_from_string(nodetool::net_address& pe, const std::string& node_addr);
- bool handle_command_line(const boost::program_options::variables_map& vm);
+ bool handle_command_line(
+ const boost::program_options::variables_map& vm
+ , bool testnet
+ );
bool idle_worker();
bool handle_remote_peerlist(const std::list<peerlist_entry>& peerlist, time_t local_time, const epee::net_utils::connection_context_base& context);
bool get_local_node_data(basic_node_data& node_data);
diff --git a/src/p2p/net_node.inl b/src/p2p/net_node.inl
index 28c572513..753af7321 100644
--- a/src/p2p/net_node.inl
+++ b/src/p2p/net_node.inl
@@ -60,7 +60,16 @@ namespace nodetool
namespace
{
const command_line::arg_descriptor<std::string> arg_p2p_bind_ip = {"p2p-bind-ip", "Interface for p2p network protocol", "0.0.0.0"};
- const command_line::arg_descriptor<std::string> arg_p2p_bind_port = {"p2p-bind-port", "Port for p2p network protocol", boost::to_string(config::P2P_DEFAULT_PORT)};
+ const command_line::arg_descriptor<std::string> arg_p2p_bind_port = {
+ "p2p-bind-port"
+ , "Port for p2p network protocol"
+ , std::to_string(config::P2P_DEFAULT_PORT)
+ };
+ const command_line::arg_descriptor<std::string> arg_testnet_p2p_bind_port = {
+ "testnet-p2p-bind-port"
+ , "Port for testnet p2p network protocol"
+ , std::to_string(config::testnet::P2P_DEFAULT_PORT)
+ };
const command_line::arg_descriptor<uint32_t> arg_p2p_external_port = {"p2p-external-port", "External port for p2p network protocol (if port forwarding used with NAT)", 0};
const command_line::arg_descriptor<bool> arg_p2p_allow_local_ip = {"allow-local-ip", "Allow local ip add to peer list, mostly in debug purposes"};
const command_line::arg_descriptor<std::vector<std::string> > arg_p2p_add_peer = {"add-peer", "Manually add peer to local peerlist"};
@@ -77,6 +86,7 @@ namespace nodetool
{
command_line::add_arg(desc, arg_p2p_bind_ip);
command_line::add_arg(desc, arg_p2p_bind_port);
+ command_line::add_arg(desc, arg_testnet_p2p_bind_port);
command_line::add_arg(desc, arg_p2p_external_port);
command_line::add_arg(desc, arg_p2p_allow_local_ip);
command_line::add_arg(desc, arg_p2p_add_peer);
@@ -138,10 +148,15 @@ namespace nodetool
}
//-----------------------------------------------------------------------------------
template<class t_payload_net_handler>
- bool node_server<t_payload_net_handler>::handle_command_line(const boost::program_options::variables_map& vm)
+ bool node_server<t_payload_net_handler>::handle_command_line(
+ const boost::program_options::variables_map& vm
+ , bool testnet
+ )
{
+ auto p2p_bind_arg = testnet ? arg_testnet_p2p_bind_port : arg_p2p_bind_port;
+
m_bind_ip = command_line::get_arg(vm, arg_p2p_bind_ip);
- m_port = command_line::get_arg(vm, arg_p2p_bind_port);
+ m_port = command_line::get_arg(vm, p2p_bind_arg);
m_external_port = command_line::get_arg(vm, arg_p2p_external_port);
m_allow_local_ip = command_line::get_arg(vm, arg_p2p_allow_local_ip);
@@ -242,7 +257,7 @@ namespace nodetool
m_network_id.data[0] += 1;
}
- bool res = handle_command_line(vm);
+ bool res = handle_command_line(vm, testnet);
CHECK_AND_ASSERT_MES(res, false, "Failed to handle command line");
m_config_folder = command_line::get_arg(vm, command_line::arg_data_dir);