From 4268dc297a817ae9d39cd39b8f39b9fea9b614f0 Mon Sep 17 00:00:00 2001 From: Dengfeng Liu Date: Mon, 24 Apr 2017 16:03:23 +0900 Subject: [PATCH] liudf 20170424 add some debug info --- CMakeLists.txt | 2 +- tcp_proxy.c | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1127a5d..2f6b74e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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}) diff --git a/tcp_proxy.c b/tcp_proxy.c index b490b2b..b7d1999 100644 --- a/tcp_proxy.c +++ b/tcp_proxy.c @@ -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; @@ -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 ); }