dovecot: Changes sent by IDLE shouldn't affect the client's inac...
dovecot at dovecot.org
dovecot at dovecot.org
Wed Jun 27 16:38:21 EEST 2007
details: http://hg.dovecot.org/dovecot/rev/3fd09104fd77
changeset: 5805:3fd09104fd77
user: Timo Sirainen <tss at iki.fi>
date: Wed Jun 27 16:38:07 2007 +0300
description:
Changes sent by IDLE shouldn't affect the client's inactivity timeout
checking.
diffstat:
3 files changed, 10 insertions(+), 2 deletions(-)
src/imap/client.c | 9 +++++++--
src/imap/client.h | 1 +
src/imap/cmd-idle.c | 2 ++
diffs (54 lines):
diff -r c7f35a9beb0b -r 3fd09104fd77 src/imap/client.c
--- a/src/imap/client.c Wed Jun 27 16:24:50 2007 +0300
+++ b/src/imap/client.c Wed Jun 27 16:38:07 2007 +0300
@@ -650,13 +650,18 @@ int _client_output(struct client *client
static void idle_timeout(void *context __attr_unused__)
{
- time_t idle_time;
+ time_t idle_time, last_change;
if (my_client == NULL)
return;
- idle_time = ioloop_time -
+ /* We mostly want to check last_input here, but if there is a very long
+ running command (like copying thousands of messages), we don't want
+ to disconnect the client just after the command was finished.
+ But any output that IDLE has sent should be ignored. */
+ last_change = my_client->idling ? my_client->last_input :
I_MAX(my_client->last_input, my_client->last_output);
+ idle_time = ioloop_time - last_change;
if (o_stream_get_buffer_used_size(my_client->output) > 0 &&
idle_time >= CLIENT_OUTPUT_TIMEOUT) {
diff -r c7f35a9beb0b -r 3fd09104fd77 src/imap/client.h
--- a/src/imap/client.h Wed Jun 27 16:24:50 2007 +0300
+++ b/src/imap/client.h Wed Jun 27 16:38:07 2007 +0300
@@ -66,6 +66,7 @@ struct client {
unsigned int disconnected:1;
unsigned int destroyed:1;
unsigned int handling_input:1;
+ unsigned int idling:1;
unsigned int input_skip_line:1; /* skip all the data until we've
found a new line */
};
diff -r c7f35a9beb0b -r 3fd09104fd77 src/imap/cmd-idle.c
--- a/src/imap/cmd-idle.c Wed Jun 27 16:24:50 2007 +0300
+++ b/src/imap/cmd-idle.c Wed Jun 27 16:38:07 2007 +0300
@@ -57,6 +57,7 @@ idle_finish(struct cmd_idle_context *ctx
if (client->mailbox != NULL)
mailbox_notify_changes_stop(client->mailbox);
+ client->idling = FALSE;
if (done_ok)
client_send_tagline(ctx->cmd, "OK Idle completed.");
else
@@ -259,6 +260,7 @@ bool cmd_idle(struct client_command_cont
client->io = io_add(i_stream_get_fd(client->input),
IO_READ, idle_client_input, ctx);
+ client->idling = TRUE;
cmd->func = cmd_idle_continue;
cmd->context = ctx;
More information about the dovecot-cvs
mailing list