改名
This commit is contained in:
@@ -38,13 +38,11 @@ class Command extends \Console\Command
|
||||
if (!in_array($dtl->get('action'), self::ACTIONS)) {
|
||||
return 'I don\'t know what I want to do.';
|
||||
}
|
||||
|
||||
/** @var Shutdown $shutdown */
|
||||
$shutdown = Kiri::app()->get('shutdown');
|
||||
if ($shutdown->isRunning() && $dtl->get('action') == 'start') {
|
||||
if ($manager->isRunner() && $dtl->get('action') == 'start') {
|
||||
return 'Service is running. Please use restart.';
|
||||
}
|
||||
$shutdown->shutdown();
|
||||
|
||||
$manager->shutdown();
|
||||
if ($dtl->get('action') == 'stop') {
|
||||
return 'shutdown success.';
|
||||
}
|
||||
|
||||
+18
-6
@@ -6,16 +6,15 @@ namespace Http;
|
||||
use Exception;
|
||||
use Http\Abstracts\HttpService;
|
||||
use JetBrains\PhpStorm\Pure;
|
||||
use ReflectionException;
|
||||
use Rpc\Service;
|
||||
use Server\Constant;
|
||||
use Server\ServerManager;
|
||||
use Kiri\Abstracts\Config;
|
||||
use Kiri\Error\LoggerProcess;
|
||||
use Kiri\Exception\ConfigException;
|
||||
use Kiri\Exception\NotFindClassException;
|
||||
use Kiri\Process\Biomonitoring;
|
||||
use Kiri\Kiri;
|
||||
use ReflectionException;
|
||||
use Rpc\Service;
|
||||
use Server\Constant;
|
||||
use Server\ServerManager;
|
||||
use Swoole\Runtime;
|
||||
|
||||
|
||||
@@ -123,7 +122,20 @@ class Server extends HttpService
|
||||
*/
|
||||
public function shutdown()
|
||||
{
|
||||
$this->manager->stopServer(0);
|
||||
$configs = Config::get('server', [], true);
|
||||
foreach ($configs['ports'] ?? [] as $config) {
|
||||
$this->manager->stopServer($config['port']);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
* @throws ConfigException
|
||||
*/
|
||||
public function isRunner(): bool
|
||||
{
|
||||
return $this->manager->isRunner();
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user