aboutsummaryrefslogtreecommitdiff
path: root/src/daemon/rpc.h
diff options
context:
space:
mode:
authorTim L <timo614@gmail.com>2017-11-15 22:58:11 -0500
committerTim L <timo614@gmail.com>2017-11-17 16:23:41 -0500
commit23b6f685de3df9c073078bc60f6f87d7c8d6f8f7 (patch)
tree218486e11d34d8759d5d62b7e97ae4916a451194 /src/daemon/rpc.h
parentMerge pull request #2818 (diff)
downloadmonero-23b6f685de3df9c073078bc60f6f87d7c8d6f8f7.tar.xz
RPC: allow binding of restricted port in addition to core port
Diffstat (limited to 'src/daemon/rpc.h')
-rw-r--r--src/daemon/rpc.h28
1 files changed, 17 insertions, 11 deletions
diff --git a/src/daemon/rpc.h b/src/daemon/rpc.h
index 0ecfdd120..9b7438053 100644
--- a/src/daemon/rpc.h
+++ b/src/daemon/rpc.h
@@ -47,35 +47,41 @@ public:
}
private:
cryptonote::core_rpc_server m_server;
+ const std::string m_description;
public:
t_rpc(
boost::program_options::variables_map const & vm
, t_core & core
, t_p2p & p2p
+ , const bool restricted
+ , const bool testnet
+ , const std::string & port
+ , const std::string & description
)
- : m_server{core.get(), p2p.get()}
+ : m_server{core.get(), p2p.get()}, m_description{description}
{
- MGINFO("Initializing core rpc server...");
- if (!m_server.init(vm))
+ MGINFO("Initializing " << m_description << " rpc server...");
+
+ if (!m_server.init(vm, restricted, testnet, port))
{
- throw std::runtime_error("Failed to initialize core rpc server.");
+ throw std::runtime_error("Failed to initialize " + m_description + " rpc server.");
}
- MGINFO("Core rpc server initialized OK on port: " << m_server.get_binded_port());
+ MGINFO(m_description << " rpc server initialized OK on port: " << m_server.get_binded_port());
}
void run()
{
- MGINFO("Starting core rpc server...");
+ MGINFO("Starting " << m_description << " rpc server...");
if (!m_server.run(2, false))
{
- throw std::runtime_error("Failed to start core rpc server.");
+ throw std::runtime_error("Failed to start " + m_description + " rpc server.");
}
- MGINFO("Core rpc server started ok");
+ MGINFO(m_description << " rpc server started ok");
}
void stop()
{
- MGINFO("Stopping core rpc server...");
+ MGINFO("Stopping " << m_description << " rpc server...");
m_server.send_stop_signal();
m_server.timed_wait_server_stop(5000);
}
@@ -87,11 +93,11 @@ public:
~t_rpc()
{
- MGINFO("Deinitializing rpc server...");
+ MGINFO("Deinitializing " << m_description << " rpc server...");
try {
m_server.deinit();
} catch (...) {
- MERROR("Failed to deinitialize rpc server...");
+ MERROR("Failed to deinitialize " << m_description << " rpc server...");
}
}
};