daemon: add --public-node mode, RPC port propagation over P2P

This commit is contained in:
xiphon
2019-02-24 08:47:49 +00:00
parent 31bdf7bd11
commit 551104fbf1
20 changed files with 147 additions and 30 deletions

View File

@@ -96,9 +96,11 @@ void t_daemon::init_options(boost::program_options::options_description & option
}
t_daemon::t_daemon(
boost::program_options::variables_map const & vm
boost::program_options::variables_map const & vm,
uint16_t public_rpc_port
)
: mp_internals{new t_internals{vm}}
: mp_internals{new t_internals{vm}},
public_rpc_port(public_rpc_port)
{
zmq_rpc_bind_port = command_line::get_arg(vm, daemon_args::arg_zmq_rpc_bind_port);
zmq_rpc_bind_address = command_line::get_arg(vm, daemon_args::arg_zmq_rpc_bind_ip);
@@ -186,6 +188,12 @@ bool t_daemon::run(bool interactive)
MINFO(std::string("ZMQ server started at ") + zmq_rpc_bind_address
+ ":" + zmq_rpc_bind_port + ".");
if (public_rpc_port > 0)
{
MGINFO("Public RPC port " << public_rpc_port << " will be advertised to other peers over P2P");
mp_internals->p2p.get().set_rpc_port(public_rpc_port);
}
mp_internals->p2p.run(); // blocks until p2p goes down
if (rpc_commands)