Files
kiri-core/Server/Manager/OnServerDefault.php
T

64 lines
1.1 KiB
PHP
Raw Normal View History

2021-07-18 12:06:56 +08:00
<?php
namespace Server\Manager;
2021-08-03 18:18:09 +08:00
use Annotation\Inject;
2021-07-23 17:17:58 +08:00
use Exception;
2021-07-19 19:04:13 +08:00
use Server\Abstracts\Server;
use Server\Constant;
2021-08-03 18:18:09 +08:00
use Server\Events\OnAfterRequest;
2021-07-23 17:12:20 +08:00
use Server\SInterface\PipeMessage;
2021-08-11 01:04:57 +08:00
use Kiri\Event;
use Kiri\Events\EventDispatch;
use Kiri\Exception\ConfigException;
2021-07-19 19:04:13 +08:00
/**
2021-08-05 16:15:42 +08:00
* Class OnServerDefault
2021-07-19 19:04:13 +08:00
* @package Server\Manager
*/
2021-08-05 16:15:42 +08:00
class OnServerDefault extends Server
2021-07-18 12:06:56 +08:00
{
2021-07-26 03:18:09 +08:00
/**
* @param \Swoole\Server $server
2021-08-03 18:18:09 +08:00
* @throws ConfigException
2021-07-26 03:18:09 +08:00
*/
2021-07-19 19:04:13 +08:00
public function onStart(\Swoole\Server $server)
2021-07-18 12:06:56 +08:00
{
2021-07-26 02:58:45 +08:00
$this->setProcessName(sprintf('start[%d].server', $server->master_pid));
2021-07-26 02:55:55 +08:00
$this->runEvent(Constant::START, null, [$server]);
2021-07-18 12:06:56 +08:00
}
2021-07-19 19:04:13 +08:00
/**
* @param \Swoole\Server $server
*/
public function onShutdown(\Swoole\Server $server)
2021-07-18 12:06:56 +08:00
{
2021-07-19 19:04:13 +08:00
$this->runEvent(Constant::SHUTDOWN, null, [$server]);
2021-07-18 12:06:56 +08:00
}
2021-07-19 19:04:13 +08:00
/**
* @param \Swoole\Server $server
*/
public function onBeforeReload(\Swoole\Server $server)
2021-07-18 12:06:56 +08:00
{
2021-07-23 17:12:20 +08:00
$this->runEvent(Constant::BEFORE_RELOAD, null, [$server]);
2021-07-18 12:06:56 +08:00
}
2021-07-19 19:04:13 +08:00
/**
* @param \Swoole\Server $server
*/
public function onAfterReload(\Swoole\Server $server)
2021-07-18 12:06:56 +08:00
{
2021-07-23 17:12:20 +08:00
$this->runEvent(Constant::AFTER_RELOAD, null, [$server]);
2021-07-18 12:06:56 +08:00
}
}