-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
37 lines (23 loc) · 1.39 KB
/
Copy pathmain.cpp
File metadata and controls
37 lines (23 loc) · 1.39 KB
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
#include "network/server.hpp"
#include <boost/asio/signal_set.hpp>
#include <thread>
int main() {
std::cout <<" _ _ _ _ _ _____ \n \
| | | |(_) | | | | / ___| \n \
| | | | _ _ __ ___ | | | | __ _ _ _ \\ `--. ___ _ __ __ __ ___ _ __ \n \
| |/\\| || || '__| / _ \\| |/\\| | / _` || | | | `--. \\ / _ \\| '__|\\ \\ / / / _ \\| '__|\n \
\\ /\\ /| || | | __/\\ /\\ /| (_| || |_| | /\\__/ /| __/| | \\ V / | __/| | \\ \n \
\\/ \\/ |_||_| \\___| \\/ \\/ \\__,_| \\__, | \\____/ \\___||_| \\_/ \\___||_| \n \
__/ | \
|___/ \n";
asio::io_context io;
tcp::acceptor acc{io, tcp::endpoint{tcp::v4(), 8888}};
asio::io_context::work work{io};
asio::signal_set signals(io, SIGTERM, SIGINT);
asio::co_spawn(io, network::Listener(std::move(acc)), asio::detached);
signals.async_wait([&](auto, auto){
Log::Print(INFO, "Server is down", std::cout);
io.stop();
});
io.run();
}