This commit is contained in:
as2252258@163.com
2021-03-23 01:20:44 +08:00
parent 8ead149dc2
commit 433b71d20a
+19 -19
View File
@@ -18,29 +18,29 @@ class OnConnect extends Callback
{ {
/** /**
* @param Server $server * @param Server $server
* @param int $fd * @param int $fd
* @param int $reactorId * @param int $reactorId
* @throws Exception * @throws Exception
*/ */
public function onHandler(Server $server, int $fd, int $reactorId) public function onHandler(Server $server, int $fd, int $reactorId)
{ {
$event = Snowflake::app()->getEvent(); $event = Snowflake::app()->getEvent();
$clientInfo = $server->getClientInfo($fd); $clientInfo = $server->getClientInfo($fd);
try { try {
$name = 'listen ' . $clientInfo['server_port'] . ' ' . Event::RECEIVE_CONNECTION; $name = 'listen ' . $clientInfo['server_port'] . ' ' . Event::SERVER_CONNECT;
$event->trigger($name, [$server, $fd, $reactorId]); $event->trigger($name, [$server, $fd, $reactorId]);
} catch (\Throwable $throwable) { } catch (\Throwable $throwable) {
$this->addError($throwable, 'connect'); $this->addError($throwable, 'connect');
} }
fire(Event::SYSTEM_RESOURCE_RELEASES); fire(Event::SYSTEM_RESOURCE_RELEASES);
logger()->insert(); logger()->insert();
} }
} }