tmp fix close connection binding warning (#128)

This commit is contained in:
sunxyw 2022-05-21 17:40:43 +08:00 committed by GitHub
parent e7e77c99d0
commit b7469b9dd4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -11,6 +11,7 @@ use ZM\Annotation\Swoole\OnCloseEvent;
use ZM\Annotation\Swoole\OnSwooleEvent;
use ZM\Annotation\Swoole\SwooleHandler;
use ZM\Config\ZMConfig;
use ZM\ConnectionManager\ConnectionObject;
use ZM\ConnectionManager\ManagerGM;
use ZM\Console\Console;
use ZM\Context\Context;
@ -34,6 +35,8 @@ class OnClose implements SwooleEvent
}
set_coroutine_params(['server' => $server, 'connection' => $conn, 'fd' => $fd]);
container()->instance(ConnectionObject::class, $conn);
$dispatcher1 = new EventDispatcher(OnCloseEvent::class);
$dispatcher1->setRuleFunction(function ($v) {
return $v->connect_type == ctx()->getConnection()->getName() && eval('return ' . $v->getRule() . ';');