Browse Source

pass results by reference

pull/147/head
orignal 10 years ago
parent
commit
8910412068
  1. 6
      I2PControl.cpp
  2. 8
      I2PControl.h

6
I2PControl.cpp

@ -171,7 +171,7 @@ namespace client
// handlers // handlers
void I2PControlService::AuthenticateHandler (const std::map<std::string, std::string>& params, std::map<std::string, std::string> results) void I2PControlService::AuthenticateHandler (const std::map<std::string, std::string>& params, std::map<std::string, std::string>& results)
{ {
const std::string& api = params.at (I2P_CONTROL_PARAM_API); const std::string& api = params.at (I2P_CONTROL_PARAM_API);
const std::string& password = params.at (I2P_CONTROL_PARAM_PASSWORD); const std::string& password = params.at (I2P_CONTROL_PARAM_PASSWORD);
@ -180,14 +180,14 @@ namespace client
results[I2P_CONTROL_PARAM_TOKEN] = boost::lexical_cast<std::string>(i2p::util::GetSecondsSinceEpoch ()); results[I2P_CONTROL_PARAM_TOKEN] = boost::lexical_cast<std::string>(i2p::util::GetSecondsSinceEpoch ());
} }
void I2PControlService::EchoHandler (const std::map<std::string, std::string>& params, std::map<std::string, std::string> results) void I2PControlService::EchoHandler (const std::map<std::string, std::string>& params, std::map<std::string, std::string>& results)
{ {
const std::string& echo = params.at (I2P_CONTROL_PARAM_ECHO); const std::string& echo = params.at (I2P_CONTROL_PARAM_ECHO);
LogPrint (eLogDebug, "I2PControl Echo Echo=", echo); LogPrint (eLogDebug, "I2PControl Echo Echo=", echo);
results[I2P_CONTROL_PARAM_RESULT] = echo; results[I2P_CONTROL_PARAM_RESULT] = echo;
} }
void I2PControlService::RouterInfoHandler (const std::map<std::string, std::string>& params, std::map<std::string, std::string> results) void I2PControlService::RouterInfoHandler (const std::map<std::string, std::string>& params, std::map<std::string, std::string>& results)
{ {
} }
} }

8
I2PControl.h

@ -59,9 +59,9 @@ namespace client
private: private:
void AuthenticateHandler (const std::map<std::string, std::string>& params, std::map<std::string, std::string> results); void AuthenticateHandler (const std::map<std::string, std::string>& params, std::map<std::string, std::string>& results);
void EchoHandler (const std::map<std::string, std::string>& params, std::map<std::string, std::string> results); void EchoHandler (const std::map<std::string, std::string>& params, std::map<std::string, std::string>& results);
void RouterInfoHandler (const std::map<std::string, std::string>& params, std::map<std::string, std::string> results); void RouterInfoHandler (const std::map<std::string, std::string>& params, std::map<std::string, std::string>& results);
private: private:
@ -71,7 +71,7 @@ namespace client
boost::asio::io_service m_Service; boost::asio::io_service m_Service;
boost::asio::ip::tcp::acceptor m_Acceptor; boost::asio::ip::tcp::acceptor m_Acceptor;
typedef void (I2PControlService::*MethodHandler)(const std::map<std::string, std::string>& params, std::map<std::string, std::string> results); typedef void (I2PControlService::*MethodHandler)(const std::map<std::string, std::string>& params, std::map<std::string, std::string>& results);
std::map<std::string, MethodHandler> m_MethodHanders; std::map<std::string, MethodHandler> m_MethodHanders;
}; };
} }

Loading…
Cancel
Save