diff options
Diffstat (limited to 'src/core/ext/filters/client_channel')
7 files changed, 29 insertions, 15 deletions
diff --git a/src/core/ext/filters/client_channel/backup_poller.cc b/src/core/ext/filters/client_channel/backup_poller.cc index bfc549e709..4ee5e9c109 100644 --- a/src/core/ext/filters/client_channel/backup_poller.cc +++ b/src/core/ext/filters/client_channel/backup_poller.cc @@ -33,7 +33,8 @@ #define DEFAULT_POLL_INTERVAL_MS 5000 -typedef struct backup_poller { +namespace { +struct backup_poller { grpc_timer polling_timer; grpc_closure run_poller_closure; grpc_closure shutdown_closure; @@ -42,7 +43,8 @@ typedef struct backup_poller { bool shutting_down; // guarded by pollset_mu gpr_refcount refs; gpr_refcount shutdown_refs; -} backup_poller; +}; +} // namespace static gpr_once g_once = GPR_ONCE_INIT; static gpr_mu g_poller_mu; diff --git a/src/core/ext/filters/client_channel/channel_connectivity.cc b/src/core/ext/filters/client_channel/channel_connectivity.cc index 20693ba419..a827aa30ec 100644 --- a/src/core/ext/filters/client_channel/channel_connectivity.cc +++ b/src/core/ext/filters/client_channel/channel_connectivity.cc @@ -58,7 +58,8 @@ typedef enum { CALLING_BACK_AND_FINISHED, } callback_phase; -typedef struct { +namespace { +struct state_watcher { gpr_mu mu; callback_phase phase; grpc_closure on_complete; @@ -71,7 +72,8 @@ typedef struct { grpc_channel* channel; grpc_error* error; void* tag; -} state_watcher; +}; +} // namespace static void delete_state_watcher(state_watcher* w) { grpc_channel_element* client_channel_elem = grpc_channel_stack_last_element( 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 3eedb08ecc..1708d81e61 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 @@ -32,7 +32,8 @@ static grpc_error* init_channel_elem(grpc_channel_element* elem, static void destroy_channel_elem(grpc_channel_element* elem) {} -typedef struct { +namespace { +struct call_data { // Stats object to update. grpc_grpclb_client_stats* client_stats; // State for intercepting send_initial_metadata. @@ -43,7 +44,8 @@ typedef struct { grpc_closure recv_initial_metadata_ready; grpc_closure* original_recv_initial_metadata_ready; bool recv_initial_metadata_succeeded; -} call_data; +}; +} // namespace static void on_complete_for_send(void* arg, grpc_error* error) { call_data* calld = (call_data*)arg; diff --git a/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc b/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc index ba4e90d4c2..f2bb409680 100644 --- a/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +++ b/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc @@ -226,6 +226,7 @@ static void wrapped_rr_closure(void* arg, grpc_error* error) { gpr_free(wc_arg->free_when_done); } +namespace { /* Linked list of pending pick requests. It stores all information needed to * eventually call (Round Robin's) pick() on them. They mainly stay pending * waiting for the RR policy to be created/updated. @@ -234,7 +235,7 @@ static void wrapped_rr_closure(void* arg, grpc_error* error) { * (in \a wrapped_on_complete and \a wrapped_on_complete_arg). This is needed in * order to correctly unref the RR policy instance upon completion of the pick. * See \a wrapped_rr_closure for details. */ -typedef struct pending_pick { +struct pending_pick { struct pending_pick* next; /* original pick()'s arguments */ @@ -246,7 +247,8 @@ typedef struct pending_pick { /* args for wrapped_on_complete */ wrapped_rr_closure_arg wrapped_on_complete_arg; -} pending_pick; +}; +} // namespace static void add_pending_pick(pending_pick** root, const grpc_lb_policy_pick_args* pick_args, diff --git a/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc b/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc index 0861261359..9ff40aa53c 100644 --- a/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc +++ b/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc @@ -31,12 +31,14 @@ grpc_core::TraceFlag grpc_lb_pick_first_trace(false, "pick_first"); -typedef struct pending_pick { +namespace { +struct pending_pick { struct pending_pick* next; uint32_t initial_metadata_flags; grpc_connected_subchannel** target; grpc_closure* on_complete; -} pending_pick; +}; +} // namespace typedef struct { /** base policy: must be first */ diff --git a/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc b/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc index b0c84017df..a964af0627 100644 --- a/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc +++ b/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc @@ -41,11 +41,12 @@ grpc_core::TraceFlag grpc_lb_round_robin_trace(false, "round_robin"); +namespace { /** List of entities waiting for a pick. * * Once a pick is available, \a target is updated and \a on_complete called. */ -typedef struct pending_pick { - struct pending_pick* next; +struct pending_pick { + pending_pick* next; /* output argument where to store the pick()ed user_data. It'll be NULL if no * such data is present or there's an error (the definite test for errors is @@ -62,7 +63,8 @@ typedef struct pending_pick { /* to be invoked once the pick() has completed (regardless of success) */ grpc_closure* on_complete; -} pending_pick; +}; +} // namespace typedef struct round_robin_lb_policy { /** base policy: must be first */ diff --git a/src/core/ext/filters/client_channel/subchannel.cc b/src/core/ext/filters/client_channel/subchannel.cc index f07394d29b..a604c55c58 100644 --- a/src/core/ext/filters/client_channel/subchannel.cc +++ b/src/core/ext/filters/client_channel/subchannel.cc @@ -59,11 +59,13 @@ ((grpc_connected_subchannel*)(gpr_atm_##barrier##_load( \ &(subchannel)->connected_subchannel))) -typedef struct { +namespace { +struct state_watcher { grpc_closure closure; grpc_subchannel* subchannel; grpc_connectivity_state connectivity_state; -} state_watcher; +}; +} // namespace typedef struct external_state_watcher { grpc_subchannel* subchannel; |