From 235ab44728d1f33f68a35839499a6fb6b9aef919 Mon Sep 17 00:00:00 2001 From: Arthur Britto Date: Wed, 13 Feb 2013 14:50:05 -0800 Subject: [PATCH] Add RPC ping. --- src/cpp/ripple/CallRPC.cpp | 1 + src/cpp/ripple/RPCHandler.cpp | 20 +++++++++++++------- src/cpp/ripple/RPCHandler.h | 1 + 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/src/cpp/ripple/CallRPC.cpp b/src/cpp/ripple/CallRPC.cpp index c24f99fbb8..f3edd39c99 100644 --- a/src/cpp/ripple/CallRPC.cpp +++ b/src/cpp/ripple/CallRPC.cpp @@ -512,6 +512,7 @@ Json::Value RPCParser::parseCommand(std::string strMethod, Json::Value jvParams) // { "nickname_info", &RPCParser::parseNicknameInfo, 1, 1 }, { "owner_info", &RPCParser::parseOwnerInfo, 1, 2 }, { "peers", &RPCParser::parseAsIs, 0, 0 }, + { "ping", &RPCParser::parseAsIs, 0, 0 }, // { "profile", &RPCParser::parseProfile, 1, 9 }, { "random", &RPCParser::parseAsIs, 0, 0 }, { "ripple_path_find", &RPCParser::parseRipplePathFind, 1, 1 }, diff --git a/src/cpp/ripple/RPCHandler.cpp b/src/cpp/ripple/RPCHandler.cpp index a865503fb3..2da84da565 100644 --- a/src/cpp/ripple/RPCHandler.cpp +++ b/src/cpp/ripple/RPCHandler.cpp @@ -774,11 +774,16 @@ Json::Value RPCHandler::doOwnerInfo(Json::Value jvRequest) 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 [submit] @@ -874,8 +879,8 @@ Json::Value RPCHandler::doProfile(Json::Value jvRequest) } // { -// account: || [] -// index: // optional, defaults to 0. +// account: || +// account_index: // optional, defaults to 0. // ledger_hash : // ledger_index : // } @@ -952,8 +957,8 @@ Json::Value RPCHandler::doAccountLines(Json::Value jvRequest) } // { -// account: || [] -// index: // optional, defaults to 0. +// account: || +// account_index: // optional, defaults to 0. // ledger_hash : // ledger_index : // } @@ -2714,6 +2719,7 @@ Json::Value RPCHandler::doCommand(const Json::Value& jvRequest, int iRole) // { "nickname_info", &RPCHandler::doNicknameInfo, false, optCurrent }, { "owner_info", &RPCHandler::doOwnerInfo, false, optCurrent }, { "peers", &RPCHandler::doPeers, true, optNone }, + { "ping", &RPCHandler::doPing, false, optNone }, // { "profile", &RPCHandler::doProfile, false, optCurrent }, { "random", &RPCHandler::doRandom, false, optNone }, { "ripple_path_find", &RPCHandler::doRipplePathFind, false, optCurrent }, diff --git a/src/cpp/ripple/RPCHandler.h b/src/cpp/ripple/RPCHandler.h index 3e584056bf..91a0c11f2e 100644 --- a/src/cpp/ripple/RPCHandler.h +++ b/src/cpp/ripple/RPCHandler.h @@ -64,6 +64,7 @@ class RPCHandler Json::Value doNicknameInfo(Json::Value params); Json::Value doOwnerInfo(Json::Value params); Json::Value doPeers(Json::Value params); + Json::Value doPing(Json::Value params); Json::Value doProfile(Json::Value params); Json::Value doRandom(Json::Value jvRequest); Json::Value doRipplePathFind(Json::Value jvRequest);