This commit is contained in:
as2252258@163.com
2021-07-28 02:07:52 +08:00
parent 17ea843ddf
commit a6731f4a03
+9 -14
View File
@@ -68,14 +68,15 @@ class HTTPServerListener extends Abstracts\Server
static::$_http->set($settings['settings'] ?? []);
static::$_http->on('request', [$reflect, 'onRequest']);
// if (swoole_version() >= '4.7.0') {
// static::$_http->on('disconnect', [$reflect, 'onDisconnect']);
// $reflect->setEvents(Constant::DISCONNECT, $settings['events'][Constant::DISCONNECT] ?? 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);
static::$_http->on('connect', [$reflect, 'onConnect']);
if (swoole_version() >= '4.7.0') {
static::$_http->on('disconnect', [$reflect, 'onDisconnect']);
$reflect->setEvents(Constant::DISCONNECT, $settings['events'][Constant::DISCONNECT] ?? 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;
}
@@ -88,8 +89,6 @@ class HTTPServerListener extends Abstracts\Server
public function onConnect(Server $server, int $fd)
{
$this->runEvent(Constant::CONNECT, null, [$server, $fd]);
$this->_event->dispatch(Event::SYSTEM_RESOURCE_RELEASES);
}
@@ -137,8 +136,6 @@ class HTTPServerListener extends Abstracts\Server
public function onDisconnect(Server $server, int $fd)
{
$this->runEvent(Constant::DISCONNECT, null, [$server, $fd]);
// $this->_event->dispatch(Event::SYSTEM_RESOURCE_RELEASES);
}
@@ -150,8 +147,6 @@ class HTTPServerListener extends Abstracts\Server
public function onClose(Server $server, int $fd)
{
$this->runEvent(Constant::CLOSE, null, [$server, $fd]);
// $this->_event->dispatch(Event::SYSTEM_RESOURCE_RELEASES);
}
}