Added timeout handling for keep-alive operations.

This commit is contained in:
Denis Chaplygin
2019-08-19 16:15:56 +03:00
parent a0582a3e68
commit 22550d078f
2 changed files with 22 additions and 4 deletions
+5
View File
@@ -52,11 +52,15 @@ class Connection : public std::enable_shared_from_this<Connection>
/// Handle completion of a write operation.
void handle_write(const boost::system::error_code &e);
/// Handle read timeout
void handle_timeout();
std::vector<char> compress_buffers(const std::vector<char> &uncompressed_data,
const http::compression_type compression_type);
boost::asio::io_service::strand strand;
boost::asio::ip::tcp::socket TCP_socket;
boost::asio::deadline_timer timer;
RequestHandler &request_handler;
RequestParser request_parser;
boost::array<char, 8192> incoming_data_buffer;
@@ -68,6 +72,7 @@ class Connection : public std::enable_shared_from_this<Connection>
//Keep alive support
bool keep_alive = false;
short processed_requests = 512;
short keepalive_timeout = 5; // In seconds
};
}
}