eee
This commit is contained in:
@@ -9,7 +9,6 @@ use Kiri\Exception\NotFindClassException;
|
||||
use Kiri\Server\Config as SConfig;
|
||||
use Kiri\Server\Constant;
|
||||
use Kiri\Server\Events\OnServerBeforeStart;
|
||||
use Kiri\Server\Events\OnShutdown;
|
||||
use Kiri\Server\Handler\OnServer;
|
||||
use Kiri\Server\Processes\TraitProcess;
|
||||
use Kiri\Server\ServerInterface;
|
||||
@@ -32,6 +31,8 @@ class AsyncServer extends Component implements ServerInterface
|
||||
*/
|
||||
private ?Server $server = null;
|
||||
|
||||
private bool $shuttingDown = false;
|
||||
|
||||
|
||||
/**
|
||||
* @param array $service
|
||||
@@ -61,14 +62,18 @@ class AsyncServer extends Component implements ServerInterface
|
||||
*/
|
||||
public function shutdown(): bool
|
||||
{
|
||||
$this->server->shutdown();
|
||||
if ($this->shuttingDown) {
|
||||
return true;
|
||||
}
|
||||
$this->shuttingDown = true;
|
||||
|
||||
$this->dispatch->dispatch(new OnShutdown);
|
||||
if ($this->server !== null) {
|
||||
$this->server->shutdown();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param array $service
|
||||
* @param int $daemon
|
||||
|
||||
Reference in New Issue
Block a user