More work toward http/https client merge.

This commit is contained in:
Arthur Britto
2013-02-01 18:10:53 -08:00
parent e53e27cfa6
commit c834ce4e06
5 changed files with 39 additions and 49 deletions

View File

@@ -625,22 +625,16 @@ int commandLineRPC(const std::vector<std::string>& vCmd)
boost::asio::io_service isService;
// void callRPC(const std::string& strIp, const int iPort, const std::string& strUsername, const std::string& strPassword, const std::string& strPath, const std::string& strMethod, const Json::Value& jvParams, const bool bSSL,
boost::function<void(const Json::Value& jvInput)> callbackFuncP)
callRPCAsync(
callRPC(
isService,
#if 0
theConfig.RPC_IP,
theConfig.RPC_PORT,
theConfig.RPC_USER,
theConfig.RPC_PASSWORD,
theConfig.RPC_IP, theConfig.RPC_PORT,
theConfig.RPC_USER, theConfig.RPC_PASSWORD,
"",
jvRequest.isMember("method") // Allow parser to rewrite method.
? jvRequest["method"].asString()
: vCmd[0],
jvParams, // Parsed, execute.
boost::bind(callRPCHandler, jvOutput, _1));
#endif
false,
boost::bind(callRPCHandler, &jvOutput, _1));
isService.run(); // This blocks until there is no more outstanding async calls.
@@ -749,7 +743,12 @@ void requestRPC(const std::string& strMethod, const Json::Value& jvParams, const
mHeaders);
}
void callRPC(const std::string& strIp, const int iPort, const std::string& strUsername, const std::string& strPassword, const std::string& strPath, const std::string& strMethod, const Json::Value& jvParams, const bool bSSL,
void callRPC(
boost::asio::io_service& io_service,
const std::string& strIp, const int iPort,
const std::string& strUsername, const std::string& strPassword,
const std::string& strPath, const std::string& strMethod,
const Json::Value& jvParams, const bool bSSL,
boost::function<void(const Json::Value& jvInput)> callbackFuncP)
{
// Connect to localhost
@@ -774,7 +773,7 @@ void callRPC(const std::string& strIp, const int iPort, const std::string& strUs
HttpsClient::httpsRequest(
bSSL,
theApp->getIOService(),
io_service,
strIp,
iPort,
boost::bind(
@@ -788,5 +787,4 @@ void callRPC(const std::string& strIp, const int iPort, const std::string& strUs
boost::bind(&responseRPC, callbackFuncP, _1, _2, _3));
}
// vim:ts=4