modify plugin name

This commit is contained in:
2022-02-23 16:32:07 +08:00
parent 0f693e3b37
commit 2157ac8174
2 changed files with 19 additions and 8 deletions
+15 -4
View File
@@ -10,6 +10,10 @@ use Kiri\Abstracts\Config;
use Kiri\Annotation\Inject; use Kiri\Annotation\Inject;
use Kiri\Events\EventDispatch; use Kiri\Events\EventDispatch;
use Kiri\Exception\ConfigException; use Kiri\Exception\ConfigException;
use Kiri\Message\Constrict\Request;
use Kiri\Message\Constrict\RequestInterface;
use Kiri\Message\Constrict\Response;
use Kiri\Message\Constrict\ResponseInterface;
use Kiri\Message\Handler\Abstracts\HttpService; use Kiri\Message\Handler\Abstracts\HttpService;
use Kiri\Message\Handler\Router; use Kiri\Message\Handler\Router;
use Kiri\Server\Events\OnServerBeforeStart; use Kiri\Server\Events\OnServerBeforeStart;
@@ -47,13 +51,20 @@ class Server extends HttpService
/** /**
* * @return void
* @throws ConfigException
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/ */
public function init() public function init()
{ {
$this->manager = Kiri::getContainer()->get(ServerManager::class); $container = $this->getContainer();
$container->mapping(ResponseInterface::class, Response::class);
$container->mapping(RequestInterface::class, Request::class);
$this->manager = $container->get(ServerManager::class);
$enable_coroutine = Config::get('servers.settings.enable_coroutine', false); $enable_coroutine = Config::get('servers.settings.enable_coroutine', false);
Config::set('servers.settings.enable_coroutine', true);
if ($enable_coroutine != true) { if ($enable_coroutine != true) {
return; return;
} }
@@ -97,7 +108,7 @@ class Server extends HttpService
$this->getContainer()->get(ProcessManager::class)->batch($processes); $this->getContainer()->get(ProcessManager::class)->batch($processes);
$this->getEventDispatch()->dispatch(new OnServerBeforeStart()); $this->eventDispatch->dispatch(new OnServerBeforeStart());
$this->getContainer()->get(Router::class)->scan_build_route(); $this->getContainer()->get(Router::class)->scan_build_route();
+4 -4
View File
@@ -6,7 +6,7 @@ use Exception;
use Kiri\Abstracts\Component; use Kiri\Abstracts\Component;
use Kiri\Abstracts\Config; use Kiri\Abstracts\Config;
use Kiri\Annotation\Inject; use Kiri\Annotation\Inject;
use Kiri\Error\Logger; use Kiri\Error\StdoutLogger;
use Kiri\Exception\ConfigException; use Kiri\Exception\ConfigException;
use Kiri\Server\Contract\OnCloseInterface; use Kiri\Server\Contract\OnCloseInterface;
use Kiri\Server\Contract\OnConnectInterface; use Kiri\Server\Contract\OnConnectInterface;
@@ -45,10 +45,10 @@ class ServerManager extends Component
/** /**
* @var Logger * @var StdoutLogger
*/ */
#[Inject(Logger::class)] #[Inject(StdoutLogger::class)]
public Logger $logger; public StdoutLogger $logger;
/** @var array<string,Port> */ /** @var array<string,Port> */
public array $ports = []; public array $ports = [];