diff options
Diffstat (limited to 'src/php')
-rw-r--r-- | src/php/ext/grpc/call.c | 9 | ||||
-rw-r--r-- | src/php/lib/Grpc/AbstractCall.php | 15 | ||||
-rw-r--r-- | src/php/lib/Grpc/BaseStub.php | 24 | ||||
-rw-r--r-- | src/php/lib/Grpc/BidiStreamingCall.php | 4 | ||||
-rw-r--r-- | src/php/lib/Grpc/ClientStreamingCall.php | 4 | ||||
-rw-r--r-- | src/php/lib/Grpc/ServerStreamingCall.php | 4 | ||||
-rw-r--r-- | src/php/lib/Grpc/UnaryCall.php | 4 |
7 files changed, 32 insertions, 32 deletions
diff --git a/src/php/ext/grpc/call.c b/src/php/ext/grpc/call.c index 64b1137c2a..be11e63d62 100644 --- a/src/php/ext/grpc/call.c +++ b/src/php/ext/grpc/call.c @@ -335,7 +335,7 @@ PHP_METHOD(Call, startBatch) { 1 TSRMLS_CC); goto cleanup; } - ops[op_num].data.send_message = + ops[op_num].data.send_message.send_message = string_to_byte_buffer(Z_STRVAL_P(message_value), Z_STRLEN_P(message_value)); break; @@ -390,10 +390,11 @@ PHP_METHOD(Call, startBatch) { } break; case GRPC_OP_RECV_INITIAL_METADATA: - ops[op_num].data.recv_initial_metadata = &recv_metadata; + ops[op_num].data.recv_initial_metadata.recv_initial_metadata = + &recv_metadata; break; case GRPC_OP_RECV_MESSAGE: - ops[op_num].data.recv_message = &message; + ops[op_num].data.recv_message.recv_message = &message; break; case GRPC_OP_RECV_STATUS_ON_CLIENT: ops[op_num].data.recv_status_on_client.trailing_metadata = @@ -498,7 +499,7 @@ cleanup: } for (int i = 0; i < op_num; i++) { if (ops[i].op == GRPC_OP_SEND_MESSAGE) { - grpc_byte_buffer_destroy(ops[i].data.send_message); + grpc_byte_buffer_destroy(ops[i].data.send_message.send_message); } if (ops[i].op == GRPC_OP_RECV_MESSAGE) { grpc_byte_buffer_destroy(message); diff --git a/src/php/lib/Grpc/AbstractCall.php b/src/php/lib/Grpc/AbstractCall.php index 9f0b02b8bb..40387abdc0 100644 --- a/src/php/lib/Grpc/AbstractCall.php +++ b/src/php/lib/Grpc/AbstractCall.php @@ -58,12 +58,11 @@ abstract class AbstractCall * the response * @param array $options Call options (optional) */ - public function __construct( - Channel $channel, - $method, - $deserialize, - array $options = [] - ) { + public function __construct(Channel $channel, + $method, + $deserialize, + array $options = []) + { if (array_key_exists('timeout', $options) && is_numeric($timeout = $options['timeout']) ) { @@ -127,7 +126,7 @@ abstract class AbstractCall * * @return string The protobuf binary format */ - protected function serializeMessage($data) + protected function _serializeMessage($data) { // Proto3 implementation if (method_exists($data, 'encode')) { @@ -145,7 +144,7 @@ abstract class AbstractCall * * @return mixed The deserialized value */ - protected function deserializeResponse($value) + protected function _deserializeResponse($value) { if ($value === null) { return; diff --git a/src/php/lib/Grpc/BaseStub.php b/src/php/lib/Grpc/BaseStub.php index a9e77b9396..ed504f85a8 100644 --- a/src/php/lib/Grpc/BaseStub.php +++ b/src/php/lib/Grpc/BaseStub.php @@ -146,6 +146,14 @@ class BaseStub } /** + * Close the communication channel associated with this stub. + */ + public function close() + { + $this->channel->close(); + } + + /** * @param $new_state Connect state * * @return bool true if state is CHANNEL_READY @@ -164,14 +172,6 @@ class BaseStub } /** - * Close the communication channel associated with this stub. - */ - public function close() - { - $this->channel->close(); - } - - /** * constructs the auth uri for the jwt. * * @param string $method The method string @@ -235,7 +235,7 @@ class BaseStub * * @return SimpleSurfaceActiveCall The active call object */ - public function _simpleRequest($method, + protected function _simpleRequest($method, $argument, $deserialize, array $metadata = [], @@ -270,7 +270,7 @@ class BaseStub * * @return ClientStreamingSurfaceActiveCall The active call object */ - public function _clientStreamRequest($method, + protected function _clientStreamRequest($method, $deserialize, array $metadata = [], array $options = []) @@ -305,7 +305,7 @@ class BaseStub * * @return ServerStreamingSurfaceActiveCall The active call object */ - public function _serverStreamRequest($method, + protected function _serverStreamRequest($method, $argument, $deserialize, array $metadata = [], @@ -339,7 +339,7 @@ class BaseStub * * @return BidiStreamingSurfaceActiveCall The active call object */ - public function _bidiRequest($method, + protected function _bidiRequest($method, $deserialize, array $metadata = [], array $options = []) diff --git a/src/php/lib/Grpc/BidiStreamingCall.php b/src/php/lib/Grpc/BidiStreamingCall.php index b03bbd204f..7cb200d141 100644 --- a/src/php/lib/Grpc/BidiStreamingCall.php +++ b/src/php/lib/Grpc/BidiStreamingCall.php @@ -69,7 +69,7 @@ class BidiStreamingCall extends AbstractCall $this->metadata = $read_event->metadata; } - return $this->deserializeResponse($read_event->message); + return $this->_deserializeResponse($read_event->message); } /** @@ -82,7 +82,7 @@ class BidiStreamingCall extends AbstractCall */ public function write($data, array $options = []) { - $message_array = ['message' => $this->serializeMessage($data)]; + $message_array = ['message' => $this->_serializeMessage($data)]; if (array_key_exists('flags', $options)) { $message_array['flags'] = $options['flags']; } diff --git a/src/php/lib/Grpc/ClientStreamingCall.php b/src/php/lib/Grpc/ClientStreamingCall.php index c542f08872..6454cbcb21 100644 --- a/src/php/lib/Grpc/ClientStreamingCall.php +++ b/src/php/lib/Grpc/ClientStreamingCall.php @@ -63,7 +63,7 @@ class ClientStreamingCall extends AbstractCall */ public function write($data, array $options = []) { - $message_array = ['message' => $this->serializeMessage($data)]; + $message_array = ['message' => $this->_serializeMessage($data)]; if (array_key_exists('flags', $options)) { $message_array['flags'] = $options['flags']; } @@ -90,6 +90,6 @@ class ClientStreamingCall extends AbstractCall $status = $event->status; $this->trailing_metadata = $status->metadata; - return [$this->deserializeResponse($event->message), $status]; + return [$this->_deserializeResponse($event->message), $status]; } } diff --git a/src/php/lib/Grpc/ServerStreamingCall.php b/src/php/lib/Grpc/ServerStreamingCall.php index 406512bf57..8659f6bc22 100644 --- a/src/php/lib/Grpc/ServerStreamingCall.php +++ b/src/php/lib/Grpc/ServerStreamingCall.php @@ -51,7 +51,7 @@ class ServerStreamingCall extends AbstractCall */ public function start($data, array $metadata = [], array $options = []) { - $message_array = ['message' => $this->serializeMessage($data)]; + $message_array = ['message' => $this->_serializeMessage($data)]; if (array_key_exists('flags', $options)) { $message_array['flags'] = $options['flags']; } @@ -73,7 +73,7 @@ class ServerStreamingCall extends AbstractCall OP_RECV_MESSAGE => true, ])->message; while ($response !== null) { - yield $this->deserializeResponse($response); + yield $this->_deserializeResponse($response); $response = $this->call->startBatch([ OP_RECV_MESSAGE => true, ])->message; diff --git a/src/php/lib/Grpc/UnaryCall.php b/src/php/lib/Grpc/UnaryCall.php index 3c1cb158ea..b8b1ed6eae 100644 --- a/src/php/lib/Grpc/UnaryCall.php +++ b/src/php/lib/Grpc/UnaryCall.php @@ -51,7 +51,7 @@ class UnaryCall extends AbstractCall */ public function start($data, array $metadata = [], array $options = []) { - $message_array = ['message' => $this->serializeMessage($data)]; + $message_array = ['message' => $this->_serializeMessage($data)]; if (isset($options['flags'])) { $message_array['flags'] = $options['flags']; } @@ -79,6 +79,6 @@ class UnaryCall extends AbstractCall $status = $event->status; $this->trailing_metadata = $status->metadata; - return [$this->deserializeResponse($event->message), $status]; + return [$this->_deserializeResponse($event->message), $status]; } } |