改名
This commit is contained in:
@@ -6,7 +6,11 @@ use Annotation\Inject;
|
||||
use Exception;
|
||||
use Server\Abstracts\Server;
|
||||
use Server\Constant;
|
||||
use Server\Events\OnAfterReload;
|
||||
use Server\Events\OnAfterRequest;
|
||||
use Server\Events\OnBeforeReload;
|
||||
use Server\Events\OnShutdown;
|
||||
use Server\Events\OnStart;
|
||||
use Server\SInterface\PipeMessage;
|
||||
use Kiri\Event;
|
||||
use Kiri\Events\EventDispatch;
|
||||
@@ -20,8 +24,14 @@ use Kiri\Exception\ConfigException;
|
||||
class OnServerDefault extends Server
|
||||
{
|
||||
|
||||
/**
|
||||
* @var EventDispatch
|
||||
*/
|
||||
#[Inject(EventDispatch::class)]
|
||||
public EventDispatch $eventDispatch;
|
||||
|
||||
/**
|
||||
|
||||
/**
|
||||
* @param \Swoole\Server $server
|
||||
* @throws ConfigException
|
||||
*/
|
||||
@@ -29,7 +39,7 @@ class OnServerDefault extends Server
|
||||
{
|
||||
$this->setProcessName(sprintf('start[%d].server', $server->master_pid));
|
||||
|
||||
$this->runEvent(Constant::START, null, [$server]);
|
||||
$this->eventDispatch->dispatch(new OnStart($server));
|
||||
}
|
||||
|
||||
|
||||
@@ -38,7 +48,7 @@ class OnServerDefault extends Server
|
||||
*/
|
||||
public function onShutdown(\Swoole\Server $server)
|
||||
{
|
||||
$this->runEvent(Constant::SHUTDOWN, null, [$server]);
|
||||
$this->eventDispatch->dispatch(new OnShutdown($server));
|
||||
}
|
||||
|
||||
|
||||
@@ -48,7 +58,7 @@ class OnServerDefault extends Server
|
||||
*/
|
||||
public function onBeforeReload(\Swoole\Server $server)
|
||||
{
|
||||
$this->runEvent(Constant::BEFORE_RELOAD, null, [$server]);
|
||||
$this->eventDispatch->dispatch(new OnBeforeReload($server));
|
||||
}
|
||||
|
||||
|
||||
@@ -57,7 +67,7 @@ class OnServerDefault extends Server
|
||||
*/
|
||||
public function onAfterReload(\Swoole\Server $server)
|
||||
{
|
||||
$this->runEvent(Constant::AFTER_RELOAD, null, [$server]);
|
||||
$this->eventDispatch->dispatch(new OnAfterReload($server));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user