aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar Craig Tiller <ctiller@google.com>2016-04-05 17:21:05 -0700
committerGravatar Craig Tiller <ctiller@google.com>2016-04-05 17:21:05 -0700
commit0b541630192d676169b785488fc08c0e863fff62 (patch)
tree6c94668c28a28e98b59bbd39e365c4c2c8071dbe /src
parentf82ddc4c78ed602ff2135a45804d8fb3415198a6 (diff)
Fixing client_config init
Diffstat (limited to 'src')
-rw-r--r--src/core/ext/client_config/client_config_plugin.c25
-rw-r--r--src/core/lib/channel/channel_stack_builder.c5
-rw-r--r--src/core/lib/channel/channel_stack_builder.h4
-rw-r--r--src/core/lib/surface/init.c4
-rw-r--r--src/python/grpcio/grpc_core_dependencies.py1
5 files changed, 32 insertions, 7 deletions
diff --git a/src/core/ext/client_config/client_config_plugin.c b/src/core/ext/client_config/client_config_plugin.c
index 2ca72616d4..aac57b5e6a 100644
--- a/src/core/ext/client_config/client_config_plugin.c
+++ b/src/core/ext/client_config/client_config_plugin.c
@@ -32,10 +32,27 @@
*/
#include <limits.h>
+#include <stdbool.h>
+#include <string.h>
+
+#include "src/core/ext/client_config/client_channel.h"
+#include "src/core/ext/client_config/lb_policy_registry.h"
+#include "src/core/ext/client_config/resolver_registry.h"
+#include "src/core/ext/client_config/subchannel_index.h"
+#include "src/core/lib/surface/channel_init.h"
+
+#ifndef GRPC_DEFAULT_NAME_PREFIX
+#define GRPC_DEFAULT_NAME_PREFIX "dns:///"
+#endif
+
+static bool append_filter(grpc_channel_stack_builder *builder, void *arg) {
+ return grpc_channel_stack_builder_append_filter(
+ builder, (const grpc_channel_filter *)arg, NULL, NULL);
+}
static bool set_default_host_if_unset(grpc_channel_stack_builder *builder,
- void *arg) {
- grpc_channel_args *args =
+ void *unused) {
+ const grpc_channel_args *args =
grpc_channel_stack_builder_get_channel_arguments(builder);
for (size_t i = 0; i < args->num_args; i++) {
if (0 == strcmp(args->args[i].key, GRPC_ARG_DEFAULT_AUTHORITY)) {
@@ -45,9 +62,11 @@ static bool set_default_host_if_unset(grpc_channel_stack_builder *builder,
grpc_arg arg;
arg.type = GRPC_ARG_STRING;
arg.key = GRPC_ARG_DEFAULT_AUTHORITY;
- arg.value.string = grpc_get_default_authority();
+ arg.value.string = grpc_get_default_authority(
+ grpc_channel_stack_builder_get_target(builder));
grpc_channel_stack_builder_set_channel_arguments(
builder, grpc_channel_args_copy_and_add(args, &arg, 1));
+ return true;
}
void grpc_client_config_init(void) {
diff --git a/src/core/lib/channel/channel_stack_builder.c b/src/core/lib/channel/channel_stack_builder.c
index f7544c9fbf..831736ad7a 100644
--- a/src/core/lib/channel/channel_stack_builder.c
+++ b/src/core/lib/channel/channel_stack_builder.c
@@ -84,6 +84,11 @@ void grpc_channel_stack_builder_set_target(grpc_channel_stack_builder *b,
b->target = gpr_strdup(target);
}
+const char *grpc_channel_stack_builder_get_target(
+ grpc_channel_stack_builder *b) {
+ return b->target;
+}
+
static grpc_channel_stack_builder_iterator *create_iterator_at_filter_node(
grpc_channel_stack_builder *builder, filter_node *node) {
grpc_channel_stack_builder_iterator *it = gpr_malloc(sizeof(*it));
diff --git a/src/core/lib/channel/channel_stack_builder.h b/src/core/lib/channel/channel_stack_builder.h
index 752c65d573..0e6bfd9aa6 100644
--- a/src/core/lib/channel/channel_stack_builder.h
+++ b/src/core/lib/channel/channel_stack_builder.h
@@ -55,6 +55,10 @@ void grpc_channel_stack_builder_set_name(grpc_channel_stack_builder *builder,
/// Set the target uri
void grpc_channel_stack_builder_set_target(grpc_channel_stack_builder *b,
const char *target);
+
+const char *grpc_channel_stack_builder_get_target(
+ grpc_channel_stack_builder *b);
+
/// Attach \a transport to the builder (does not take ownership)
void grpc_channel_stack_builder_set_transport(
grpc_channel_stack_builder *builder, grpc_transport *transport);
diff --git a/src/core/lib/surface/init.c b/src/core/lib/surface/init.c
index 9c0448d422..06c5dd4a31 100644
--- a/src/core/lib/surface/init.c
+++ b/src/core/lib/surface/init.c
@@ -59,10 +59,6 @@
#include "src/core/lib/transport/connectivity_state.h"
#include "src/core/lib/transport/transport_impl.h"
-#ifndef GRPC_DEFAULT_NAME_PREFIX
-#define GRPC_DEFAULT_NAME_PREFIX "dns:///"
-#endif
-
/* (generated) built in registry of plugins */
extern void grpc_register_built_in_plugins(void);
diff --git a/src/python/grpcio/grpc_core_dependencies.py b/src/python/grpcio/grpc_core_dependencies.py
index ee5c34c849..62a0f463e2 100644
--- a/src/python/grpcio/grpc_core_dependencies.py
+++ b/src/python/grpcio/grpc_core_dependencies.py
@@ -87,6 +87,7 @@ CORE_SOURCE_FILES = [
'src/core/ext/client_config/client_channel.c',
'src/core/ext/client_config/client_channel_factory.c',
'src/core/ext/client_config/client_config.c',
+ 'src/core/ext/client_config/client_config_plugin.c',
'src/core/ext/client_config/connector.c',
'src/core/ext/client_config/default_initial_connect_string.c',
'src/core/ext/client_config/initial_connect_string.c',