From 21eb9a6f620cff53e5751ea88cc3839fa81abd57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Tue, 23 Mar 2021 16:50:59 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Rpc/Client.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Rpc/Client.php b/Rpc/Client.php index f3b8efef..9e24c41d 100644 --- a/Rpc/Client.php +++ b/Rpc/Client.php @@ -24,7 +24,7 @@ class Client extends Component public string $service = ''; - private ?CClient $client; + private ?CClient $client = null; /** @@ -35,15 +35,17 @@ class Client extends Component */ public function dispatch(string $cmd, array $param): mixed { - $service = $this->config; - if (empty($service)) { + if (empty($this->config)) { return null; } if (!($this->client instanceof CClient)) { $this->client = $this->getClient(); } if (!$this->client->isConnected()) { - if (!$this->client->connect($service['host'], $service['port'], $service['timeout'] ?? 1)) { + if (!$this->client->connect( + $this->config['host'], $this->config['port'], + $this->config['timeout'] ?? 1 + )) { return $this->client->errCode . ':' . $this->client->errMsg; } }