mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-20 11:05:54 +00:00
'connect' RPC command
This commit is contained in:
@@ -312,6 +312,19 @@ Json::Value RPCServer::doFamilyInfo(Json::Value ¶ms)
|
|||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Json::Value RPCServer::doConnect(Json::Value& params)
|
||||||
|
{
|
||||||
|
// connect <ip> [port]
|
||||||
|
std::string host, port;
|
||||||
|
|
||||||
|
if(!extractString(host, params, 0))
|
||||||
|
return JSONRPCError(500, "Host required");
|
||||||
|
if(!extractString(port, params, 1))
|
||||||
|
port="6561";
|
||||||
|
theApp->getConnectionPool().connectTo(host, port);
|
||||||
|
return "connecting";
|
||||||
|
}
|
||||||
|
|
||||||
Json::Value RPCServer::doSendTo(Json::Value& params)
|
Json::Value RPCServer::doSendTo(Json::Value& params)
|
||||||
{ // Implement simple sending without gathering
|
{ // Implement simple sending without gathering
|
||||||
// sendto <destination> <amount>
|
// sendto <destination> <amount>
|
||||||
@@ -401,6 +414,7 @@ Json::Value RPCServer::doCommand(const std::string& command, Json::Value& params
|
|||||||
if(command=="lock") return doLock(params);
|
if(command=="lock") return doLock(params);
|
||||||
if(command=="unlock") return doUnlock(params);
|
if(command=="unlock") return doUnlock(params);
|
||||||
if(command=="sendto") return doSendTo(params);
|
if(command=="sendto") return doSendTo(params);
|
||||||
|
if(command=="connect") return doConnect(params);
|
||||||
|
|
||||||
return "unknown command";
|
return "unknown command";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ class RPCServer : public boost::enable_shared_from_this<RPCServer>
|
|||||||
Json::Value doLock(Json::Value& params);
|
Json::Value doLock(Json::Value& params);
|
||||||
Json::Value doUnlock(Json::Value& params);
|
Json::Value doUnlock(Json::Value& params);
|
||||||
Json::Value doSendTo(Json::Value& params);
|
Json::Value doSendTo(Json::Value& params);
|
||||||
|
Json::Value doConnect(Json::Value& params);
|
||||||
|
|
||||||
// parses a string account name into a uint160
|
// parses a string account name into a uint160
|
||||||
// can be local or remote
|
// can be local or remote
|
||||||
|
|||||||
Reference in New Issue
Block a user