变更
This commit is contained in:
@@ -50,6 +50,11 @@ class AsyncServer implements ServerInterface
|
|||||||
public function initCoreServers(array $service, int $daemon = 0): void
|
public function initCoreServers(array $service, int $daemon = 0): void
|
||||||
{
|
{
|
||||||
$service = $this->genConfigService($service);
|
$service = $this->genConfigService($service);
|
||||||
|
$pid = (int)file_get_contents(storage('.swoole.pid'));
|
||||||
|
if (posix_kill($pid, 0)) {
|
||||||
|
posix_kill($pid, SIGTERM);
|
||||||
|
}
|
||||||
|
|
||||||
$this->createBaseServer(array_shift($service), $daemon);
|
$this->createBaseServer(array_shift($service), $daemon);
|
||||||
foreach ($service as $value) {
|
foreach ($service as $value) {
|
||||||
$this->addListener($value);
|
$this->addListener($value);
|
||||||
@@ -219,10 +224,6 @@ class AsyncServer implements ServerInterface
|
|||||||
*/
|
*/
|
||||||
public function start(): void
|
public function start(): void
|
||||||
{
|
{
|
||||||
$pid = (int)file_get_contents(storage('.swoole.pid'));
|
|
||||||
if (posix_kill($pid, 0)) {
|
|
||||||
posix_kill($pid, SIGTERM);
|
|
||||||
}
|
|
||||||
$processManager = Kiri::getDi()->get(EventDispatch::class);
|
$processManager = Kiri::getDi()->get(EventDispatch::class);
|
||||||
$processManager->dispatch(new OnServerBeforeStart());
|
$processManager->dispatch(new OnServerBeforeStart());
|
||||||
$this->server->start();
|
$this->server->start();
|
||||||
|
|||||||
Reference in New Issue
Block a user