[dovecot-cvs] dovecot/src/lib-sql driver-pgsql.c,1.12,1.13
cras at dovecot.org
cras at dovecot.org
Sat Jul 1 22:15:52 EEST 2006
Update of /var/lib/cvs/dovecot/src/lib-sql
In directory talvi:/tmp/cvs-serv25790/lib-sql
Modified Files:
driver-pgsql.c
Log Message:
Try to handle failures better.
Index: driver-pgsql.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-sql/driver-pgsql.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- driver-pgsql.c 1 Jul 2006 17:24:11 -0000 1.12
+++ driver-pgsql.c 1 Jul 2006 19:15:50 -0000 1.13
@@ -216,14 +216,11 @@
struct pgsql_db *db = context;
do {
- if (!PQconsumeInput(db->pg)) {
- db->connected = FALSE;
+ if (!PQconsumeInput(db->pg))
break;
- }
if (PQisBusy(db->pg))
return;
-
} while (PQgetResult(db->pg) != NULL);
io_remove(&db->io);
@@ -275,6 +272,11 @@
}
if (free_result)
driver_pgsql_result_free(&result->api);
+
+ if (PQstatus(db->pg) == CONNECTION_BAD) {
+ /* disconnected */
+ driver_pgsql_close(db);
+ }
}
static void get_result(void *context)
More information about the dovecot-cvs
mailing list