diff --git a/src/cpp/ripple/RPCServer.cpp b/src/cpp/ripple/RPCServer.cpp index bbfc750b52..206da1773c 100644 --- a/src/cpp/ripple/RPCServer.cpp +++ b/src/cpp/ripple/RPCServer.cpp @@ -58,11 +58,6 @@ void RPCServer::handle_read_req (const boost::system::error_code& e) mStrand.wrap (boost::bind (&RPCServer::handle_write, shared_from_this (), boost::asio::placeholders::error))); } -static void dummy_handler () -{ - ; -} - void RPCServer::handle_read_line (const boost::system::error_code& e) { if (e) @@ -74,7 +69,7 @@ void RPCServer::handle_read_line (const boost::system::error_code& e) { // request with no body WriteLog (lsWARNING, RPCServer) << "RPC HTTP request with no body"; - mSocket.async_shutdown (boost::bind (&dummy_handler)); + mSocket.async_shutdown (boost::bind (&RPCServer::handle_shutdown, shared_from_this(), boost::asio::placeholders::error)); return; } else if (action == haREAD_LINE) @@ -90,7 +85,7 @@ void RPCServer::handle_read_line (const boost::system::error_code& e) if ((rLen < 0) || (rLen > RPC_MAXIMUM_QUERY)) { WriteLog (lsWARNING, RPCServer) << "Illegal RPC request length " << rLen; - mSocket.async_shutdown (boost::bind (&dummy_handler)); + mSocket.async_shutdown (boost::bind (&RPCServer::handle_shutdown, shared_from_this(), boost::asio::placeholders::error)); return; } @@ -111,7 +106,7 @@ void RPCServer::handle_read_line (const boost::system::error_code& e) } } else - mSocket.async_shutdown (boost::bind (&dummy_handler)); + mSocket.async_shutdown (boost::bind (&RPCServer::handle_shutdown, shared_from_this(), boost::asio::placeholders::error)); } std::string RPCServer::handleRequest (const std::string& requestStr) @@ -201,7 +196,7 @@ void RPCServer::handle_write (const boost::system::error_code& e) HTTPRequestAction action = mHTTPRequest.requestDone (false); if (action == haCLOSE_CONN) - mSocket.async_shutdown (boost::bind (&dummy_handler)); + mSocket.async_shutdown (boost::bind (&RPCServer::handle_shutdown, shared_from_this(), boost::asio::placeholders::error)); else { boost::asio::async_read_until (mSocket, mLineBuffer, "\r\n", @@ -215,4 +210,9 @@ void RPCServer::handle_write (const boost::system::error_code& e) } } +// nothing to do, we just keep the object alive +void RPCServer::handle_shutdown (const boost::system::error_code& e) +{ +} + // vim:ts=4 diff --git a/src/cpp/ripple/RPCServer.h b/src/cpp/ripple/RPCServer.h index 8734ff40af..542e2b62b3 100644 --- a/src/cpp/ripple/RPCServer.h +++ b/src/cpp/ripple/RPCServer.h @@ -40,6 +40,7 @@ private: void handle_write (const boost::system::error_code& ec); void handle_read_line (const boost::system::error_code& ec); void handle_read_req (const boost::system::error_code& ec); + void handle_shutdown (const boost::system::error_code& ec); std::string handleRequest (const std::string& requestStr);