[dovecot-cvs] dovecot/src/lib-sql driver-pgsql.c,1.10.2.2,1.10.2.3

cras at dovecot.org cras at dovecot.org
Sat Jul 1 22:15:51 EEST 2006


Update of /var/lib/cvs/dovecot/src/lib-sql
In directory talvi:/tmp/cvs-serv1385/lib-sql

Modified Files:
      Tag: branch_1_0
	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.10.2.2
retrieving revision 1.10.2.3
diff -u -d -r1.10.2.2 -r1.10.2.3
--- driver-pgsql.c	1 Jul 2006 17:24:11 -0000	1.10.2.2
+++ driver-pgsql.c	1 Jul 2006 19:15:49 -0000	1.10.2.3
@@ -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