Added support for trailing metadata, fixed status support
Change on 2014/12/16 by mlumish <mlumish@google.com>
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=82239977
diff --git a/src/php/ext/grpc/call.c b/src/php/ext/grpc/call.c
index be7969f..cc87e21 100755
--- a/src/php/ext/grpc/call.c
+++ b/src/php/ext/grpc/call.c
@@ -376,12 +376,12 @@
long status_code;
int status_details_length;
long tag;
- grpc_status status;
+ char *status_details;
/* "lsl" == 1 long, 1 string, 1 long */
if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC,
"lsl",
&status_code,
- &status.details, &status_details_length,
+ &status_details, &status_details_length,
&tag) == FAILURE){
zend_throw_exception(
spl_ce_InvalidArgumentException,
@@ -389,9 +389,9 @@
1 TSRMLS_CC);
return;
}
- status.code = (gpr_uint32)status_code;
RETURN_LONG(grpc_call_start_write_status(call->wrapped,
- status,
+ (grpc_status_code)status_code,
+ status_details,
(void*)tag));
}
diff --git a/src/php/ext/grpc/event.c b/src/php/ext/grpc/event.c
index 8ec29c9..23ce2c8 100755
--- a/src/php/ext/grpc/event.c
+++ b/src/php/ext/grpc/event.c
@@ -130,7 +130,7 @@
case GRPC_FINISHED:
MAKE_STD_ZVAL(retval);
object_init(retval);
- add_property_long(retval, "code", event->data.finished.code);
+ add_property_long(retval, "code", event->data.finished.status);
if(event->data.finished.details == NULL){
add_property_null(retval, "details");
} else {
@@ -142,6 +142,9 @@
detail_string,
true);
}
+ add_property_zval(retval, "metadata", grpc_call_create_metadata_array(
+ event->data.finished.metadata_count,
+ event->data.finished.metadata_elements));
break;
case GRPC_SERVER_RPC_NEW:
MAKE_STD_ZVAL(retval);
diff --git a/src/php/lib/Grpc/ActiveCall.php b/src/php/lib/Grpc/ActiveCall.php
index 10a37cd..63877e3 100755
--- a/src/php/lib/Grpc/ActiveCall.php
+++ b/src/php/lib/Grpc/ActiveCall.php
@@ -87,8 +87,8 @@
/**
* Wait for the server to send the status, and return it.
- * @return object The status object, with integer $code and string $details
- * members
+ * @return object The status object, with integer $code, string $details,
+ * and array $metadata members
*/
public function getStatus() {
$status_event = $this->completion_queue->pluck(FINISHED,