Electroneum
daemonize::t_rpc Class Referencefinal

#include <rpc.h>

Public Member Functions

 t_rpc (boost::program_options::variables_map const &vm, t_core &core, t_p2p &p2p, const bool restricted, const std::string &port, const std::string &description)
 
void run ()
 
void stop ()
 
cryptonote::core_rpc_serverget_server ()
 
 ~t_rpc ()
 

Static Public Member Functions

static void init_options (boost::program_options::options_description &option_spec)
 

Detailed Description

Definition at line 42 of file rpc.h.

Constructor & Destructor Documentation

◆ t_rpc()

daemonize::t_rpc::t_rpc ( boost::program_options::variables_map const &  vm,
t_core core,
t_p2p p2p,
const bool  restricted,
const std::string &  port,
const std::string &  description 
)
inline

Definition at line 53 of file rpc.h.

61  : m_server{core.get(), p2p.get()}, m_description{description}
62  {
63  MGINFO("Initializing " << m_description << " RPC server...");
64 
65  if (!m_server.init(vm, restricted, port))
66  {
67  throw std::runtime_error("Failed to initialize " + m_description + " RPC server.");
68  }
69  MGINFO(m_description << " RPC server initialized OK on port: " << m_server.get_binded_port());
70  }
bool init(const boost::program_options::variables_map &vm, const bool restricted, const std::string &port)
#define MGINFO(x)
Definition: misc_log_ex.h:80
boost::endian::big_uint16_t port
Definition: socks.cpp:60
Here is the call graph for this function:

◆ ~t_rpc()

daemonize::t_rpc::~t_rpc ( )
inline

Definition at line 94 of file rpc.h.

95  {
96  MGINFO("Deinitializing " << m_description << " RPC server...");
97  try {
98  m_server.deinit();
99  } catch (...) {
100  MERROR("Failed to deinitialize " << m_description << " RPC server...");
101  }
102  }
#define MERROR(x)
Definition: misc_log_ex.h:73
#define MGINFO(x)
Definition: misc_log_ex.h:80
Here is the call graph for this function:

Member Function Documentation

◆ get_server()

cryptonote::core_rpc_server* daemonize::t_rpc::get_server ( )
inline

Definition at line 89 of file rpc.h.

90  {
91  return &m_server;
92  }

◆ init_options()

static void daemonize::t_rpc::init_options ( boost::program_options::options_description &  option_spec)
inlinestatic

Definition at line 45 of file rpc.h.

46  {
48  }
static void init_options(boost::program_options::options_description &desc)
Here is the call graph for this function:

◆ run()

void daemonize::t_rpc::run ( )
inline

Definition at line 72 of file rpc.h.

73  {
74  MGINFO("Starting " << m_description << " RPC server...");
75  if (!m_server.run(2, false))
76  {
77  throw std::runtime_error("Failed to start " + m_description + " RPC server.");
78  }
79  MGINFO(m_description << " RPC server started ok");
80  }
#define MGINFO(x)
Definition: misc_log_ex.h:80
bool run(size_t threads_count, bool wait=true)
Here is the call graph for this function:

◆ stop()

void daemonize::t_rpc::stop ( )
inline

Definition at line 82 of file rpc.h.

83  {
84  MGINFO("Stopping " << m_description << " RPC server...");
85  m_server.send_stop_signal();
86  m_server.timed_wait_server_stop(5000);
87  }
#define MGINFO(x)
Definition: misc_log_ex.h:80
bool timed_wait_server_stop(uint64_t ms)
Here is the call graph for this function:

The documentation for this class was generated from the following file: