diff --git a/common.h b/common.h index 459fdde..e12f48e 100644 --- a/common.h +++ b/common.h @@ -105,7 +105,7 @@ const u32_t client_conn_timeout=10000; const u32_t client_conn_uplink_timeout=client_conn_timeout+2000; //const uint32_t server_conn_timeout=conv_timeout+60000;//this should be 60s+ longer than conv_timeout,so that conv_manager can destruct convs gradually,to avoid latency glicth -const u32_t server_conn_timeout=conv_timeout+60000;//for test +const u32_t server_conn_timeout=conv_timeout+20000;//for test extern int about_to_exit; diff --git a/connection.cpp b/connection.cpp index c9c982c..7ac7519 100644 --- a/connection.cpp +++ b/connection.cpp @@ -313,6 +313,10 @@ int conn_manager_t::clear_inactive0() //mylog(log_info,"[%s:%d]size %d \n",my_ntoa(get_u64_h(it->first)),get_u64_l(it->first),(int)it->second->conv_manager.get_size()); it++; } + else if(current_timesecond->last_active_time+server_conn_timeout) + { + it++; + } else { mylog(log_info,"[%s:%d]inactive conn cleared \n",my_ntoa(get_u64_h(it->first)),get_u64_l(it->first)); diff --git a/connection.h b/connection.h index 289b807..a68e029 100644 --- a/connection.h +++ b/connection.h @@ -76,9 +76,14 @@ struct conn_info_t //stores info for a raw connection.for client ,there is o fec_decode_manager_t fec_decode_manager; my_timer_t timer; ip_port_t ip_port; + u64_t last_active_time; conn_info_t() { } + void update_active_time() + { + last_active_time=get_current_time(); + } conn_info_t(const conn_info_t &b) { assert(0==1); diff --git a/fec_manager.cpp b/fec_manager.cpp index 5dc851c..45066e2 100644 --- a/fec_manager.cpp +++ b/fec_manager.cpp @@ -252,7 +252,7 @@ int fec_encode_manager_t::input(char *s,int len/*,int &is_first_packet*/) } } - mylog(log_info,"%d %d %d\n",actual_data_num,actual_redundant_num,fec_len); + mylog(log_trace,"%d %d %d\n",actual_data_num,actual_redundant_num,fec_len); char *tmp_output_buf[max_fec_packet_num+5]={0}; for(int i=0;i