aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/surface/lame_client.c
diff options
context:
space:
mode:
authorGravatar Craig Tiller <ctiller@google.com>2016-02-17 20:54:46 -0800
committerGravatar Craig Tiller <ctiller@google.com>2016-02-17 20:54:46 -0800
commit178edfae2be7014abce0998ca6c34babc65df499 (patch)
tree9ef0028ad1c54cf6729086a9067813da9c9d641f /src/core/surface/lame_client.c
parentc15cd723ebabbab4825480032b56a2ddd9a8b76b (diff)
Decouple filter selection from channel construction
Allow plugins to extend the set of filters used by gRPC core: - plugins at construction time can register against the 'channel_init' system to be allowed to mutate a new channel_stack_builder type - channel_stack_builder provides a central and rather dynamic place to construct the list of filters required by a channel stack - ultimately we construct the channel stack in the fashion we always have This is also a prerequisite step to allowing filters to be implemented from wrapped languages.
Diffstat (limited to 'src/core/surface/lame_client.c')
-rw-r--r--src/core/surface/lame_client.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/core/surface/lame_client.c b/src/core/surface/lame_client.c
index 537069e984..58f89946d2 100644
--- a/src/core/surface/lame_client.c
+++ b/src/core/surface/lame_client.c
@@ -31,6 +31,8 @@
*
*/
+#include "src/core/surface/lame_client.h"
+
#include <grpc/grpc.h>
#include <string.h>
@@ -115,7 +117,7 @@ static void init_channel_elem(grpc_exec_ctx *exec_ctx,
static void destroy_channel_elem(grpc_exec_ctx *exec_ctx,
grpc_channel_element *elem) {}
-static const grpc_channel_filter lame_filter = {
+const grpc_channel_filter grpc_lame_filter = {
lame_start_transport_stream_op, lame_start_transport_op, sizeof(call_data),
init_call_elem, grpc_call_stack_ignore_set_pollset, destroy_call_elem,
sizeof(channel_data), init_channel_elem, destroy_channel_elem,
@@ -127,19 +129,17 @@ static const grpc_channel_filter lame_filter = {
grpc_channel *grpc_lame_client_channel_create(const char *target,
grpc_status_code error_code,
const char *error_message) {
- grpc_channel *channel;
+ grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_channel_element *elem;
channel_data *chand;
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- static const grpc_channel_filter *filters[] = {&lame_filter};
- channel =
- grpc_channel_create_from_filters(&exec_ctx, target, filters, 1, NULL, 1);
+ grpc_channel *channel = grpc_channel_create(&exec_ctx, target, NULL,
+ GRPC_CLIENT_LAME_CHANNEL, NULL);
elem = grpc_channel_stack_element(grpc_channel_get_channel_stack(channel), 0);
GRPC_API_TRACE(
"grpc_lame_client_channel_create(target=%s, error_code=%d, "
"error_message=%s)",
3, (target, (int)error_code, error_message));
- GPR_ASSERT(elem->filter == &lame_filter);
+ GPR_ASSERT(elem->filter == &grpc_lame_filter);
chand = (channel_data *)elem->channel_data;
chand->error_code = error_code;
chand->error_message = error_message;