Skip to content

Commit

Permalink
keep alive fix
Browse files Browse the repository at this point in the history
  • Loading branch information
wangyu- committed Oct 29, 2017
1 parent db52c76 commit 4b24513
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions tun_dev.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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())
Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -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())
{
Expand Down Expand Up @@ -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;
}

Expand All @@ -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;
Expand Down

0 comments on commit 4b24513

Please sign in to comment.