From: Timo Sirainen Date: Tue, 5 Oct 2010 21:53:58 +0000 (+0100) Subject: imap IDLE: Don't send "Still here" notifications if there is already data in output... X-Git-Tag: 2.0.6~92 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=5fcc2aa187730d1de013d68faf01af11a1004630;p=thirdparty%2Fdovecot%2Fcore.git imap IDLE: Don't send "Still here" notifications if there is already data in output buffer. --- diff --git a/src/imap/cmd-idle.c b/src/imap/cmd-idle.c index bcb85550f1..8d87beb3d0 100644 --- a/src/imap/cmd-idle.c +++ b/src/imap/cmd-idle.c @@ -110,11 +110,15 @@ static void keepalive_timeout(struct cmd_idle_context *ctx) 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. */