From 6822a7a4f647d54468e7042d0e1d1265db4e900f Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Tue, 6 Dec 2016 19:28:52 -0800 Subject: Make core_banned_functions.py pass again --- src/core/ext/client_channel/http_connect_handshaker.c | 11 +++++++---- src/core/ext/transport/chttp2/client/chttp2_connector.c | 3 ++- src/core/ext/transport/chttp2/server/chttp2_server.c | 3 ++- src/core/lib/channel/http_client_filter.c | 2 +- src/core/lib/http/httpcli_security_connector.c | 3 ++- src/core/lib/iomgr/tcp_uv.c | 2 +- src/core/lib/security/transport/security_handshaker.c | 13 +++++++------ 7 files changed, 22 insertions(+), 15 deletions(-) (limited to 'src/core') diff --git a/src/core/ext/client_channel/http_connect_handshaker.c b/src/core/ext/client_channel/http_connect_handshaker.c index 76e2c627ef..1e198cba97 100644 --- a/src/core/ext/client_channel/http_connect_handshaker.c +++ b/src/core/ext/client_channel/http_connect_handshaker.c @@ -44,6 +44,7 @@ #include "src/core/lib/channel/channel_args.h" #include "src/core/lib/http/format_request.h" #include "src/core/lib/http/parser.h" +#include "src/core/lib/slice/slice_internal.h" #include "src/core/lib/support/env.h" typedef struct http_connect_handshaker { @@ -82,12 +83,13 @@ static void http_connect_handshaker_unref(grpc_exec_ctx* exec_ctx, grpc_endpoint_destroy(exec_ctx, handshaker->endpoint_to_destroy); } if (handshaker->read_buffer_to_destroy != NULL) { - grpc_slice_buffer_destroy(handshaker->read_buffer_to_destroy); + grpc_slice_buffer_destroy_internal(exec_ctx, + handshaker->read_buffer_to_destroy); gpr_free(handshaker->read_buffer_to_destroy); } gpr_free(handshaker->proxy_server); gpr_free(handshaker->server_name); - grpc_slice_buffer_destroy(&handshaker->write_buffer); + grpc_slice_buffer_destroy_internal(exec_ctx, &handshaker->write_buffer); grpc_http_parser_destroy(&handshaker->http_parser); grpc_http_response_destroy(&handshaker->http_response); gpr_free(handshaker); @@ -193,7 +195,7 @@ static void on_read_done(grpc_exec_ctx* exec_ctx, void* arg, &handshaker->args->read_buffer->slices[i + 1], handshaker->args->read_buffer->count - i - 1); grpc_slice_buffer_swap(handshaker->args->read_buffer, &tmp_buffer); - grpc_slice_buffer_destroy(&tmp_buffer); + grpc_slice_buffer_destroy_internal(exec_ctx, &tmp_buffer); break; } } @@ -210,7 +212,8 @@ static void on_read_done(grpc_exec_ctx* exec_ctx, void* arg, // complete (e.g., handling chunked transfer encoding or looking // at the Content-Length: header). if (handshaker->http_parser.state != GRPC_HTTP_BODY) { - grpc_slice_buffer_reset_and_unref(handshaker->args->read_buffer); + grpc_slice_buffer_reset_and_unref_internal(exec_ctx, + handshaker->args->read_buffer); grpc_endpoint_read(exec_ctx, handshaker->args->endpoint, handshaker->args->read_buffer, &handshaker->response_read_closure); diff --git a/src/core/ext/transport/chttp2/client/chttp2_connector.c b/src/core/ext/transport/chttp2/client/chttp2_connector.c index 9927646b7a..f311b14f2b 100644 --- a/src/core/ext/transport/chttp2/client/chttp2_connector.c +++ b/src/core/ext/transport/chttp2/client/chttp2_connector.c @@ -48,6 +48,7 @@ #include "src/core/lib/channel/handshaker.h" #include "src/core/lib/iomgr/tcp_client.h" #include "src/core/lib/security/transport/security_connector.h" +#include "src/core/lib/slice/slice_internal.h" typedef struct { grpc_connector base; @@ -127,7 +128,7 @@ static void on_handshake_done(grpc_exec_ctx *exec_ctx, void *arg, grpc_endpoint_shutdown(exec_ctx, args->endpoint); grpc_endpoint_destroy(exec_ctx, args->endpoint); grpc_channel_args_destroy(exec_ctx, args->args); - grpc_slice_buffer_destroy(args->read_buffer); + grpc_slice_buffer_destroy_internal(exec_ctx, args->read_buffer); gpr_free(args->read_buffer); } else { error = GRPC_ERROR_REF(error); diff --git a/src/core/ext/transport/chttp2/server/chttp2_server.c b/src/core/ext/transport/chttp2/server/chttp2_server.c index 4a182146bf..4319454407 100644 --- a/src/core/ext/transport/chttp2/server/chttp2_server.c +++ b/src/core/ext/transport/chttp2/server/chttp2_server.c @@ -50,6 +50,7 @@ #include "src/core/lib/iomgr/endpoint.h" #include "src/core/lib/iomgr/resolve_address.h" #include "src/core/lib/iomgr/tcp_server.h" +#include "src/core/lib/slice/slice_internal.h" #include "src/core/lib/surface/api_trace.h" #include "src/core/lib/surface/server.h" @@ -149,7 +150,7 @@ static void on_handshake_done(grpc_exec_ctx *exec_ctx, void *arg, grpc_endpoint_shutdown(exec_ctx, args->endpoint); grpc_endpoint_destroy(exec_ctx, args->endpoint); grpc_channel_args_destroy(exec_ctx, args->args); - grpc_slice_buffer_destroy(args->read_buffer); + grpc_slice_buffer_destroy_internal(exec_ctx, args->read_buffer); gpr_free(args->read_buffer); } } else { diff --git a/src/core/lib/channel/http_client_filter.c b/src/core/lib/channel/http_client_filter.c index 3af999ec53..81310741ac 100644 --- a/src/core/lib/channel/http_client_filter.c +++ b/src/core/lib/channel/http_client_filter.c @@ -111,7 +111,7 @@ static grpc_mdelem *client_recv_filter(grpc_exec_ctx *exec_ctx, void *user_data, grpc_slice pct_decoded_msg = grpc_permissive_percent_decode_slice(md->value->slice); if (grpc_slice_is_equivalent(pct_decoded_msg, md->value->slice)) { - grpc_slice_unref(pct_decoded_msg); + grpc_slice_unref_internal(exec_ctx, pct_decoded_msg); return md; } else { return grpc_mdelem_from_metadata_strings( diff --git a/src/core/lib/http/httpcli_security_connector.c b/src/core/lib/http/httpcli_security_connector.c index 0a456ccc09..414383f8ca 100644 --- a/src/core/lib/http/httpcli_security_connector.c +++ b/src/core/lib/http/httpcli_security_connector.c @@ -41,6 +41,7 @@ #include "src/core/lib/channel/channel_args.h" #include "src/core/lib/security/transport/security_handshaker.h" +#include "src/core/lib/slice/slice_internal.h" #include "src/core/lib/support/string.h" #include "src/core/lib/tsi/ssl_transport_security.h" @@ -158,7 +159,7 @@ static void on_handshake_done(grpc_exec_ctx *exec_ctx, void *arg, c->func(exec_ctx, c->arg, NULL); } else { grpc_channel_args_destroy(exec_ctx, args->args); - grpc_slice_buffer_destroy(args->read_buffer); + grpc_slice_buffer_destroy_internal(exec_ctx, args->read_buffer); gpr_free(args->read_buffer); c->func(exec_ctx, c->arg, args->endpoint); } diff --git a/src/core/lib/iomgr/tcp_uv.c b/src/core/lib/iomgr/tcp_uv.c index 6e2ad1dbe9..257a4778c8 100644 --- a/src/core/lib/iomgr/tcp_uv.c +++ b/src/core/lib/iomgr/tcp_uv.c @@ -181,7 +181,7 @@ static void uv_endpoint_read(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep, GPR_ASSERT(tcp->read_cb == NULL); tcp->read_cb = cb; tcp->read_slices = read_slices; - grpc_slice_buffer_reset_and_unref(read_slices); + grpc_slice_buffer_reset_and_unref_internal(exec_ctx,read_slices); TCP_REF(tcp, "read"); // TODO(murgatroid99): figure out what the return value here means status = diff --git a/src/core/lib/security/transport/security_handshaker.c b/src/core/lib/security/transport/security_handshaker.c index 4a5bbb5402..e96c480044 100644 --- a/src/core/lib/security/transport/security_handshaker.c +++ b/src/core/lib/security/transport/security_handshaker.c @@ -45,6 +45,7 @@ #include "src/core/lib/security/context/security_context.h" #include "src/core/lib/security/transport/secure_endpoint.h" #include "src/core/lib/security/transport/tsi_error.h" +#include "src/core/lib/slice/slice_internal.h" #define GRPC_INITIAL_HANDSHAKE_BUFFER_SIZE 256 @@ -86,12 +87,12 @@ static void security_handshaker_unref(grpc_exec_ctx *exec_ctx, grpc_endpoint_destroy(exec_ctx, h->endpoint_to_destroy); } if (h->read_buffer_to_destroy != NULL) { - grpc_slice_buffer_destroy(h->read_buffer_to_destroy); + grpc_slice_buffer_destroy_internal(exec_ctx, h->read_buffer_to_destroy); gpr_free(h->read_buffer_to_destroy); } gpr_free(h->handshake_buffer); - grpc_slice_buffer_destroy(&h->left_overs); - grpc_slice_buffer_destroy(&h->outgoing); + grpc_slice_buffer_destroy_internal(exec_ctx, &h->left_overs); + grpc_slice_buffer_destroy_internal(exec_ctx, &h->outgoing); GRPC_AUTH_CONTEXT_UNREF(h->auth_context, "handshake"); GRPC_SECURITY_CONNECTOR_UNREF(exec_ctx, h->connector, "handshake"); gpr_free(h); @@ -163,7 +164,7 @@ static void on_peer_checked(grpc_exec_ctx *exec_ctx, void *arg, h->left_overs.length = 0; // Clear out the read buffer before it gets passed to the transport, // since any excess bytes were already copied to h->left_overs. - grpc_slice_buffer_reset_and_unref(h->args->read_buffer); + grpc_slice_buffer_reset_and_unref_internal(exec_ctx, h->args->read_buffer); // Add auth context to channel args. grpc_arg auth_context_arg = grpc_auth_context_to_arg(h->auth_context); grpc_channel_args *tmp_args = h->args->args; @@ -216,7 +217,7 @@ static grpc_error *send_handshake_bytes_to_peer_locked(grpc_exec_ctx *exec_ctx, // Send data. grpc_slice to_send = grpc_slice_from_copied_buffer((const char *)h->handshake_buffer, offset); - grpc_slice_buffer_reset_and_unref(&h->outgoing); + grpc_slice_buffer_reset_and_unref_internal(exec_ctx, &h->outgoing); grpc_slice_buffer_add(&h->outgoing, to_send); grpc_endpoint_write(exec_ctx, h->args->endpoint, &h->outgoing, &h->on_handshake_data_sent_to_peer); @@ -285,7 +286,7 @@ static void on_handshake_data_received_from_peer(grpc_exec_ctx *exec_ctx, grpc_slice_split_tail(&h->args->read_buffer->slices[i], consumed_slice_size)); /* split_tail above increments refcount. */ - grpc_slice_unref(h->args->read_buffer->slices[i]); + grpc_slice_unref_internal(exec_ctx, h->args->read_buffer->slices[i]); } grpc_slice_buffer_addn( &h->left_overs, &h->args->read_buffer->slices[i + 1], -- cgit v1.2.3