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;