Skip to content

Commit

Permalink
Properly handle all cases of php_uv_t * for uv_stop in uv_do_callback2()
Browse files Browse the repository at this point in the history
  • Loading branch information
bwoebi committed Feb 15, 2020
1 parent 6735670 commit 5be79e4
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
24 changes: 23 additions & 1 deletion php_uv.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 3 additions & 0 deletions php_uv.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 5be79e4

Please sign in to comment.