changeset 20618:199918a54c38

lib: Added connection.last_input_tv for more accuracy
author Timo Sirainen <timo.sirainen@dovecot.fi>
date Wed, 10 Aug 2016 17:41:51 +0300
parents 1aed896c25c1
children 533591bab969
files src/lib/connection.c src/lib/connection.h
diffstat 2 files changed, 3 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib/connection.c	Wed Aug 10 17:37:53 2016 +0300
+++ b/src/lib/connection.c	Wed Aug 10 17:41:51 2016 +0300
@@ -292,6 +292,7 @@
 void connection_disconnect(struct connection *conn)
 {
 	conn->last_input = 0;
+	memset(&conn->last_input_tv, 0, sizeof(conn->last_input_tv));
 	if (conn->to != NULL)
 		timeout_remove(&conn->to);
 	if (conn->io != NULL)
@@ -327,6 +328,7 @@
 int connection_input_read(struct connection *conn)
 {
 	conn->last_input = ioloop_time;
+	conn->last_input_tv = ioloop_timeval;
 	if (conn->to != NULL)
 		timeout_reset(conn->to);
 
--- a/src/lib/connection.h	Wed Aug 10 17:37:53 2016 +0300
+++ b/src/lib/connection.h	Wed Aug 10 17:41:51 2016 +0300
@@ -80,6 +80,7 @@
 
 	struct timeout *to;
 	time_t last_input;
+	struct timeval last_input_tv;
 
 	/* for IP client: */
 	struct ip_addr ip;