-
Notifications
You must be signed in to change notification settings - Fork 0
/
Worker.h
52 lines (36 loc) · 797 Bytes
/
Worker.h
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
42
43
44
45
46
47
48
49
50
51
52
//
// Created by user on 19-3-24.
//
#ifndef WEBSERVER_WORKER_H
#define WEBSERVER_WORKER_H
#include <sys/socket.h>
#include <sys/epoll.h>
#include <sys/ioctl.h>
#include <netinet/tcp.h>
#include <unistd.h>
#include <fcntl.h>
#include <vector>
//#include <time.h>
#include <unordered_map>
#include <map>
#include "FastCGI.h"
#include "Timer.h"
#include "CGIManager.h"
#include "FileManager.h"
#include "Setting.h"
void worker(int listenfd, int ipcfd);
class WorkerManage {
public:
WorkerManage();
~WorkerManage();
pid_t CreateWorkers(int nums);
void CloseWorkers();
int recv_fd();
ssize_t Write(int i, char *buf, size_t size);
ssize_t send_fd(int i, int fd);
int getfd();
private:
int fd;
std::vector<int> fds;
};
#endif //WEBSERVER_WORKER_H