dovecot-1.1: pgsql: Don't break with synchronous queries (with d...
dovecot at dovecot.org
dovecot at dovecot.org
Tue Jul 8 11:19:43 EEST 2008
details: http://hg.dovecot.org/dovecot-1.1/rev/48f3d14f2dc3
changeset: 7724:48f3d14f2dc3
user: Timo Sirainen <tss at iki.fi>
date: Tue Jul 08 13:49:35 2008 +0530
description:
pgsql: Don't break with synchronous queries (with dict-sql)
diffstat:
1 file changed, 10 insertions(+), 7 deletions(-)
src/lib-sql/driver-pgsql.c | 17 ++++++++++-------
diffs (48 lines):
diff -r 71e6e2c739c0 -r 48f3d14f2dc3 src/lib-sql/driver-pgsql.c
--- a/src/lib-sql/driver-pgsql.c Tue Jul 08 13:46:07 2008 +0530
+++ b/src/lib-sql/driver-pgsql.c Tue Jul 08 13:49:35 2008 +0530
@@ -208,7 +208,7 @@ static void driver_pgsql_deinit_v(struct
db->queue = next;
}
- if (db->queue_to != 0)
+ if (db->queue_to != NULL)
timeout_remove(&db->queue_to);
driver_pgsql_close(db);
i_free(db->error);
@@ -562,6 +562,12 @@ driver_pgsql_query_s(struct sql_db *_db,
struct pgsql_db *db = (struct pgsql_db *)_db;
struct io old_io;
+ if (db->queue_to != NULL) {
+ /* we're creating a new ioloop, make sure the timeout gets
+ added there. */
+ timeout_remove(&db->queue_to);
+ }
+
if (db->io == NULL)
db->ioloop = io_loop_create();
else {
@@ -575,12 +581,6 @@ driver_pgsql_query_s(struct sql_db *_db,
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;
driver_pgsql_query(_db, query, pgsql_query_s_callback, db);
@@ -596,6 +596,9 @@ driver_pgsql_query_s(struct sql_db *_db,
}
if (db->queue_to != NULL)
timeout_remove(&db->queue_to);
+ } else {
+ i_assert(db->io == NULL);
+ i_assert(db->queue_to == NULL);
}
io_loop_destroy(&db->ioloop);
More information about the dovecot-cvs
mailing list