qqq
This commit is contained in:
@@ -134,8 +134,7 @@ class AsyncServer implements ServerInterface
|
||||
* @param $daemon
|
||||
* @return void
|
||||
* @throws ConfigException
|
||||
* @throws ReflectionException
|
||||
*/
|
||||
*/
|
||||
private function initServer($match, $config, $daemon): void
|
||||
{
|
||||
$this->server = new $match($config->host, $config->port, $config->mode, $config->socket);
|
||||
@@ -145,7 +144,7 @@ class AsyncServer implements ServerInterface
|
||||
if (!isset($config->events[Constant::SHUTDOWN])) {
|
||||
$config->events[Constant::SHUTDOWN] = [OnServer::class, 'onShutdown'];
|
||||
}
|
||||
Kiri::service()->set('server', $this->server);
|
||||
Kiri::getDi()->bind(ServerInterface::class, $this->server);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ use Kiri\Abstracts\Component;
|
||||
use Kiri\Server\Contract\OnProcessInterface;
|
||||
use Psr\Container\ContainerExceptionInterface;
|
||||
use Psr\Container\NotFoundExceptionInterface;
|
||||
use ReflectionException;
|
||||
use Swoole\Coroutine;
|
||||
use Swoole\Process;
|
||||
use Psr\Container\ContainerInterface;
|
||||
@@ -36,15 +37,14 @@ class ProcessManager extends Component
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param OnServerBeforeStart $beforeStart
|
||||
* @return void
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface|Exception
|
||||
*/
|
||||
/**
|
||||
* @param OnServerBeforeStart $beforeStart
|
||||
* @return void
|
||||
* @throws ReflectionException
|
||||
*/
|
||||
public function OnServerBeforeStart(OnServerBeforeStart $beforeStart): void
|
||||
{
|
||||
$server = Kiri::service()->get('server');
|
||||
$server = Kiri::getDi()->get(ServerInterface::class);
|
||||
foreach ($this->_process as $custom) {
|
||||
if (Kiri\Di\Context::inCoroutine()) {
|
||||
Coroutine::create(function () use ($custom) {
|
||||
@@ -180,7 +180,7 @@ class ProcessManager extends Component
|
||||
* @param Process $process
|
||||
* @return void
|
||||
* @throws Kiri\Exception\ConfigException
|
||||
* @throws \ReflectionException
|
||||
* @throws ReflectionException
|
||||
*/
|
||||
public function extracted(mixed $custom, Process $process): void
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user