X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-pq;a=blobdiff_plain;f=src%2Fphp_pq.c;h=64d59af36d06f8f417fc6e33bf2ad986616981b4;hp=6223ef95c74f90a47194102be28773dbe6be1006;hb=86e7a4a14c80824b25074743e1acae0c2f0fc0e8;hpb=610b4a3a7a4a14a5bb0996f0f0871eb79e46b8e5 diff --git a/src/php_pq.c b/src/php_pq.c index 6223ef9..64d59af 100644 --- a/src/php_pq.c +++ b/src/php_pq.c @@ -1810,6 +1810,7 @@ static void php_pqconn_notice_ignore(void *p, const PGresult *res) static void php_pqconn_retire(php_persistent_handle_factory_t *f, void **handle TSRMLS_DC) { php_pqconn_event_data_t *evdata = PQinstanceData(*handle, php_pqconn_event); + PGcancel *cancel; PGresult *res; /* go away */ @@ -1818,6 +1819,11 @@ static void php_pqconn_retire(php_persistent_handle_factory_t *f, void **handle /* ignore notices */ PQsetNoticeReceiver(*handle, php_pqconn_notice_ignore, NULL); + /* cancel async queries */ + if (PQisBusy(*handle) && (cancel = PQgetCancel(*handle))) { + PQcancel(cancel, ZEND_STRL("retiring persistent connection")); + PQfreeCancel(cancel); + } /* clean up async results */ while ((res = PQgetResult(*handle))) { PHP_PQclear(res);