aboutsummaryrefslogtreecommitdiff
path: root/src/p2p/net_node.inl
diff options
context:
space:
mode:
authorZachary Michaels <mikezackles@gmail.com>2014-09-08 12:51:04 -0400
committerRiccardo Spagni <ric@spagni.net>2014-09-15 15:53:10 +0200
commit98ed9a41f7bf0d904e257372f4561aea3ad12c18 (patch)
tree1a9bde3f4ff6129a40e8a36e3c2310c3fb3b5442 /src/p2p/net_node.inl
parentReorganize testnet constants (diff)
downloadmonero-98ed9a41f7bf0d904e257372f4561aea3ad12c18.tar.xz
Separate p2p port for testnet
Diffstat (limited to 'src/p2p/net_node.inl')
-rw-r--r--src/p2p/net_node.inl23
1 files changed, 19 insertions, 4 deletions
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);