forked from lthn/blockchain
minor improvements
This commit is contained in:
parent
141a8eac6a
commit
8341f4f31f
2 changed files with 12 additions and 12 deletions
|
|
@ -22,16 +22,16 @@ namespace currency
|
|||
{
|
||||
namespace
|
||||
{
|
||||
const command_line::arg_descriptor<std::string> arg_rpc_bind_ip ("rpc-bind-ip", "", "127.0.0.1");
|
||||
const command_line::arg_descriptor<std::string> arg_rpc_bind_port ("rpc-bind-port", "", std::to_string(RPC_DEFAULT_PORT));
|
||||
const command_line::arg_descriptor<bool> arg_rpc_ignore_status ("rpc-ignore-offline", "Let rpc calls despite online/offline status");
|
||||
const command_line::arg_descriptor<std::string> arg_rpc_bind_ip ("rpc-bind-ip", "", "127.0.0.1");
|
||||
const command_line::arg_descriptor<std::string> arg_rpc_bind_port ("rpc-bind-port", "", std::to_string(RPC_DEFAULT_PORT));
|
||||
const command_line::arg_descriptor<bool> arg_rpc_ignore_offline_status ("rpc-ignore-offline", "Let rpc calls despite online/offline status");
|
||||
}
|
||||
//-----------------------------------------------------------------------------------
|
||||
void core_rpc_server::init_options(boost::program_options::options_description& desc)
|
||||
{
|
||||
command_line::add_arg(desc, arg_rpc_bind_ip);
|
||||
command_line::add_arg(desc, arg_rpc_bind_port);
|
||||
command_line::add_arg(desc, arg_rpc_ignore_status);
|
||||
command_line::add_arg(desc, arg_rpc_ignore_offline_status);
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------------------------------------
|
||||
core_rpc_server::core_rpc_server(core& cr, nodetool::node_server<currency::t_currency_protocol_handler<currency::core> >& p2p,
|
||||
|
|
@ -39,16 +39,16 @@ namespace currency
|
|||
: m_core(cr)
|
||||
, m_p2p(p2p)
|
||||
, m_of(of)
|
||||
, m_ignore_status(false)
|
||||
, m_ignore_offline_status(false)
|
||||
{}
|
||||
//------------------------------------------------------------------------------------------------------------------------------
|
||||
bool core_rpc_server::handle_command_line(const boost::program_options::variables_map& vm)
|
||||
{
|
||||
m_bind_ip = command_line::get_arg(vm, arg_rpc_bind_ip);
|
||||
m_port = command_line::get_arg(vm, arg_rpc_bind_port);
|
||||
if (command_line::has_arg(vm, arg_rpc_ignore_status))
|
||||
if (command_line::has_arg(vm, arg_rpc_ignore_offline_status))
|
||||
{
|
||||
m_ignore_status = command_line::get_arg(vm, arg_rpc_ignore_status);
|
||||
m_ignore_offline_status = command_line::get_arg(vm, arg_rpc_ignore_offline_status);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
@ -64,7 +64,7 @@ namespace currency
|
|||
bool core_rpc_server::check_core_ready_(const std::string& calling_method)
|
||||
{
|
||||
#ifndef TESTNET
|
||||
if (m_ignore_status)
|
||||
if (m_ignore_offline_status)
|
||||
return true;
|
||||
if(!m_p2p.get_payload_object().is_synchronized())
|
||||
{
|
||||
|
|
@ -576,7 +576,7 @@ namespace currency
|
|||
//------------------------------------------------------------------------------------------------------------------------------
|
||||
bool core_rpc_server::on_get_pos_mining_details(const COMMAND_RPC_GET_POS_MINING_DETAILS::request& req, COMMAND_RPC_GET_POS_MINING_DETAILS::response& res, connection_context& cntx)
|
||||
{
|
||||
if (!m_ignore_status && !m_p2p.get_connections_count())
|
||||
if (!m_ignore_offline_status && !m_p2p.get_connections_count())
|
||||
{
|
||||
res.status = API_RETURN_CODE_DISCONNECTED;
|
||||
return true;
|
||||
|
|
@ -862,7 +862,7 @@ namespace currency
|
|||
return true;
|
||||
}
|
||||
|
||||
if (!m_ignore_status && !m_p2p.get_payload_object().get_synchronized_connections_count())
|
||||
if (!m_ignore_offline_status && !m_p2p.get_payload_object().get_synchronized_connections_count())
|
||||
{
|
||||
LOG_PRINT_L0("[on_send_raw_tx]: Failed to send, daemon not connected to net");
|
||||
res.status = API_RETURN_CODE_DISCONNECTED;
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ namespace currency
|
|||
|
||||
void set_rpc_chain_handler(epee::net_utils::http::i_chain_handler* prpc_chain_handler) { m_prpc_chain_handler = prpc_chain_handler; }
|
||||
bool on_get_blocks_direct(const COMMAND_RPC_GET_BLOCKS_DIRECT::request& req, COMMAND_RPC_GET_BLOCKS_DIRECT::response& res, connection_context& cntx);
|
||||
void set_ignore_connectivity_status(bool ignore) { m_ignore_status = ignore;}
|
||||
void set_ignore_connectivity_status(bool ignore) { m_ignore_offline_status = ignore;}
|
||||
|
||||
bool on_get_height(const COMMAND_RPC_GET_HEIGHT::request& req, COMMAND_RPC_GET_HEIGHT::response& res, connection_context& cntx);
|
||||
bool on_get_blocks(const COMMAND_RPC_GET_BLOCKS_FAST::request& req, COMMAND_RPC_GET_BLOCKS_FAST::response& res, connection_context& cntx);
|
||||
|
|
@ -196,7 +196,7 @@ namespace currency
|
|||
bc_services::bc_offers_service& m_of;
|
||||
std::string m_port;
|
||||
std::string m_bind_ip;
|
||||
bool m_ignore_status;
|
||||
bool m_ignore_offline_status;
|
||||
epee::net_utils::http::i_chain_handler* m_prpc_chain_handler = nullptr;
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue