From 71eb325e80017627d8de449941c3debfab1f91c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=91=E6=9E=97?= Date: Fri, 31 Mar 2023 10:24:29 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=98=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Abstracts/AsyncServer.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Abstracts/AsyncServer.php b/Abstracts/AsyncServer.php index be25eda..f7c2b36 100644 --- a/Abstracts/AsyncServer.php +++ b/Abstracts/AsyncServer.php @@ -14,6 +14,7 @@ use Psr\Log\LoggerInterface; use ReflectionException; use Kiri\Server\Config as SConfig; use Kiri\Di\LocalService; +use Swoole\Runtime; use Swoole\Server; use Kiri\Server\ServerInterface; use Kiri\Server\Constant; @@ -143,6 +144,9 @@ class AsyncServer implements ServerInterface $settings[Constant::OPTION_DAEMONIZE] = (bool)$daemon; $settings[Constant::OPTION_ENABLE_REUSE_PORT] = true; $settings[Constant::OPTION_PID_FILE] = storage('.swoole.pid'); + if ($settings[Constant::OPTION_ENABLE_COROUTINE] ?? false) { + Runtime::enableCoroutine(); + } if (!isset($settings[Constant::OPTION_PID_FILE])) { $settings[Constant::OPTION_LOG_FILE] = storage('system.log'); }