From 05c81ce77d9e366f7a6bf44bff6285d38d937a16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Tue, 23 Mar 2021 18:16:27 +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 | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Rpc/Client.php b/Rpc/Client.php index 9047c870..afc3182e 100644 --- a/Rpc/Client.php +++ b/Rpc/Client.php @@ -52,10 +52,11 @@ 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()))) { + + $response = $this->client->recv(); + $this->client->close(); + + if (is_bool($unpack = Json::decode($response))) { return $this->addError('Service return data format error(500)'); } return $unpack;