This commit is contained in:
2023-04-04 13:56:42 +08:00
parent 6dd6dfdcf3
commit 6e43e9319a
+7 -1
View File
@@ -42,6 +42,9 @@ class Server extends HttpService
private mixed $daemon = 0; private mixed $daemon = 0;
public AsyncServer $manager;
/** /**
* @param State $state * @param State $state
* @param AsyncServer $manager * @param AsyncServer $manager
@@ -54,7 +57,6 @@ class Server extends HttpService
* @throws Exception * @throws Exception
*/ */
public function __construct(public State $state, public function __construct(public State $state,
public AsyncServer $manager,
public ContainerInterface $container, public ContainerInterface $container,
public ProcessManager $processManager, public ProcessManager $processManager,
public EventDispatch $dispatch, public EventDispatch $dispatch,
@@ -69,9 +71,13 @@ class Server extends HttpService
/** /**
* @return void * @return void
* @throws ConfigException * @throws ConfigException
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/ */
public function init(): void public function init(): void
{ {
$this->manager = $this->container->get(Config::get('server.class',AsyncServer::class));
$enable_coroutine = Config::get('server.settings.enable_coroutine', false); $enable_coroutine = Config::get('server.settings.enable_coroutine', false);
if (!$enable_coroutine) { if (!$enable_coroutine) {
return; return;