mirror of
https://github.com/wangyu-/UDPspeeder.git
synced 2025-01-31 12:19:35 +08:00
it works now,without anything changed..
This commit is contained in:
parent
8fd5118e6c
commit
d3beacf586
@ -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<u64_t,conn_info_t*>::iterator it;
|
||||
unordered_map<u64_t,conn_info_t*>::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
|
||||
|
@ -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;i<data_num;i++)
|
||||
{
|
||||
blob_decode.input(fec_tmp_arr[i],len);
|
||||
}
|
||||
blob_decode.output(output_n,output_s_arr,output_len_arr);
|
||||
ready_for_output=1;
|
||||
anti_replay.set_invaild(seq);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
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;i<data_num;i++)
|
||||
{
|
||||
blob_decode.input(fec_tmp_arr[i],len);
|
||||
}
|
||||
blob_decode.output(output_n,output_s_arr,output_len_arr);
|
||||
ready_for_output=1;
|
||||
anti_replay.set_invaild(seq);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
4
main.cpp
4
main.cpp
@ -310,7 +310,7 @@ int client_event_loop()
|
||||
|
||||
if(events[idx].data.u64 == conn_info.fec_encode_manager.get_timer_fd64())
|
||||
{
|
||||
mylog(log_info,"timer!!!\n");
|
||||
//mylog(log_info,"timer!!!\n");
|
||||
uint64_t value;
|
||||
if(!fd_manager.exist(fd64)) //fd64 has been closed
|
||||
{
|
||||
@ -733,7 +733,7 @@ int server_event_loop()
|
||||
|
||||
if(fd64==conn_info.fec_encode_manager.get_timer_fd64())
|
||||
{
|
||||
mylog(log_info,"timer!!!\n");
|
||||
//mylog(log_info,"timer!!!\n");
|
||||
uint64_t value;
|
||||
if(read(fd_manager.to_fd(fd64), &value, 8)!=8)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user