Refine the connection close

This commit is contained in:
Chunting Gu
2019-07-15 15:36:30 +08:00
parent 2a20030f7e
commit 46ea52cb90
24 changed files with 214 additions and 147 deletions
+6 -5
View File
@@ -38,10 +38,14 @@ public:
void Close();
// Send a response to the client.
void SendResponse(ResponsePtr response);
// `Connection` header will be set to "Close" if |no_keep_alive| is true no
// matter whether the client asked for Keep-Alive or not.
void SendResponse(ResponsePtr response, bool no_keep_alive = false);
// Send a response with the given status and an empty body to the client.
void SendResponse(Status status);
// `Connection` header will be set to "Close" if |no_keep_alive| is true no
// matter whether the client asked for Keep-Alive or not.
void SendResponse(Status status, bool no_keep_alive = false);
private:
void DoRead();
@@ -54,9 +58,6 @@ private:
void OnWriteOK();
void OnWriteError(boost::system::error_code ec);
// Shutdown the socket.
void Shutdown();
// The socket for the connection.
boost::asio::ip::tcp::socket socket_;