eee
This commit is contained in:
+14
-20
@@ -28,10 +28,7 @@ class ServerCommand extends Command
|
||||
{
|
||||
|
||||
|
||||
public AsyncServer $manager;
|
||||
public State $state;
|
||||
public EventDispatch $dispatch;
|
||||
public Router $router;
|
||||
public State $state;
|
||||
|
||||
|
||||
/**
|
||||
@@ -41,11 +38,8 @@ class ServerCommand extends Command
|
||||
public function __construct(string $name = null)
|
||||
{
|
||||
parent::__construct($name);
|
||||
$container = Kiri::getDi();
|
||||
$this->manager = $container->get(AsyncServer::class);
|
||||
$this->state = $container->get(State::class);
|
||||
$this->dispatch = $container->get(EventDispatch::class);
|
||||
$this->router = $container->get(Router::class);
|
||||
$container = Kiri::getDi();
|
||||
$this->state = $container->get(State::class);
|
||||
}
|
||||
|
||||
|
||||
@@ -99,11 +93,12 @@ class ServerCommand extends Command
|
||||
protected function stop(): int
|
||||
{
|
||||
$configs = config('server', []);
|
||||
$instances = $this->manager->sortService($configs['ports'] ?? []);
|
||||
$instances = Kiri::getDi()->get(AsyncServer::class)->sortService($configs['ports'] ?? []);
|
||||
foreach ($instances as $config) {
|
||||
$this->state->exit($config->port);
|
||||
}
|
||||
$this->dispatch->dispatch(new OnShutdown());
|
||||
$dispatch = Kiri::getDi()->get(EventDispatch::class);
|
||||
$dispatch->dispatch(new OnShutdown());
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -115,15 +110,14 @@ class ServerCommand extends Command
|
||||
*/
|
||||
protected function start(InputInterface $input): int
|
||||
{
|
||||
$daemon = (int)$input->getOption('daemon');
|
||||
if (config('reload.hot', false) === true) {
|
||||
$this->manager->addProcess(HotReload::class);
|
||||
} else {
|
||||
$this->router->scan_build_route();
|
||||
}
|
||||
$this->manager->addProcess(config('processes', []));
|
||||
$this->manager->initCoreServers(config('server', []), $daemon);
|
||||
$this->manager->start();
|
||||
$daemon = (int)$input->getOption('daemon');
|
||||
$manager = Kiri::getDi()->get(AsyncServer::class);
|
||||
$router = Kiri::getDi()->get(Router::class);
|
||||
|
||||
$router->scan_build_route();
|
||||
$manager->addProcess(config('processes', []));
|
||||
$manager->initCoreServers(config('server', []), $daemon);
|
||||
$manager->start();
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user