|
|
|
@ -52,7 +52,7 @@ |
|
|
|
|
#include <grpc/grpc_security.h> |
|
|
|
|
|
|
|
|
|
#include "completion_queue.h" |
|
|
|
|
#include "credentials.h" |
|
|
|
|
#include "channel_credentials.h" |
|
|
|
|
#include "server.h" |
|
|
|
|
#include "timeval.h" |
|
|
|
|
|
|
|
|
@ -125,14 +125,15 @@ void php_grpc_read_args_array(zval *args_array, grpc_channel_args *args) { |
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Construct an instance of the Channel class. If the $args array contains a |
|
|
|
|
* "credentials" key mapping to a Credentials object, a secure channel will be |
|
|
|
|
* created with those credentials. |
|
|
|
|
* "credentials" key mapping to a ChannelCredentials object, a secure channel |
|
|
|
|
* will be created with those credentials. |
|
|
|
|
* @param string $target The hostname to associate with this channel |
|
|
|
|
* @param array $args The arguments to pass to the Channel (optional) |
|
|
|
|
*/ |
|
|
|
|
PHP_METHOD(Channel, __construct) { |
|
|
|
|
wrapped_grpc_channel *channel = |
|
|
|
|
(wrapped_grpc_channel *)zend_object_store_get_object(getThis() TSRMLS_CC); |
|
|
|
|
(wrapped_grpc_channel *)zend_object_store_get_object( |
|
|
|
|
getThis() TSRMLS_CC); |
|
|
|
|
char *target; |
|
|
|
|
int target_length; |
|
|
|
|
zval *args_array = NULL; |
|
|
|
@ -153,7 +154,8 @@ PHP_METHOD(Channel, __construct) { |
|
|
|
|
array_hash = Z_ARRVAL_P(args_array); |
|
|
|
|
if (zend_hash_find(array_hash, "credentials", sizeof("credentials"), |
|
|
|
|
(void **)&creds_obj) == SUCCESS) { |
|
|
|
|
if (zend_get_class_entry(*creds_obj TSRMLS_CC) != grpc_ce_channel_credentials) { |
|
|
|
|
if (zend_get_class_entry(*creds_obj TSRMLS_CC) != |
|
|
|
|
grpc_ce_channel_credentials) { |
|
|
|
|
zend_throw_exception(spl_ce_InvalidArgumentException, |
|
|
|
|
"credentials must be a ChannelCredentials object", |
|
|
|
|
1 TSRMLS_CC); |
|
|
|
|