1
0
mirror of https://github.com/danog/ext-pq.git synced 2024-12-02 09:18:02 +01:00

ping server and eventually reset conn on wakeup

This commit is contained in:
Michael Wallner 2014-09-13 08:56:29 +02:00
parent 280761d6fe
commit 6dc0521ba8

View File

@ -541,7 +541,12 @@ php_resource_factory_ops_t *php_pqconn_get_resource_factory_ops(void)
static void php_pqconn_wakeup(php_persistent_handle_factory_t *f, void **handle TSRMLS_DC)
{
// FIXME: ping server
PGresult *res = PQexec(*handle, "");
PHP_PQclear(res);
if (CONNECTION_OK != PQstatus(*handle)) {
PQreset(*handle);
}
}
static inline PGresult *unlisten(PGconn *conn, const char *channel_str, size_t channel_len TSRMLS_DC)