diff options
author | ncteisen <ncteisen@gmail.com> | 2017-06-12 09:06:24 -0700 |
---|---|---|
committer | ncteisen <ncteisen@gmail.com> | 2017-06-12 09:06:24 -0700 |
commit | 63068f3a7c678b9d7d42b85c010962f6878f24bb (patch) | |
tree | e20265c791cfececf6b6893e25276cd5fc6d16b5 /src/core/ext | |
parent | f8061e88eaee4973ceb82319cdb987741534dd8f (diff) | |
parent | 65b2ff9418b0cd97ff7d8bda2409ea6c7937b9a0 (diff) |
Merge branch 'master' of https://github.com/grpc/grpc into tracing-overhaul
Diffstat (limited to 'src/core/ext')
10 files changed, 24 insertions, 49 deletions
diff --git a/src/core/ext/filters/client_channel/client_channel_factory.c b/src/core/ext/filters/client_channel/client_channel_factory.c index 04bb4d5a2d..7220a8639e 100644 --- a/src/core/ext/filters/client_channel/client_channel_factory.c +++ b/src/core/ext/filters/client_channel/client_channel_factory.c @@ -17,6 +17,7 @@ */ #include "src/core/ext/filters/client_channel/client_channel_factory.h" +#include "src/core/lib/channel/channel_args.h" void grpc_client_channel_factory_ref(grpc_client_channel_factory* factory) { factory->vtable->ref(factory); @@ -63,10 +64,6 @@ static const grpc_arg_pointer_vtable factory_arg_vtable = { grpc_arg grpc_client_channel_factory_create_channel_arg( grpc_client_channel_factory* factory) { - grpc_arg arg; - arg.type = GRPC_ARG_POINTER; - arg.key = GRPC_ARG_CLIENT_CHANNEL_FACTORY; - arg.value.pointer.p = factory; - arg.value.pointer.vtable = &factory_arg_vtable; - return arg; + return grpc_channel_arg_pointer_create(GRPC_ARG_CLIENT_CHANNEL_FACTORY, + factory, &factory_arg_vtable); } diff --git a/src/core/ext/filters/client_channel/client_channel_plugin.c b/src/core/ext/filters/client_channel/client_channel_plugin.c index 5dc1441344..60e77d6268 100644 --- a/src/core/ext/filters/client_channel/client_channel_plugin.c +++ b/src/core/ext/filters/client_channel/client_channel_plugin.c @@ -54,10 +54,8 @@ static bool set_default_host_if_unset(grpc_exec_ctx *exec_ctx, char *default_authority = grpc_get_default_authority( exec_ctx, grpc_channel_stack_builder_get_target(builder)); if (default_authority != NULL) { - grpc_arg arg; - arg.type = GRPC_ARG_STRING; - arg.key = GRPC_ARG_DEFAULT_AUTHORITY; - arg.value.string = default_authority; + grpc_arg arg = grpc_channel_arg_string_create(GRPC_ARG_DEFAULT_AUTHORITY, + default_authority); grpc_channel_args *new_args = grpc_channel_args_copy_and_add(args, &arg, 1); grpc_channel_stack_builder_set_channel_arguments(exec_ctx, builder, new_args); diff --git a/src/core/ext/filters/client_channel/http_proxy.c b/src/core/ext/filters/client_channel/http_proxy.c index b8332980e5..cfb5ec6f00 100644 --- a/src/core/ext/filters/client_channel/http_proxy.c +++ b/src/core/ext/filters/client_channel/http_proxy.c @@ -80,10 +80,9 @@ static bool proxy_mapper_map_name(grpc_exec_ctx* exec_ctx, grpc_uri_destroy(uri); return false; } - grpc_arg new_arg; - new_arg.key = GRPC_ARG_HTTP_CONNECT_SERVER; - new_arg.type = GRPC_ARG_STRING; - new_arg.value.string = uri->path[0] == '/' ? uri->path + 1 : uri->path; + grpc_arg new_arg = grpc_channel_arg_string_create( + GRPC_ARG_HTTP_CONNECT_SERVER, + uri->path[0] == '/' ? uri->path + 1 : uri->path); *new_args = grpc_channel_args_copy_and_add(args, &new_arg, 1); grpc_uri_destroy(uri); return true; diff --git a/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.c b/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.c index cf442ce669..5a5ff2902d 100644 --- a/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.c +++ b/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.c @@ -974,10 +974,8 @@ static grpc_lb_policy *glb_create(grpc_exec_ctx *exec_ctx, // Make sure that GRPC_ARG_LB_POLICY_NAME is set in channel args, // since we use this to trigger the client_load_reporting filter. - grpc_arg new_arg; - new_arg.key = GRPC_ARG_LB_POLICY_NAME; - new_arg.type = GRPC_ARG_STRING; - new_arg.value.string = "grpclb"; + grpc_arg new_arg = + grpc_channel_arg_string_create(GRPC_ARG_LB_POLICY_NAME, "grpclb"); static const char *args_to_remove[] = {GRPC_ARG_LB_POLICY_NAME}; glb_policy->args = grpc_channel_args_copy_and_add_and_remove( args->args, args_to_remove, GPR_ARRAY_SIZE(args_to_remove), &new_arg, 1); diff --git a/src/core/ext/filters/client_channel/lb_policy_factory.c b/src/core/ext/filters/client_channel/lb_policy_factory.c index abac0fd7b4..538d8d65ed 100644 --- a/src/core/ext/filters/client_channel/lb_policy_factory.c +++ b/src/core/ext/filters/client_channel/lb_policy_factory.c @@ -138,12 +138,8 @@ static const grpc_arg_pointer_vtable lb_addresses_arg_vtable = { grpc_arg grpc_lb_addresses_create_channel_arg( const grpc_lb_addresses* addresses) { - grpc_arg arg; - arg.type = GRPC_ARG_POINTER; - arg.key = GRPC_ARG_LB_ADDRESSES; - arg.value.pointer.p = (void*)addresses; - arg.value.pointer.vtable = &lb_addresses_arg_vtable; - return arg; + return grpc_channel_arg_pointer_create( + GRPC_ARG_LB_ADDRESSES, (void*)addresses, &lb_addresses_arg_vtable); } grpc_lb_addresses* grpc_lb_addresses_find_channel_arg( diff --git a/src/core/ext/filters/client_channel/subchannel.c b/src/core/ext/filters/client_channel/subchannel.c index c85b31002e..31a38b08ae 100644 --- a/src/core/ext/filters/client_channel/subchannel.c +++ b/src/core/ext/filters/client_channel/subchannel.c @@ -809,10 +809,7 @@ const char *grpc_get_subchannel_address_uri_arg(const grpc_channel_args *args) { } grpc_arg grpc_create_subchannel_address_arg(const grpc_resolved_address *addr) { - grpc_arg new_arg; - new_arg.key = GRPC_ARG_SUBCHANNEL_ADDRESS; - new_arg.type = GRPC_ARG_STRING; - new_arg.value.string = - addr->len > 0 ? grpc_sockaddr_to_uri(addr) : gpr_strdup(""); - return new_arg; + return grpc_channel_arg_string_create( + GRPC_ARG_SUBCHANNEL_ADDRESS, + addr->len > 0 ? grpc_sockaddr_to_uri(addr) : gpr_strdup("")); } diff --git a/src/core/ext/filters/load_reporting/load_reporting.c b/src/core/ext/filters/load_reporting/load_reporting.c index a97322ee1d..9745763c91 100644 --- a/src/core/ext/filters/load_reporting/load_reporting.c +++ b/src/core/ext/filters/load_reporting/load_reporting.c @@ -50,11 +50,7 @@ static bool maybe_add_load_reporting_filter(grpc_exec_ctx *exec_ctx, } grpc_arg grpc_load_reporting_enable_arg() { - grpc_arg arg; - arg.type = GRPC_ARG_INTEGER; - arg.key = GRPC_ARG_ENABLE_LOAD_REPORTING; - arg.value.integer = 1; - return arg; + return grpc_channel_arg_integer_create(GRPC_ARG_ENABLE_LOAD_REPORTING, 1); } /* Plugin registration */ diff --git a/src/core/ext/transport/chttp2/client/insecure/channel_create.c b/src/core/ext/transport/chttp2/client/insecure/channel_create.c index 99bae76237..cccb347bf1 100644 --- a/src/core/ext/transport/chttp2/client/insecure/channel_create.c +++ b/src/core/ext/transport/chttp2/client/insecure/channel_create.c @@ -54,11 +54,9 @@ static grpc_channel *client_channel_factory_create_channel( return NULL; } // Add channel arg containing the server URI. - grpc_arg arg; - arg.type = GRPC_ARG_STRING; - arg.key = GRPC_ARG_SERVER_URI; - arg.value.string = - grpc_resolver_factory_add_default_prefix_if_needed(exec_ctx, target); + grpc_arg arg = grpc_channel_arg_string_create( + GRPC_ARG_SERVER_URI, + grpc_resolver_factory_add_default_prefix_if_needed(exec_ctx, target)); const char *to_remove[] = {GRPC_ARG_SERVER_URI}; grpc_channel_args *new_args = grpc_channel_args_copy_and_add_and_remove(args, to_remove, 1, &arg, 1); diff --git a/src/core/ext/transport/chttp2/client/insecure/channel_create_posix.c b/src/core/ext/transport/chttp2/client/insecure/channel_create_posix.c index 05145aeb2f..0346d50b6c 100644 --- a/src/core/ext/transport/chttp2/client/insecure/channel_create_posix.c +++ b/src/core/ext/transport/chttp2/client/insecure/channel_create_posix.c @@ -41,10 +41,8 @@ grpc_channel *grpc_insecure_channel_create_from_fd( GRPC_API_TRACE("grpc_insecure_channel_create(target=%p, fd=%d, args=%p)", 3, (target, fd, args)); - grpc_arg default_authority_arg; - default_authority_arg.type = GRPC_ARG_STRING; - default_authority_arg.key = GRPC_ARG_DEFAULT_AUTHORITY; - default_authority_arg.value.string = "test.authority"; + grpc_arg default_authority_arg = grpc_channel_arg_string_create( + GRPC_ARG_DEFAULT_AUTHORITY, "test.authority"); grpc_channel_args *final_args = grpc_channel_args_copy_and_add(args, &default_authority_arg, 1); diff --git a/src/core/ext/transport/chttp2/client/secure/secure_channel_create.c b/src/core/ext/transport/chttp2/client/secure/secure_channel_create.c index 7b76caba17..d4580f15f5 100644 --- a/src/core/ext/transport/chttp2/client/secure/secure_channel_create.c +++ b/src/core/ext/transport/chttp2/client/secure/secure_channel_create.c @@ -163,11 +163,9 @@ static grpc_channel *client_channel_factory_create_channel( return NULL; } // Add channel arg containing the server URI. - grpc_arg arg; - arg.type = GRPC_ARG_STRING; - arg.key = GRPC_ARG_SERVER_URI; - arg.value.string = - grpc_resolver_factory_add_default_prefix_if_needed(exec_ctx, target); + grpc_arg arg = grpc_channel_arg_string_create( + GRPC_ARG_SERVER_URI, + grpc_resolver_factory_add_default_prefix_if_needed(exec_ctx, target)); const char *to_remove[] = {GRPC_ARG_SERVER_URI}; grpc_channel_args *new_args = grpc_channel_args_copy_and_add_and_remove(args, to_remove, 1, &arg, 1); |