mirror of
https://github.com/danog/ext-uv.git
synced 2024-11-30 04:29:01 +01:00
common: uv_close check uv resource type
This commit is contained in:
parent
7b03433f2d
commit
9f6fdbce52
22
php_uv.c
22
php_uv.c
@ -3632,6 +3632,28 @@ PHP_FUNCTION(uv_close)
|
||||
}
|
||||
|
||||
ZEND_FETCH_RESOURCE(uv, php_uv_t *, &client, -1, PHP_UV_RESOURCE_NAME, uv_resource_handle);
|
||||
|
||||
switch (uv->type) {
|
||||
/* TODO: use libuv enum */
|
||||
case IS_UV_PIPE:
|
||||
case IS_UV_TTY:
|
||||
case IS_UV_TCP:
|
||||
case IS_UV_UDP:
|
||||
case IS_UV_PREPARE:
|
||||
case IS_UV_CHECK:
|
||||
case IS_UV_IDLE:
|
||||
case IS_UV_ASYNC:
|
||||
case IS_UV_TIMER:
|
||||
case IS_UV_PROCESS:
|
||||
case IS_UV_FS_EVENT:
|
||||
case IS_UV_POLL:
|
||||
case IS_UV_FS_POLL:
|
||||
break;
|
||||
default:
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "passed resource didn't initialize for uv_close (%d)", uv->type);
|
||||
RETURN_FALSE;
|
||||
break;
|
||||
}
|
||||
|
||||
php_uv_cb_init(&cb, uv, &fci, &fcc, PHP_UV_CLOSE_CB);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user