改名
This commit is contained in:
@@ -54,12 +54,22 @@ abstract class CustomProcess implements \Server\SInterface\CustomProcess
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
go(function () use ($process) {
|
Coroutine::create(function () use ($process) {
|
||||||
|
/** @var Coroutine\Socket $message */
|
||||||
|
$message = $process->exportSocket();
|
||||||
|
error($message->recv());
|
||||||
|
$process->exit(0);
|
||||||
|
});
|
||||||
|
Coroutine::create(function () use ($process) {
|
||||||
$data = Coroutine::waitSignal(SIGTERM | SIGKILL, -1);
|
$data = Coroutine::waitSignal(SIGTERM | SIGKILL, -1);
|
||||||
if ($data) {
|
if ($data) {
|
||||||
$lists = Kiri::app()->getProcess();
|
$lists = Kiri::app()->getProcess();
|
||||||
foreach ($lists as $process) {
|
foreach ($lists as $name => $process) {
|
||||||
$process->exit(0);
|
foreach ($process as $item) {
|
||||||
|
/** @var Coroutine\Socket $export */
|
||||||
|
$export = $item->exportSocket();
|
||||||
|
$export->send([$name => 'exit']);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -203,7 +203,6 @@ class ServerManager
|
|||||||
* @param array $config
|
* @param array $config
|
||||||
* @param int $daemon
|
* @param int $daemon
|
||||||
* @throws ConfigException
|
* @throws ConfigException
|
||||||
* @throws NotFindClassException
|
|
||||||
* @throws ReflectionException
|
* @throws ReflectionException
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ class Application extends BaseApplication
|
|||||||
public string $state = '';
|
public string $state = '';
|
||||||
|
|
||||||
|
|
||||||
/** @var array<Process> */
|
/** @var array<array<Process>> */
|
||||||
private array $_process = [];
|
private array $_process = [];
|
||||||
|
|
||||||
|
|
||||||
@@ -88,7 +88,10 @@ class Application extends BaseApplication
|
|||||||
*/
|
*/
|
||||||
public function addProcess(string $class, Process $process)
|
public function addProcess(string $class, Process $process)
|
||||||
{
|
{
|
||||||
$this->_process[$class] = $process;
|
if (isset($this->_process[$class])) {
|
||||||
|
$this->_process[$class] = [];
|
||||||
|
}
|
||||||
|
$this->_process[$class][] = $process;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user