-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.hpp
41 lines (40 loc) · 1.08 KB
/
server.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#ifndef SERVER_HPP
#define SERVER_HPP
#include <sys/socket.h>
#include <unistd.h>
#include <stdio.h>
#include <sys/socket.h>
#include <stdlib.h>
#include <netinet/in.h>
#include <string.h>
#include <future>
#include <iostream>
#include <condition_variable>
#include "response.hpp"
#include "request.hpp"
#include "ressourcemapper.hpp"
#include "worker.hpp"
#include "queues.hpp"
#include "socket.hpp"
#define HTTP_MSIZE 8192
class HTTPServer{
private:
TLSHandlerSock sslmastersock;
HandlerSock mastersock;
int handle(Socket *);
std::vector<RequestWorker*> m_request_workers;
MessageQueue m_MsgQueue;
ResponseQueue m_RepQueue;
std::thread m_respond_thread;
int responder();
SocketMultiplexer multiplexer;
std::condition_variable m_newMsg;
std::condition_variable m_newRep;
public:
HTTPServer(int port, const char * ressource_path, int workers,
std::string certpath, std::string keypath);
RessourceMapper *mapper;
int mainloop();
int test_mainloop(int n_request);
};
#endif