qqq
This commit is contained in:
+34
-31
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace Kiri\Server\Handler;
|
||||
|
||||
use Kiri\Abstracts\Logger;
|
||||
use Kiri\Di\Inject\Container;
|
||||
use Kiri\Events\EventDispatch;
|
||||
use Kiri\Exception\ConfigException;
|
||||
@@ -25,40 +26,42 @@ class OnServer extends Server
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @param SServer $server
|
||||
* @throws ReflectionException
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
public function onStart(SServer $server): void
|
||||
{
|
||||
\Kiri::setProcessName(sprintf('start[%d].server', $server->master_pid));
|
||||
|
||||
event(new OnStart($server));
|
||||
}
|
||||
/**
|
||||
* @param SServer $server
|
||||
* @throws ReflectionException
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
public function onStart(SServer $server): void
|
||||
{
|
||||
\Kiri::setProcessName(sprintf('start[%d].server', $server->master_pid));
|
||||
foreach (config('server.ports') as $value) {
|
||||
Logger::_alert('Listen ' . $value['type'] . ' address ' . $value['host'] . '::' . $value['port']);
|
||||
}
|
||||
event(new OnStart($server));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param SServer $server
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
* @throws ReflectionException
|
||||
*/
|
||||
public function onBeforeShutdown(SServer $server): void
|
||||
{
|
||||
event(new OnBeforeShutdown($server));
|
||||
}
|
||||
/**
|
||||
* @param SServer $server
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
* @throws ReflectionException
|
||||
*/
|
||||
public function onBeforeShutdown(SServer $server): void
|
||||
{
|
||||
event(new OnBeforeShutdown($server));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param SServer $server
|
||||
* @throws
|
||||
*/
|
||||
public function onShutdown(SServer $server): void
|
||||
{
|
||||
@unlink(storage('.swoole.pid'));
|
||||
event(new OnShutdown($server));
|
||||
}
|
||||
/**
|
||||
* @param SServer $server
|
||||
* @throws
|
||||
*/
|
||||
public function onShutdown(SServer $server): void
|
||||
{
|
||||
@unlink(storage('.swoole.pid'));
|
||||
event(new OnShutdown($server));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user