dovecot-2.0: imap IDLE: Don't send "Still here" notifications if...

dovecot at dovecot.org dovecot at dovecot.org
Wed Oct 6 00:54:04 EEST 2010


details:   http://hg.dovecot.org/dovecot-2.0/rev/73c6b077bcba
changeset: 12244:73c6b077bcba
user:      Timo Sirainen <tss at iki.fi>
date:      Tue Oct 05 22:53:58 2010 +0100
description:
imap IDLE: Don't send "Still here" notifications if there is already data in output buffer.

diffstat:

 src/imap/cmd-idle.c |  14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)

diffs (24 lines):

diff -r 760e584b352b -r 73c6b077bcba src/imap/cmd-idle.c
--- a/src/imap/cmd-idle.c	Tue Oct 05 22:52:55 2010 +0100
+++ b/src/imap/cmd-idle.c	Tue Oct 05 22:53:58 2010 +0100
@@ -110,11 +110,15 @@
 		return;
 	}
 
-	/* Sending this keeps NATs/stateful firewalls alive. Sending this
-	   also catches dead connections. */
-	o_stream_cork(ctx->client->output);
-	client_send_line(ctx->client, "* OK Still here");
-	o_stream_uncork(ctx->client->output);
+	if (o_stream_get_buffer_used_size(ctx->client->output) == 0) {
+		/* Sending this keeps NATs/stateful firewalls alive.
+		   Sending this also catches dead connections. Don't send
+		   anything if there is already data waiting in output
+		   buffer. */
+		o_stream_cork(ctx->client->output);
+		client_send_line(ctx->client, "* OK Still here");
+		o_stream_uncork(ctx->client->output);
+	}
 	/* Make sure idling connections don't get disconnected. There are
 	   several clients that really want to IDLE forever and there's not
 	   much harm in letting them do so. */


More information about the dovecot-cvs mailing list