Skip to content

Commit

Permalink
update library
Browse files Browse the repository at this point in the history
  • Loading branch information
NathanFreeman committed Jan 23, 2025
1 parent 214334f commit a44346a
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 2 deletions.
13 changes: 11 additions & 2 deletions ext-src/php_swoole_library.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
+----------------------------------------------------------------------+
*/

/* $Id: f0118343cf7d61224924b4899d173b2877f14c91 */
/* $Id: 55873a764b83b7993498004cb1d9d151ae446141 */

#ifndef SWOOLE_LIBRARY_H
#define SWOOLE_LIBRARY_H
Expand Down Expand Up @@ -536,8 +536,14 @@ static const char* swoole_library_source_core_constant =
"\n"
" public const OPTION_MESSAGE_QUEUE_KEY = 'message_queue_key';\n"
"\n"
" /**\n"
" * @since 6.0.0-beta\n"
" */\n"
" public const OPTION_BOOTSTRAP = 'bootstrap';\n"
"\n"
" /**\n"
" * @since 6.0.0-beta\n"
" */\n"
" public const OPTION_INIT_ARGUMENTS = 'init_arguments';\n"
"\n"
" public const OPTION_BACKLOG = 'backlog';\n"
Expand Down Expand Up @@ -8577,6 +8583,9 @@ static const char* swoole_library_source_core_server_helper =
" 'dns_lookup_random' => true,\n"
" 'use_async_resolver' => true,\n"
" 'enable_coroutine' => true,\n"
" 'iouring_entries' => true,\n"
" 'iouring_workers' => true,\n"
" 'iouring_flag' => true,\n"
" ];\n"
"\n"
" public const COROUTINE_OPTIONS = [\n"
Expand Down Expand Up @@ -10024,7 +10033,7 @@ static const char* swoole_library_source_functions =
" $cpu_max = file_get_contents($cpu_max);\n"
" $fields = explode($cpu_max, ' ');\n"
" $quota_us = $fields[0];\n"
" if ($quota_us == 'max') {\n"
" if ($quota_us === 'max') { // @phpstan-ignore identical.alwaysFalse\n"
" return swoole_cpu_num();\n"
" }\n"
" $period_us = $fields[1] ?? 100000;\n"
Expand Down
40 changes: 40 additions & 0 deletions tests/swoole_iouring/setting.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
--TEST--
swoole_http_server: iouring setting test
--SKIPIF--
<?php require __DIR__ . '/../include/skipif.inc'; ?>
--FILE--
<?php
require __DIR__ . '/../include/bootstrap.php';

$pm = new ProcessManager;
$pm->initRandomData(1);
$pm->parentFunc = function () use ($pm) {
Co\run(function () use ($pm) {
$headers = httpGetHeaders("http://127.0.0.1:{$pm->getFreePort()}");
});

$pm->kill();
echo "DONE\n";
};

$pm->childFunc = function () use ($pm) {
$http = new Swoole\Http\Server('127.0.0.1', $pm->getFreePort(), SWOOLE_BASE);
$http->set([
'iouring_flag' => SWOOLE_IOURING_SQPOLL,
'iouring_entries' => 4096,
'iouring_workers' => 16
]);
$http->on('workerStart', function () use ($pm) {
$pm->wakeup();
});
$http->on('request', function (Swoole\Http\Request $request, Swoole\Http\Response $response) use ($pm) {
$response->status(200, "status");
$response->end("Hello World");
});
$http->start();
};
$pm->childFirst();
$pm->run();
?>
--EXPECTF--
DONE

0 comments on commit a44346a

Please sign in to comment.