mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-05 04:11:08 +00:00
Use a better check to ensure database connection is up (pointer to connection must exist, and connection must report status being ok) (issue #7955 reported by sorg)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@43162 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -729,7 +729,7 @@ static int pgsql_reconnect(const char *database)
|
|||||||
free(connInfo);
|
free(connInfo);
|
||||||
connInfo = NULL;
|
connInfo = NULL;
|
||||||
ast_log(LOG_DEBUG, "pgsqlConn=%p\n", pgsqlConn);
|
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");
|
ast_log(LOG_DEBUG, "Postgresql RealTime: Successfully connected to database.\n");
|
||||||
connect_time = time(NULL);
|
connect_time = time(NULL);
|
||||||
return 1;
|
return 1;
|
||||||
|
Reference in New Issue
Block a user