Fix inactive connection removal

This commit is contained in:
William Robinet 2015-04-27 14:37:44 +02:00
parent 05fe4a619c
commit d5dc74824d

View file

@ -161,6 +161,7 @@ int tcp_destroy_conn(conn)
free_tcp_segment_queue(conn->i2r.oo_queue); free_tcp_segment_queue(conn->i2r.oo_queue);
free_tcp_segment_queue(conn->r2i.oo_queue); free_tcp_segment_queue(conn->r2i.oo_queue);
zero_conn(conn); zero_conn(conn);
free(conn->backptr);
free(conn); free(conn);
return(0); return(0);
@ -176,11 +177,11 @@ int clean_old_conn() {
return 0; // Still processing first block of packets return 0; // Still processing first block of packets
for(conn=first_conn;conn;conn=conn->next) { for(conn=first_conn;conn;conn=conn->next) {
i++;
tcpconn = &conn->conn; tcpconn = &conn->conn;
timestamp_diff(&last_packet_seen_time, &tcpconn->last_seen_time, &dt); timestamp_diff(&last_packet_seen_time, &tcpconn->last_seen_time, &dt);
if(dt.tv_sec > conn_ttl) { if(dt.tv_sec > conn_ttl) {
tcp_destroy_conn(&(first_conn->conn)); i++;
tcp_destroy_conn(tcpconn);
} }
} }
return i; return i;