Initialize initial reference timeval

Avoids wrong cleaning of first connection(s)
This commit is contained in:
William Robinet 2015-04-23 11:29:42 +02:00
parent 3ca46766e4
commit 05fe4a619c
2 changed files with 5 additions and 2 deletions

View file

@ -91,8 +91,8 @@ int packet_cnt = 0; // Packet counter used for connection pool cleaning
int conn_freq = 100; // Number of packets after which a connection pool
// cleaning is performed
int conn_ttl = 100; // TTL of inactive connections in connection pool
struct timeval last_packet_seen_time; // Timestamp of the last packet of the
// last block of conn_freq packets seen
struct timeval last_packet_seen_time = // Timestamp of the last packet of the
(struct timeval) {0}; // last block of conn_freq packets seen
int err_exit(str,num)
char *str;

View file

@ -172,6 +172,9 @@ int clean_old_conn() {
struct timeval dt;
int i = 0;
if(!last_packet_seen_time.tv_sec)
return 0; // Still processing first block of packets
for(conn=first_conn;conn;conn=conn->next) {
i++;
tcpconn = &conn->conn;