From ce47e99d6d903a2ca7d0e2743782799d753f4b2e Mon Sep 17 00:00:00 2001 From: Arthur Britto Date: Thu, 6 Dec 2012 07:43:39 -0800 Subject: [PATCH] Comments. --- src/cpp/ripple/RPCHandler.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/cpp/ripple/RPCHandler.cpp b/src/cpp/ripple/RPCHandler.cpp index 8ab4b3163..b92d4d494 100644 --- a/src/cpp/ripple/RPCHandler.cpp +++ b/src/cpp/ripple/RPCHandler.cpp @@ -2226,9 +2226,12 @@ Json::Value RPCHandler::doUnsubscribe(Json::Value jvRequest) } // Provide the JSON-RPC "result" value. -Json::Value RPCHandler::doRpcCommand(const std::string& strCommand, Json::Value& jvParams, int iRole) +// +// JSON-RPC provides a method and an array of params. JSON-RPC is used as a transport for a command and a request object. The +// command is the method. The request object is supplied as the first element of the params. +Json::Value RPCHandler::doRpcCommand(const std::string& strMethod, Json::Value& jvParams, int iRole) { - // cLog(lsTRACE) << "doRpcCommand:" << strCommand << ":" << jvParams; + // cLog(lsTRACE) << "doRpcCommand:" << strMethod << ":" << jvParams; if (!jvParams.isArray() || jvParams.size() < 1) return rpcError(rpcINVALID_PARAMS); @@ -2238,7 +2241,8 @@ Json::Value RPCHandler::doRpcCommand(const std::string& strCommand, Json::Value& if (!jvRequest.isObject() || !jvRequest.isMember("command")) return rpcError(rpcINVALID_PARAMS); - jvRequest["command"] = strCommand; + // Provide the JSON-RPC method as the field "command" in the request. + jvRequest["command"] = strMethod; Json::Value jvResult = doCommand(jvRequest, iRole);