This commit is contained in:
2021-08-05 16:15:42 +08:00
parent dca2948371
commit 4b16d82bb9
8 changed files with 73 additions and 52 deletions
+63
View File
@@ -0,0 +1,63 @@
<?php
namespace Server\Manager;
use Annotation\Inject;
use Exception;
use Server\Abstracts\Server;
use Server\Constant;
use Server\Events\OnAfterRequest;
use Server\SInterface\PipeMessage;
use Snowflake\Event;
use Snowflake\Events\EventDispatch;
use Snowflake\Exception\ConfigException;
/**
* Class OnServerDefault
* @package Server\Manager
*/
class OnServerDefault extends Server
{
/**
* @param \Swoole\Server $server
* @throws ConfigException
*/
public function onStart(\Swoole\Server $server)
{
$this->setProcessName(sprintf('start[%d].server', $server->master_pid));
$this->runEvent(Constant::START, null, [$server]);
}
/**
* @param \Swoole\Server $server
*/
public function onShutdown(\Swoole\Server $server)
{
$this->runEvent(Constant::SHUTDOWN, null, [$server]);
}
/**
* @param \Swoole\Server $server
*/
public function onBeforeReload(\Swoole\Server $server)
{
$this->runEvent(Constant::BEFORE_RELOAD, null, [$server]);
}
/**
* @param \Swoole\Server $server
*/
public function onAfterReload(\Swoole\Server $server)
{
$this->runEvent(Constant::AFTER_RELOAD, null, [$server]);
}
}