add log for study server threading
This commit is contained in:
+16
-8
@@ -13,6 +13,11 @@
|
||||
#include "webcc/request_parser.h"
|
||||
#include "webcc/response.h"
|
||||
|
||||
// Set 1 to enable the log for the study of server thread model.
|
||||
// Need to use multiple workers and loops for Server::Run().
|
||||
// Suggest to configure the log level to USER.
|
||||
#define WEBCC_STUDY_SERVER_THREADING 0
|
||||
|
||||
namespace webcc {
|
||||
|
||||
class Connection;
|
||||
@@ -27,11 +32,11 @@ public:
|
||||
Queue<ConnectionPtr>* queue, ViewMatcher&& view_matcher,
|
||||
std::size_t buffer_size);
|
||||
|
||||
~Connection() = default;
|
||||
|
||||
Connection(const Connection&) = delete;
|
||||
Connection& operator=(const Connection&) = delete;
|
||||
|
||||
~Connection() = default;
|
||||
|
||||
RequestPtr request() const {
|
||||
return request_;
|
||||
}
|
||||
@@ -53,16 +58,19 @@ public:
|
||||
void SendResponse(Status status, bool no_keep_alive = false);
|
||||
|
||||
private:
|
||||
void DoRead();
|
||||
void AsyncRead();
|
||||
void OnRead(boost::system::error_code ec, std::size_t length);
|
||||
|
||||
void DoWrite();
|
||||
void AsyncWrite();
|
||||
void OnWriteHeaders(boost::system::error_code ec, std::size_t length);
|
||||
void DoWriteBody();
|
||||
void OnWriteBody(boost::system::error_code ec, std::size_t length);
|
||||
void OnWriteOK();
|
||||
void OnWriteError(boost::system::error_code ec);
|
||||
|
||||
void AsyncWriteBody();
|
||||
void OnWriteBody(boost::system::error_code ec, std::size_t length);
|
||||
|
||||
void HandleWriteOK();
|
||||
void HandleWriteError(boost::system::error_code ec);
|
||||
|
||||
private:
|
||||
// The socket for the connection.
|
||||
boost::asio::ip::tcp::socket socket_;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user