From 4273a5fb0d03e9bee3d0f0c2931e81a2b3aff84d Mon Sep 17 00:00:00 2001 From: wangyu- Date: Sat, 7 Oct 2017 06:52:10 -0500 Subject: [PATCH] just commit --- delay_manager.cpp | 2 +- fec_manager.cpp | 1 + main.cpp | 26 +++++++++++++++++++------- packet.cpp | 8 ++++---- 4 files changed, 25 insertions(+), 12 deletions(-) diff --git a/delay_manager.cpp b/delay_manager.cpp index 5d6190e..1be0500 100644 --- a/delay_manager.cpp +++ b/delay_manager.cpp @@ -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); diff --git a/fec_manager.cpp b/fec_manager.cpp index dc47aad..30d0b1b 100644 --- a/fec_manager.cpp +++ b/fec_manager.cpp @@ -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 diff --git a/main.cpp b/main.cpp index 4a6491b..320fa1f 100644 --- a/main.cpp +++ b/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