dovecot: Fixes to handling transaction updates.
dovecot at dovecot.org
dovecot at dovecot.org
Mon Nov 12 19:56:29 EET 2007
details: http://hg.dovecot.org/dovecot/rev/33cfef65a5e1
changeset: 6793:33cfef65a5e1
user: Timo Sirainen <tss at iki.fi>
date: Mon Nov 12 19:56:25 2007 +0200
description:
Fixes to handling transaction updates.
diffstat:
1 file changed, 14 insertions(+), 1 deletion(-)
src/lib-sql/driver-pgsql.c | 15 ++++++++++++++-
diffs (46 lines):
diff -r 7005fc7e69dc -r 33cfef65a5e1 src/lib-sql/driver-pgsql.c
--- a/src/lib-sql/driver-pgsql.c Mon Nov 12 19:23:55 2007 +0200
+++ b/src/lib-sql/driver-pgsql.c Mon Nov 12 19:56:25 2007 +0200
@@ -248,6 +248,9 @@ static void driver_pgsql_result_free(str
if (result->api.callback)
return;
+ if (_result == db->sync_result)
+ db->sync_result = NULL;
+
if (result->pgres != NULL) {
PQclear(result->pgres);
@@ -464,6 +467,8 @@ static void do_query(struct pgsql_result
{
struct pgsql_db *db = (struct pgsql_db *)result->api.db;
+ i_assert(db->sync_result == NULL);
+
if (db->querying) {
/* only one query at a time */
driver_pgsql_queue_query(result, query);
@@ -568,6 +573,12 @@ driver_pgsql_query_s(struct sql_db *_db,
db->io = io_add(PQsocket(db->pg), old_io.condition,
old_io.callback, old_io.context);
+ }
+
+ if (db->queue_to != NULL) {
+ /* we're creating a new ioloop, make sure the timeout gets
+ added there. */
+ timeout_remove(&db->queue_to);
}
db->query_finished = FALSE;
@@ -829,7 +840,9 @@ driver_pgsql_transaction_commit_s(struct
*error_r = NULL;
else {
result = sql_query_s(_ctx->db, "COMMIT");
- if (sql_result_next_row(result) < 0)
+ if (ctx->failed)
+ *error_r = ctx->error;
+ else if (sql_result_next_row(result) < 0)
*error_r = sql_result_get_error(result);
else
*error_r = NULL;
More information about the dovecot-cvs
mailing list