#pragma once #include #include #include #include "request.h" namespace firecgi { class Server { public: Server(int port, const std::function& callback, int threads = 1, int max_request_len = (16 * 1024)); ~Server(); void Serve(); void Shutdown(); void RegisterSignalHandlers(); private: Connection* NewConn(int listen_sock, int epoll_fd); int NewListenSock(); void ServeInt(); const int port_; const std::function callback_; const int threads_; const int max_request_len_; int close_fd_; }; } // namespace firecgi