Files
firecgi/server.h

35 lines
631 B
C
Raw Normal View History

2019-05-04 23:00:53 -07:00
#pragma once
#include <functional>
#include <memory>
#include <unordered_set>
2019-05-04 23:21:33 -07:00
#include "request.h"
2019-05-04 23:00:53 -07:00
namespace firecgi {
class Server {
2019-05-18 12:15:11 -07:00
public:
Server(int port, const std::function<void(Request*)>& 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<void(Request*)> callback_;
const int threads_;
const int max_request_len_;
int close_fd_;
2019-05-04 23:00:53 -07:00
};
2019-05-18 12:15:11 -07:00
} // namespace firecgi