改名
This commit is contained in:
@@ -7,7 +7,6 @@ namespace HttpServer\Events;
|
|||||||
use Exception;
|
use Exception;
|
||||||
use HttpServer\Abstracts\Callback;
|
use HttpServer\Abstracts\Callback;
|
||||||
use Snowflake\Event;
|
use Snowflake\Event;
|
||||||
use Snowflake\Snowflake;
|
|
||||||
use Swoole\Server;
|
use Swoole\Server;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -18,36 +17,37 @@ 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)
|
||||||
{
|
{
|
||||||
try {
|
var_dump($fd, $reactorId);
|
||||||
defer(function () {
|
try {
|
||||||
fire(Event::SYSTEM_RESOURCE_RELEASES);
|
defer(function () {
|
||||||
});
|
fire(Event::SYSTEM_RESOURCE_RELEASES);
|
||||||
if (($clientInfo = $server->getClientInfo($fd, $reactorId)) === false) {
|
});
|
||||||
return;
|
if (($clientInfo = $server->getClientInfo($fd, $reactorId)) === false) {
|
||||||
}
|
return;
|
||||||
fire($this->getName($clientInfo), [$server, $fd, $reactorId]);
|
}
|
||||||
} catch (\Throwable $throwable) {
|
fire($this->getName($clientInfo), [$server, $fd, $reactorId]);
|
||||||
$this->addError($throwable, 'connect');
|
} catch (\Throwable $throwable) {
|
||||||
}
|
$this->addError($throwable, 'connect');
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param array $clientInfo
|
* @param array $clientInfo
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
private function getName(array $clientInfo): string
|
private function getName(array $clientInfo): string
|
||||||
{
|
{
|
||||||
return 'listen ' . $clientInfo['server_port'] . ' ' . Event::SERVER_CONNECT;
|
return 'listen ' . $clientInfo['server_port'] . ' ' . Event::SERVER_CONNECT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user