2019-05-05 00:11:57 -07:00
|
|
|
#pragma once
|
|
|
|
|
|
2019-05-11 22:27:33 -07:00
|
|
|
#include <set>
|
2019-05-11 21:53:12 -07:00
|
|
|
|
2019-05-07 23:44:55 -07:00
|
|
|
#include "firecgi/server.h"
|
2019-05-12 08:45:56 -07:00
|
|
|
|
|
|
|
|
#include "index.h"
|
2019-05-12 11:18:59 -07:00
|
|
|
#include "keepalive.h"
|
2019-05-05 00:11:57 -07:00
|
|
|
#include "stream.h"
|
|
|
|
|
|
|
|
|
|
namespace firesse {
|
|
|
|
|
|
|
|
|
|
class Server {
|
2019-05-18 12:18:26 -07:00
|
|
|
public:
|
|
|
|
|
Server(int port, const std::function<void(Stream*)>& callback);
|
|
|
|
|
void Serve();
|
|
|
|
|
void Shutdown();
|
|
|
|
|
void RegisterSignalHandlers();
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
void OnRequest(firecgi::Request* request);
|
|
|
|
|
|
|
|
|
|
std::function<void(Stream*)> callback_;
|
|
|
|
|
Index index_;
|
|
|
|
|
KeepAlive keep_alive_;
|
|
|
|
|
firecgi::Server firecgi_server_;
|
2019-05-05 00:11:57 -07:00
|
|
|
};
|
|
|
|
|
|
2019-05-18 12:18:26 -07:00
|
|
|
} // namespace firesse
|