projects
/
m6w6
/
ext-pq
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
|
github
raw
|
inline
| side by side
cancel any active async query on persistent connection retirement
[m6w6/ext-pq]
/
src
/
php_pq.c
diff --git
a/src/php_pq.c
b/src/php_pq.c
index 6223ef95c74f90a47194102be28773dbe6be1006..64d59af36d06f8f417fc6e33bf2ad986616981b4 100644
(file)
--- 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);
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 */
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);
/* 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);
/* clean up async results */
while ((res = PQgetResult(*handle))) {
PHP_PQclear(res);