diff options
author | 2016-11-16 14:58:05 -0800 | |
---|---|---|
committer | 2016-11-16 14:58:05 -0800 | |
commit | f9b56b93f76f50c85b1897f2732d1a5bbf6727b1 (patch) | |
tree | 4abbfed39306357e32b2ed8ec19314c48a7e54f5 /src/core/ext/transport | |
parent | 411297b9a154eefccaadc2c40c06102f9e331507 (diff) |
Change grpc_handshaker_args to be owned by the handshake manager.
Also clean up hand-off semantics of endpoints.
Diffstat (limited to 'src/core/ext/transport')
4 files changed, 6 insertions, 9 deletions
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 c4c1e638a9..e0bce57fc2 100644 --- a/src/core/ext/transport/chttp2/client/insecure/channel_create.c +++ b/src/core/ext/transport/chttp2/client/insecure/channel_create.c @@ -97,6 +97,7 @@ static void on_handshake_done(grpc_exec_ctx *exec_ctx, void *arg, grpc_handshaker_args *args = arg; connector *c = args->user_data; if (error != GRPC_ERROR_NONE) { + grpc_endpoint_destroy(exec_ctx, args->endpoint); grpc_channel_args_destroy(args->args); gpr_free(args->read_buffer); } else { @@ -107,7 +108,6 @@ static void on_handshake_done(grpc_exec_ctx *exec_ctx, void *arg, args->read_buffer); c->result->channel_args = args->args; } - gpr_free(args); grpc_closure *notify = c->notify; c->notify = NULL; grpc_exec_ctx_sched(exec_ctx, notify, GRPC_ERROR_REF(error), NULL); 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 5101737e11..4182aa730f 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 @@ -135,6 +135,7 @@ static void on_handshake_done(grpc_exec_ctx *exec_ctx, void *arg, connector *c = args->user_data; c->tmp_args = args->args; if (error != GRPC_ERROR_NONE) { + grpc_endpoint_destroy(exec_ctx, args->endpoint); gpr_free(args->read_buffer); grpc_closure *notify = c->notify; c->notify = NULL; @@ -147,7 +148,6 @@ static void on_handshake_done(grpc_exec_ctx *exec_ctx, void *arg, exec_ctx, c->security_connector, args->endpoint, args->read_buffer, c->args.deadline, on_secure_handshake_done, c); } - gpr_free(args); } static void on_initial_connect_string_sent(grpc_exec_ctx *exec_ctx, void *arg, diff --git a/src/core/ext/transport/chttp2/server/insecure/server_chttp2.c b/src/core/ext/transport/chttp2/server/insecure/server_chttp2.c index 669a3869ab..5a9d4f8928 100644 --- a/src/core/ext/transport/chttp2/server/insecure/server_chttp2.c +++ b/src/core/ext/transport/chttp2/server/insecure/server_chttp2.c @@ -62,7 +62,7 @@ static void on_handshake_done(grpc_exec_ctx *exec_ctx, void *arg, const char *error_str = grpc_error_string(error); gpr_log(GPR_ERROR, "Handshaking failed: %s", error_str); grpc_error_free_string(error_str); - grpc_handshake_manager_shutdown(exec_ctx, state->handshake_mgr); + grpc_endpoint_destroy(exec_ctx, args->endpoint); gpr_free(args->read_buffer); } else { // Beware that the call to grpc_create_chttp2_transport() has to happen @@ -79,7 +79,6 @@ static void on_handshake_done(grpc_exec_ctx *exec_ctx, void *arg, } // Clean up. grpc_channel_args_destroy(args->args); - gpr_free(args); grpc_handshake_manager_destroy(exec_ctx, state->handshake_mgr); gpr_free(state); } diff --git a/src/core/ext/transport/chttp2/server/secure/server_secure_chttp2.c b/src/core/ext/transport/chttp2/server/secure/server_secure_chttp2.c index c7980780f3..1d1973be8b 100644 --- a/src/core/ext/transport/chttp2/server/secure/server_secure_chttp2.c +++ b/src/core/ext/transport/chttp2/server/secure/server_secure_chttp2.c @@ -123,17 +123,14 @@ static void on_handshake_done(grpc_exec_ctx *exec_ctx, void *arg, const char *error_str = grpc_error_string(error); gpr_log(GPR_ERROR, "Handshaking failed: %s", error_str); grpc_error_free_string(error_str); + grpc_endpoint_destroy(exec_ctx, args->endpoint); grpc_channel_args_destroy(args->args); gpr_free(args->read_buffer); - gpr_free(args); - grpc_handshake_manager_shutdown(exec_ctx, connection_state->handshake_mgr); grpc_handshake_manager_destroy(exec_ctx, connection_state->handshake_mgr); grpc_tcp_server_unref(exec_ctx, connection_state->server_state->tcp); gpr_free(connection_state); return; } - grpc_handshake_manager_destroy(exec_ctx, connection_state->handshake_mgr); - connection_state->handshake_mgr = NULL; // TODO(roth, jboeuf): Convert security connector handshaking to use new // handshake API, and then move the code from on_secure_handshake_done() // into this function. @@ -142,7 +139,8 @@ static void on_handshake_done(grpc_exec_ctx *exec_ctx, void *arg, exec_ctx, connection_state->server_state->sc, connection_state->acceptor, args->endpoint, args->read_buffer, connection_state->deadline, on_secure_handshake_done, connection_state); - gpr_free(args); + grpc_handshake_manager_destroy(exec_ctx, connection_state->handshake_mgr); + connection_state->handshake_mgr = NULL; } static void on_accept(grpc_exec_ctx *exec_ctx, void *statep, grpc_endpoint *tcp, |