mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Allow optional port number in rpc_ip command
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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 <ip-address>[':'<port-number>]
|
||||
*/
|
||||
void setRpcIpAndOptionalPort (std::string const& newAddress);
|
||||
|
||||
/** Set the client or server RPC IP.
|
||||
|
||||
@note The string is not syntax-checked.
|
||||
|
||||
Reference in New Issue
Block a user