diff options
author | yang-g <yangg@google.com> | 2015-11-05 23:14:07 -0800 |
---|---|---|
committer | yang-g <yangg@google.com> | 2015-11-05 23:14:07 -0800 |
commit | 074c6fc1b37c954539aecc2039b2e386965abdf1 (patch) | |
tree | 3e6436e7b92f947416d819dbfcc60c9ccecffd00 /src/core/surface | |
parent | a6124120ae5ece38d39ebb0178c5877e5f940e80 (diff) |
add insecure version
Diffstat (limited to 'src/core/surface')
-rw-r--r-- | src/core/surface/channel_create.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/core/surface/channel_create.c b/src/core/surface/channel_create.c index 51d9130b63..3291ac3a4a 100644 --- a/src/core/surface/channel_create.c +++ b/src/core/surface/channel_create.c @@ -37,6 +37,8 @@ #include <string.h> #include <grpc/support/alloc.h> +#include <grpc/support/slice.h> +#include <grpc/support/slice_buffer.h> #include "src/core/census/grpc_filter.h" #include "src/core/channel/channel_args.h" @@ -56,6 +58,8 @@ typedef struct { grpc_closure *notify; grpc_connect_in_args args; grpc_connect_out_args *result; + grpc_closure initial_string_sent; + gpr_slice_buffer initial_string_buffer; grpc_endpoint *tcp; @@ -73,15 +77,26 @@ static void connector_unref(grpc_exec_ctx *exec_ctx, grpc_connector *con) { connector *c = (connector *)con; if (gpr_unref(&c->refs)) { grpc_mdctx_unref(c->mdctx); + /* c->initial_string_buffer does not need to be destroyed */ gpr_free(c); } } +static void do_nothing(grpc_exec_ctx *exec_ctx, void *arg, int success) {} + static void connected(grpc_exec_ctx *exec_ctx, void *arg, int success) { connector *c = arg; grpc_closure *notify; grpc_endpoint *tcp = c->tcp; if (tcp != NULL) { + if (!GPR_SLICE_IS_EMPTY(c->args.initial_connect_string)) { + grpc_closure_init(&c->initial_string_sent, do_nothing, NULL); + gpr_slice_buffer_init(&c->initial_string_buffer); + gpr_slice_buffer_add(&c->initial_string_buffer, + c->args.initial_connect_string); + grpc_endpoint_write(exec_ctx, tcp, &c->initial_string_buffer, + &c->initial_string_sent); + } c->result->transport = grpc_create_chttp2_transport( exec_ctx, c->args.channel_args, tcp, c->mdctx, 1); grpc_chttp2_transport_start_reading(exec_ctx, c->result->transport, NULL, |