Even though the handler doesn't do anything, it still has to be

wrapped in a strand to protect the composed SSL shutdown handler.
This commit is contained in:
JoelKatz
2013-06-19 11:51:31 -07:00
parent 82dbf5794b
commit abce930b8b

View File

@@ -69,7 +69,7 @@ void RPCServer::handle_read_line (const boost::system::error_code& e)
{ {
// request with no body // request with no body
WriteLog (lsWARNING, RPCServer) << "RPC HTTP request with no body"; WriteLog (lsWARNING, RPCServer) << "RPC HTTP request with no body";
mSocket.async_shutdown (boost::bind (&RPCServer::handle_shutdown, shared_from_this(), boost::asio::placeholders::error)); mSocket.async_shutdown (mStrand.wrap (boost::bind (&RPCServer::handle_shutdown, shared_from_this(), boost::asio::placeholders::error)));
return; return;
} }
else if (action == haREAD_LINE) else if (action == haREAD_LINE)
@@ -85,7 +85,7 @@ void RPCServer::handle_read_line (const boost::system::error_code& e)
if ((rLen < 0) || (rLen > RPC_MAXIMUM_QUERY)) if ((rLen < 0) || (rLen > RPC_MAXIMUM_QUERY))
{ {
WriteLog (lsWARNING, RPCServer) << "Illegal RPC request length " << rLen; WriteLog (lsWARNING, RPCServer) << "Illegal RPC request length " << rLen;
mSocket.async_shutdown (boost::bind (&RPCServer::handle_shutdown, shared_from_this(), boost::asio::placeholders::error)); mSocket.async_shutdown (mStrand.wrap (boost::bind (&RPCServer::handle_shutdown, shared_from_this(), boost::asio::placeholders::error)));
return; return;
} }
@@ -106,7 +106,7 @@ void RPCServer::handle_read_line (const boost::system::error_code& e)
} }
} }
else else
mSocket.async_shutdown (boost::bind (&RPCServer::handle_shutdown, shared_from_this(), boost::asio::placeholders::error)); mSocket.async_shutdown (mStrand.wrap (boost::bind (&RPCServer::handle_shutdown, shared_from_this(), boost::asio::placeholders::error)));
} }
std::string RPCServer::handleRequest (const std::string& requestStr) std::string RPCServer::handleRequest (const std::string& requestStr)
@@ -196,7 +196,7 @@ void RPCServer::handle_write (const boost::system::error_code& e)
HTTPRequestAction action = mHTTPRequest.requestDone (false); HTTPRequestAction action = mHTTPRequest.requestDone (false);
if (action == haCLOSE_CONN) if (action == haCLOSE_CONN)
mSocket.async_shutdown (boost::bind (&RPCServer::handle_shutdown, shared_from_this(), boost::asio::placeholders::error)); mSocket.async_shutdown (mStrand.wrap (boost::bind (&RPCServer::handle_shutdown, shared_from_this(), boost::asio::placeholders::error)));
else else
{ {
boost::asio::async_read_until (mSocket, mLineBuffer, "\r\n", boost::asio::async_read_until (mSocket, mLineBuffer, "\r\n",