Add multi-thread support.
This commit is contained in:
10
fastcgi.h
10
fastcgi.h
@@ -8,14 +8,16 @@
|
||||
|
||||
class FastCGIServer {
|
||||
public:
|
||||
FastCGIServer(int port, const std::function<void(std::unique_ptr<FastCGIRequest>)>& callback, const std::unordered_set<std::string_view>& headers={});
|
||||
FastCGIServer(int port, const std::function<void(std::unique_ptr<FastCGIRequest>)>& callback, int threads=1, const std::unordered_set<std::string_view>& headers={});
|
||||
void Serve();
|
||||
|
||||
private:
|
||||
void NewConn();
|
||||
void NewConn(int listen_sock, int epoll_fd);
|
||||
int NewListenSock();
|
||||
void ServeInt();
|
||||
|
||||
const int port_;
|
||||
const std::function<void(std::unique_ptr<FastCGIRequest>)> callback_;
|
||||
const int threads_;
|
||||
const std::unordered_set<std::string_view> headers_;
|
||||
int epoll_fd_;
|
||||
int listen_sock_;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user