dovecot-2.2: lib-dict: Abort async transaction commits if client...

dovecot at dovecot.org dovecot at dovecot.org
Mon Oct 29 17:55:55 EET 2012


details:   http://hg.dovecot.org/dovecot-2.2/rev/67e9cb0b06ec
changeset: 15336:67e9cb0b06ec
user:      Timo Sirainen <tss at iki.fi>
date:      Mon Oct 29 16:36:59 2012 +0200
description:
lib-dict: Abort async transaction commits if client gets disconnected from dict server.

diffstat:

 src/lib-dict/dict-client.c |  11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

diffs (38 lines):

diff -r 22875bcaa952 -r 67e9cb0b06ec src/lib-dict/dict-client.c
--- a/src/lib-dict/dict-client.c	Fri Oct 26 13:05:43 2012 +0300
+++ b/src/lib-dict/dict-client.c	Mon Oct 29 16:36:59 2012 +0200
@@ -72,6 +72,7 @@
 
 	unsigned int failed:1;
 	unsigned int sent_begin:1;
+	unsigned int async:1;
 };
 
 static int client_dict_connect(struct client_dict *dict);
@@ -444,9 +445,18 @@
 
 static void client_dict_disconnect(struct client_dict *dict)
 {
+	struct client_dict_transaction_context *ctx, *next;
+
 	dict->connect_counter++;
 	dict->handshaked = FALSE;
 
+	/* abort all pending async commits */
+	for (ctx = dict->transactions; ctx != NULL; ctx = next) {
+		next = ctx->next;
+		if (ctx->async)
+			client_dict_finish_transaction(dict, ctx->id, -1);
+	}
+
 	if (dict->to_idle != NULL)
 		timeout_remove(&dict->to_idle);
 	if (dict->io != NULL)
@@ -706,6 +716,7 @@
 		else if (async) {
 			ctx->callback = callback;
 			ctx->context = context;
+			ctx->async = TRUE;
 			if (dict->async_commits++ == 0) {
 				dict->io = io_add(dict->fd, IO_READ,
 						  dict_async_input, dict);


More information about the dovecot-cvs mailing list