dovecot-2.2: dict-sql: Fixed async iteration with MySQL and SQLite

dovecot at dovecot.org dovecot at dovecot.org
Tue Oct 20 10:12:35 UTC 2015


details:   http://hg.dovecot.org/dovecot-2.2/rev/467695fee373
changeset: 19316:467695fee373
user:      Timo Sirainen <tss at iki.fi>
date:      Tue Oct 20 13:12:24 2015 +0300
description:
dict-sql: Fixed async iteration with MySQL and SQLite

diffstat:

 src/lib-dict/dict-sql.c |  5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diffs (31 lines):

diff -r 0f5e58361c48 -r 467695fee373 src/lib-dict/dict-sql.c
--- a/src/lib-dict/dict-sql.c	Tue Oct 20 00:25:14 2015 +0300
+++ b/src/lib-dict/dict-sql.c	Tue Oct 20 13:12:24 2015 +0300
@@ -45,6 +45,7 @@
 	const struct dict_sql_map *map;
 	unsigned int key_prefix_len, pattern_prefix_len, next_map_idx;
 	unsigned int path_idx, sql_fields_start_idx;
+	bool synchronous_result;
 	bool failed;
 };
 
@@ -616,7 +617,7 @@
 {
 	sql_result_ref(result);
 	ctx->result = result;
-	if (ctx->ctx.async_callback != NULL)
+	if (ctx->ctx.async_callback != NULL && !ctx->synchronous_result)
 		ctx->ctx.async_callback(ctx->ctx.async_context);
 }
 
@@ -638,8 +639,10 @@
 			ctx->result = sql_query_s(dict->db, str_c(query));
 		} else {
 			i_assert(ctx->result == NULL);
+			ctx->synchronous_result = TRUE;
 			sql_query(dict->db, str_c(query),
 				  sql_dict_iterate_callback, ctx);
+			ctx->synchronous_result = FALSE;
 		}
 	} T_END;
 	*error_r = t_strdup(error);


More information about the dovecot-cvs mailing list