改名
This commit is contained in:
@@ -9,9 +9,9 @@ class OnShutdown
|
||||
|
||||
|
||||
/**
|
||||
* @param Server $server
|
||||
* @param Server|null $server
|
||||
*/
|
||||
public function __construct(Server $server)
|
||||
public function __construct(?Server $server = null)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -3,17 +3,20 @@
|
||||
|
||||
namespace Http;
|
||||
|
||||
use Annotation\Inject;
|
||||
use Exception;
|
||||
use Http\Abstracts\HttpService;
|
||||
use JetBrains\PhpStorm\Pure;
|
||||
use Kiri\Abstracts\Config;
|
||||
use Kiri\Error\LoggerProcess;
|
||||
use Kiri\Events\EventDispatch;
|
||||
use Kiri\Exception\ConfigException;
|
||||
use Kiri\Exception\NotFindClassException;
|
||||
use Kiri\Process\Biomonitoring;
|
||||
use ReflectionException;
|
||||
use Rpc\Service;
|
||||
use Server\Constant;
|
||||
use Server\Events\OnShutdown;
|
||||
use Server\ServerManager;
|
||||
use Swoole\Runtime;
|
||||
|
||||
@@ -37,6 +40,11 @@ class Server extends HttpService
|
||||
private mixed $daemon = 0;
|
||||
|
||||
|
||||
/** @var EventDispatch */
|
||||
#[Inject(EventDispatch::class)]
|
||||
public EventDispatch $eventDispatch;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@@ -126,6 +134,7 @@ class Server extends HttpService
|
||||
foreach ($configs['ports'] ?? [] as $config) {
|
||||
$this->manager->stopServer($config['port']);
|
||||
}
|
||||
$this->eventDispatch->dispatch(new OnShutdown());
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user