Skip to content

Commit

Permalink
fix getter
Browse files Browse the repository at this point in the history
  • Loading branch information
sentrychen committed Jun 10, 2020
1 parent 70d4f50 commit 94617f2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
9 changes: 4 additions & 5 deletions src/rpc-client/src/Concern/ServiceTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,7 @@ protected function __proxyCall(string $interfaceClass, string $methodName, array

$protocol = Protocol::new($version, $interfaceClass, $methodName, $params, $ext);
$data = $packet->encode($protocol);
//$message = sprintf('Rpc call failed.interface=%s method=%s pool=%s version=%s', $interfaceClass, $methodName,
// $poolName, $version);

$message = 'Rpc call failed.code=%d message=%s ' . sprintf('interface=%s method=%s pool=%s version=%s',
$interfaceClass, $methodName, $poolName, $version);

Expand Down Expand Up @@ -95,7 +94,7 @@ private function sendAndRecv(Connection $connection, string $data, string $messa

if (!$connection->send($data)) {
if ($reconnect) {
$message = sprintf($message, $connection->errCode(), $connection->errMsg());
$message = sprintf($message, $connection->getErrCode(), $connection->getErrMsg());
$connection->release();
throw new RpcClientException($message);
}
Expand All @@ -106,8 +105,8 @@ private function sendAndRecv(Connection $connection, string $data, string $messa
$result = $connection->recv();
if ($result === false || empty($result)) {
//Reconnected or receive date timeout
if ($reconnect || $connection->errCode() === SOCKET_ETIMEDOUT) {
$message = sprintf($message, $connection->errCode(), $connection->errMsg());
if ($reconnect || $connection->getErrCode() === SOCKET_ETIMEDOUT) {
$message = sprintf($message, $connection->getErrCode(), $connection->getErrMsg());
$connection->release();
throw new RpcClientException($message);
}
Expand Down
4 changes: 2 additions & 2 deletions src/rpc-client/src/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,15 +137,15 @@ public function recv()
/**
* @return int
*/
public function errCode()
public function getErrCode()
{
return $this->connection->errCode;
}

/**
* @return string
*/
public function errMsg()
public function getErrMsg()
{
return $this->connection->errMsg;
}
Expand Down

0 comments on commit 94617f2

Please sign in to comment.