From 6f5e358da7f3ba2de1dbfeafa7116adf093c073b Mon Sep 17 00:00:00 2001 From: Yash Tibrewal Date: Tue, 10 Sep 2019 16:46:06 -0700 Subject: [PATCH 1/2] Rename filter functions to be able to uniquely identify them --- .../grpclb/client_load_reporting_filter.cc | 28 ++++++------- .../ext/filters/deadline/deadline_filter.cc | 40 +++++++++---------- .../filters/http/client/http_client_filter.cc | 24 +++++------ .../filters/http/client_authority_filter.cc | 28 ++++++------- .../message_compress_filter.cc | 24 +++++------ .../ext/filters/max_age/max_age_filter.cc | 24 +++++------ .../message_size/message_size_filter.cc | 28 ++++++------- .../workaround_cronet_compression_filter.cc | 29 +++++++------- .../security/transport/client_auth_filter.cc | 34 ++++++++-------- .../security/transport/server_auth_filter.cc | 28 ++++++------- src/core/lib/surface/lame_client.cc | 24 +++++------ 11 files changed, 156 insertions(+), 155 deletions(-) diff --git a/src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.cc b/src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.cc index 3057b26d315..09dd75b041f 100644 --- a/src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.cc +++ b/src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.cc @@ -30,12 +30,12 @@ #include "src/core/lib/iomgr/error.h" #include "src/core/lib/profiling/timers.h" -static grpc_error* init_channel_elem(grpc_channel_element* elem, - grpc_channel_element_args* args) { +static grpc_error* clr_init_channel_elem(grpc_channel_element* elem, + grpc_channel_element_args* args) { return GRPC_ERROR_NONE; } -static void destroy_channel_elem(grpc_channel_element* elem) {} +static void clr_destroy_channel_elem(grpc_channel_element* elem) {} namespace { @@ -71,16 +71,16 @@ static void recv_initial_metadata_ready(void* arg, grpc_error* error) { GRPC_ERROR_REF(error)); } -static grpc_error* init_call_elem(grpc_call_element* elem, - const grpc_call_element_args* args) { +static grpc_error* clr_init_call_elem(grpc_call_element* elem, + const grpc_call_element_args* args) { GPR_ASSERT(args->context != nullptr); new (elem->call_data) call_data(); return GRPC_ERROR_NONE; } -static void destroy_call_elem(grpc_call_element* elem, - const grpc_call_final_info* final_info, - grpc_closure* ignored) { +static void clr_destroy_call_elem(grpc_call_element* elem, + const grpc_call_final_info* final_info, + grpc_closure* ignored) { call_data* calld = static_cast(elem->call_data); if (calld->client_stats != nullptr) { // Record call finished, optionally setting client_failed_to_send and @@ -92,7 +92,7 @@ static void destroy_call_elem(grpc_call_element* elem, calld->~call_data(); } -static void start_transport_stream_op_batch( +static void clr_start_transport_stream_op_batch( grpc_call_element* elem, grpc_transport_stream_op_batch* batch) { call_data* calld = static_cast(elem->call_data); GPR_TIMER_SCOPE("clr_start_transport_stream_op_batch", 0); @@ -142,14 +142,14 @@ static void start_transport_stream_op_batch( } const grpc_channel_filter grpc_client_load_reporting_filter = { - start_transport_stream_op_batch, + clr_start_transport_stream_op_batch, grpc_channel_next_op, sizeof(call_data), - init_call_elem, + clr_init_call_elem, grpc_call_stack_ignore_set_pollset_or_pollset_set, - destroy_call_elem, + clr_destroy_call_elem, 0, // sizeof(channel_data) - init_channel_elem, - destroy_channel_elem, + clr_init_channel_elem, + clr_destroy_channel_elem, grpc_channel_next_get_info, "client_load_reporting"}; diff --git a/src/core/ext/filters/deadline/deadline_filter.cc b/src/core/ext/filters/deadline/deadline_filter.cc index 20a2953e5ff..d6c2b8e2588 100644 --- a/src/core/ext/filters/deadline/deadline_filter.cc +++ b/src/core/ext/filters/deadline/deadline_filter.cc @@ -233,14 +233,14 @@ void grpc_deadline_state_client_start_transport_stream_op_batch( // // Constructor for channel_data. Used for both client and server filters. -static grpc_error* init_channel_elem(grpc_channel_element* elem, - grpc_channel_element_args* args) { +static grpc_error* deadline_init_channel_elem(grpc_channel_element* elem, + grpc_channel_element_args* args) { GPR_ASSERT(!args->is_last); return GRPC_ERROR_NONE; } // Destructor for channel_data. Used for both client and server filters. -static void destroy_channel_elem(grpc_channel_element* elem) {} +static void deadline_destroy_channel_elem(grpc_channel_element* elem) {} // Call data used for both client and server filter. typedef struct base_call_data { @@ -260,24 +260,24 @@ typedef struct server_call_data { } server_call_data; // Constructor for call_data. Used for both client and server filters. -static grpc_error* init_call_elem(grpc_call_element* elem, - const grpc_call_element_args* args) { +static grpc_error* deadline_init_call_elem(grpc_call_element* elem, + const grpc_call_element_args* args) { new (elem->call_data) grpc_deadline_state( elem, args->call_stack, args->call_combiner, args->deadline); return GRPC_ERROR_NONE; } // Destructor for call_data. Used for both client and server filters. -static void destroy_call_elem(grpc_call_element* elem, - const grpc_call_final_info* final_info, - grpc_closure* ignored) { +static void deadline_destroy_call_elem(grpc_call_element* elem, + const grpc_call_final_info* final_info, + grpc_closure* ignored) { grpc_deadline_state* deadline_state = static_cast(elem->call_data); deadline_state->~grpc_deadline_state(); } // Method for starting a call op for client filter. -static void client_start_transport_stream_op_batch( +static void deadline_client_start_transport_stream_op_batch( grpc_call_element* elem, grpc_transport_stream_op_batch* op) { grpc_deadline_state_client_start_transport_stream_op_batch(elem, op); // Chain to next filter. @@ -295,7 +295,7 @@ static void recv_initial_metadata_ready(void* arg, grpc_error* error) { } // Method for starting a call op for server filter. -static void server_start_transport_stream_op_batch( +static void deadline_server_start_transport_stream_op_batch( grpc_call_element* elem, grpc_transport_stream_op_batch* op) { server_call_data* calld = static_cast(elem->call_data); if (op->cancel_stream) { @@ -329,29 +329,29 @@ static void server_start_transport_stream_op_batch( } const grpc_channel_filter grpc_client_deadline_filter = { - client_start_transport_stream_op_batch, + deadline_client_start_transport_stream_op_batch, grpc_channel_next_op, sizeof(base_call_data), - init_call_elem, + deadline_init_call_elem, grpc_call_stack_ignore_set_pollset_or_pollset_set, - destroy_call_elem, + deadline_destroy_call_elem, 0, // sizeof(channel_data) - init_channel_elem, - destroy_channel_elem, + deadline_init_channel_elem, + deadline_destroy_channel_elem, grpc_channel_next_get_info, "deadline", }; const grpc_channel_filter grpc_server_deadline_filter = { - server_start_transport_stream_op_batch, + deadline_server_start_transport_stream_op_batch, grpc_channel_next_op, sizeof(server_call_data), - init_call_elem, + deadline_init_call_elem, grpc_call_stack_ignore_set_pollset_or_pollset_set, - destroy_call_elem, + deadline_destroy_call_elem, 0, // sizeof(channel_data) - init_channel_elem, - destroy_channel_elem, + deadline_init_channel_elem, + deadline_destroy_channel_elem, grpc_channel_next_get_info, "deadline", }; diff --git a/src/core/ext/filters/http/client/http_client_filter.cc b/src/core/ext/filters/http/client/http_client_filter.cc index b16d26b1f24..1793e8106e4 100644 --- a/src/core/ext/filters/http/client/http_client_filter.cc +++ b/src/core/ext/filters/http/client/http_client_filter.cc @@ -465,16 +465,16 @@ done: } /* Constructor for call_data */ -static grpc_error* init_call_elem(grpc_call_element* elem, - const grpc_call_element_args* args) { +static grpc_error* hc_init_call_elem(grpc_call_element* elem, + const grpc_call_element_args* args) { new (elem->call_data) call_data(elem, *args); return GRPC_ERROR_NONE; } /* Destructor for call_data */ -static void destroy_call_elem(grpc_call_element* elem, - const grpc_call_final_info* final_info, - grpc_closure* ignored) { +static void hc_destroy_call_elem(grpc_call_element* elem, + const grpc_call_final_info* final_info, + grpc_closure* ignored) { call_data* calld = static_cast(elem->call_data); calld->~call_data(); } @@ -566,8 +566,8 @@ static grpc_core::ManagedMemorySlice user_agent_from_args( } /* Constructor for channel_data */ -static grpc_error* init_channel_elem(grpc_channel_element* elem, - grpc_channel_element_args* args) { +static grpc_error* hc_init_channel_elem(grpc_channel_element* elem, + grpc_channel_element_args* args) { channel_data* chand = static_cast(elem->channel_data); GPR_ASSERT(!args->is_last); GPR_ASSERT(args->optional_transport != nullptr); @@ -582,7 +582,7 @@ static grpc_error* init_channel_elem(grpc_channel_element* elem, } /* Destructor for channel data */ -static void destroy_channel_elem(grpc_channel_element* elem) { +static void hc_destroy_channel_elem(grpc_channel_element* elem) { channel_data* chand = static_cast(elem->channel_data); GRPC_MDELEM_UNREF(chand->user_agent); } @@ -591,11 +591,11 @@ const grpc_channel_filter grpc_http_client_filter = { hc_start_transport_stream_op_batch, grpc_channel_next_op, sizeof(call_data), - init_call_elem, + hc_init_call_elem, grpc_call_stack_ignore_set_pollset_or_pollset_set, - destroy_call_elem, + hc_destroy_call_elem, sizeof(channel_data), - init_channel_elem, - destroy_channel_elem, + hc_init_channel_elem, + hc_destroy_channel_elem, grpc_channel_next_get_info, "http-client"}; diff --git a/src/core/ext/filters/http/client_authority_filter.cc b/src/core/ext/filters/http/client_authority_filter.cc index dc8beb986fc..4d5d6233f8c 100644 --- a/src/core/ext/filters/http/client_authority_filter.cc +++ b/src/core/ext/filters/http/client_authority_filter.cc @@ -48,7 +48,7 @@ struct channel_data { grpc_mdelem default_authority_mdelem; }; -void authority_start_transport_stream_op_batch( +void client_authority_start_transport_stream_op_batch( grpc_call_element* elem, grpc_transport_stream_op_batch* batch) { channel_data* chand = static_cast(elem->channel_data); call_data* calld = static_cast(elem->call_data); @@ -72,21 +72,21 @@ void authority_start_transport_stream_op_batch( } /* Constructor for call_data */ -grpc_error* init_call_elem(grpc_call_element* elem, - const grpc_call_element_args* args) { +grpc_error* client_authority_init_call_elem( + grpc_call_element* elem, const grpc_call_element_args* args) { call_data* calld = static_cast(elem->call_data); calld->call_combiner = args->call_combiner; return GRPC_ERROR_NONE; } /* Destructor for call_data */ -void destroy_call_elem(grpc_call_element* elem, - const grpc_call_final_info* final_info, - grpc_closure* ignored) {} +void client_authority_destroy_call_elem(grpc_call_element* elem, + const grpc_call_final_info* final_info, + grpc_closure* ignored) {} /* Constructor for channel_data */ -grpc_error* init_channel_elem(grpc_channel_element* elem, - grpc_channel_element_args* args) { +grpc_error* client_authority_init_channel_elem( + grpc_channel_element* elem, grpc_channel_element_args* args) { channel_data* chand = static_cast(elem->channel_data); const grpc_arg* default_authority_arg = grpc_channel_args_find(args->channel_args, GRPC_ARG_DEFAULT_AUTHORITY); @@ -110,7 +110,7 @@ grpc_error* init_channel_elem(grpc_channel_element* elem, } /* Destructor for channel data */ -void destroy_channel_elem(grpc_channel_element* elem) { +void client_authority_destroy_channel_elem(grpc_channel_element* elem) { channel_data* chand = static_cast(elem->channel_data); grpc_slice_unref_internal(chand->default_authority); GRPC_MDELEM_UNREF(chand->default_authority_mdelem); @@ -118,15 +118,15 @@ void destroy_channel_elem(grpc_channel_element* elem) { } // namespace const grpc_channel_filter grpc_client_authority_filter = { - authority_start_transport_stream_op_batch, + client_authority_start_transport_stream_op_batch, grpc_channel_next_op, sizeof(call_data), - init_call_elem, + client_authority_init_call_elem, grpc_call_stack_ignore_set_pollset_or_pollset_set, - destroy_call_elem, + client_authority_destroy_call_elem, sizeof(channel_data), - init_channel_elem, - destroy_channel_elem, + client_authority_init_channel_elem, + client_authority_destroy_channel_elem, grpc_channel_next_get_info, "authority"}; diff --git a/src/core/ext/filters/http/message_compress/message_compress_filter.cc b/src/core/ext/filters/http/message_compress/message_compress_filter.cc index 9ef8e6a1990..2f4854e43ec 100644 --- a/src/core/ext/filters/http/message_compress/message_compress_filter.cc +++ b/src/core/ext/filters/http/message_compress/message_compress_filter.cc @@ -441,23 +441,23 @@ static void compress_start_transport_stream_op_batch( } /* Constructor for call_data */ -static grpc_error* init_call_elem(grpc_call_element* elem, - const grpc_call_element_args* args) { +static grpc_error* compress_init_call_elem(grpc_call_element* elem, + const grpc_call_element_args* args) { new (elem->call_data) call_data(elem, *args); return GRPC_ERROR_NONE; } /* Destructor for call_data */ -static void destroy_call_elem(grpc_call_element* elem, - const grpc_call_final_info* final_info, - grpc_closure* ignored) { +static void compress_destroy_call_elem(grpc_call_element* elem, + const grpc_call_final_info* final_info, + grpc_closure* ignored) { call_data* calld = static_cast(elem->call_data); calld->~call_data(); } /* Constructor for channel_data */ -static grpc_error* init_channel_elem(grpc_channel_element* elem, - grpc_channel_element_args* args) { +static grpc_error* compress_init_channel_elem(grpc_channel_element* elem, + grpc_channel_element_args* args) { channel_data* channeld = static_cast(elem->channel_data); // Get the enabled and the default algorithms from channel args. channeld->enabled_compression_algorithms_bitset = @@ -487,17 +487,17 @@ static grpc_error* init_channel_elem(grpc_channel_element* elem, } /* Destructor for channel data */ -static void destroy_channel_elem(grpc_channel_element* elem) {} +static void compress_destroy_channel_elem(grpc_channel_element* elem) {} const grpc_channel_filter grpc_message_compress_filter = { compress_start_transport_stream_op_batch, grpc_channel_next_op, sizeof(call_data), - init_call_elem, + compress_init_call_elem, grpc_call_stack_ignore_set_pollset_or_pollset_set, - destroy_call_elem, + compress_destroy_call_elem, sizeof(channel_data), - init_channel_elem, - destroy_channel_elem, + compress_init_channel_elem, + compress_destroy_channel_elem, grpc_channel_next_get_info, "message_compress"}; diff --git a/src/core/ext/filters/max_age/max_age_filter.cc b/src/core/ext/filters/max_age/max_age_filter.cc index 96f2f02056f..770343d9b1f 100644 --- a/src/core/ext/filters/max_age/max_age_filter.cc +++ b/src/core/ext/filters/max_age/max_age_filter.cc @@ -395,24 +395,24 @@ add_random_max_connection_age_jitter_and_convert_to_grpc_millis(int value) { } /* Constructor for call_data. */ -static grpc_error* init_call_elem(grpc_call_element* elem, - const grpc_call_element_args* args) { +static grpc_error* max_age_init_call_elem(grpc_call_element* elem, + const grpc_call_element_args* args) { channel_data* chand = static_cast(elem->channel_data); increase_call_count(chand); return GRPC_ERROR_NONE; } /* Destructor for call_data. */ -static void destroy_call_elem(grpc_call_element* elem, - const grpc_call_final_info* final_info, - grpc_closure* ignored) { +static void max_age_destroy_call_elem(grpc_call_element* elem, + const grpc_call_final_info* final_info, + grpc_closure* ignored) { channel_data* chand = static_cast(elem->channel_data); decrease_call_count(chand); } /* Constructor for channel_data. */ -static grpc_error* init_channel_elem(grpc_channel_element* elem, - grpc_channel_element_args* args) { +static grpc_error* max_age_init_channel_elem(grpc_channel_element* elem, + grpc_channel_element_args* args) { channel_data* chand = static_cast(elem->channel_data); gpr_mu_init(&chand->max_age_timer_mu); chand->max_age_timer_pending = false; @@ -499,7 +499,7 @@ static grpc_error* init_channel_elem(grpc_channel_element* elem, } /* Destructor for channel_data. */ -static void destroy_channel_elem(grpc_channel_element* elem) { +static void max_age_destroy_channel_elem(grpc_channel_element* elem) { channel_data* chand = static_cast(elem->channel_data); gpr_mu_destroy(&chand->max_age_timer_mu); } @@ -508,12 +508,12 @@ const grpc_channel_filter grpc_max_age_filter = { grpc_call_next_op, grpc_channel_next_op, 0, /* sizeof_call_data */ - init_call_elem, + max_age_init_call_elem, grpc_call_stack_ignore_set_pollset_or_pollset_set, - destroy_call_elem, + max_age_destroy_call_elem, sizeof(channel_data), - init_channel_elem, - destroy_channel_elem, + max_age_init_channel_elem, + max_age_destroy_channel_elem, grpc_channel_next_get_info, "max_age"}; diff --git a/src/core/ext/filters/message_size/message_size_filter.cc b/src/core/ext/filters/message_size/message_size_filter.cc index 8e93d11c9c0..df447c226b1 100644 --- a/src/core/ext/filters/message_size/message_size_filter.cc +++ b/src/core/ext/filters/message_size/message_size_filter.cc @@ -238,7 +238,7 @@ static void recv_trailing_metadata_ready(void* user_data, grpc_error* error) { } // Start transport stream op. -static void start_transport_stream_op_batch( +static void message_size_start_transport_stream_op_batch( grpc_call_element* elem, grpc_transport_stream_op_batch* op) { call_data* calld = static_cast(elem->call_data); // Check max send message size. @@ -277,17 +277,17 @@ static void start_transport_stream_op_batch( } // Constructor for call_data. -static grpc_error* init_call_elem(grpc_call_element* elem, - const grpc_call_element_args* args) { +static grpc_error* message_size_init_call_elem( + grpc_call_element* elem, const grpc_call_element_args* args) { channel_data* chand = static_cast(elem->channel_data); new (elem->call_data) call_data(elem, *chand, *args); return GRPC_ERROR_NONE; } // Destructor for call_data. -static void destroy_call_elem(grpc_call_element* elem, - const grpc_call_final_info* final_info, - grpc_closure* ignored) { +static void message_size_destroy_call_elem( + grpc_call_element* elem, const grpc_call_final_info* final_info, + grpc_closure* ignored) { call_data* calld = (call_data*)elem->call_data; calld->~call_data(); } @@ -325,8 +325,8 @@ grpc_core::MessageSizeParsedConfig::message_size_limits get_message_size_limits( } // Constructor for channel_data. -static grpc_error* init_channel_elem(grpc_channel_element* elem, - grpc_channel_element_args* args) { +static grpc_error* message_size_init_channel_elem( + grpc_channel_element* elem, grpc_channel_element_args* args) { GPR_ASSERT(!args->is_last); channel_data* chand = static_cast(elem->channel_data); new (chand) channel_data(); @@ -355,21 +355,21 @@ static grpc_error* init_channel_elem(grpc_channel_element* elem, } // Destructor for channel_data. -static void destroy_channel_elem(grpc_channel_element* elem) { +static void message_size_destroy_channel_elem(grpc_channel_element* elem) { channel_data* chand = static_cast(elem->channel_data); chand->~channel_data(); } const grpc_channel_filter grpc_message_size_filter = { - start_transport_stream_op_batch, + message_size_start_transport_stream_op_batch, grpc_channel_next_op, sizeof(call_data), - init_call_elem, + message_size_init_call_elem, grpc_call_stack_ignore_set_pollset_or_pollset_set, - destroy_call_elem, + message_size_destroy_call_elem, sizeof(channel_data), - init_channel_elem, - destroy_channel_elem, + message_size_init_channel_elem, + message_size_destroy_channel_elem, grpc_channel_next_get_info, "message_size"}; diff --git a/src/core/ext/filters/workarounds/workaround_cronet_compression_filter.cc b/src/core/ext/filters/workarounds/workaround_cronet_compression_filter.cc index c7070d4d9ba..0426e008e40 100644 --- a/src/core/ext/filters/workarounds/workaround_cronet_compression_filter.cc +++ b/src/core/ext/filters/workarounds/workaround_cronet_compression_filter.cc @@ -75,7 +75,7 @@ static void recv_initial_metadata_ready(void* user_data, grpc_error* error) { } // Start transport stream op. -static void start_transport_stream_op_batch( +static void cronet_compression_start_transport_stream_op_batch( grpc_call_element* elem, grpc_transport_stream_op_batch* op) { call_data* calld = static_cast(elem->call_data); @@ -104,8 +104,8 @@ static void start_transport_stream_op_batch( } // Constructor for call_data. -static grpc_error* init_call_elem(grpc_call_element* elem, - const grpc_call_element_args* args) { +static grpc_error* cronet_compression_init_call_elem( + grpc_call_element* elem, const grpc_call_element_args* args) { call_data* calld = static_cast(elem->call_data); calld->next_recv_initial_metadata_ready = nullptr; calld->workaround_active = false; @@ -116,18 +116,19 @@ static grpc_error* init_call_elem(grpc_call_element* elem, } // Destructor for call_data. -static void destroy_call_elem(grpc_call_element* elem, - const grpc_call_final_info* final_info, - grpc_closure* ignored) {} +static void cronet_compression_destroy_call_elem( + grpc_call_element* elem, const grpc_call_final_info* final_info, + grpc_closure* ignored) {} // Constructor for channel_data. -static grpc_error* init_channel_elem(grpc_channel_element* elem, - grpc_channel_element_args* args) { +static grpc_error* cronet_compression_init_channel_elem( + grpc_channel_element* elem, grpc_channel_element_args* args) { return GRPC_ERROR_NONE; } // Destructor for channel_data. -static void destroy_channel_elem(grpc_channel_element* elem) {} +static void cronet_compression_destroy_channel_elem( + grpc_channel_element* elem) {} // Parse the user agent static bool parse_user_agent(grpc_mdelem md) { @@ -169,15 +170,15 @@ static bool parse_user_agent(grpc_mdelem md) { } const grpc_channel_filter grpc_workaround_cronet_compression_filter = { - start_transport_stream_op_batch, + cronet_compression_start_transport_stream_op_batch, grpc_channel_next_op, sizeof(call_data), - init_call_elem, + cronet_compression_init_call_elem, grpc_call_stack_ignore_set_pollset_or_pollset_set, - destroy_call_elem, + cronet_compression_destroy_call_elem, 0, - init_channel_elem, - destroy_channel_elem, + cronet_compression_init_channel_elem, + cronet_compression_destroy_channel_elem, grpc_channel_next_get_info, "workaround_cronet_compression"}; diff --git a/src/core/lib/security/transport/client_auth_filter.cc b/src/core/lib/security/transport/client_auth_filter.cc index 33343d276eb..282ec5c97a9 100644 --- a/src/core/lib/security/transport/client_auth_filter.cc +++ b/src/core/lib/security/transport/client_auth_filter.cc @@ -324,7 +324,7 @@ static void cancel_check_call_host(void* arg, grpc_error* error) { } } -static void auth_start_transport_stream_op_batch( +static void client_auth_start_transport_stream_op_batch( grpc_call_element* elem, grpc_transport_stream_op_batch* batch) { GPR_TIMER_SCOPE("auth_start_transport_stream_op_batch", 0); @@ -369,29 +369,29 @@ static void auth_start_transport_stream_op_batch( } /* Constructor for call_data */ -static grpc_error* init_call_elem(grpc_call_element* elem, - const grpc_call_element_args* args) { +static grpc_error* client_auth_init_call_elem( + grpc_call_element* elem, const grpc_call_element_args* args) { new (elem->call_data) call_data(elem, *args); return GRPC_ERROR_NONE; } -static void set_pollset_or_pollset_set(grpc_call_element* elem, - grpc_polling_entity* pollent) { +static void client_auth_set_pollset_or_pollset_set( + grpc_call_element* elem, grpc_polling_entity* pollent) { call_data* calld = static_cast(elem->call_data); calld->pollent = pollent; } /* Destructor for call_data */ -static void destroy_call_elem(grpc_call_element* elem, - const grpc_call_final_info* final_info, - grpc_closure* ignored) { +static void client_auth_destroy_call_elem( + grpc_call_element* elem, const grpc_call_final_info* final_info, + grpc_closure* ignored) { call_data* calld = static_cast(elem->call_data); calld->destroy(); } /* Constructor for channel_data */ -static grpc_error* init_channel_elem(grpc_channel_element* elem, - grpc_channel_element_args* args) { +static grpc_error* client_auth_init_channel_elem( + grpc_channel_element* elem, grpc_channel_element_args* args) { /* The first and the last filters tend to be implemented differently to handle the case that there's no 'next' filter to call on the up or down path */ @@ -414,20 +414,20 @@ static grpc_error* init_channel_elem(grpc_channel_element* elem, } /* Destructor for channel data */ -static void destroy_channel_elem(grpc_channel_element* elem) { +static void client_auth_destroy_channel_elem(grpc_channel_element* elem) { channel_data* chand = static_cast(elem->channel_data); chand->~channel_data(); } const grpc_channel_filter grpc_client_auth_filter = { - auth_start_transport_stream_op_batch, + client_auth_start_transport_stream_op_batch, grpc_channel_next_op, sizeof(call_data), - init_call_elem, - set_pollset_or_pollset_set, - destroy_call_elem, + client_auth_init_call_elem, + client_auth_set_pollset_or_pollset_set, + client_auth_destroy_call_elem, sizeof(channel_data), - init_channel_elem, - destroy_channel_elem, + client_auth_init_channel_elem, + client_auth_destroy_channel_elem, grpc_channel_next_get_info, "client-auth"}; diff --git a/src/core/lib/security/transport/server_auth_filter.cc b/src/core/lib/security/transport/server_auth_filter.cc index 43509e6c61b..341e0e4a86a 100644 --- a/src/core/lib/security/transport/server_auth_filter.cc +++ b/src/core/lib/security/transport/server_auth_filter.cc @@ -257,7 +257,7 @@ static void recv_trailing_metadata_ready(void* user_data, grpc_error* err) { GRPC_CLOSURE_RUN(calld->original_recv_trailing_metadata_ready, err); } -static void auth_start_transport_stream_op_batch( +static void server_auth_start_transport_stream_op_batch( grpc_call_element* elem, grpc_transport_stream_op_batch* batch) { call_data* calld = static_cast(elem->call_data); if (batch->recv_initial_metadata) { @@ -278,23 +278,23 @@ static void auth_start_transport_stream_op_batch( } /* Constructor for call_data */ -static grpc_error* init_call_elem(grpc_call_element* elem, - const grpc_call_element_args* args) { +static grpc_error* server_auth_init_call_elem( + grpc_call_element* elem, const grpc_call_element_args* args) { new (elem->call_data) call_data(elem, *args); return GRPC_ERROR_NONE; } /* Destructor for call_data */ -static void destroy_call_elem(grpc_call_element* elem, - const grpc_call_final_info* final_info, - grpc_closure* ignored) { +static void server_auth_destroy_call_elem( + grpc_call_element* elem, const grpc_call_final_info* final_info, + grpc_closure* ignored) { call_data* calld = static_cast(elem->call_data); calld->~call_data(); } /* Constructor for channel_data */ -static grpc_error* init_channel_elem(grpc_channel_element* elem, - grpc_channel_element_args* args) { +static grpc_error* server_auth_init_channel_elem( + grpc_channel_element* elem, grpc_channel_element_args* args) { GPR_ASSERT(!args->is_last); grpc_auth_context* auth_context = grpc_find_auth_context_in_args(args->channel_args); @@ -306,20 +306,20 @@ static grpc_error* init_channel_elem(grpc_channel_element* elem, } /* Destructor for channel data */ -static void destroy_channel_elem(grpc_channel_element* elem) { +static void server_auth_destroy_channel_elem(grpc_channel_element* elem) { channel_data* chand = static_cast(elem->channel_data); chand->~channel_data(); } const grpc_channel_filter grpc_server_auth_filter = { - auth_start_transport_stream_op_batch, + server_auth_start_transport_stream_op_batch, grpc_channel_next_op, sizeof(call_data), - init_call_elem, + server_auth_init_call_elem, grpc_call_stack_ignore_set_pollset_or_pollset_set, - destroy_call_elem, + server_auth_destroy_call_elem, sizeof(channel_data), - init_channel_elem, - destroy_channel_elem, + server_auth_init_channel_elem, + server_auth_destroy_channel_elem, grpc_channel_next_get_info, "server-auth"}; diff --git a/src/core/lib/surface/lame_client.cc b/src/core/lib/surface/lame_client.cc index 10a27924073..9208160938e 100644 --- a/src/core/lib/surface/lame_client.cc +++ b/src/core/lib/surface/lame_client.cc @@ -115,27 +115,27 @@ static void lame_start_transport_op(grpc_channel_element* elem, } } -static grpc_error* init_call_elem(grpc_call_element* elem, - const grpc_call_element_args* args) { +static grpc_error* lame_init_call_elem(grpc_call_element* elem, + const grpc_call_element_args* args) { CallData* calld = static_cast(elem->call_data); calld->call_combiner = args->call_combiner; return GRPC_ERROR_NONE; } -static void destroy_call_elem(grpc_call_element* elem, - const grpc_call_final_info* final_info, - grpc_closure* then_schedule_closure) { +static void lame_destroy_call_elem(grpc_call_element* elem, + const grpc_call_final_info* final_info, + grpc_closure* then_schedule_closure) { GRPC_CLOSURE_SCHED(then_schedule_closure, GRPC_ERROR_NONE); } -static grpc_error* init_channel_elem(grpc_channel_element* elem, - grpc_channel_element_args* args) { +static grpc_error* lame_init_channel_elem(grpc_channel_element* elem, + grpc_channel_element_args* args) { GPR_ASSERT(args->is_first); GPR_ASSERT(args->is_last); return GRPC_ERROR_NONE; } -static void destroy_channel_elem(grpc_channel_element* elem) {} +static void lame_destroy_channel_elem(grpc_channel_element* elem) {} } // namespace @@ -145,12 +145,12 @@ const grpc_channel_filter grpc_lame_filter = { grpc_core::lame_start_transport_stream_op_batch, grpc_core::lame_start_transport_op, sizeof(grpc_core::CallData), - grpc_core::init_call_elem, + grpc_core::lame_init_call_elem, grpc_call_stack_ignore_set_pollset_or_pollset_set, - grpc_core::destroy_call_elem, + grpc_core::lame_destroy_call_elem, sizeof(grpc_core::ChannelData), - grpc_core::init_channel_elem, - grpc_core::destroy_channel_elem, + grpc_core::lame_init_channel_elem, + grpc_core::lame_destroy_channel_elem, grpc_core::lame_get_channel_info, "lame-client", }; From 1b1364eb6b6b17875d1dce77377ec1a8b343d0a2 Mon Sep 17 00:00:00 2001 From: Yash Tibrewal Date: Wed, 11 Sep 2019 14:17:27 -0700 Subject: [PATCH 2/2] Reviewer comments --- .../filters/http/client/http_client_filter.cc | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/core/ext/filters/http/client/http_client_filter.cc b/src/core/ext/filters/http/client/http_client_filter.cc index 1793e8106e4..1687f7ead09 100644 --- a/src/core/ext/filters/http/client/http_client_filter.cc +++ b/src/core/ext/filters/http/client/http_client_filter.cc @@ -340,11 +340,11 @@ static void remove_if_present(grpc_metadata_batch* batch, } } -static void hc_start_transport_stream_op_batch( +static void http_client_start_transport_stream_op_batch( grpc_call_element* elem, grpc_transport_stream_op_batch* batch) { call_data* calld = static_cast(elem->call_data); channel_data* channeld = static_cast(elem->channel_data); - GPR_TIMER_SCOPE("hc_start_transport_stream_op_batch", 0); + GPR_TIMER_SCOPE("http_client_start_transport_stream_op_batch", 0); if (batch->recv_initial_metadata) { /* substitute our callback for the higher callback */ @@ -465,16 +465,16 @@ done: } /* Constructor for call_data */ -static grpc_error* hc_init_call_elem(grpc_call_element* elem, - const grpc_call_element_args* args) { +static grpc_error* http_client_init_call_elem( + grpc_call_element* elem, const grpc_call_element_args* args) { new (elem->call_data) call_data(elem, *args); return GRPC_ERROR_NONE; } /* Destructor for call_data */ -static void hc_destroy_call_elem(grpc_call_element* elem, - const grpc_call_final_info* final_info, - grpc_closure* ignored) { +static void http_client_destroy_call_elem( + grpc_call_element* elem, const grpc_call_final_info* final_info, + grpc_closure* ignored) { call_data* calld = static_cast(elem->call_data); calld->~call_data(); } @@ -566,8 +566,8 @@ static grpc_core::ManagedMemorySlice user_agent_from_args( } /* Constructor for channel_data */ -static grpc_error* hc_init_channel_elem(grpc_channel_element* elem, - grpc_channel_element_args* args) { +static grpc_error* http_client_init_channel_elem( + grpc_channel_element* elem, grpc_channel_element_args* args) { channel_data* chand = static_cast(elem->channel_data); GPR_ASSERT(!args->is_last); GPR_ASSERT(args->optional_transport != nullptr); @@ -582,20 +582,20 @@ static grpc_error* hc_init_channel_elem(grpc_channel_element* elem, } /* Destructor for channel data */ -static void hc_destroy_channel_elem(grpc_channel_element* elem) { +static void http_client_destroy_channel_elem(grpc_channel_element* elem) { channel_data* chand = static_cast(elem->channel_data); GRPC_MDELEM_UNREF(chand->user_agent); } const grpc_channel_filter grpc_http_client_filter = { - hc_start_transport_stream_op_batch, + http_client_start_transport_stream_op_batch, grpc_channel_next_op, sizeof(call_data), - hc_init_call_elem, + http_client_init_call_elem, grpc_call_stack_ignore_set_pollset_or_pollset_set, - hc_destroy_call_elem, + http_client_destroy_call_elem, sizeof(channel_data), - hc_init_channel_elem, - hc_destroy_channel_elem, + http_client_init_channel_elem, + http_client_destroy_channel_elem, grpc_channel_next_get_info, "http-client"};