mirror of
https://github.com/XRPLF/clio.git
synced 2026-04-29 15:37:53 +00:00
add server info
This commit is contained in:
@@ -44,7 +44,8 @@ enum RPCCommand {
|
||||
ledger_data,
|
||||
book_offers,
|
||||
ledger_range,
|
||||
ledger_entry
|
||||
ledger_entry,
|
||||
server_info
|
||||
};
|
||||
std::unordered_map<std::string, RPCCommand> commandMap{
|
||||
{"tx", tx},
|
||||
@@ -54,7 +55,8 @@ std::unordered_map<std::string, RPCCommand> commandMap{
|
||||
{"ledger_entry", ledger_entry},
|
||||
{"account_info", account_info},
|
||||
{"ledger_data", ledger_data},
|
||||
{"book_offers", book_offers}};
|
||||
{"book_offers", book_offers},
|
||||
{"server_info", server_info}};
|
||||
|
||||
boost::json::object
|
||||
doAccountInfo(
|
||||
@@ -84,6 +86,10 @@ boost::json::object
|
||||
doLedgerRange(
|
||||
boost::json::object const& request,
|
||||
BackendInterface const& backend);
|
||||
boost::json::object
|
||||
doServerInfo(
|
||||
boost::json::object const& request,
|
||||
BackendInterface const& backend);
|
||||
|
||||
std::pair<boost::json::object, uint32_t>
|
||||
buildResponse(
|
||||
@@ -125,6 +131,10 @@ buildResponse(
|
||||
return {res, 1};
|
||||
}
|
||||
break;
|
||||
case server_info: {
|
||||
return {doServerInfo(request, backend), 1};
|
||||
break;
|
||||
}
|
||||
case account_info:
|
||||
return {doAccountInfo(request, backend), 1};
|
||||
break;
|
||||
@@ -170,10 +180,10 @@ public:
|
||||
void
|
||||
run()
|
||||
{
|
||||
// We need to be executing within a strand to perform async operations
|
||||
// on the I/O objects in this session. Although not strictly necessary
|
||||
// for single-threaded contexts, this example code is written to be
|
||||
// thread-safe by default.
|
||||
// We need to be executing within a strand to perform async
|
||||
// operations on the I/O objects in this session. Although not
|
||||
// strictly necessary for single-threaded contexts, this example
|
||||
// code is written to be thread-safe by default.
|
||||
boost::asio::dispatch(
|
||||
ws_.get_executor(),
|
||||
boost::beast::bind_front_handler(
|
||||
|
||||
Reference in New Issue
Block a user