This commit is contained in:
2021-12-02 14:16:57 +08:00
parent 0d12baf49f
commit ced92a10e1
2 changed files with 14 additions and 8 deletions
+13 -5
View File
@@ -2,15 +2,16 @@
namespace Server;
use Note\Inject;
use Exception;
use Kiri\Abstracts\Config;
use Kiri\Di\Container;
use Psr\Container\ContainerInterface;
use Kiri\Error\Logger;
use Kiri\Events\EventDispatch;
use Kiri\Exception\ConfigException;
use Kiri\Kiri;
use Note\Inject;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\ContainerInterface;
use Psr\Container\NotFoundExceptionInterface;
use ReflectionException;
use Server\Abstracts\BaseProcess;
@@ -22,13 +23,13 @@ use Server\Contract\OnMessageInterface;
use Server\Contract\OnPacketInterface;
use Server\Contract\OnProcessInterface;
use Server\Contract\OnReceiveInterface;
use Server\Contract\OnTaskInterface;
use Server\Events\OnServerBeforeStart;
use Server\Handler\OnPipeMessage;
use Server\Handler\OnServer;
use Server\Handler\OnServerManager;
use Server\Handler\OnServerReload;
use Server\Tasker\OnServerTask;
use Server\Handler\OnServerWorker;
use Server\Tasker\OnServerTask;
use Swoole\Http\Server as HServer;
use Swoole\Process;
use Swoole\Server;
@@ -59,6 +60,13 @@ class ServerManager
public Logger $logger;
/**
* @var EventDispatch
*/
#[Inject(EventDispatch::class)]
public EventDispatch $eventProvider;
/**
* @var State
*/
@@ -66,7 +74,6 @@ class ServerManager
public State $state;
/** @var array<string,Port> */
public array $ports = [];
@@ -114,6 +121,7 @@ class ServerManager
*/
public function getServer(): Server|WServer|HServer|null
{
$this->eventProvider->dispatch(new OnServerBeforeStart());
return $this->server;
}