提交 302c323a authored 作者: Eliot Gable's avatar Eliot Gable

Update PGSQL socket descriptor on reconnect in case a new descriptor was assigned.

上级 fec1046d
...@@ -135,6 +135,7 @@ static int db_is_up(switch_pgsql_handle_t *handle) ...@@ -135,6 +135,7 @@ static int db_is_up(switch_pgsql_handle_t *handle)
goto error; goto error;
} }
handle->state = SWITCH_PGSQL_STATE_CONNECTED; handle->state = SWITCH_PGSQL_STATE_CONNECTED;
handle->sock = PQsocket(handle->con);
} }
/* if (!PQsendQuery(handle->con, "SELECT 1")) { /* if (!PQsendQuery(handle->con, "SELECT 1")) {
...@@ -167,6 +168,7 @@ static int db_is_up(switch_pgsql_handle_t *handle) ...@@ -167,6 +168,7 @@ static int db_is_up(switch_pgsql_handle_t *handle)
if (PQstatus(handle->con) == CONNECTION_OK) { if (PQstatus(handle->con) == CONNECTION_OK) {
handle->state = SWITCH_PGSQL_STATE_CONNECTED; handle->state = SWITCH_PGSQL_STATE_CONNECTED;
recon = SWITCH_PGSQL_SUCCESS; recon = SWITCH_PGSQL_SUCCESS;
handle->sock = PQsocket(handle->con);
} }
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论