dovecot-1.0: Changes sent by IDLE shouldn't affect the client's ...
dovecot at dovecot.org
dovecot at dovecot.org
Wed Jun 27 16:38:16 EEST 2007
details: http://hg.dovecot.org/dovecot-1.0/rev/111275296af5
changeset: 5327:111275296af5
user: Timo Sirainen <tss at iki.fi>
date: Wed Jun 27 16:38:06 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 ba3c6dc3126c -r 111275296af5 src/imap/client.c
--- a/src/imap/client.c Tue Jun 26 15:44:20 2007 +0300
+++ b/src/imap/client.c Wed Jun 27 16:38:06 2007 +0300
@@ -485,13 +485,18 @@ int _client_output(void *context)
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 (my_client->command_pending &&
o_stream_get_buffer_used_size(my_client->output) > 0 &&
diff -r ba3c6dc3126c -r 111275296af5 src/imap/client.h
--- a/src/imap/client.h Tue Jun 26 15:44:20 2007 +0300
+++ b/src/imap/client.h Wed Jun 27 16:38:06 2007 +0300
@@ -52,6 +52,7 @@ struct client {
unsigned int input_pending:1;
unsigned int output_pending: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 ba3c6dc3126c -r 111275296af5 src/imap/cmd-idle.c
--- a/src/imap/cmd-idle.c Tue Jun 26 15:44:20 2007 +0300
+++ b/src/imap/cmd-idle.c Wed Jun 27 16:38:06 2007 +0300
@@ -56,6 +56,7 @@ static void idle_finish(struct cmd_idle_
if (client->mailbox != NULL)
mailbox_notify_changes(client->mailbox, 0, NULL, NULL);
+ client->idling = FALSE;
if (done_ok)
client_send_tagline(ctx->cmd, "OK Idle completed.");
else
@@ -263,6 +264,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;
client->command_pending = TRUE;
cmd->func = cmd_idle_continue;
cmd->context = ctx;
More information about the dovecot-cvs
mailing list