From 5be79e433d8bcc50c546ab4649617f564e5a8f86 Mon Sep 17 00:00:00 2001 From: Bob Weinand Date: Sat, 15 Feb 2020 22:19:26 +0100 Subject: [PATCH] Properly handle all cases of php_uv_t * for uv_stop in uv_do_callback2() --- php_uv.c | 24 +++++++++++++++++++++++- php_uv.h | 3 +++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/php_uv.c b/php_uv.c index 9804de6..a301c53 100644 --- a/php_uv.c +++ b/php_uv.c @@ -1361,7 +1361,29 @@ static int php_uv_do_callback2(zval *retval_ptr, php_uv_t *uv, zval *params, int //zend_fcall_info_args_clear(&uv->callback[type]->fci, 0); if (EG(exception)) { - uv_stop(uv->uv.handle.loop); + switch (type) { + case PHP_UV_FS_CB: + uv_stop(uv->uv.fs.loop); + break; + case PHP_UV_GETADDR_CB: + uv_stop(uv->uv.addrinfo.loop); + break; + case PHP_UV_AFTER_WORK_CB: + uv_stop(uv->uv.work.loop); + break; + case PHP_UV_SHUTDOWN_CB: + uv_stop(uv->uv.shutdown.handle->loop); + break; + case PHP_UV_SEND_CB: + uv_stop(uv->uv.udp_send.handle->loop); + break; + case PHP_UV_CONNECT_CB: + case PHP_UV_PIPE_CONNECT_CB: + uv_stop(uv->uv.connect.handle->loop); + break; + default: + uv_stop(uv->uv.handle.loop); + } } return error; diff --git a/php_uv.h b/php_uv.h index 91c4324..9f2644b 100755 --- a/php_uv.h +++ b/php_uv.h @@ -158,6 +158,9 @@ typedef struct { uv_handle_t handle; uv_req_t req; uv_stream_t stream; + uv_shutdown_t shutdown; + uv_udp_send_t udp_send; + uv_connect_t connect; uv_getaddrinfo_t addrinfo; uv_prepare_t prepare; uv_check_t check;