Allow to set file chunk size to the server.

This commit is contained in:
Chunting Gu
2019-08-05 10:45:18 +08:00
parent da6addc653
commit 1f4b6cac30
4 changed files with 12 additions and 4 deletions
+2 -2
View File
@@ -21,7 +21,7 @@ using tcp = boost::asio::ip::tcp;
namespace webcc {
Server::Server(std::uint16_t port, const Path& doc_root)
: port_(port), doc_root_(doc_root), running_(false),
: port_(port), doc_root_(doc_root), file_chunk_size_(1024), running_(false),
acceptor_(io_context_), signals_(io_context_) {
AddSignals();
}
@@ -352,7 +352,7 @@ bool Server::ServeStatic(ConnectionPtr connection) {
Path p = doc_root_ / path;
try {
auto body = std::make_shared<FileBody>(p);
auto body = std::make_shared<FileBody>(p, file_chunk_size_);
auto response = std::make_shared<Response>(Status::kOK);