Skip to content

Commit

Permalink
liudf 20170424 add some debug info
Browse files Browse the repository at this point in the history
  • Loading branch information
Dengfeng Liu committed Apr 24, 2017
1 parent 54fe9f7 commit 4268dc2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ set(libs
event
json-c)

ADD_DEFINITIONS(-O2 -Wall -g --std=gnu99 -Wmissing-declarations)
ADD_DEFINITIONS(-Wall -g --std=gnu99 -Wmissing-declarations)

add_executable(xkcp_spy ${src_xkcp_spy})
target_link_libraries(xkcp_spy ${libs})
Expand Down
5 changes: 3 additions & 2 deletions tcp_proxy.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,14 @@ tcp_proxy_accept_cb(struct evconnlistener *listener, evutil_socket_t fd,
BEV_OPT_CLOSE_ON_FREE|BEV_OPT_DEFER_CALLBACKS);
assert(b_in);

debug(LOG_INFO, "accept new client in");

static int conv = 1;
ikcpcb *kcp_client = ikcp_create(conv, param);
xkcp_set_config_param(kcp_client);
conv++;

debug(LOG_INFO, "accept new client [%d] in, conv [%d]", fd, conv-1);

struct xkcp_task *task = malloc(sizeof(struct xkcp_task));
assert(task);
task->kcp = kcp_client;
Expand All @@ -85,5 +86,5 @@ tcp_proxy_accept_cb(struct evconnlistener *listener, evutil_socket_t fd,
add_task_tail(task, &xkcp_task_list);

bufferevent_setcb(b_in, tcp_proxy_read_cb, NULL, tcp_proxy_event_cb, task);
bufferevent_enable(b_in, EV_READ | EV_WRITE | EV_PERSIST);
bufferevent_enable(b_in, EV_READ | EV_WRITE );
}

0 comments on commit 4268dc2

Please sign in to comment.