From 4b245135856a71da20b43960b3210fd48fcaddd4 Mon Sep 17 00:00:00 2001 From: wangyu- Date: Sun, 29 Oct 2017 10:12:21 -0500 Subject: [PATCH] keep alive fix --- tun_dev.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/tun_dev.cpp b/tun_dev.cpp index dc05347..c6923c8 100644 --- a/tun_dev.cpp +++ b/tun_dev.cpp @@ -148,14 +148,14 @@ int from_fec_to_normal2(conn_info_t & conn_info,dest_t &dest,char * data,int len return 0; } -int keep_alive(dest_t & dest) +int do_keep_alive(dest_t & dest) { if(get_current_time()-last_keep_alive_time>u64_t(keep_alive_interval)) { last_keep_alive_time=get_current_time(); char data[buf_len];int len; data[0]=header_keep_alive; - int len=1; + len=1; assert(dest.cook==1); //do_cook(data,len); @@ -296,7 +296,7 @@ int tun_dev_client_event_loop() read(conn_info.timer.get_timer_fd(), &value, 8); mylog(log_trace,"events[idx].data.u64==(u64_t)conn_info.timer.get_timer_fd()\n"); conn_info.stat.report_as_client(); - if(got_feed_back) keep_alive(udp_dest); + if(got_feed_back) do_keep_alive(udp_dest); } else if(events[idx].data.u64==conn_info.fec_encode_manager.get_timer_fd64()) @@ -368,9 +368,9 @@ int tun_dev_client_event_loop() continue; } - if(header==keep_alive) + if(header==header_keep_alive) { - mylog(log_debug,"got keep_alive packet\n"); + mylog(log_trace,"got keep_alive packet\n"); continue; } @@ -567,7 +567,7 @@ int tun_dev_server_event_loop() continue; } conn_info.stat.report_as_server(udp_dest.inner.fd_ip_port.ip_port); - keep_alive(udp_dest); + do_keep_alive(udp_dest); } else if(events[idx].data.u64==conn_info.fec_encode_manager.get_timer_fd64()) { @@ -622,9 +622,9 @@ int tun_dev_server_event_loop() if((udp_dest.inner.fd_ip_port.ip_port.ip==udp_new_addr_in.sin_addr.s_addr) && (udp_dest.inner.fd_ip_port.ip_port.port==ntohs(udp_new_addr_in.sin_port))) { - if(header==keep_alive) + if(header==header_keep_alive) { - mylog(log_debug,"got keep_alive packet\n"); + mylog(log_trace,"got keep_alive packet\n"); continue; } @@ -636,7 +636,7 @@ int tun_dev_server_event_loop() } else { - if(header==keep_alive) + if(header==header_keep_alive) { mylog(log_debug,"got keep_alive packet from unexpected client\n"); continue;