This commit is contained in:
as2252258@163.com
2021-07-28 01:45:49 +08:00
parent bc5eeeac25
commit bab9f9d6f7
+5 -3
View File
@@ -69,12 +69,13 @@ class HTTPServerListener extends Abstracts\Server
static::$_http->set($settings['settings'] ?? []);
static::$_http->on('request', [$reflect, 'onRequest']);
static::$_http->on('connect', [$reflect, 'onConnect']);
static::$_http->on('close', [$reflect, 'onClose']);
if (swoole_version() >= '4.7.0') {
static::$_http->on('disconnect', [$reflect, 'onDisconnect']);
$reflect->setEvents(Constant::DISCONNECT, $settings['events'][Constant::DISCONNECT] ?? null);
}
$reflect->setEvents(Constant::CLOSE, $settings['events'][Constant::CLOSE] ?? null);
} else {
static::$_http->on('close', [$reflect, 'onClose']);
$reflect->setEvents(Constant::CLOSE, $settings['events'][Constant::CLOSE] ?? null);
}
$reflect->setEvents(Constant::CONNECT, $settings['events'][Constant::CONNECT] ?? null);
return static::$_http;
}
@@ -102,6 +103,7 @@ class HTTPServerListener extends Abstracts\Server
{
try {
// defer(fn() => fire(Event::SYSTEM_RESOURCE_RELEASES));
/** @var \HttpServer\Http\Response $sResponse */
[$sRequest, $sResponse] = $this->request($request, $response);
$result = $this->router->dispatch($sRequest);