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
+8
View File
@@ -26,6 +26,10 @@ public:
Server(const Server&) = delete;
Server& operator=(const Server&) = delete;
void set_file_chunk_size(std::size_t file_chunk_size) {
file_chunk_size_ = file_chunk_size;
}
// Route a URL to a view.
// The URL should start with "/". E.g., "/instances".
bool Route(const std::string& url, ViewPtr view,
@@ -109,6 +113,10 @@ private:
// The directory with the static files to be served.
Path doc_root_;
// The size of the chunk loaded into memory each time when serving a
// static file.
std::size_t file_chunk_size_;
// Is the server running?
bool running_;