dovecot-2.2: imap: Fixed command output locking.
dovecot at dovecot.org
dovecot at dovecot.org
Tue Aug 21 10:18:48 EEST 2012
details: http://hg.dovecot.org/dovecot-2.2/rev/eea4d286185a
changeset: 14942:eea4d286185a
user: Timo Sirainen <tss at iki.fi>
date: Tue Aug 21 10:18:38 2012 +0300
description:
imap: Fixed command output locking.
diffstat:
src/imap/cmd-idle.c | 2 +-
src/imap/imap-client.c | 11 ++++-------
src/imap/imap-client.h | 1 -
src/imap/imap-fetch.c | 5 +++--
src/imap/imap-sync.c | 4 ++--
src/imap/main.c | 2 +-
6 files changed, 11 insertions(+), 14 deletions(-)
diffs (127 lines):
diff -r bf727e0b721a -r eea4d286185a src/imap/cmd-idle.c
--- a/src/imap/cmd-idle.c Tue Aug 21 10:02:44 2012 +0300
+++ b/src/imap/cmd-idle.c Tue Aug 21 10:18:38 2012 +0300
@@ -115,7 +115,7 @@
static void keepalive_timeout(struct cmd_idle_context *ctx)
{
- if (ctx->client->output_locked) {
+ if (ctx->client->output_cmd_lock != NULL) {
/* it's busy sending output */
return;
}
diff -r bf727e0b721a -r eea4d286185a src/imap/imap-client.c
--- a/src/imap/imap-client.c Tue Aug 21 10:02:44 2012 +0300
+++ b/src/imap/imap-client.c Tue Aug 21 10:18:38 2012 +0300
@@ -31,7 +31,7 @@
static void client_idle_timeout(struct client *client)
{
- if (!client->output_locked)
+ if (client->output_cmd_lock == NULL)
client_send_line(client, "* BYE Disconnected for inactivity.");
client_destroy(client, "Disconnected for inactivity");
}
@@ -574,10 +574,7 @@
*_cmd = NULL;
- if (client->output_cmd_lock == cmd) {
- i_assert(client->disconnected);
- client->output_cmd_lock = NULL;
- }
+ i_assert(client->output_cmd_lock == NULL);
/* reset input idle time because command output might have taken a
long time and we don't want to disconnect client immediately then */
@@ -801,7 +798,7 @@
/* beginning a new command */
if (client->command_queue_size >= CLIENT_COMMAND_QUEUE_MAX_SIZE ||
- client->output_locked) {
+ client->output_cmd_lock != NULL) {
/* wait for some of the commands to finish */
*remove_io_r = TRUE;
return FALSE;
@@ -907,7 +904,7 @@
client->output_cmd_lock->temp_executed = TRUE;
client_output_cmd(client->output_cmd_lock);
}
- while (!client->output_locked) {
+ while (client->output_cmd_lock == NULL) {
/* go through the entire commands list every time in case
multiple commands were freed. temp_executed keeps track of
which messages we've called so far */
diff -r bf727e0b721a -r eea4d286185a src/imap/imap-client.h
--- a/src/imap/imap-client.h Tue Aug 21 10:02:44 2012 +0300
+++ b/src/imap/imap-client.h Tue Aug 21 10:18:38 2012 +0300
@@ -152,7 +152,6 @@
unsigned int mailbox_examined:1;
unsigned int anvil_sent:1;
unsigned int tls_compression:1;
- unsigned int output_locked:1;
unsigned int input_skip_line:1; /* skip all the data until we've
found a new line */
unsigned int modseqs_sent_since_sync:1;
diff -r bf727e0b721a -r eea4d286185a src/imap/imap-fetch.c
--- a/src/imap/imap-fetch.c Tue Aug 21 10:02:44 2012 +0300
+++ b/src/imap/imap-fetch.c Tue Aug 21 10:18:38 2012 +0300
@@ -569,7 +569,7 @@
{
int ret;
- i_assert(!ctx->client->output_locked ||
+ i_assert(ctx->client->output_cmd_lock == NULL ||
ctx->client->output_cmd_lock == cmd);
ret = imap_fetch_more_int(ctx, cmd->cancel);
@@ -586,7 +586,6 @@
client_disconnect(ctx->client, "Failed to cancel FETCH");
ctx->client->output_cmd_lock = NULL;
}
- ctx->client->output_locked = ctx->client->output_cmd_lock != NULL;
return ret;
}
@@ -618,6 +617,8 @@
state->failed = TRUE;
}
}
+ ctx->client->output_cmd_lock = NULL;
+
if (state->cur_str != NULL)
str_free(&state->cur_str);
diff -r bf727e0b721a -r eea4d286185a src/imap/imap-sync.c
--- a/src/imap/imap-sync.c Tue Aug 21 10:02:44 2012 +0300
+++ b/src/imap/imap-sync.c Tue Aug 21 10:18:38 2012 +0300
@@ -764,7 +764,7 @@
{
struct client *client = cmd->client;
- i_assert(!client->output_locked);
+ i_assert(client->output_cmd_lock == NULL);
if (cmd->cancel)
return TRUE;
@@ -837,7 +837,7 @@
{
struct client_command_context *cmd, *first_expunge, *first_nonexpunge;
- if (client->output_locked) {
+ if (client->output_cmd_lock != NULL) {
/* wait until we can send output to client */
return FALSE;
}
diff -r bf727e0b721a -r eea4d286185a src/imap/main.c
--- a/src/imap/main.c Tue Aug 21 10:02:44 2012 +0300
+++ b/src/imap/main.c Tue Aug 21 10:18:38 2012 +0300
@@ -85,7 +85,7 @@
static void client_kill_idle(struct client *client)
{
- if (client->output_locked)
+ if (client->output_cmd_lock != NULL)
return;
client_send_line(client, "* BYE Server shutting down.");
More information about the dovecot-cvs
mailing list