Fix type convert error

This commit is contained in:
crazywhalecc
2022-03-26 14:51:25 +08:00
parent b6e135a642
commit 971f03ae0f
3 changed files with 4 additions and 7 deletions

View File

@@ -33,7 +33,7 @@ class ServerStopCommand extends DaemonCommand
$name = explode('.', $file);
if (end($name) == 'pid') {
$pid = file_get_contents($file_path . '/' . $file);
Process::kill($pid, SIGKILL);
Process::kill((int) $pid, SIGKILL);
} elseif ($file === 'master.json') {
$json = json_decode(file_get_contents($file_path . '/' . $file), true);
Process::kill($json['pid'], SIGKILL);

View File

@@ -31,11 +31,8 @@ class OnMessage implements SwooleEvent
$conn = ManagerGM::get($frame->fd);
set_coroutine_params(['server' => $server, 'frame' => $frame, 'connection' => $conn]);
$dispatcher1 = new EventDispatcher(OnMessageEvent::class);
$dispatcher1->setRuleFunction(function ($v) {
if ($v->getRule() == '') {
return true;
}
return eval('return ' . $v->getRule() . ';');
$dispatcher1->setRuleFunction(function ($v) use ($conn) {
return $v->connect_type === $conn->getName() && ($v->getRule() === '' || eval('return ' . $v->getRule() . ';'));
});
$dispatcher = new EventDispatcher(OnSwooleEvent::class);

View File

@@ -95,7 +95,7 @@ class SignalListener
$name = explode('.', $file);
if (end($name) == 'pid' && $name[0] !== 'manager') {
$pid = file_get_contents($file_path . '/' . $file);
Process::kill($pid, SIGKILL);
Process::kill((int) $pid, SIGKILL);
}
unlink($file_path . '/' . $file);
}