Add RPC ping.

This commit is contained in:
Arthur Britto
2013-02-13 14:50:05 -08:00
parent 73f96aa0d5
commit 235ab44728
3 changed files with 15 additions and 7 deletions

View File

@@ -512,6 +512,7 @@ Json::Value RPCParser::parseCommand(std::string strMethod, Json::Value jvParams)
// { "nickname_info", &RPCParser::parseNicknameInfo, 1, 1 }, // { "nickname_info", &RPCParser::parseNicknameInfo, 1, 1 },
{ "owner_info", &RPCParser::parseOwnerInfo, 1, 2 }, { "owner_info", &RPCParser::parseOwnerInfo, 1, 2 },
{ "peers", &RPCParser::parseAsIs, 0, 0 }, { "peers", &RPCParser::parseAsIs, 0, 0 },
{ "ping", &RPCParser::parseAsIs, 0, 0 },
// { "profile", &RPCParser::parseProfile, 1, 9 }, // { "profile", &RPCParser::parseProfile, 1, 9 },
{ "random", &RPCParser::parseAsIs, 0, 0 }, { "random", &RPCParser::parseAsIs, 0, 0 },
{ "ripple_path_find", &RPCParser::parseRipplePathFind, 1, 1 }, { "ripple_path_find", &RPCParser::parseRipplePathFind, 1, 1 },

View File

@@ -774,11 +774,16 @@ Json::Value RPCHandler::doOwnerInfo(Json::Value jvRequest)
Json::Value RPCHandler::doPeers(Json::Value) Json::Value RPCHandler::doPeers(Json::Value)
{ {
Json::Value obj(Json::objectValue); Json::Value jvResult(Json::objectValue);
obj["peers"]=theApp->getConnectionPool().getPeersJson(); jvResult["peers"] = theApp->getConnectionPool().getPeersJson();
return obj; return jvResult;
}
Json::Value RPCHandler::doPing(Json::Value)
{
return Json::Value(Json::objectValue);
} }
// profile offers <pass_a> <account_a> <currency_offer_a> <account_b> <currency_offer_b> <count> [submit] // profile offers <pass_a> <account_a> <currency_offer_a> <account_b> <currency_offer_b> <count> [submit]
@@ -874,8 +879,8 @@ Json::Value RPCHandler::doProfile(Json::Value jvRequest)
} }
// { // {
// account: <account>|<nickname>|<account_public_key> [<index>] // account: <account>|<nickname>|<account_public_key>
// index: <number> // optional, defaults to 0. // account_index: <number> // optional, defaults to 0.
// ledger_hash : <ledger> // ledger_hash : <ledger>
// ledger_index : <ledger_index> // ledger_index : <ledger_index>
// } // }
@@ -952,8 +957,8 @@ Json::Value RPCHandler::doAccountLines(Json::Value jvRequest)
} }
// { // {
// account: <account>|<nickname>|<account_public_key> [<index>] // account: <account>|<nickname>|<account_public_key>
// index: <number> // optional, defaults to 0. // account_index: <number> // optional, defaults to 0.
// ledger_hash : <ledger> // ledger_hash : <ledger>
// ledger_index : <ledger_index> // ledger_index : <ledger_index>
// } // }
@@ -2714,6 +2719,7 @@ Json::Value RPCHandler::doCommand(const Json::Value& jvRequest, int iRole)
// { "nickname_info", &RPCHandler::doNicknameInfo, false, optCurrent }, // { "nickname_info", &RPCHandler::doNicknameInfo, false, optCurrent },
{ "owner_info", &RPCHandler::doOwnerInfo, false, optCurrent }, { "owner_info", &RPCHandler::doOwnerInfo, false, optCurrent },
{ "peers", &RPCHandler::doPeers, true, optNone }, { "peers", &RPCHandler::doPeers, true, optNone },
{ "ping", &RPCHandler::doPing, false, optNone },
// { "profile", &RPCHandler::doProfile, false, optCurrent }, // { "profile", &RPCHandler::doProfile, false, optCurrent },
{ "random", &RPCHandler::doRandom, false, optNone }, { "random", &RPCHandler::doRandom, false, optNone },
{ "ripple_path_find", &RPCHandler::doRipplePathFind, false, optCurrent }, { "ripple_path_find", &RPCHandler::doRipplePathFind, false, optCurrent },

View File

@@ -64,6 +64,7 @@ class RPCHandler
Json::Value doNicknameInfo(Json::Value params); Json::Value doNicknameInfo(Json::Value params);
Json::Value doOwnerInfo(Json::Value params); Json::Value doOwnerInfo(Json::Value params);
Json::Value doPeers(Json::Value params); Json::Value doPeers(Json::Value params);
Json::Value doPing(Json::Value params);
Json::Value doProfile(Json::Value params); Json::Value doProfile(Json::Value params);
Json::Value doRandom(Json::Value jvRequest); Json::Value doRandom(Json::Value jvRequest);
Json::Value doRipplePathFind(Json::Value jvRequest); Json::Value doRipplePathFind(Json::Value jvRequest);