dovecot-2.0: pgsql: When executing synchronous queries, don't wr...
dovecot at dovecot.org
dovecot at dovecot.org
Sun Jan 9 21:37:27 EET 2011
details: http://hg.dovecot.org/dovecot-2.0/rev/f043ef71b936
changeset: 12555:f043ef71b936
user: Timo Sirainen <tss at iki.fi>
date: Sun Jan 09 21:37:24 2011 +0200
description:
pgsql: When executing synchronous queries, don't wrongly add a connect timeout.
diffstat:
src/lib-sql/driver-pgsql.c | 14 +++++++++++---
1 files changed, 11 insertions(+), 3 deletions(-)
diffs (34 lines):
diff -r 73a889098495 -r f043ef71b936 src/lib-sql/driver-pgsql.c
--- a/src/lib-sql/driver-pgsql.c Sun Jan 09 21:13:31 2011 +0200
+++ b/src/lib-sql/driver-pgsql.c Sun Jan 09 21:37:24 2011 +0200
@@ -526,6 +526,8 @@
static void driver_pgsql_sync_init(struct pgsql_db *db)
{
+ bool add_to_connect;
+
db->orig_ioloop = current_ioloop;
if (db->io == NULL) {
db->ioloop = io_loop_create();
@@ -536,12 +538,18 @@
/* have to move our existing I/O and timeout handlers to new I/O loop */
io_remove(&db->io);
- if (db->to_connect != NULL)
+ if (db->to_connect != NULL) {
timeout_remove(&db->to_connect);
+ add_to_connect = TRUE;
+ } else {
+ add_to_connect = FALSE;
+ }
db->ioloop = io_loop_create();
- db->to_connect = timeout_add(SQL_CONNECT_TIMEOUT_SECS * 1000,
- driver_pgsql_connect_timeout, db);
+ if (add_to_connect) {
+ db->to_connect = timeout_add(SQL_CONNECT_TIMEOUT_SECS * 1000,
+ driver_pgsql_connect_timeout, db);
+ }
db->io = io_add(PQsocket(db->pg), db->io_dir, connect_callback, db);
/* wait for connecting to finish */
io_loop_run(db->ioloop);
More information about the dovecot-cvs
mailing list