فهرست منبع

Merge remote-tracking branch 'upstream/master'

Na-Na Pang 6 سال پیش
والد
کامیت
aab2b35bdd

+ 1 - 1
.github/ISSUE_TEMPLATE/bug_report.md

@@ -2,7 +2,7 @@
 name: Report a bug
 about: Create a report to help us improve
 labels: kind/bug, priority/P2
-assignees: veblush
+assignees: nicolasnoble
 
 ---
 

+ 1 - 1
.github/ISSUE_TEMPLATE/cleanup_request.md

@@ -2,7 +2,7 @@
 name: Request a cleanup
 about: Suggest a cleanup in our repository
 labels: kind/internal cleanup
-assignees: veblush
+assignees: nicolasnoble
 
 ---
 

+ 1 - 1
.github/ISSUE_TEMPLATE/feature_request.md

@@ -2,7 +2,7 @@
 name: Request a feature
 about: Suggest an idea for this project
 labels: kind/enhancement
-assignees: veblush
+assignees: nicolasnoble
 
 ---
 

+ 1 - 1
.github/pull_request_template.md

@@ -8,4 +8,4 @@ If you know who should review your pull request, please remove the mentioning be
 
 -->
 
-@veblush
+@nicolasnoble

+ 8 - 0
examples/cpp/helloworld/.gitignore

@@ -0,0 +1,8 @@
+*.o
+*.pb.cc
+*.pb.h
+greeter_client
+greeter_server
+greeter_async_client
+greeter_async_client2
+greeter_async_server

+ 0 - 13
include/grpcpp/impl/codegen/server_interface.h

@@ -266,12 +266,6 @@ class ServerInterface : public internal::CallHook {
               server, context, stream, call_cq, notification_cq, tag,
               registered_method->name(), registered_method->method_type()),
           registered_method_(registered_method),
