diff options
author | Mark D. Roth <roth@google.com> | 2016-09-16 10:23:28 -0700 |
---|---|---|
committer | Mark D. Roth <roth@google.com> | 2016-09-16 10:23:28 -0700 |
commit | fef585f1be2dcc03ee813d1083a50e4ca0ba8486 (patch) | |
tree | 2b15d2ae64b04af32897f109e82c469dfae593f3 /src/core | |
parent | 6d5715867f737442805338a139a1fd91bd37238d (diff) |
Fix bugs from merge.
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/ext/client_config/lb_policy_factory.c | 9 | ||||
-rw-r--r-- | src/core/ext/client_config/lb_policy_factory.h | 2 | ||||
-rw-r--r-- | src/core/ext/client_config/resolver_result.c | 8 | ||||
-rw-r--r-- | src/core/ext/client_config/resolver_result.h | 2 |
4 files changed, 12 insertions, 9 deletions
diff --git a/src/core/ext/client_config/lb_policy_factory.c b/src/core/ext/client_config/lb_policy_factory.c index 88e8f15d99..2489505791 100644 --- a/src/core/ext/client_config/lb_policy_factory.c +++ b/src/core/ext/client_config/lb_policy_factory.c @@ -34,6 +34,7 @@ #include <string.h> #include <grpc/support/alloc.h> +#include <grpc/support/string_util.h> #include "src/core/ext/client_config/lb_policy_factory.h" @@ -50,10 +51,12 @@ grpc_lb_addresses* grpc_lb_addresses_copy(grpc_lb_addresses* addresses, void* (*user_data_copy)(void*)) { grpc_lb_addresses* new = grpc_lb_addresses_create(addresses->num_addresses); memcpy(new->addresses, addresses->addresses, - sizeof(grpc_address) * addresses->num_addresses); + sizeof(grpc_lb_address) * addresses->num_addresses); for (size_t i = 0; i < addresses->num_addresses; ++i) { - new->addresses[i].balancer_name = - gpr_strdup(new->addresses[i].balancer_name); + if (new->addresses[i].balancer_name != NULL) { + new->addresses[i].balancer_name = + gpr_strdup(new->addresses[i].balancer_name); + } if (user_data_copy != NULL) { new->addresses[i].user_data = user_data_copy(new->addresses[i].user_data); } diff --git a/src/core/ext/client_config/lb_policy_factory.h b/src/core/ext/client_config/lb_policy_factory.h index ac62dd9bc0..c9499d4f87 100644 --- a/src/core/ext/client_config/lb_policy_factory.h +++ b/src/core/ext/client_config/lb_policy_factory.h @@ -36,9 +36,9 @@ #include "src/core/ext/client_config/client_channel_factory.h" #include "src/core/ext/client_config/lb_policy.h" -#include "src/core/ext/client_config/resolver_result.h" #include "src/core/lib/iomgr/exec_ctx.h" +#include "src/core/lib/iomgr/resolve_address.h" typedef struct grpc_lb_policy_factory grpc_lb_policy_factory; typedef struct grpc_lb_policy_factory_vtable grpc_lb_policy_factory_vtable; diff --git a/src/core/ext/client_config/resolver_result.c b/src/core/ext/client_config/resolver_result.c index c07bd8b4da..59c9e7dc25 100644 --- a/src/core/ext/client_config/resolver_result.c +++ b/src/core/ext/client_config/resolver_result.c @@ -40,13 +40,13 @@ struct grpc_resolver_result { gpr_refcount refs; - grpc_addresses* addresses; + grpc_lb_addresses* addresses; char* lb_policy_name; grpc_channel_args* lb_policy_args; }; grpc_resolver_result* grpc_resolver_result_create( - grpc_addresses* addresses, const char* lb_policy_name, + grpc_lb_addresses* addresses, const char* lb_policy_name, grpc_channel_args* lb_policy_args) { grpc_resolver_result* result = gpr_malloc(sizeof(*result)); memset(result, 0, sizeof(*result)); @@ -64,14 +64,14 @@ void grpc_resolver_result_ref(grpc_resolver_result* result) { void grpc_resolver_result_unref(grpc_exec_ctx* exec_ctx, grpc_resolver_result* result) { if (gpr_unref(&result->refs)) { - grpc_addresses_destroy(result->addresses); + grpc_lb_addresses_destroy(result->addresses, NULL /* user_data_destroy */); gpr_free(result->lb_policy_name); grpc_channel_args_destroy(result->lb_policy_args); gpr_free(result); } } -grpc_addresses* grpc_resolver_result_get_addresses( +grpc_lb_addresses* grpc_resolver_result_get_addresses( grpc_resolver_result* result) { return result->addresses; } diff --git a/src/core/ext/client_config/resolver_result.h b/src/core/ext/client_config/resolver_result.h index e28a2f5bf3..d4118b90e8 100644 --- a/src/core/ext/client_config/resolver_result.h +++ b/src/core/ext/client_config/resolver_result.h @@ -57,7 +57,7 @@ void grpc_resolver_result_unref(grpc_exec_ctx* exec_ctx, grpc_resolver_result* result); /// Caller does NOT take ownership of result. -grpc_addresses* grpc_resolver_result_get_addresses( +grpc_lb_addresses* grpc_resolver_result_get_addresses( grpc_resolver_result* result); /// Caller does NOT take ownership of result. |