-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.cpp
More file actions
39 lines (28 loc) · 801 Bytes
/
main.cpp
File metadata and controls
39 lines (28 loc) · 801 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
35
36
37
38
39
#include <iostream>
#include <unistd.h>
#include "cppsockets/sockets.hpp"
#include "rxprotocol.hpp"
#include "logger.hpp"
#include "config.hpp"
#include "tcpserver.hpp"
using namespace std;
using namespace remexec;
using namespace sockets;
int main(int argc, char **argv){
close(STDIN_FILENO);
Config defconf;
defconf.loadDefaultConfig();
constexpr char defconfpath[] = "remexec-server.conf";
Config config(defconf);
if (!config.loadFromFile(defconfpath)){
Log::warn("Can't open config file (", defconfpath, "), using defaults");
}
if (!config.checkIsValid()){
return 1;
}
address_ip4 addr(config.getString(Config::LISTEN_ADDRESS), config.getInteger(Config::LISTEN_PORT));
Log::info("Listen on ", addr.str());
TCPServer server(config, addr);
server.start();
return 0;
}