From d3beacf586835f88d5dbc792abd099d21cc280a9 Mon Sep 17 00:00:00 2001 From: wangyu- Date: Mon, 9 Oct 2017 02:24:23 -0500 Subject: [PATCH] it works now,without anything changed.. --- connection.cpp | 8 ++++---- fec_manager.cpp | 34 +++++++++++++++++++++------------- main.cpp | 4 ++-- 3 files changed, 27 insertions(+), 19 deletions(-) diff --git a/connection.cpp b/connection.cpp index 7349547..c9c982c 100644 --- a/connection.cpp +++ b/connection.cpp @@ -281,7 +281,7 @@ int conn_manager_t::clear_inactive() } int conn_manager_t::clear_inactive0() { -mylog(log_info,"called\n"); +//mylog(log_info,"called\n"); unordered_map::iterator it; unordered_map::iterator old_it; @@ -293,12 +293,12 @@ mylog(log_info,"called\n"); int size=mp.size(); int num_to_clean=size/conn_clear_ratio+conn_clear_min; //clear 1/10 each time,to avoid latency glitch - mylog(log_trace,"mp.size() %d\n", size); + //mylog(log_trace,"mp.size() %d\n", size); num_to_clean=min(num_to_clean,(int)mp.size()); u64_t current_time=get_current_time(); - mylog(log_info,"here size=%d\n",(int)mp.size()); + //mylog(log_info,"here size=%d\n",(int)mp.size()); for(;;) { if(cnt>=num_to_clean) break; @@ -310,7 +310,7 @@ mylog(log_info,"called\n"); if(it->second->conv_manager.get_size() >0) { - 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()); + //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 diff --git a/fec_manager.cpp b/fec_manager.cpp index 729a54a..4c20c79 100644 --- a/fec_manager.cpp +++ b/fec_manager.cpp @@ -276,6 +276,8 @@ int fec_decode_manager_t::input(char *s,int len) ok=0; if(fec_data[first_idx].len!=len) ok=0; + if(fec_data[first_idx].type!=type) + ok=0; if(ok==0) { return 0; @@ -308,21 +310,27 @@ int fec_decode_manager_t::input(char *s,int len) assert((int)inner_mp.size()<=data_num); if((int)inner_mp.size()==data_num) { + if(type==0) + { + char *fec_tmp_arr[max_fec_packet_num+5]={0}; + for(auto it=inner_mp.begin();it!=inner_mp.end();it++) + { + fec_tmp_arr[it->first]=fec_data[it->second].buf; + } + rs_decode2(data_num,data_num+redundant_num,fec_tmp_arr,len); //the input data has been modified in-place + blob_decode.clear(); + for(int i=0;ifirst]=fec_data[it->second].buf; } - rs_decode2(data_num,data_num+redundant_num,fec_tmp_arr,len); //the input data has been modified in-place - blob_decode.clear(); - for(int i=0;i