改名
This commit is contained in:
+6
-29
@@ -368,11 +368,9 @@ class Server extends HttpService
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Http|Packet|Receive|Websocket|null
|
* @return Packet|Websocket|Receive|Http|null
|
||||||
* @throws ComponentException
|
|
||||||
* @throws ConfigException
|
* @throws ConfigException
|
||||||
* @throws NotFindClassException
|
* @throws Exception
|
||||||
* @throws ReflectionException
|
|
||||||
*/
|
*/
|
||||||
private function startRpcService(): Packet|Websocket|Receive|Http|null
|
private function startRpcService(): Packet|Websocket|Receive|Http|null
|
||||||
{
|
{
|
||||||
@@ -382,6 +380,7 @@ class Server extends HttpService
|
|||||||
$service = Snowflake::app()->get('rpc-service');
|
$service = Snowflake::app()->get('rpc-service');
|
||||||
$service->instance($this->swoole);
|
$service->instance($this->swoole);
|
||||||
}
|
}
|
||||||
|
$this->onLoadHttpHandler();
|
||||||
return $this->swoole;
|
return $this->swoole;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -403,15 +402,11 @@ class Server extends HttpService
|
|||||||
if (!isset($settings['pid_file'])) {
|
if (!isset($settings['pid_file'])) {
|
||||||
$settings['pid_file'] = PID_PATH;
|
$settings['pid_file'] = PID_PATH;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->debug(Snowflake::listen($config));
|
$this->debug(Snowflake::listen($config));
|
||||||
$this->swoole->set($settings);
|
$this->swoole->set($settings);
|
||||||
$this->onProcessListener();
|
$this->onProcessListener();
|
||||||
if ($config['type'] == self::WEBSOCKET) {
|
|
||||||
$this->onLoadWebsocketHandler();
|
|
||||||
$this->onLoadHttpHandler();
|
|
||||||
} else if ($config['type'] == self::HTTP) {
|
|
||||||
$this->onLoadHttpHandler();
|
|
||||||
}
|
|
||||||
return $this->swoole;
|
return $this->swoole;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -485,9 +480,6 @@ class Server extends HttpService
|
|||||||
*/
|
*/
|
||||||
public function onBindCallback($name, $callback)
|
public function onBindCallback($name, $callback)
|
||||||
{
|
{
|
||||||
if ($name === 'request') {
|
|
||||||
$this->onLoadHttpHandler();
|
|
||||||
}
|
|
||||||
if ($this->swoole->getCallback($name) !== null) {
|
if ($this->swoole->getCallback($name) !== null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -507,9 +499,7 @@ class Server extends HttpService
|
|||||||
router()->loadRouterSetting();
|
router()->loadRouterSetting();
|
||||||
|
|
||||||
$annotation = Snowflake::app()->getAttributes();
|
$annotation = Snowflake::app()->getAttributes();
|
||||||
$annotation->instanceDirectoryFiles(CONTROLLER_PATH);
|
$annotation->instanceDirectoryFiles(APP_PATH);
|
||||||
$annotation->instanceDirectoryFiles(RPC_SERVICE_PATH);
|
|
||||||
$annotation->instanceDirectoryFiles(RPC_CLIENT_PATH);
|
|
||||||
} catch (\Throwable $exception) {
|
} catch (\Throwable $exception) {
|
||||||
$this->addError($exception, 'throwable');
|
$this->addError($exception, 'throwable');
|
||||||
}
|
}
|
||||||
@@ -517,19 +507,6 @@ class Server extends HttpService
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @throws Exception
|
|
||||||
*/
|
|
||||||
public function onLoadWebsocketHandler()
|
|
||||||
{
|
|
||||||
$event = Snowflake::app()->getEvent();
|
|
||||||
$event->on(Event::SERVER_WORKER_START, function () {
|
|
||||||
$annotation = Snowflake::app()->getAttributes();
|
|
||||||
$annotation->instanceDirectoryFiles(SOCKET_PATH);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $type
|
* @param $type
|
||||||
* @return string
|
* @return string
|
||||||
|
|||||||
Reference in New Issue
Block a user