diff --git a/main.cpp b/main.cpp index f7768e1..0ec2687 100755 --- a/main.cpp +++ b/main.cpp @@ -408,6 +408,8 @@ struct conn_manager_t assert(erase_it->second->conv_manager==0); assert(erase_it->second->timer_fd ==0); assert(erase_it->second->oppsite_const_id==0); + delete(erase_it->second); + mp.erase(erase_it->first); } return 0; } @@ -424,7 +426,11 @@ int clear_inactive() 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",mp.size()); + + num_to_clean=min(num_to_clean,(int)mp.size()); uint64_t current_time=get_current_time(); + for(;;) { if(cnt>=num_to_clean) break; @@ -1301,6 +1307,11 @@ int client_on_raw_recv(conn_info_t &conn_info) return -1; } + if(data_len