diff --git a/connection.cpp b/connection.cpp index 3c7fe18..bbbab16 100644 --- a/connection.cpp +++ b/connection.cpp @@ -237,8 +237,11 @@ int conn_manager_t::exist(ip_port_t ip_port) int conn_manager_t::erase(unordered_map::iterator erase_it) { ////////todo close and erase timer_fd ,check fd64 empty ///dont need + delete(erase_it->second); mp.erase(erase_it->first); + + return 0; } int conn_manager_t::clear_inactive() diff --git a/connection.h b/connection.h index dab8ab8..4a4462a 100644 --- a/connection.h +++ b/connection.h @@ -112,7 +112,7 @@ struct conn_info_t //stores info for a raw connection.for client ,there is o u64_t last_active_time; stat_t stat; - ev_loop* loop; + ev_loop* loop=0; int local_listen_fd; int remote_fd; //only used for client @@ -123,6 +123,12 @@ struct conn_info_t //stores info for a raw connection.for client ,there is o conn_info_t() { } + + ~conn_info_t() + { + if(loop) + ev_timer_stop(loop,&timer); + } void update_active_time() { last_active_time=get_current_time(); diff --git a/fec_manager.cpp b/fec_manager.cpp index fcb6a2a..7a504b8 100644 --- a/fec_manager.cpp +++ b/fec_manager.cpp @@ -131,7 +131,7 @@ int blob_decode_t::output(int &n,char ** &s_arr,int *&len_arr) fec_encode_manager_t::~fec_encode_manager_t() { - clear(); + clear_all(); //fd_manager.fd64_close(timer_fd64); } /* @@ -168,8 +168,9 @@ int fec_encode_manager_t::reset_fec_parameter(int data_num,int redundant_num,int assert(data_num+redundant_num\n",n); assert(n==1); fec_decode_manager.input(s_arr[0],len[0]); @@ -575,7 +586,7 @@ int unit_test() } - + myexit(0); return 0; } diff --git a/tunnel_client.cpp b/tunnel_client.cpp index 8101241..5dfbf39 100644 --- a/tunnel_client.cpp +++ b/tunnel_client.cpp @@ -277,6 +277,8 @@ int tunnel_client_event_loop() struct ev_loop * loop= ev_default_loop(0); assert(loop != NULL); + conn_info.loop=loop; + //ev.events = EPOLLIN; //ev.data.u64 = local_listen_fd; //ret = epoll_ctl(epoll_fd, EPOLL_CTL_ADD, local_listen_fd, &ev);