modify
This commit is contained in:
@@ -69,12 +69,13 @@ class HTTPServerListener extends Abstracts\Server
|
|||||||
static::$_http->set($settings['settings'] ?? []);
|
static::$_http->set($settings['settings'] ?? []);
|
||||||
static::$_http->on('request', [$reflect, 'onRequest']);
|
static::$_http->on('request', [$reflect, 'onRequest']);
|
||||||
static::$_http->on('connect', [$reflect, 'onConnect']);
|
static::$_http->on('connect', [$reflect, 'onConnect']);
|
||||||
static::$_http->on('close', [$reflect, 'onClose']);
|
|
||||||
if (swoole_version() >= '4.7.0') {
|
if (swoole_version() >= '4.7.0') {
|
||||||
static::$_http->on('disconnect', [$reflect, 'onDisconnect']);
|
static::$_http->on('disconnect', [$reflect, 'onDisconnect']);
|
||||||
$reflect->setEvents(Constant::DISCONNECT, $settings['events'][Constant::DISCONNECT] ?? null);
|
$reflect->setEvents(Constant::DISCONNECT, $settings['events'][Constant::DISCONNECT] ?? null);
|
||||||
}
|
} else {
|
||||||
$reflect->setEvents(Constant::CLOSE, $settings['events'][Constant::CLOSE] ?? null);
|
static::$_http->on('close', [$reflect, 'onClose']);
|
||||||
|
$reflect->setEvents(Constant::CLOSE, $settings['events'][Constant::CLOSE] ?? null);
|
||||||
|
}
|
||||||
$reflect->setEvents(Constant::CONNECT, $settings['events'][Constant::CONNECT] ?? null);
|
$reflect->setEvents(Constant::CONNECT, $settings['events'][Constant::CONNECT] ?? null);
|
||||||
return static::$_http;
|
return static::$_http;
|
||||||
}
|
}
|
||||||
@@ -102,6 +103,7 @@ class HTTPServerListener extends Abstracts\Server
|
|||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
// defer(fn() => fire(Event::SYSTEM_RESOURCE_RELEASES));
|
// defer(fn() => fire(Event::SYSTEM_RESOURCE_RELEASES));
|
||||||
|
/** @var \HttpServer\Http\Response $sResponse */
|
||||||
[$sRequest, $sResponse] = $this->request($request, $response);
|
[$sRequest, $sResponse] = $this->request($request, $response);
|
||||||
|
|
||||||
$result = $this->router->dispatch($sRequest);
|
$result = $this->router->dispatch($sRequest);
|
||||||
|
|||||||
Reference in New Issue
Block a user