Clean shutdown behavior, signal handling

This commit is contained in:
flamingcow
2019-05-10 00:40:38 -07:00
parent b5b0cbd599
commit 88b1131104
7 changed files with 90 additions and 14 deletions

View File

@@ -12,9 +12,11 @@ class Server {
public:
Server(int port, const std::function<void(Request*)>& callback, int threads=1, const std::unordered_set<std::string_view>& headers={}, int max_request_len=(16*1024));
void Serve();
void Shutdown();
void RegisterSignalHandlers();
private:
void NewConn(int listen_sock, int epoll_fd);
Connection *NewConn(int listen_sock, int epoll_fd);
int NewListenSock();
void ServeInt();
@@ -23,6 +25,8 @@ class Server {
const int threads_;
const std::unordered_set<std::string_view> headers_;
const int max_request_len_;
int close_fd_;
};
} // firecgi