This commit is contained in:
2021-07-19 19:04:13 +08:00
parent 5aa94c1a25
commit b369e5c492
21 changed files with 952 additions and 616 deletions
+36 -11
View File
@@ -2,37 +2,62 @@
namespace Server\Manager;
class ServerBase
use Server\Abstracts\Server;
use Server\Constant;
/**
* Class ServerBase
* @package Server\Manager
*/
class ServerBase extends Server
{
public function onStart()
/**
* @param \Swoole\Server $server
*/
public function onStart(\Swoole\Server $server)
{
var_dump(func_get_args());
$this->runEvent(Constant::START, null, [$server]);
}
public function onShutdown()
/**
* @param \Swoole\Server $server
*/
public function onShutdown(\Swoole\Server $server)
{
var_dump(func_get_args());
$this->runEvent(Constant::SHUTDOWN, null, [$server]);
}
public function onPipeMessage()
/**
* @param \Swoole\Server $server
* @param int $src_worker_id
* @param mixed $message
*/
public function onPipeMessage(\Swoole\Server $server, int $src_worker_id, mixed $message)
{
$this->runEvent(Constant::PIPE_MESSAGE, null, [$server, $src_worker_id, $message]);
}
public function onBeforeReload()
/**
* @param \Swoole\Server $server
*/
public function onBeforeReload(\Swoole\Server $server)
{
$this->runEvent(Constant::PIPE_MESSAGE, null, [$server]);
}
public function onAfterReload()
/**
* @param \Swoole\Server $server
*/
public function onAfterReload(\Swoole\Server $server)
{
$this->runEvent(Constant::PIPE_MESSAGE, null, [$server]);
}
}
+20 -5
View File
@@ -2,18 +2,33 @@
namespace Server\Manager;
class ServerManager
use Server\Abstracts\Server;
use Server\Constant;
/**
* Class ServerManager
* @package Server\Manager
*/
class ServerManager extends Server
{
public function onManagerStart()
/**
* @param \Swoole\Server $server
*/
public function onManagerStart(\Swoole\Server $server)
{
$this->runEvent(Constant::MANAGER_START, null, [$server]);
}
public function onManagerStop()
{
/**
* @param \Swoole\Server $server
*/
public function onManagerStop(\Swoole\Server $server)
{
$this->runEvent(Constant::MANAGER_STOP, null, [$server]);
}