This commit is contained in:
2021-03-23 10:53:16 +08:00
parent 362d8ba2dc
commit ab3083e490
+2 -14
View File
@@ -103,30 +103,18 @@ class Server extends HttpService
} }
/**
* @param array $configs
* @return Packet|Websocket|Receive|Http|null
* @throws Exception
*/
public function initCore(array $configs): Packet|Websocket|Receive|Http|null
{
$this->orders($configs);
return $this->getServer();
}
/** /**
* @param $configs * @param $configs
* @return Packet|Websocket|Receive|Http|null * @return Packet|Websocket|Receive|Http|null
* @throws Exception * @throws Exception
*/ */
private function orders($configs): Packet|Websocket|Receive|Http|null private function initCore($configs): Packet|Websocket|Receive|Http|null
{ {
$servers = $this->sortServers($configs); $servers = $this->sortServers($configs);
foreach ($servers as $server) { foreach ($servers as $server) {
$this->create($server); $this->create($server);
if (!$this->baseServer) { if (!$this->baseServer) {
return null; throw new Exception('Base service create fail.');
} }
} }
return $this->startRpcService(); return $this->startRpcService();