Don't leak eventfd

This commit is contained in:
flamingcow
2019-05-12 16:08:46 -07:00
parent 0ba446bacb
commit a39ef8e25d
2 changed files with 6 additions and 0 deletions

View File

@@ -28,6 +28,10 @@ Server::Server(int port, const std::function<void(Request*)>& callback, int thre
signal(SIGPIPE, SIG_IGN); signal(SIGPIPE, SIG_IGN);
} }
Server::~Server() {
PCHECK(close(close_fd_) == 0);
}
void Server::Serve() { void Server::Serve() {
std::vector<std::thread> threads; std::vector<std::thread> threads;
for (int i = 0; i < threads_ - 1; ++i) { for (int i = 0; i < threads_ - 1; ++i) {

View File

@@ -11,6 +11,8 @@ namespace firecgi {
class Server { class Server {
public: public:
Server(int port, const std::function<void(Request*)>& callback, int threads=1, int max_request_len=(16*1024)); Server(int port, const std::function<void(Request*)>& callback, int threads=1, int max_request_len=(16*1024));
~Server();
void Serve(); void Serve();
void Shutdown(); void Shutdown();
void RegisterSignalHandlers(); void RegisterSignalHandlers();