-          server_(server),
-          context_(context),
-          stream_(stream),
-          call_cq_(call_cq),
-          notification_cq_(notification_cq),
-          tag_(tag),
           request_(request) {
       IssueRequest(registered_method->server_tag(), payload_.bbuf_ptr(),
                    notification_cq);
@@ -313,13 +307,6 @@ class ServerInterface : public internal::CallHook {
 
    private:
     internal::RpcServiceMethod* const registered_method_;
-    ServerInterface* const server_;
-    ::grpc_impl::ServerContext* const context_;
-    internal::ServerAsyncStreamingInterface* const stream_;
-    ::grpc_impl::CompletionQueue* const call_cq_;
-
-    ::grpc_impl::ServerCompletionQueue* const notification_cq_;
-    void* const tag_;
     Message* const request_;
     ByteBuffer payload_;
   };

+ 2 - 2
package.xml

@@ -10,7 +10,7 @@
   <email>grpc-packages@google.com</email>
   <active>yes</active>
  </lead>
- <date>2018-01-19</date>
+ <date>2019-09-24</date>
  <time>16:06:07</time>
  <version>
   <release>1.25.0dev</release>
@@ -22,7 +22,7 @@
  </stability>
  <license>Apache 2.0</license>
  <notes>
-- TBD
+- gRPC Core 1.25.0 update
  </notes>
  <contents>
   <dir baseinstalldir="/" name="/">

+ 2 - 2
src/core/ext/filters/client_channel/lb_policy/xds/xds_load_balancer_api.cc

@@ -66,7 +66,7 @@ bool XdsDropConfig::ShouldDrop(const UniquePtr<char>** category_name) const {
   return false;
 }
 
-grpc_slice XdsEdsRequestCreateAndEncode(const char* service_name) {
+grpc_slice XdsEdsRequestCreateAndEncode(const char* server_name) {
   upb::Arena arena;
   // Create a request.
   envoy_api_v2_DiscoveryRequest* request =
@@ -83,7 +83,7 @@ grpc_slice XdsEdsRequestCreateAndEncode(const char* service_name) {
       google_protobuf_Struct_FieldsEntry_mutable_value(field, arena.ptr());
   google_protobuf_Value_set_bool_value(value, true);
   envoy_api_v2_DiscoveryRequest_add_resource_names(
-      request, upb_strview_makez(service_name), arena.ptr());
+      request, upb_strview_makez(server_name), arena.ptr());
   envoy_api_v2_DiscoveryRequest_set_type_url(request,
                                              upb_strview_makez(kEdsTypeUrl));
   // Encode the request.

+ 1 - 1
src/core/ext/filters/client_channel/lb_policy/xds/xds_load_balancer_api.h

@@ -99,7 +99,7 @@ struct XdsUpdate {
 };
 
 // Creates an EDS request querying \a service_name.
-grpc_slice XdsEdsRequestCreateAndEncode(const char* service_name);
+grpc_slice XdsEdsRequestCreateAndEncode(const char* server_name);
 
 // Parses the EDS response and returns the args to update locality map. If there
 // is any error, the output update is invalid.

+ 46 - 18
src/php/ext/grpc/channel.c

@@ -98,6 +98,21 @@ php_grpc_zend_object create_wrapped_grpc_channel(zend_class_entry *class_type
   PHP_GRPC_FREE_CLASS_OBJECT(wrapped_grpc_channel, channel_ce_handlers);
 }
 
+static bool php_grpc_not_channel_arg_key(const char* key) {
+  static const char* ignoredKeys[] = {
+    "credentials",
+    "force_new",
+    "grpc_target_persist_bound",
+  };
+
+  for (int i = 0; i < sizeof(ignoredKeys) / sizeof(ignoredKeys[0]); i++) {
+    if (strcmp(key, ignoredKeys[i]) == 0) {
+      return true;
+    }
+  }
+  return false;
+}
+
 int php_grpc_read_args_array(zval *args_array,
                              grpc_channel_args *args TSRMLS_DC) {
   HashTable *array_hash;
@@ -108,8 +123,8 @@ int php_grpc_read_args_array(zval *args_array,
                          "array_hash is NULL", 1 TSRMLS_CC);
     return FAILURE;
   }
-  args->num_args = zend_hash_num_elements(array_hash);
-  args->args = ecalloc(args->num_args, sizeof(grpc_arg));
+
+  args->args = ecalloc(zend_hash_num_elements(array_hash), sizeof(grpc_arg));
   args_index = 0;
 
   char *key = NULL;
@@ -122,6 +137,11 @@ int php_grpc_read_args_array(zval *args_array,
                            "args keys must be strings", 1 TSRMLS_CC);
       return FAILURE;
     }
+
+    if (php_grpc_not_channel_arg_key(key)) {
+      continue;
+    }
+
     args->args[args_index].key = key;
     switch (Z_TYPE_P(data)) {
     case IS_LONG:
@@ -139,6 +159,7 @@ int php_grpc_read_args_array(zval *args_array,
     }
     args_index++;
   PHP_GRPC_HASH_FOREACH_END()
+  args->num_args = args_index;
   return SUCCESS;
 }
 
@@ -322,7 +343,6 @@ PHP_METHOD(Channel, __construct) {
                               (void **)&creds_obj) == SUCCESS) {
     if (Z_TYPE_P(creds_obj) == IS_NULL) {
       creds = NULL;
-      php_grpc_zend_hash_del(array_hash, "credentials", sizeof("credentials"));
     } else if (PHP_GRPC_GET_CLASS_ENTRY(creds_obj) !=
                grpc_ce_channel_credentials) {
       zend_throw_exception(spl_ce_InvalidArgumentException,
@@ -333,7 +353,6 @@ PHP_METHOD(Channel, __construct) {
       Z_ADDREF(*creds_obj);
       creds = PHP_GRPC_GET_WRAPPED_OBJECT(wrapped_grpc_channel_credentials,
                                           creds_obj);
-      php_grpc_zend_hash_del(array_hash, "credentials", sizeof("credentials"));
     }
   }
   if (php_grpc_zend_hash_find(array_hash, "force_new", sizeof("force_new"),
@@ -341,7 +360,6 @@ PHP_METHOD(Channel, __construct) {
     if (PHP_GRPC_BVAL_IS_TRUE(force_new_obj)) {
       force_new = true;
     }
-    php_grpc_zend_hash_del(array_hash, "force_new", sizeof("force_new"));
   }
 
   if (php_grpc_zend_hash_find(array_hash, "grpc_target_persist_bound",
@@ -353,8 +371,6 @@ PHP_METHOD(Channel, __construct) {
                            1 TSRMLS_CC);
     }
     target_upper_bound = (int)Z_LVAL_P(force_new_obj);
-    php_grpc_zend_hash_del(array_hash, "grpc_target_persist_bound",
-                           sizeof("grpc_target_persist_bound"));
   }
 
   // parse the rest of the channel args array
@@ -366,18 +382,31 @@ PHP_METHOD(Channel, __construct) {
   // Construct a hashkey for the persistent channel
   // Currently, the hashkey contains 3 parts:
   // 1. hostname
-  // 2. hash value of the channel args array (excluding "credentials"
-  //    and "force_new")
+  // 2. hash value of the channel args (args_array excluding "credentials",
+  //    "force_new" and "grpc_target_persist_bound")
   // 3. (optional) hash value of the ChannelCredentials object
-  php_serialize_data_t var_hash;
-  smart_str buf = {0};
-  PHP_VAR_SERIALIZE_INIT(var_hash);
-  PHP_GRPC_VAR_SERIALIZE(&buf, args_array, &var_hash);
-  PHP_VAR_SERIALIZE_DESTROY(var_hash);
 
-  char sha1str[41];
-  generate_sha1_str(sha1str, PHP_GRPC_SERIALIZED_BUF_STR(buf),
-                    PHP_GRPC_SERIALIZED_BUF_LEN(buf));
+  char sha1str[41] = { 0 };
+  unsigned char digest[20] = { 0 };
+  PHP_SHA1_CTX context;
+  PHP_SHA1Init(&context);
+  for (int i = 0; i < args.num_args; i++) {
+    PHP_GRPC_SHA1Update(&context, args.args[i].key, strlen(args.args[i].key) + 1);
+    switch (args.args[i].type) {
+    case GRPC_ARG_INTEGER:
+      PHP_GRPC_SHA1Update(&context, &args.args[i].value.integer, 4);
+      break;
+    case GRPC_ARG_STRING:
+      PHP_GRPC_SHA1Update(&context, args.args[i].value.string, strlen(args.args[i].value.string) + 1);
+      break;
+    default:
+      zend_throw_exception(spl_ce_InvalidArgumentException,
+                           "args values must be int or string", 1 TSRMLS_CC);
+      return;
+    }
+  };
+  PHP_SHA1Final(digest, &context);
+  make_sha1_digest(sha1str, digest);
 
   php_grpc_int key_len = target_length + strlen(sha1str);
   if (creds != NULL && creds->hashstr != NULL) {
@@ -405,7 +434,6 @@ PHP_METHOD(Channel, __construct) {
   }
 
   gpr_mu_init(&channel->wrapper->mu);
-  smart_str_free(&buf);
   if (force_new || (creds != NULL && creds->has_call_creds)) {
     // If the ChannelCredentials object was composed with a CallCredentials
     // object, there is no way we can tell them apart. Do NOT persist

+ 2 - 2
templates/package.xml.template

@@ -12,7 +12,7 @@
     <email>grpc-packages@google.com</email>
     <active>yes</active>
    </lead>
-   <date>2018-01-19</date>
+   <date>2019-09-24</date>
    <time>16:06:07</time>
    <version>
     <release>${settings.php_version.php()}</release>
@@ -24,7 +24,7 @@
    </stability>
    <license>Apache 2.0</license>
    <notes>
-  - TBD
+  - gRPC Core ${settings.php_version.php_composer()} update
    </notes>
    <contents>
     <dir baseinstalldir="/" name="/">

+ 3 - 1
templates/tools/dockerfile/interoptest/grpc_interop_aspnetcore/build_interop.sh.template

@@ -39,4 +39,6 @@
     ln -s $(pwd)/.dotnet/dotnet /usr/local/bin/dotnet
   fi
 
-  dotnet build --configuration Debug Grpc.DotNet.sln
+  # Cloning from a local path sets RepositoryUrl to a path and breaks Source Link.
+  # Override RepositoryUrl to a URL to fix Source Link. The value doesn't matter.
+  dotnet build --configuration Debug Grpc.DotNet.sln -p:RepositoryUrl=https://github.com/grpc/grpc-dotnet.git

+ 3 - 1
tools/dockerfile/interoptest/grpc_interop_aspnetcore/build_interop.sh

@@ -37,4 +37,6 @@ then
   ln -s $(pwd)/.dotnet/dotnet /usr/local/bin/dotnet
 fi
 
-dotnet build --configuration Debug Grpc.DotNet.sln
+# Cloning from a local path sets RepositoryUrl to a path and breaks Source Link.
+# Override RepositoryUrl to a URL to fix Source Link. The value doesn't matter.
+dotnet build --configuration Debug Grpc.DotNet.sln -p:RepositoryUrl=https://github.com/grpc/grpc-dotnet.git