Browse Source

* HTTPServer.cpp: drop separate function handlers for commands

pull/489/head
hagen 9 years ago
parent
commit
65395516b0
  1. 36
      HTTPServer.cpp

36
HTTPServer.cpp

@ -593,27 +593,6 @@ namespace http {
} }
} }
void StopAcceptingTunnels (std::stringstream& s)
{
s << "<b>Stop Accepting Tunnels:</b><br>\r\n<br>\r\n";
i2p::context.SetAcceptsTunnels (false);
s << "Accepting tunnels stopped" << std::endl;
}
void StartAcceptingTunnels (std::stringstream& s)
{
s << "<b>Start Accepting Tunnels:</b><br>\r\n<br>\r\n";
i2p::context.SetAcceptsTunnels (true);
s << "Accepting tunnels started" << std::endl;
}
void RunPeerTest (std::stringstream& s)
{
s << "<b>Run Peer Test:</b><br>\r\n<br>\r\n";
i2p::transport::transports.PeerTest ();
s << "Peer test is running" << std::endl;
}
void HTTPConnection::Receive () void HTTPConnection::Receive ()
{ {
m_Socket->async_read_some (boost::asio::buffer (m_Buffer, HTTP_CONNECTION_BUFFER_SIZE), m_Socket->async_read_some (boost::asio::buffer (m_Buffer, HTTP_CONNECTION_BUFFER_SIZE),
@ -749,14 +728,17 @@ namespace http {
url.parse_query(params); url.parse_query(params);
cmd = params["cmd"]; cmd = params["cmd"];
if (cmd == HTTP_COMMAND_START_ACCEPTING_TUNNELS) if (cmd == HTTP_COMMAND_RUN_PEER_TEST)
StartAcceptingTunnels (s); i2p::transport::transports.PeerTest ();
else if (cmd == HTTP_COMMAND_START_ACCEPTING_TUNNELS)
i2p::context.SetAcceptsTunnels (true);
else if (cmd == HTTP_COMMAND_STOP_ACCEPTING_TUNNELS) else if (cmd == HTTP_COMMAND_STOP_ACCEPTING_TUNNELS)
StopAcceptingTunnels (s); i2p::context.SetAcceptsTunnels (false);
else if (cmd == HTTP_COMMAND_RUN_PEER_TEST) else {
RunPeerTest (s);
else
SendError("Unknown command: " + cmd); SendError("Unknown command: " + cmd);
return;
}
s << "<b>Command accepted</b>";
} }
void HTTPConnection::SendReply (const std::string& content, int code) void HTTPConnection::SendReply (const std::string& content, int code)

Loading…
Cancel
Save