This commit is contained in:
2022-01-09 03:49:02 +08:00
parent b5ad99332d
commit 550197de96
44 changed files with 2113 additions and 2113 deletions
+50 -50
View File
@@ -1,50 +1,50 @@
<?php
namespace Server\Handler;
use Kiri\Annotation\Inject;
use Kiri\Events\EventDispatch;
use ReflectionException;
use Server\Abstracts\Server;
use Kiri\Exception\ConfigException;
use Server\Events\OnManagerStart;
use Server\Events\OnManagerStop;
/**
* Class OnServerManager
* @package Server\Manager
*/
class OnServerManager extends Server
{
/**
* @var EventDispatch
*/
#[Inject(EventDispatch::class)]
public EventDispatch $eventDispatch;
/**
* @param \Swoole\Server $server
* @throws ConfigException|ReflectionException
*/
public function onManagerStart(\Swoole\Server $server)
{
$this->setProcessName(sprintf('manger[%d].0', $server->manager_pid));
$this->eventDispatch->dispatch(new OnManagerStart($server));
}
/**
* @param \Swoole\Server $server
* @throws ReflectionException
*/
public function onManagerStop(\Swoole\Server $server)
{
$this->eventDispatch->dispatch(new OnManagerStop($server));
}
}
<?php
namespace Server\Handler;
use Kiri\Annotation\Inject;
use Kiri\Events\EventDispatch;
use ReflectionException;
use Server\Abstracts\Server;
use Kiri\Exception\ConfigException;
use Server\Events\OnManagerStart;
use Server\Events\OnManagerStop;
/**
* Class OnServerManager
* @package Server\Manager
*/
class OnServerManager extends Server
{
/**
* @var EventDispatch
*/
#[Inject(EventDispatch::class)]
public EventDispatch $eventDispatch;
/**
* @param \Swoole\Server $server
* @throws ConfigException|ReflectionException
*/
public function onManagerStart(\Swoole\Server $server)
{
$this->setProcessName(sprintf('manger[%d].0', $server->manager_pid));
$this->eventDispatch->dispatch(new OnManagerStart($server));
}
/**
* @param \Swoole\Server $server
* @throws ReflectionException
*/
public function onManagerStop(\Swoole\Server $server)
{
$this->eventDispatch->dispatch(new OnManagerStop($server));
}
}