diff --git a/HttpServer/Events/OnClose.php b/HttpServer/Events/OnClose.php index 7b07b938..f59b1531 100644 --- a/HttpServer/Events/OnClose.php +++ b/HttpServer/Events/OnClose.php @@ -67,35 +67,4 @@ class OnClose extends Callback $logger->insert(); } } - - - /** - * @param $server - * @param $fd - * @return array|null - * @throws Exception - */ - public function resolve($server, $fd): ?array - { - if ($server instanceof WServer) { - if (!$server->isEstablished($fd)) { - return [null, null]; - } - $router = Snowflake::app()->getRouter(); - $node = $router->search(Socket::HANDSHAKE . '::' . null, 'sw::socket'); - if ($node === null) { - return [null, null]; - } - return $node->dispatch(); - } else if ($server instanceof HServer) { - $manager = Snowflake::app()->annotation->http; - $name = $manager->getName(Http::CLOSE); - } else { - $manager = Snowflake::app()->annotation->tcp; - $name = $manager->getName(Tcp::CLOSE); - } - return [$manager, $name]; - } - - } diff --git a/HttpServer/Route/Node.php b/HttpServer/Route/Node.php index 8954f78f..e16cefd8 100644 --- a/HttpServer/Route/Node.php +++ b/HttpServer/Route/Node.php @@ -198,22 +198,16 @@ class Node extends Application * @return null|array * @throws Exception */ - private function getReflect(string $controller, string $action) + private function getReflect(string $controller, string $action): ?array { try { $reflect = Snowflake::getDi()->getReflect($controller); if (!$reflect->isInstantiable()) { throw new Exception($controller . ' Class is con\'t Instantiable.'); } - if (!empty($action) && !$reflect->hasMethod($action)) { throw new Exception('method ' . $action . ' not exists at ' . $controller . '.'); } - - $annotation = Snowflake::app()->annotation->http; - if (!empty($annotations = $annotation->getAnnotation(Http::class))) { - $annotation->read($this, $reflect, $action, $annotations); - } return [$reflect->newInstance(), $action]; } catch (\Throwable $exception) { $this->_error = $exception->getMessage(); diff --git a/HttpServer/Route/Router.php b/HttpServer/Route/Router.php index 86a50e63..6bad97db 100644 --- a/HttpServer/Route/Router.php +++ b/HttpServer/Route/Router.php @@ -588,16 +588,6 @@ class Router extends Application implements RouterInterface */ public function loadRouterSetting() { - $prefix = APP_PATH . 'app/Http/'; - - /** @var Http $annotation */ - $annotation = Snowflake::app()->annotation; - - $annotation = $annotation->http; - $annotation->registration_notes($prefix . 'Interceptor', 'App\Http\Interceptor'); - $annotation->registration_notes($prefix . 'Limits', 'App\Http\Limits'); - $annotation->registration_notes($prefix . 'Middleware', 'App\Http\Middleware'); - $this->loadRouteDir(APP_PATH . '/routes'); } diff --git a/HttpServer/Server.php b/HttpServer/Server.php index c10fbb17..d8004249 100644 --- a/HttpServer/Server.php +++ b/HttpServer/Server.php @@ -207,10 +207,6 @@ class Server extends Application return; } -// $attributes = Snowflake::app()->getAttributes(); -// $attributes->readControllers(CONTROLLER_PATH, 'App\Http\Controllers', 'controllers'); -// $attributes->readControllers(SOCKET_PATH, 'App\Websocket', 'sockets'); - $processes = Config::get('processes'); if (!empty($processes) && is_array($processes)) { $this->deliveryProcess(merge($processes, $this->process));