Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
72 lines (55 loc) · 1.57 KB

File metadata and controls

72 lines (55 loc) · 1.57 KB
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
/*
* route_server.cpp
*
* Created on: 2013-7-4
* Author: ziteng@mogujie.com
*/
#include "RouteConn.h"
#include "netlib.h"
#include "ConfigFileReader.h"
#include "version.h"
// this callback will be replaced by imconn_callback() in OnConnect()
void route_serv_callback(void* callback_data, uint8_t msg, uint32_t handle, void* pParam)
{
if (msg == NETLIB_MSG_CONNECT)
{
CRouteConn* pConn = new CRouteConn();
pConn->OnConnect(handle);
}
else
{
log("!!!error msg: %d\n", msg);
}
}
int main(int argc, char* argv[])
{
if ((argc == 2) && (strcmp(argv[1], "-v") == 0)) {
printf("Server Version: RouteServer/%s\n", VERSION);
printf("Server Build: %s %s\n", __DATE__, __TIME__);
return 0;
}
signal(SIGPIPE, SIG_IGN);
srand(time(NULL));
CConfigFileReader config_file("routeserver.conf");
char* listen_ip = config_file.GetConfigName("ListenIP");
char* str_listen_msg_port = config_file.GetConfigName("ListenMsgPort");
if (!listen_ip || !str_listen_msg_port) {
log("config item missing, exit...\n");
return -1;
}
uint16_t listen_msg_port = atoi(str_listen_msg_port);
int ret = netlib_init();
if (ret == NETLIB_ERROR)
return ret;
CStrExplode listen_ip_list(listen_ip, ';');
for (uint32_t i = 0; i < listen_ip_list.GetItemCnt(); i++) {
ret = netlib_listen(listen_ip_list.GetItem(i), listen_msg_port, route_serv_callback, NULL);
if (ret == NETLIB_ERROR)
return ret;
}
printf("server start listen on: %s:%d\n", listen_ip, listen_msg_port);
init_routeconn_timer_callback();
printf("now enter the event loop...\n");
netlib_eventloop();
return 0;
}
Morty Proxy This is a proxified and sanitized view of the page, visit original site.