From c8750f1d9af1a6975790b4583e33bd047b2ee146 Mon Sep 17 00:00:00 2001 From: Vinnie Falco Date: Sun, 7 Jul 2013 18:49:19 -0700 Subject: [PATCH 1/4] Fix spelling in rpc override help text --- src/cpp/ripple/ripple_Main.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/cpp/ripple/ripple_Main.cpp b/src/cpp/ripple/ripple_Main.cpp index 23b2f619cf..3cd9238254 100644 --- a/src/cpp/ripple/ripple_Main.cpp +++ b/src/cpp/ripple/ripple_Main.cpp @@ -58,8 +58,8 @@ void printHelp (const po::options_description& desc) cerr << desc << endl; cerr << "Options: " << endl; - cerr << " -rpc-ip=[':']" << endl; - cerr << " -rpc-port=" << endl; + cerr << " -rpc_ip=[':']" << endl; + cerr << " -rpc_port=" << endl; cerr << endl; cerr << "Commands: " << endl; cerr << " account_info |||| [] [strict]" << endl; From fa56c018da6bc919734f22675eb4b7992a1afd89 Mon Sep 17 00:00:00 2001 From: Vinnie Falco Date: Sun, 7 Jul 2013 19:07:16 -0700 Subject: [PATCH 2/4] Remove extraneous command line help text --- src/cpp/ripple/ripple_Main.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/cpp/ripple/ripple_Main.cpp b/src/cpp/ripple/ripple_Main.cpp index 3cd9238254..a5b42f972a 100644 --- a/src/cpp/ripple/ripple_Main.cpp +++ b/src/cpp/ripple/ripple_Main.cpp @@ -57,10 +57,6 @@ void printHelp (const po::options_description& desc) cerr << desc << endl; - cerr << "Options: " << endl; - cerr << " -rpc_ip=[':']" << endl; - cerr << " -rpc_port=" << endl; - cerr << endl; cerr << "Commands: " << endl; cerr << " account_info |||| [] [strict]" << endl; cerr << " account_lines |\"\" []" << endl; From 635165c724ba7fe0ea8b4b5ec53f1a582079deef Mon Sep 17 00:00:00 2001 From: Vinnie Falco Date: Sun, 7 Jul 2013 19:18:37 -0700 Subject: [PATCH 3/4] Fix broken conflict resolution --- Builds/VisualStudio2012/RippleD.vcxproj.filters | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/Builds/VisualStudio2012/RippleD.vcxproj.filters b/Builds/VisualStudio2012/RippleD.vcxproj.filters index 71cc6b8f64..7c2bd2c131 100644 --- a/Builds/VisualStudio2012/RippleD.vcxproj.filters +++ b/Builds/VisualStudio2012/RippleD.vcxproj.filters @@ -822,17 +822,6 @@ [1] Ripple\ripple_app - - 1. Modules\ripple_app - - - 1. Modules\ripple_app - - - 1. Modules\ripple_app - - - 1. Modules\ripple_app [1] Ripple\ripple_basics\utility From 2d277dc307fe4dc329c66ca8973cd034ff44e05a Mon Sep 17 00:00:00 2001 From: Vinnie Falco Date: Sun, 7 Jul 2013 19:42:37 -0700 Subject: [PATCH 4/4] Allow optional port number in rpc_ip command --- .../ripple_core/functional/ripple_Config.cpp | 20 ++++++++++++++++++- .../ripple_core/functional/ripple_Config.h | 8 ++++++++ src/cpp/ripple/ripple_Main.cpp | 4 ++-- 3 files changed, 29 insertions(+), 3 deletions(-) diff --git a/modules/ripple_core/functional/ripple_Config.cpp b/modules/ripple_core/functional/ripple_Config.cpp index 568f708ed8..741c528908 100644 --- a/modules/ripple_core/functional/ripple_Config.cpp +++ b/modules/ripple_core/functional/ripple_Config.cpp @@ -578,5 +578,23 @@ int Config::getSize (SizedItemName item) return -1; } +void Config::setRpcIpAndOptionalPort (std::string const& newAddress) +{ + String const s (newAddress.c_str ()); + + int const colonPosition = s.lastIndexOfChar (':'); + + if (colonPosition != -1) + { + String const ipPart = s.substring (0, colonPosition); + String const portPart = s.substring (colonPosition + 1, s.length ()); + + setRpcIP (ipPart.toRawUTF8 ()); + setRpcPort (portPart.getIntValue ()); + } + else + { + setRpcIP (newAddress); + } +} -// vim:ts=4 diff --git a/modules/ripple_core/functional/ripple_Config.h b/modules/ripple_core/functional/ripple_Config.h index 8fee07eaa3..0d9b3c1c5a 100644 --- a/modules/ripple_core/functional/ripple_Config.h +++ b/modules/ripple_core/functional/ripple_Config.h @@ -181,6 +181,14 @@ public: */ int getRpcPort () const { return m_rpcPort; } + /** Set the client or server RPC IP and optional port. + + @note The string is not syntax checked. + + @param newAddress A string in the format [':'] + */ + void setRpcIpAndOptionalPort (std::string const& newAddress); + /** Set the client or server RPC IP. @note The string is not syntax-checked. diff --git a/src/cpp/ripple/ripple_Main.cpp b/src/cpp/ripple/ripple_Main.cpp index a5b42f972a..21c5d8b59e 100644 --- a/src/cpp/ripple/ripple_Main.cpp +++ b/src/cpp/ripple/ripple_Main.cpp @@ -164,7 +164,7 @@ int rippleMain (int argc, char** argv) ("help,h", "Display this message.") ("conf", po::value (), "Specify the configuration file.") ("rpc", "Perform rpc command (default).") - ("rpc_ip", po::value (), "Specify the IP address for RPC command.") + ("rpc_ip", po::value (), "Specify the IP address for RPC command. Format: [':']") ("rpc_port", po::value (), "Specify the port number for RPC command.") ("standalone,a", "Run with no peers.") ("testnet,t", "Run in test net mode.") @@ -302,7 +302,7 @@ int rippleMain (int argc, char** argv) // if (vm.count ("rpc_ip")) { - theConfig.setRpcIP (vm ["rpc_ip"].as ()); + theConfig.setRpcIpAndOptionalPort (vm ["rpc_ip"].as ()); } // Override the RPC destination port number