-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
97 lines (67 loc) · 1.4 KB
/
main.cpp
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#include "include.hpp"
#include "Cluster.hpp"
int main(int ac,char **av)
{
Cluster cluster;
if (ac != 2)
{
std::cout << "Wrong number of argument\n";
return 0;
}
std::string path = std::string(av[1]);
if ((cluster.clusterConfig(path)) < 0)
{
std::cout << "Error: config file\n";
return (0);
}
try
{
cluster.clusterSetup();
cluster.clusterRun();
}
catch(const std::exception& e)
{
std::cerr << e.what() << '\n';
}
return 0;
}
// #include "response.hpp"
// #include "server.hpp"
// #include "include.hpp"
// int g_socket;
// int g_size_add;
// void *g_add;
// void closeserver(int nb)
// {
// (void)nb;
// ft_memset(g_add, 0, g_size_add);
// close(g_socket);
// exit(0);
// }
// int main()
// {
// // Server server;
// // int new_socket = -1;
// // int timeout = (3 * 60 * 1000); // 1 min
// // struct pollfd fds[POLL_SIZE];
// // int nfds = 1;
// // int current_size = 0;
// // int end_server = FALSE;
// // int compress_array = FALSE;
// // int close_conn;
// // int ret = 0;
// // signal(SIGINT, closeserver);
// try
// {
// // server.setup();
// // g_socket = server.get_sfd();
// // g_add = server.get_address();
// // g_size_add = sizeof(*server.get_address());
// // server.listenConnexion();
// }
// catch(const std::exception& e)
// {
// std::cerr << e.what() << '\n';
// }
// return 0;
// }