]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
imap IDLE: Don't send "Still here" notifications if there is already data in output...
authorTimo Sirainen <tss@iki.fi>
Tue, 5 Oct 2010 21:53:58 +0000 (22:53 +0100)
committerTimo Sirainen <tss@iki.fi>
Tue, 5 Oct 2010 21:53:58 +0000 (22:53 +0100)
src/imap/cmd-idle.c

index bcb85550f1031e1bfa632ae984060a294e59afeb..8d87beb3d0a3d6bec9d89ac0f3658284a972d255 100644 (file)
@@ -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. */