Re-use Request, instead of re-create. Add asan target.

This commit is contained in:
flamingcow
2019-05-07 22:56:00 -07:00
parent c571e47bae
commit a4171b0ae1
9 changed files with 37 additions and 24 deletions

View File

@@ -10,7 +10,7 @@ namespace firecgi {
class Server {
public:
Server(int port, const std::function<void(std::unique_ptr<Request>)>& callback, int threads=1, const std::unordered_set<std::string_view>& headers={});
Server(int port, const std::function<void(Request*)>& callback, int threads=1, const std::unordered_set<std::string_view>& headers={});
void Serve();
private:
@@ -19,7 +19,7 @@ class Server {
void ServeInt();
const int port_;
const std::function<void(std::unique_ptr<Request>)> callback_;
const std::function<void(Request*)> callback_;
const int threads_;
const std::unordered_set<std::string_view> headers_;
};