From e3a5ac51e4fe7a87f0e04cc906ebef3a7049618d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Tue, 23 Mar 2021 18:14:50 +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 | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Rpc/Client.php b/Rpc/Client.php index b98e2b6f..9047c870 100644 --- a/Rpc/Client.php +++ b/Rpc/Client.php @@ -6,7 +6,7 @@ namespace Rpc; use Exception; use Snowflake\Abstracts\Component; -use Snowflake\Abstracts\Config; +use Swoole; use Snowflake\Core\Json; use Snowflake\Exception\ConfigException; use Swoole\Coroutine\Client as CClient; @@ -52,7 +52,9 @@ class Client extends Component if ($isSend === false) { return $this->addError($this->client->errMsg . '(' . $this->client->errCode . ')'); } - + Swoole\Coroutine\defer(function () { + $this->client->close(); + }); if (is_bool($unpack = Json::decode($this->client->recv()))) { return $this->addError('Service return data format error(500)'); }