-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.cpp
More file actions
34 lines (27 loc) · 750 Bytes
/
main.cpp
File metadata and controls
34 lines (27 loc) · 750 Bytes
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
#include <signal.h>
#include <unistd.h>
#include <iostream>
#include <stdexcept>
#include <string>
#include <vector>
#include "config/ConfigParser.hpp"
#include "config/Server.hpp"
#include "server/EventLoop.hpp"
int main(int argc, char** argv) {
if (2 < argc) {
std::cout << "[0000] main - insufficient number of arguments :" << argc - 1
<< std::endl;
return 0;
}
try {
signal(SIGCHLD, SIG_IGN);
char const* configPath = argc == 2 ? argv[1] : "./conf/default.conf";
ConfigParser configParser(configPath);
std::vector<Server> servers = configParser.parse();
EventLoop loop(servers);
loop.run();
} catch (std::exception const& e) {
std::cout << e.what() << std::endl;
}
return 0;
}