update to build 420

This commit is contained in:
crazywhalecc
2021-09-11 11:59:02 +08:00
parent 07391810ff
commit 907a9cea25
11 changed files with 102 additions and 21 deletions

View File

@@ -25,6 +25,9 @@ use ZM\Event\SwooleEvent;
*/
class OnMessage implements SwooleEvent
{
/**
* @noinspection PhpUnreachableStatementInspection
*/
public function onCall($server, Frame $frame) {
Console::debug("Calling Swoole \"message\" from fd=" . $frame->fd . ": " . TermColor::ITALIC . $frame->data . TermColor::RESET);
unset(Context::$context[Coroutine::getCid()]);
@@ -32,8 +35,8 @@ class OnMessage implements SwooleEvent
set_coroutine_params(["server" => $server, "frame" => $frame, "connection" => $conn]);
$dispatcher1 = new EventDispatcher(OnMessageEvent::class);
$dispatcher1->setRuleFunction(function ($v) {
/** @noinspection PhpUnreachableStatementInspection */
return ctx()->getConnection()->getName() == $v->connect_type && eval("return " . $v->getRule() . ";");
if ($v->getRule() == '') return true;
else return eval("return " . $v->getRule() . ";");
});