dovecot-2.2: lib: Using istream-timeout with timeout disabled ca...
    dovecot at dovecot.org 
    dovecot at dovecot.org
       
    Mon Sep 28 12:53:16 UTC 2015
    
    
  
details:   http://hg.dovecot.org/dovecot-2.2/rev/b7a0b0d86651
changeset: 19243:b7a0b0d86651
user:      Timo Sirainen <tss at iki.fi>
date:      Mon Sep 28 15:51:45 2015 +0300
description:
lib: Using istream-timeout with timeout disabled caused excessive CPU usage.
diffstat:
 src/lib/istream-timeout.c |  7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)
diffs (20 lines):
diff -r 60814596aff2 -r b7a0b0d86651 src/lib/istream-timeout.c
--- a/src/lib/istream-timeout.c	Mon Sep 28 15:10:29 2015 +0300
+++ b/src/lib/istream-timeout.c	Mon Sep 28 15:51:45 2015 +0300
@@ -101,13 +101,12 @@
 				"%s (opened %d secs ago)",
 				i_stream_get_error(stream->parent), diff);
 		}
-	} else if (tstream->to == NULL) {
+	} else if (tstream->to == NULL && tstream->timeout_msecs > 0) {
 		/* first read. add the timeout here instead of in init
 		   in case the stream is created long before it's actually
 		   read from. */
-		tstream->to = tstream->timeout_msecs == 0 ? NULL :
-			timeout_add(tstream->timeout_msecs,
-				    i_stream_timeout, tstream);
+		tstream->to = timeout_add(tstream->timeout_msecs,
+					  i_stream_timeout, tstream);
 		i_stream_timeout_set_pending(tstream);
 	} else if (ret > 0 && tstream->to != NULL) {
 		/* we read something, reset the timeout */
    
    
More information about the dovecot-cvs
mailing list