dovecot-2.2: lib: istream-timeout logs how long the stream was o...

dovecot at dovecot.org dovecot at dovecot.org
Tue Oct 28 04:49:31 UTC 2014


details:   http://hg.dovecot.org/dovecot-2.2/rev/aa5dde56424f
changeset: 18037:aa5dde56424f
user:      Timo Sirainen <tss at iki.fi>
date:      Mon Oct 27 21:48:29 2014 -0700
description:
lib: istream-timeout logs how long the stream was open if parent read fails with ECONNRESET/EPIPE.

diffstat:

 src/lib/istream-timeout.c |  9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diffs (33 lines):

diff -r f08b79e8d22e -r aa5dde56424f src/lib/istream-timeout.c
--- a/src/lib/istream-timeout.c	Mon Oct 27 21:43:10 2014 -0700
+++ b/src/lib/istream-timeout.c	Mon Oct 27 21:48:29 2014 -0700
@@ -11,6 +11,7 @@
 
 	struct timeout *to;
 	struct timeval last_read_timestamp;
+	time_t created;
 
 	unsigned int timeout_msecs;
 	bool update_timestamp;
@@ -75,6 +76,13 @@
 	ret = i_stream_read_copy_from_parent(&stream->istream);
 	if (ret < 0) {
 		/* failed */
+		if (errno == ECONNRESET || errno == EPIPE) {
+			int diff = ioloop_time - tstream->created;
+
+			io_stream_set_error(&tstream->istream.iostream,
+				"%s (opened %d secs ago)",
+				i_stream_get_error(stream->parent), diff);
+		}
 	} else if (tstream->to == NULL) {
 		/* first read. add the timeout here instead of in init
 		   in case the stream is created long before it's actually
@@ -111,6 +119,7 @@
 	tstream->timeout_msecs = timeout_msecs;
 	tstream->istream.max_buffer_size = input->real_stream->max_buffer_size;
 	tstream->istream.stream_size_passthrough = TRUE;
+	tstream->created = ioloop_time;
 
 	tstream->istream.read = i_stream_timeout_read;
 	tstream->istream.switch_ioloop = i_stream_timeout_switch_ioloop;


More information about the dovecot-cvs mailing list