mirror of
https://git.wownero.com/wownero/wownero.git
synced 2024-12-23 08:48:52 +00:00
Merge pull request #5597
343c0b4
add a command line option to disable ZMQ server (jtgrassie)
This commit is contained in:
commit
015c1792c0
@ -122,6 +122,11 @@ namespace daemon_args
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const command_line::arg_descriptor<bool> arg_zmq_rpc_disabled = {
|
||||||
|
"no-zmq"
|
||||||
|
, "Disable ZMQ RPC server"
|
||||||
|
};
|
||||||
|
|
||||||
} // namespace daemon_args
|
} // namespace daemon_args
|
||||||
|
|
||||||
#endif // DAEMON_COMMAND_LINE_ARGS_H
|
#endif // DAEMON_COMMAND_LINE_ARGS_H
|
||||||
|
@ -105,6 +105,7 @@ t_daemon::t_daemon(
|
|||||||
{
|
{
|
||||||
zmq_rpc_bind_port = command_line::get_arg(vm, daemon_args::arg_zmq_rpc_bind_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);
|
zmq_rpc_bind_address = command_line::get_arg(vm, daemon_args::arg_zmq_rpc_bind_ip);
|
||||||
|
zmq_rpc_disabled = command_line::get_arg(vm, daemon_args::arg_zmq_rpc_disabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
t_daemon::~t_daemon() = default;
|
t_daemon::~t_daemon() = default;
|
||||||
@ -171,6 +172,8 @@ bool t_daemon::run(bool interactive)
|
|||||||
cryptonote::rpc::DaemonHandler rpc_daemon_handler(mp_internals->core.get(), mp_internals->p2p.get());
|
cryptonote::rpc::DaemonHandler rpc_daemon_handler(mp_internals->core.get(), mp_internals->p2p.get());
|
||||||
cryptonote::rpc::ZmqServer zmq_server(rpc_daemon_handler);
|
cryptonote::rpc::ZmqServer zmq_server(rpc_daemon_handler);
|
||||||
|
|
||||||
|
if (!zmq_rpc_disabled)
|
||||||
|
{
|
||||||
if (!zmq_server.addTCPSocket(zmq_rpc_bind_address, zmq_rpc_bind_port))
|
if (!zmq_server.addTCPSocket(zmq_rpc_bind_address, zmq_rpc_bind_port))
|
||||||
{
|
{
|
||||||
LOG_ERROR(std::string("Failed to add TCP Socket (") + zmq_rpc_bind_address
|
LOG_ERROR(std::string("Failed to add TCP Socket (") + zmq_rpc_bind_address
|
||||||
@ -190,6 +193,9 @@ bool t_daemon::run(bool interactive)
|
|||||||
|
|
||||||
MINFO(std::string("ZMQ server started at ") + zmq_rpc_bind_address
|
MINFO(std::string("ZMQ server started at ") + zmq_rpc_bind_address
|
||||||
+ ":" + zmq_rpc_bind_port + ".");
|
+ ":" + zmq_rpc_bind_port + ".");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
MINFO("ZMQ server disabled");
|
||||||
|
|
||||||
if (public_rpc_port > 0)
|
if (public_rpc_port > 0)
|
||||||
{
|
{
|
||||||
@ -202,6 +208,7 @@ bool t_daemon::run(bool interactive)
|
|||||||
if (rpc_commands)
|
if (rpc_commands)
|
||||||
rpc_commands->stop_handling();
|
rpc_commands->stop_handling();
|
||||||
|
|
||||||
|
if (!zmq_rpc_disabled)
|
||||||
zmq_server.stop();
|
zmq_server.stop();
|
||||||
|
|
||||||
for(auto& rpc : mp_internals->rpcs)
|
for(auto& rpc : mp_internals->rpcs)
|
||||||
|
@ -46,6 +46,7 @@ private:
|
|||||||
uint16_t public_rpc_port;
|
uint16_t public_rpc_port;
|
||||||
std::string zmq_rpc_bind_address;
|
std::string zmq_rpc_bind_address;
|
||||||
std::string zmq_rpc_bind_port;
|
std::string zmq_rpc_bind_port;
|
||||||
|
bool zmq_rpc_disabled;
|
||||||
public:
|
public:
|
||||||
t_daemon(
|
t_daemon(
|
||||||
boost::program_options::variables_map const & vm,
|
boost::program_options::variables_map const & vm,
|
||||||
|
@ -141,6 +141,7 @@ int main(int argc, char const * argv[])
|
|||||||
command_line::add_arg(core_settings, daemon_args::arg_public_node);
|
command_line::add_arg(core_settings, daemon_args::arg_public_node);
|
||||||
command_line::add_arg(core_settings, daemon_args::arg_zmq_rpc_bind_ip);
|
command_line::add_arg(core_settings, daemon_args::arg_zmq_rpc_bind_ip);
|
||||||
command_line::add_arg(core_settings, daemon_args::arg_zmq_rpc_bind_port);
|
command_line::add_arg(core_settings, daemon_args::arg_zmq_rpc_bind_port);
|
||||||
|
command_line::add_arg(core_settings, daemon_args::arg_zmq_rpc_disabled);
|
||||||
|
|
||||||
daemonizer::init_options(hidden_options, visible_options);
|
daemonizer::init_options(hidden_options, visible_options);
|
||||||
daemonize::t_executor::init_options(core_settings);
|
daemonize::t_executor::init_options(core_settings);
|
||||||
|
Loading…
Reference in New Issue
Block a user