mirror of
https://github.com/wangyu-/UDPspeeder.git
synced 2025-01-18 22:09:35 +08:00
just commit
This commit is contained in:
parent
707cc56562
commit
4273a5fb0d
@ -92,7 +92,7 @@ int delay_manager_t::check()
|
||||
{
|
||||
ret=it->second.handle();
|
||||
if (ret != 0) {
|
||||
mylog(log_debug, "handle() return %d\n", ret);
|
||||
mylog(log_trace, "handle() return %d\n", ret);
|
||||
}
|
||||
free(it->second.data);
|
||||
delay_mp.erase(it);
|
||||
|
@ -156,6 +156,7 @@ int fec_encode_manager_t::input(char *s,int len/*,int &is_first_packet*/)
|
||||
{
|
||||
char ** blob_output;
|
||||
int blob_len;
|
||||
mylog(log_debug,"counter=%d\n",counter);
|
||||
if(counter==0)
|
||||
{
|
||||
if(s==0) return 0;//relax this restriction temporarily
|
||||
|
26
main.cpp
26
main.cpp
@ -27,11 +27,12 @@ int jitter_max=0;
|
||||
|
||||
int mtu_warn=1350;
|
||||
|
||||
int fec_data_num=3;
|
||||
int fec_redundant_num=2;
|
||||
int fec_mtu=30;
|
||||
int fec_pending_num=5;
|
||||
int fec_pending_time=2000000;
|
||||
int fec_data_num=30;
|
||||
int fec_redundant_num=20;
|
||||
int fec_mtu=1200;
|
||||
int fec_pending_num=200;
|
||||
int fec_pending_time=50000;
|
||||
|
||||
u32_t local_ip_uint32,remote_ip_uint32=0;
|
||||
char local_ip[100], remote_ip[100];
|
||||
int local_port = -1, remote_port = -1;
|
||||
@ -109,6 +110,13 @@ int new_connected_socket(int &fd,u32_t ip,int port)
|
||||
}
|
||||
int delay_send(my_time_t delay,const dest_t &dest,char *data,int len)
|
||||
{
|
||||
int rand=random()%100;
|
||||
//mylog(log_info,"rand = %d\n",rand);
|
||||
if(rand>=80)
|
||||
{
|
||||
return 0;
|
||||
//mylog(log_info,"dropped!\n");
|
||||
}
|
||||
return delay_manager.add(delay,dest,data,len);;
|
||||
}
|
||||
int from_normal_to_fec(conn_info_t & conn_info,char *data,int len,int & out_n,char **&out_arr,int *&out_len,int *&out_delay)
|
||||
@ -149,7 +157,7 @@ int from_normal_to_fec(conn_info_t & conn_info,char *data,int len,int & out_n,ch
|
||||
for(int i=0;i<out_n;i++)
|
||||
{
|
||||
out_len_buf[i]=tmp_out_len;
|
||||
out_delay_buf[i]=100000*i;
|
||||
//out_delay_buf[i]=100*i;
|
||||
}
|
||||
|
||||
}
|
||||
@ -187,7 +195,7 @@ int from_fec_to_normal(conn_info_t & conn_info,char *data,int len,int & out_n,ch
|
||||
conn_info.fec_decode_manager.output(out_n,out_arr,out_len);
|
||||
for(int i=0;i<out_n;i++)
|
||||
{
|
||||
out_delay_buf[i]=100000*i;
|
||||
//out_delay_buf[i]=100*i;
|
||||
}
|
||||
|
||||
}
|
||||
@ -364,6 +372,10 @@ int client_event_loop()
|
||||
|
||||
}
|
||||
|
||||
if(out_n!=-1)
|
||||
{
|
||||
mylog(log_debug,"n=%d\n",out_n);
|
||||
}
|
||||
for(int i=0;i<out_n;i++)
|
||||
{
|
||||
delay_send(out_delay[i],dest,out_arr[i],out_len[i]);
|
||||
|
@ -216,7 +216,7 @@ unsigned int crc32h(unsigned char *message,int len) {
|
||||
return ~crc;
|
||||
}
|
||||
|
||||
int put_conv(u32_t conv,const char * input,int len_in,char *&output,int &len_out)
|
||||
int put_conv0(u32_t conv,const char * input,int len_in,char *&output,int &len_out)
|
||||
{
|
||||
static char buf[buf_len];
|
||||
output=buf;
|
||||
@ -229,7 +229,7 @@ int put_conv(u32_t conv,const char * input,int len_in,char *&output,int &len_out
|
||||
memcpy(output+len_in+(int)(sizeof(n_conv)),&crc32_n,sizeof(crc32_n));
|
||||
return 0;
|
||||
}
|
||||
int get_conv(u32_t &conv,const char *input,int len_in,char *&output,int &len_out )
|
||||
int get_conv0(u32_t &conv,const char *input,int len_in,char *&output,int &len_out )
|
||||
{
|
||||
u32_t n_conv;
|
||||
memcpy(&n_conv,input,sizeof(n_conv));
|
||||
@ -252,7 +252,7 @@ int get_conv(u32_t &conv,const char *input,int len_in,char *&output,int &len_out
|
||||
return 0;
|
||||
}
|
||||
|
||||
int put_conv1(u32_t conv,const char * input,int len_in,char *&output,int &len_out)
|
||||
int put_conv(u32_t conv,const char * input,int len_in,char *&output,int &len_out)
|
||||
{
|
||||
static char buf[buf_len];
|
||||
output=buf;
|
||||
@ -262,7 +262,7 @@ int put_conv1(u32_t conv,const char * input,int len_in,char *&output,int &len_ou
|
||||
len_out=len_in+(int)(sizeof(n_conv));
|
||||
return 0;
|
||||
}
|
||||
int get_conv1(u32_t &conv,const char *input,int len_in,char *&output,int &len_out )
|
||||
int get_conv(u32_t &conv,const char *input,int len_in,char *&output,int &len_out )
|
||||
{
|
||||
u32_t n_conv;
|
||||
memcpy(&n_conv,input,sizeof(n_conv));
|
||||
|
Loading…
x
Reference in New Issue
Block a user