modify plugin name
This commit is contained in:
@@ -2,8 +2,11 @@
|
||||
|
||||
namespace Kiri\Server\Handler;
|
||||
|
||||
use Kiri;
|
||||
use Kiri\Annotation\Inject;
|
||||
use Kiri\Events\EventDispatch;
|
||||
use Psr\Container\ContainerExceptionInterface;
|
||||
use Psr\Container\NotFoundExceptionInterface;
|
||||
use ReflectionException;
|
||||
use Kiri\Server\Abstracts\Server;
|
||||
use Kiri\Exception\ConfigException;
|
||||
@@ -18,26 +21,39 @@ use Kiri\Server\Events\OnManagerStop;
|
||||
class OnServerManager extends Server
|
||||
{
|
||||
|
||||
/**
|
||||
* @param EventDispatch $dispatch
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function __construct(public EventDispatch $dispatch)
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Swoole\Server $server
|
||||
* @throws ConfigException|ReflectionException
|
||||
* @param \Swoole\Server $server
|
||||
* @throws ConfigException
|
||||
* @throws ReflectionException
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
public function onManagerStart(\Swoole\Server $server)
|
||||
{
|
||||
$this->setProcessName(sprintf('manger[%d].0', $server->manager_pid));
|
||||
Kiri::setProcessName(sprintf('manger[%d].0', $server->manager_pid));
|
||||
|
||||
\Kiri::getDi()->get(EventDispatch::class)->dispatch(new OnManagerStart($server));
|
||||
$this->dispatch->dispatch(new OnManagerStart($server));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param \Swoole\Server $server
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
* @throws ReflectionException
|
||||
*/
|
||||
public function onManagerStop(\Swoole\Server $server)
|
||||
{
|
||||
\Kiri::getDi()->get(EventDispatch::class)->dispatch(new OnManagerStop($server));
|
||||
$this->dispatch->dispatch(new OnManagerStop($server));
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user