Use a better check to ensure database connection is up (pointer to connection must...
authorJoshua Colp <jcolp@digium.com>
Mon, 18 Sep 2006 15:15:33 +0000 (15:15 +0000)
committerJoshua Colp <jcolp@digium.com>
Mon, 18 Sep 2006 15:15:33 +0000 (15:15 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@43162 65c4cc65-6c06-0410-ace0-fbb531ad65f3

res/res_config_pgsql.c

index d3d1144..4665823 100644 (file)
@@ -729,7 +729,7 @@ static int pgsql_reconnect(const char *database)
                free(connInfo);
                connInfo = NULL;
                ast_log(LOG_DEBUG, "pgsqlConn=%p\n", pgsqlConn);
-               if (pgsqlConn) {
+               if (pgsqlConn && PQstatus(pgsqlConn) == CONNECTION_OK) {
                        ast_log(LOG_DEBUG, "Postgresql RealTime: Successfully connected to database.\n");
                        connect_time = time(NULL);
                        return 1;