generated from ucu-cs/template_cpp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
55 lines (38 loc) · 1.31 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
#include <iostream>
#include "common/logging.h"
#include "common/socket.h"
#include "common/defines.h"
#ifdef ECHO_SERVER_SIMPLE
#include "echo_server_simple.h"
#elif ECHO_SERVER_SIMPLE_THREADED
#include "echo_server_simple_threaded.h"
#elif ECHO_SERVER_CUSTOM_THREAD_POOL
#include "echo_server_custom_thread_pool.h"
#elif ECHO_SERVER_BOOST_ASIO
#include "echo_server_boost_asio.h"
#elif ECHO_SERVER_BOOST_ASIO_THREADED
#include "echo_server_boost_asio_threaded.h"
#endif
int main(int argc, char *argv[]) {
int ret = 0;
// Initialize Google’s logging library.
logging_init(&argc, &argv);
set_log_severity(google::GLOG_INFO);
sock_num_set_max_limit();
#ifdef ECHO_SERVER_SIMPLE
ret = echo_server_simple_main(ECHO_SERVER_PORT);
#elif ECHO_SERVER_SIMPLE_THREADED
ret = echo_server_simple_threaded_main(ECHO_SERVER_PORT);
#elif ECHO_SERVER_CUSTOM_THREAD_POOL
ret = echo_server_custom_thread_pool_main(ECHO_SERVER_PORT);
#elif ECHO_SERVER_BOOST_ASIO
ret = echo_server_boost_asio_main(ECHO_SERVER_PORT);
#elif ECHO_SERVER_BOOST_ASIO_THREADED
ret = echo_server_boost_asio_threaded_main(ECHO_SERVER_PORT);
#else
LOG(FATAL) << "No valid target specified during compilation!!!";
#endif
LOG(INFO) << "Server finished with exit code: " << ret;
logging_deinit();
return ret;
}