aboutsummaryrefslogtreecommitdiffstats
path: root/res
diff options
context:
space:
mode:
Diffstat (limited to 'res')
-rw-r--r--res/res_config_pgsql.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/res/res_config_pgsql.c b/res/res_config_pgsql.c
index d3d11446a..4665823f3 100644
--- a/res/res_config_pgsql.c
+++ b/res/res_config_pgsql.c
@@ -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;