modify plugin name

This commit is contained in:
2022-02-14 18:51:07 +08:00
parent 4f366fe0e6
commit 7b50598783
+7 -11
View File
@@ -247,15 +247,13 @@ class ServerManager extends Component
*/ */
private function createBaseServer(string $type, string $host, int $port, int $mode, array $settings = []) private function createBaseServer(string $type, string $host, int $port, int $mode, array $settings = [])
{ {
$this->server = new Server('0.0.0.0', 0, SWOOLE_PROCESS, SOCK_STREAM); $match = match ($type) {
Constant::SERVER_TYPE_BASE, Constant::SERVER_TYPE_TCP,
// $match = match ($type) { Constant::SERVER_TYPE_UDP => Server::class,
// Constant::SERVER_TYPE_BASE, Constant::SERVER_TYPE_TCP, Constant::SERVER_TYPE_HTTP => HServer::class,
// Constant::SERVER_TYPE_UDP => Server::class, Constant::SERVER_TYPE_WEBSOCKET => WServer::class
// Constant::SERVER_TYPE_HTTP => HServer::class, };
// Constant::SERVER_TYPE_WEBSOCKET => WServer::class $this->server = new $match($host, $port, SWOOLE_PROCESS, $mode);
// };
// $this->server = new $match($host, $port, SWOOLE_PROCESS, $mode);
$this->server->set(array_merge(Config::get('server.settings', []), $settings['settings'])); $this->server->set(array_merge(Config::get('server.settings', []), $settings['settings']));
$this->getContainer()->setBindings(SwooleServerInterface::class, $this->server); $this->getContainer()->setBindings(SwooleServerInterface::class, $this->server);
@@ -265,8 +263,6 @@ class ServerManager extends Component
$this->logger->debug(sprintf('[%s].' . $type . ' service %s::%d start', $id, $host, $port)); $this->logger->debug(sprintf('[%s].' . $type . ' service %s::%d start', $id, $host, $port));
$this->addDefaultListener($settings); $this->addDefaultListener($settings);
$this->addNewListener($type, $host, $port, $mode, $settings);
} }