Merge pull request #3 from wllm-rbnt/master

[bugfix] Initialize initial reference timeval
This commit is contained in:
Alexandre Dulaunoy 2015-04-27 08:01:42 +02:00
commit 0c177776c2
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 int conn_freq = 100; // Number of packets after which a connection pool
// cleaning is performed // cleaning is performed
int conn_ttl = 100; // TTL of inactive connections in connection pool int conn_ttl = 100; // TTL of inactive connections in connection pool
struct timeval last_packet_seen_time; // Timestamp of the last packet of the struct timeval last_packet_seen_time = // Timestamp of the last packet of the
// last block of conn_freq packets seen (struct timeval) {0}; // last block of conn_freq packets seen
int err_exit(str,num) int err_exit(str,num)
char *str; char *str;

View file

@ -172,6 +172,9 @@ int clean_old_conn() {
struct timeval dt; struct timeval dt;
int i = 0; 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) { for(conn=first_conn;conn;conn=conn->next) {
i++; i++;
tcpconn = &conn->conn; tcpconn = &conn->conn;