This commit is contained in:
2021-10-19 15:07:02 +08:00
parent ea5b473638
commit 95b4a3e80b
5 changed files with 69 additions and 35 deletions
+18 -10
View File
@@ -3,11 +3,12 @@
namespace Server\Manager;
use Annotation\Inject;
use Server\Abstracts\Server;
use Server\Events\OnShutdown;
use Server\Events\OnStart;
use Kiri\Events\EventDispatch;
use Kiri\Exception\ConfigException;
use Server\Abstracts\Server;
use Server\Events\OnBeforeShutdown;
use Server\Events\OnShutdown;
use Server\Events\OnStart;
/**
@@ -25,18 +26,26 @@ class OnServer extends Server
/**
* @param \Swoole\Server $server
* @throws ConfigException
*/
* @param \Swoole\Server $server
* @throws ConfigException
*/
public function onStart(\Swoole\Server $server)
{
$this->setProcessName(sprintf('start[%d].server', $server->master_pid));
$this->setProcessName(sprintf('start[%d].server', $server->master_pid));
$this->eventDispatch->dispatch(new OnStart($server));
$this->eventDispatch->dispatch(new OnStart($server));
}
/**
* @param \Swoole\Server $server
*/
public function onBeforeShutdown(\Swoole\Server $server)
{
$this->eventDispatch->dispatch(new OnBeforeShutdown($server));
}
/**
* @param \Swoole\Server $server
*/
@@ -46,5 +55,4 @@ class OnServer extends Server
}
}