From 10521de2fcf3ff3dda4d42257d44150d9dfe0857 Mon Sep 17 00:00:00 2001 From: Miguel Portilla Date: Wed, 25 May 2016 14:25:27 -0400 Subject: [PATCH] Remove obsolete Internal command (RIPD-888) --- Builds/VisualStudio2015/RippleD.vcxproj | 6 -- .../VisualStudio2015/RippleD.vcxproj.filters | 6 -- src/ripple/resource/impl/Logic.h | 2 +- src/ripple/rpc/InternalHandler.h | 50 --------------- src/ripple/rpc/handlers/Handlers.h | 1 - src/ripple/rpc/handlers/Internal.cpp | 62 ------------------- src/ripple/rpc/impl/Handler.cpp | 1 - src/ripple/unity/rpcx.cpp | 1 - 8 files changed, 1 insertion(+), 128 deletions(-) delete mode 100644 src/ripple/rpc/InternalHandler.h delete mode 100644 src/ripple/rpc/handlers/Internal.cpp diff --git a/Builds/VisualStudio2015/RippleD.vcxproj b/Builds/VisualStudio2015/RippleD.vcxproj index b3726c308e..75b8f0e794 100644 --- a/Builds/VisualStudio2015/RippleD.vcxproj +++ b/Builds/VisualStudio2015/RippleD.vcxproj @@ -3123,10 +3123,6 @@ - - True - True - True True @@ -3331,8 +3327,6 @@ - - diff --git a/Builds/VisualStudio2015/RippleD.vcxproj.filters b/Builds/VisualStudio2015/RippleD.vcxproj.filters index 816ce4bc0b..86107664ae 100644 --- a/Builds/VisualStudio2015/RippleD.vcxproj.filters +++ b/Builds/VisualStudio2015/RippleD.vcxproj.filters @@ -3615,9 +3615,6 @@ ripple\rpc\handlers - - ripple\rpc\handlers - ripple\rpc\handlers @@ -3786,9 +3783,6 @@ ripple\rpc\impl - - ripple\rpc - ripple\rpc diff --git a/src/ripple/resource/impl/Logic.h b/src/ripple/resource/impl/Logic.h index 8fe7059521..af9640151a 100644 --- a/src/ripple/resource/impl/Logic.h +++ b/src/ripple/resource/impl/Logic.h @@ -222,7 +222,7 @@ public: Json::Value& entry = (ret[inboundEntry.to_string()] = Json::objectValue); entry[jss::local] = localBalance; entry[jss::remote] = inboundEntry.remote_balance; - entry[jss::type] = "outbound"; + entry[jss::type] = "inbound"; } } diff --git a/src/ripple/rpc/InternalHandler.h b/src/ripple/rpc/InternalHandler.h deleted file mode 100644 index 3a4497cb6a..0000000000 --- a/src/ripple/rpc/InternalHandler.h +++ /dev/null @@ -1,50 +0,0 @@ -//------------------------------------------------------------------------------ -/* - This file is part of rippled: https://github.com/ripple/rippled - Copyright (c) 2012, 2013 Ripple Labs Inc. - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ -//============================================================================== - -#ifndef RIPPLE_RPC_INTERNALHANDLER_H_INCLUDED -#define RIPPLE_RPC_INTERNALHANDLER_H_INCLUDED - -namespace ripple { -namespace RPC { - -/** To dynamically add custom or experimental RPC handlers, construct a new - * instance of InternalHandler with your own handler function. */ -struct InternalHandler -{ - using handler_t = Json::Value (*) (const Json::Value&); - - InternalHandler (const std::string& name, handler_t handler) - : name_ (name), - handler_ (handler) - { - nextHandler_ = InternalHandler::headHandler; - InternalHandler::headHandler = this; - } - - InternalHandler* nextHandler_; - std::string name_; - handler_t handler_; - - static InternalHandler* headHandler; -}; - -} // RPC -} // ripple - -#endif diff --git a/src/ripple/rpc/handlers/Handlers.h b/src/ripple/rpc/handlers/Handlers.h index 7db4044dd1..edb2ee06e1 100644 --- a/src/ripple/rpc/handlers/Handlers.h +++ b/src/ripple/rpc/handlers/Handlers.h @@ -42,7 +42,6 @@ Json::Value doFee (RPC::Context&); Json::Value doFetchInfo (RPC::Context&); Json::Value doGatewayBalances (RPC::Context&); Json::Value doGetCounts (RPC::Context&); -Json::Value doInternal (RPC::Context&); Json::Value doLedgerAccept (RPC::Context&); Json::Value doLedgerCleaner (RPC::Context&); Json::Value doLedgerClosed (RPC::Context&); diff --git a/src/ripple/rpc/handlers/Internal.cpp b/src/ripple/rpc/handlers/Internal.cpp deleted file mode 100644 index b9d70a0b58..0000000000 --- a/src/ripple/rpc/handlers/Internal.cpp +++ /dev/null @@ -1,62 +0,0 @@ -//------------------------------------------------------------------------------ -/* - This file is part of rippled: https://github.com/ripple/rippled - Copyright (c) 2012-2014 Ripple Labs Inc. - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ -//============================================================================== - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -namespace ripple { - -RPC::InternalHandler* RPC::InternalHandler::headHandler = nullptr; - -Json::Value doInternal (RPC::Context& context) -{ - // Used for debug or special-purpose RPC commands - if (!context.params.isMember (jss::internal_command)) - return rpcError (rpcINVALID_PARAMS); - - auto name = context.params[jss::internal_command].asString (); - auto params = context.params[jss::params]; - - for (auto* h = RPC::InternalHandler::headHandler; h; ) - { - if (name == h->name_) - { - JLOG (context.j.warn()) - << "Internal command " << name << ": " << params; - Json::Value ret = h->handler_ (params); - JLOG (context.j.warn()) - << "Internal command returns: " << ret; - return ret; - } - - h = h->nextHandler_; - } - - return rpcError (rpcBAD_SYNTAX); -} - -} // ripple diff --git a/src/ripple/rpc/impl/Handler.cpp b/src/ripple/rpc/impl/Handler.cpp index 1d42cf11ff..f0ddeda4db 100644 --- a/src/ripple/rpc/impl/Handler.cpp +++ b/src/ripple/rpc/impl/Handler.cpp @@ -114,7 +114,6 @@ Handler handlerArray[] { { "consensus_info", byRef (&doConsensusInfo), Role::ADMIN, NO_CONDITION }, { "gateway_balances", byRef (&doGatewayBalances), Role::USER, NO_CONDITION }, { "get_counts", byRef (&doGetCounts), Role::ADMIN, NO_CONDITION }, - { "internal", byRef (&doInternal), Role::ADMIN, NO_CONDITION }, { "feature", byRef (&doFeature), Role::ADMIN, NO_CONDITION }, { "fee", byRef (&doFee), Role::USER, NO_CONDITION }, { "fetch_info", byRef (&doFetchInfo), Role::ADMIN, NO_CONDITION }, diff --git a/src/ripple/unity/rpcx.cpp b/src/ripple/unity/rpcx.cpp index 9635457ebc..1ddfc28e8b 100644 --- a/src/ripple/unity/rpcx.cpp +++ b/src/ripple/unity/rpcx.cpp @@ -48,7 +48,6 @@ #include #include #include -#include #include #include #include