aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core
diff options
context:
space:
mode:
authorGravatar Craig Tiller <ctiller@google.com>2015-09-22 09:30:00 -0700
committerGravatar Craig Tiller <ctiller@google.com>2015-09-22 09:30:00 -0700
commitd9ccbbf6b98721f3e0256436e8a31fb378324d34 (patch)
tree70044a256dc950acf8b5fe203e417b00da6a1114 /src/core
parent10ee2747a92a20c0bbe8cf3e2e759a121c6cb076 (diff)
Rename call_list to closure_list
Diffstat (limited to 'src/core')
-rw-r--r--src/core/census/grpc_filter.c24
-rw-r--r--src/core/channel/channel_stack.c33
-rw-r--r--src/core/channel/channel_stack.h32
-rw-r--r--src/core/channel/client_channel.c185
-rw-r--r--src/core/channel/client_channel.h11
-rw-r--r--src/core/channel/compress_filter.c16
-rw-r--r--src/core/channel/connected_channel.c34
-rw-r--r--src/core/channel/http_client_filter.c22
-rw-r--r--src/core/channel/http_server_filter.c24
-rw-r--r--src/core/channel/noop_filter.c12
-rw-r--r--src/core/client_config/client_config.c4
-rw-r--r--src/core/client_config/client_config.h2
-rw-r--r--src/core/client_config/connector.c14
-rw-r--r--src/core/client_config/connector.h14
-rw-r--r--src/core/client_config/lb_policies/pick_first.c104
-rw-r--r--src/core/client_config/lb_policies/round_robin.c85
-rw-r--r--src/core/client_config/lb_policy.c34
-rw-r--r--src/core/client_config/lb_policy.h37
-rw-r--r--src/core/client_config/resolver.c25
-rw-r--r--src/core/client_config/resolver.h22
-rw-r--r--src/core/client_config/resolvers/dns_resolver.c45
-rw-r--r--src/core/client_config/resolvers/sockaddr_resolver.c35
-rw-r--r--src/core/client_config/subchannel.c170
-rw-r--r--src/core/client_config/subchannel.h18
-rw-r--r--src/core/client_config/subchannel_factory.c8
-rw-r--r--src/core/client_config/subchannel_factory.h9
-rw-r--r--src/core/client_config/subchannel_factory_decorators/merge_channel_args.c8
-rw-r--r--src/core/httpcli/httpcli.c105
-rw-r--r--src/core/httpcli/httpcli.h14
-rw-r--r--src/core/httpcli/httpcli_security_connector.c25
-rw-r--r--src/core/iomgr/alarm.c26
-rw-r--r--src/core/iomgr/alarm.h4
-rw-r--r--src/core/iomgr/alarm_internal.h4
-rw-r--r--src/core/iomgr/endpoint.c25
-rw-r--r--src/core/iomgr/endpoint.h24
-rw-r--r--src/core/iomgr/fd_posix.c46
-rw-r--r--src/core/iomgr/fd_posix.h14
-rw-r--r--src/core/iomgr/iomgr.c38
-rw-r--r--src/core/iomgr/iomgr.h18
-rw-r--r--src/core/iomgr/pollset.h7
-rw-r--r--src/core/iomgr/pollset_multipoller_with_epoll.c39
-rw-r--r--src/core/iomgr/pollset_multipoller_with_poll_posix.c25
-rw-r--r--src/core/iomgr/pollset_posix.c65
-rw-r--r--src/core/iomgr/pollset_posix.h17
-rw-r--r--src/core/iomgr/pollset_set.h4
-rw-r--r--src/core/iomgr/pollset_set_posix.c12
-rw-r--r--src/core/iomgr/pollset_set_posix.h4
-rw-r--r--src/core/iomgr/resolve_address.h2
-rw-r--r--src/core/iomgr/resolve_address_posix.c6
-rw-r--r--src/core/iomgr/tcp_client.h3
-rw-r--r--src/core/iomgr/tcp_client_posix.c37
-rw-r--r--src/core/iomgr/tcp_posix.c86
-rw-r--r--src/core/iomgr/tcp_server.h6
-rw-r--r--src/core/iomgr/tcp_server_posix.c38
-rw-r--r--src/core/iomgr/udp_server.c34
-rw-r--r--src/core/iomgr/udp_server.h5
-rw-r--r--src/core/iomgr/workqueue.h15
-rw-r--r--src/core/iomgr/workqueue_posix.c45
-rw-r--r--src/core/iomgr/workqueue_posix.h2
-rw-r--r--src/core/security/client_auth_filter.c44
-rw-r--r--src/core/security/credentials.c77
-rw-r--r--src/core/security/credentials.h8
-rw-r--r--src/core/security/google_default_credentials.c16
-rw-r--r--src/core/security/handshake.c71
-rw-r--r--src/core/security/handshake.h3
-rw-r--r--src/core/security/jwt_verifier.c14
-rw-r--r--src/core/security/jwt_verifier.h2
-rw-r--r--src/core/security/secure_endpoint.c59
-rw-r--r--src/core/security/security_connector.c40
-rw-r--r--src/core/security/security_connector.h20
-rw-r--r--src/core/security/server_auth_filter.c24
-rw-r--r--src/core/security/server_secure_chttp2.c44
-rw-r--r--src/core/surface/call.c146
-rw-r--r--src/core/surface/call.h18
-rw-r--r--src/core/surface/channel.c23
-rw-r--r--src/core/surface/channel.h14
-rw-r--r--src/core/surface/channel_connectivity.c53
-rw-r--r--src/core/surface/channel_create.c40
-rw-r--r--src/core/surface/completion_queue.c34
-rw-r--r--src/core/surface/completion_queue.h6
-rw-r--r--src/core/surface/lame_client.c33
-rw-r--r--src/core/surface/secure_channel_create.c47
-rw-r--r--src/core/surface/server.c228
-rw-r--r--src/core/surface/server.h8
-rw-r--r--src/core/surface/server_chttp2.c31
-rw-r--r--src/core/transport/chttp2/frame_data.c2
-rw-r--r--src/core/transport/chttp2/frame_data.h2
-rw-r--r--src/core/transport/chttp2/frame_goaway.c2
-rw-r--r--src/core/transport/chttp2/frame_goaway.h2
-rw-r--r--src/core/transport/chttp2/frame_ping.c4
-rw-r--r--src/core/transport/chttp2/frame_ping.h2
-rw-r--r--src/core/transport/chttp2/frame_rst_stream.c2
-rw-r--r--src/core/transport/chttp2/frame_rst_stream.h2
-rw-r--r--src/core/transport/chttp2/frame_settings.c2
-rw-r--r--src/core/transport/chttp2/frame_settings.h2
-rw-r--r--src/core/transport/chttp2/frame_window_update.c2
-rw-r--r--src/core/transport/chttp2/frame_window_update.h2
-rw-r--r--src/core/transport/chttp2/hpack_parser.c2
-rw-r--r--src/core/transport/chttp2/hpack_parser.h2
-rw-r--r--src/core/transport/chttp2/internal.h14
-rw-r--r--src/core/transport/chttp2/parsing.c26
-rw-r--r--src/core/transport/chttp2/writing.c9
-rw-r--r--src/core/transport/chttp2_transport.c219
-rw-r--r--src/core/transport/chttp2_transport.h5
-rw-r--r--src/core/transport/connectivity_state.c12
-rw-r--r--src/core/transport/connectivity_state.h7
-rw-r--r--src/core/transport/transport.c38
-rw-r--r--src/core/transport/transport.h16
-rw-r--r--src/core/transport/transport_impl.h12
109 files changed, 1718 insertions, 1595 deletions
diff --git a/src/core/census/grpc_filter.c b/src/core/census/grpc_filter.c
index fa318c4e54..26de5142c5 100644
--- a/src/core/census/grpc_filter.c
+++ b/src/core/census/grpc_filter.c
@@ -90,20 +90,20 @@ static void client_mutate_op(grpc_call_element* elem,
static void client_start_transport_op(grpc_call_element* elem,
grpc_transport_stream_op* op,
- grpc_call_list* call_list) {
+ grpc_closure_list* closure_list) {
client_mutate_op(elem, op);
- grpc_call_next_op(elem, op, call_list);
+ grpc_call_next_op(elem, op, closure_list);
}
static void server_on_done_recv(void* ptr, int success,
- grpc_call_list* call_list) {
+ grpc_closure_list* closure_list) {
grpc_call_element* elem = ptr;
call_data* calld = elem->call_data;
channel_data* chand = elem->channel_data;
if (success) {
extract_and_annotate_method_tag(calld->recv_ops, calld, chand);
}
- calld->on_done_recv->cb(calld->on_done_recv->cb_arg, success, call_list);
+ calld->on_done_recv->cb(calld->on_done_recv->cb_arg, success, closure_list);
}
static void server_mutate_op(grpc_call_element* elem,
@@ -119,17 +119,17 @@ static void server_mutate_op(grpc_call_element* elem,
static void server_start_transport_op(grpc_call_element* elem,
grpc_transport_stream_op* op,
- grpc_call_list* call_list) {
+ grpc_closure_list* closure_list) {
call_data* calld = elem->call_data;
GPR_ASSERT((calld->op_id.upper != 0) || (calld->op_id.lower != 0));
server_mutate_op(elem, op);
- grpc_call_next_op(elem, op, call_list);
+ grpc_call_next_op(elem, op, closure_list);
}
static void client_init_call_elem(grpc_call_element* elem,
const void* server_transport_data,
grpc_transport_stream_op* initial_op,
- grpc_call_list* call_list) {
+ grpc_closure_list* closure_list) {
call_data* d = elem->call_data;
GPR_ASSERT(d != NULL);
d->start_ts = gpr_now(GPR_CLOCK_REALTIME);
@@ -137,7 +137,7 @@ static void client_init_call_elem(grpc_call_element* elem,
}
static void client_destroy_call_elem(grpc_call_element* elem,
- grpc_call_list* call_list) {
+ grpc_closure_list* closure_list) {
call_data* d = elem->call_data;
GPR_ASSERT(d != NULL);
/* TODO(hongyu): record rpc client stats and census_rpc_end_op here */
@@ -146,7 +146,7 @@ static void client_destroy_call_elem(grpc_call_element* elem,
static void server_init_call_elem(grpc_call_element* elem,
const void* server_transport_data,
grpc_transport_stream_op* initial_op,
- grpc_call_list* call_list) {
+ grpc_closure_list* closure_list) {
call_data* d = elem->call_data;
GPR_ASSERT(d != NULL);
d->start_ts = gpr_now(GPR_CLOCK_REALTIME);
@@ -156,7 +156,7 @@ static void server_init_call_elem(grpc_call_element* elem,
}
static void server_destroy_call_elem(grpc_call_element* elem,
- grpc_call_list* call_list) {
+ grpc_closure_list* closure_list) {
call_data* d = elem->call_data;
GPR_ASSERT(d != NULL);
/* TODO(hongyu): record rpc server stats and census_tracing_end_op here */
@@ -165,14 +165,14 @@ static void server_destroy_call_elem(grpc_call_element* elem,
static void init_channel_elem(grpc_channel_element* elem, grpc_channel* master,
const grpc_channel_args* args, grpc_mdctx* mdctx,
int is_first, int is_last,
- grpc_call_list* call_list) {
+ grpc_closure_list* closure_list) {
channel_data* chand = elem->channel_data;
GPR_ASSERT(chand != NULL);
chand->path_str = grpc_mdstr_from_string(mdctx, ":path", 0);
}
static void destroy_channel_elem(grpc_channel_element* elem,
- grpc_call_list* call_list) {
+ grpc_closure_list* closure_list) {
channel_data* chand = elem->channel_data;
GPR_ASSERT(chand != NULL);
if (chand->path_str != NULL) {
diff --git a/src/core/channel/channel_stack.c b/src/core/channel/channel_stack.c
index 10fbd520c3..47f1f8e828 100644
--- a/src/core/channel/channel_stack.c
+++ b/src/core/channel/channel_stack.c
@@ -106,7 +106,7 @@ void grpc_channel_stack_init(const grpc_channel_filter **filters,
const grpc_channel_args *args,
grpc_mdctx *metadata_context,
grpc_channel_stack *stack,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
size_t call_size =
ROUND_UP_TO_ALIGNMENT_SIZE(sizeof(grpc_call_stack)) +
ROUND_UP_TO_ALIGNMENT_SIZE(filter_count * sizeof(grpc_call_element));
@@ -126,7 +126,7 @@ void grpc_channel_stack_init(const grpc_channel_filter **filters,
elems[i].channel_data = user_data;
elems[i].filter->init_channel_elem(&elems[i], master, args,
metadata_context, i == 0,
- i == (filter_count - 1), call_list);
+ i == (filter_count - 1), closure_list);
user_data += ROUND_UP_TO_ALIGNMENT_SIZE(filters[i]->sizeof_channel_data);
call_size += ROUND_UP_TO_ALIGNMENT_SIZE(filters[i]->sizeof_call_data);
}
@@ -139,14 +139,15 @@ void grpc_channel_stack_init(const grpc_channel_filter **filters,
}
void grpc_channel_stack_destroy(grpc_channel_stack *stack,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
grpc_channel_element *channel_elems = CHANNEL_ELEMS_FROM_STACK(stack);
size_t count = stack->count;
size_t i;
/* destroy per-filter data */
for (i = 0; i < count; i++) {
- channel_elems[i].filter->destroy_channel_elem(&channel_elems[i], call_list);
+ channel_elems[i].filter->destroy_channel_elem(&channel_elems[i],
+ closure_list);
}
}
@@ -154,7 +155,7 @@ void grpc_call_stack_init(grpc_channel_stack *channel_stack,
const void *transport_server_data,
grpc_transport_stream_op *initial_op,
grpc_call_stack *call_stack,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
grpc_channel_element *channel_elems = CHANNEL_ELEMS_FROM_STACK(channel_stack);
size_t count = channel_stack->count;
grpc_call_element *call_elems;
@@ -172,40 +173,40 @@ void grpc_call_stack_init(grpc_channel_stack *channel_stack,
call_elems[i].channel_data = channel_elems[i].channel_data;
call_elems[i].call_data = user_data;
call_elems[i].filter->init_call_elem(&call_elems[i], transport_server_data,
- initial_op, call_list);
+ initial_op, closure_list);
user_data +=
ROUND_UP_TO_ALIGNMENT_SIZE(call_elems[i].filter->sizeof_call_data);
}
}
void grpc_call_stack_destroy(grpc_call_stack *stack,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
grpc_call_element *elems = CALL_ELEMS_FROM_STACK(stack);
size_t count = stack->count;
size_t i;
/* destroy per-filter data */
for (i = 0; i < count; i++) {
- elems[i].filter->destroy_call_elem(&elems[i], call_list);
+ elems[i].filter->destroy_call_elem(&elems[i], closure_list);
}
}
void grpc_call_next_op(grpc_call_element *elem, grpc_transport_stream_op *op,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
grpc_call_element *next_elem = elem + 1;
- next_elem->filter->start_transport_stream_op(next_elem, op, call_list);
+ next_elem->filter->start_transport_stream_op(next_elem, op, closure_list);
}
char *grpc_call_next_get_peer(grpc_call_element *elem,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
grpc_call_element *next_elem = elem + 1;
- return next_elem->filter->get_peer(next_elem, call_list);
+ return next_elem->filter->get_peer(next_elem, closure_list);
}
void grpc_channel_next_op(grpc_channel_element *elem, grpc_transport_op *op,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
grpc_channel_element *next_elem = elem + 1;
- next_elem->filter->start_transport_op(next_elem, op, call_list);
+ next_elem->filter->start_transport_op(next_elem, op, closure_list);
}
grpc_channel_stack *grpc_channel_stack_from_top_element(
@@ -220,9 +221,9 @@ grpc_call_stack *grpc_call_stack_from_top_element(grpc_call_element *elem) {
}
void grpc_call_element_send_cancel(grpc_call_element *cur_elem,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
grpc_transport_stream_op op;
memset(&op, 0, sizeof(op));
op.cancel_with_status = GRPC_STATUS_CANCELLED;
- grpc_call_next_op(cur_elem, &op, call_list);
+ grpc_call_next_op(cur_elem, &op, closure_list);
}
diff --git a/src/core/channel/channel_stack.h b/src/core/channel/channel_stack.h
index 5afe7f258a..b3facd4f01 100644
--- a/src/core/channel/channel_stack.h
+++ b/src/core/channel/channel_stack.h
@@ -66,12 +66,12 @@ typedef struct {
See grpc_call_next_op on how to call the next element in the stack */
void (*start_transport_stream_op)(grpc_call_element *elem,
grpc_transport_stream_op *op,
- grpc_call_list *call_list);
+ grpc_closure_list *closure_list);
/* Called to handle channel level operations - e.g. new calls, or transport
closure.
See grpc_channel_next_op on how to call the next element in the stack */
void (*start_transport_op)(grpc_channel_element *elem, grpc_transport_op *op,
- grpc_call_list *call_list);
+ grpc_closure_list *closure_list);
/* sizeof(per call data) */
size_t sizeof_call_data;
@@ -86,10 +86,11 @@ typedef struct {
void (*init_call_elem)(grpc_call_element *elem,
const void *server_transport_data,
grpc_transport_stream_op *initial_op,
- grpc_call_list *call_list);
+ grpc_closure_list *closure_list);
/* Destroy per call data.
The filter does not need to do any chaining */
- void (*destroy_call_elem)(grpc_call_element *elem, grpc_call_list *call_list);
+ void (*destroy_call_elem)(grpc_call_element *elem,
+ grpc_closure_list *closure_list);
/* sizeof(per channel data) */
size_t sizeof_channel_data;
@@ -102,14 +103,14 @@ typedef struct {
void (*init_channel_elem)(grpc_channel_element *elem, grpc_channel *master,
const grpc_channel_args *args,
grpc_mdctx *metadata_context, int is_first,
- int is_last, grpc_call_list *call_list);
+ int is_last, grpc_closure_list *closure_list);
/* Destroy per channel data.
The filter does not need to do any chaining */
void (*destroy_channel_elem)(grpc_channel_element *elem,
- grpc_call_list *call_list);
+ grpc_closure_list *closure_list);
/* Implement grpc_call_get_peer() */
- char *(*get_peer)(grpc_call_element *elem, grpc_call_list *call_list);
+ char *(*get_peer)(grpc_call_element *elem, grpc_closure_list *closure_list);
/* The name of this filter */
const char *name;
@@ -162,10 +163,10 @@ void grpc_channel_stack_init(const grpc_channel_filter **filters,
const grpc_channel_args *args,
grpc_mdctx *metadata_context,
grpc_channel_stack *stack,
- grpc_call_list *call_list);
+ grpc_closure_list *closure_list);
/* Destroy a channel stack */
void grpc_channel_stack_destroy(grpc_channel_stack *stack,
- grpc_call_list *call_list);
+ grpc_closure_list *closure_list);
/* Initialize a call stack given a channel stack. transport_server_data is
expected to be NULL on a client, or an opaque transport owned pointer on the
@@ -174,20 +175,21 @@ void grpc_call_stack_init(grpc_channel_stack *channel_stack,
const void *transport_server_data,
grpc_transport_stream_op *initial_op,
grpc_call_stack *call_stack,
- grpc_call_list *call_list);
+ grpc_closure_list *closure_list);
/* Destroy a call stack */
-void grpc_call_stack_destroy(grpc_call_stack *stack, grpc_call_list *call_list);
+void grpc_call_stack_destroy(grpc_call_stack *stack,
+ grpc_closure_list *closure_list);
/* Call the next operation in a call stack */
void grpc_call_next_op(grpc_call_element *elem, grpc_transport_stream_op *op,
- grpc_call_list *call_list);
+ grpc_closure_list *closure_list);
/* Call the next operation (depending on call directionality) in a channel
stack */
void grpc_channel_next_op(grpc_channel_element *elem, grpc_transport_op *op,
- grpc_call_list *call_list);
+ grpc_closure_list *closure_list);
/* Pass through a request to get_peer to the next child element */
char *grpc_call_next_get_peer(grpc_call_element *elem,
- grpc_call_list *call_list);
+ grpc_closure_list *closure_list);
/* Given the top element of a channel stack, get the channel stack itself */
grpc_channel_stack *grpc_channel_stack_from_top_element(
@@ -199,7 +201,7 @@ void grpc_call_log_op(char *file, int line, gpr_log_severity severity,
grpc_call_element *elem, grpc_transport_stream_op *op);
void grpc_call_element_send_cancel(grpc_call_element *cur_elem,
- grpc_call_list *call_list);
+ grpc_closure_list *closure_list);
extern int grpc_trace_channel;
diff --git a/src/core/channel/client_channel.c b/src/core/channel/client_channel.c
index 62f81daf44..54adeaee9d 100644
--- a/src/core/channel/client_channel.c
+++ b/src/core/channel/client_channel.c
@@ -73,7 +73,7 @@ typedef struct {
guarded by mu_config */
grpc_client_config *incoming_configuration;
/** a list of closures that are all waiting for config to come in */
- grpc_call_list waiting_for_config_closures;
+ grpc_closure_list waiting_for_config_closures;
/** resolver callback */
grpc_closure on_config_changed;
/** connectivity state being tracked */
@@ -129,12 +129,12 @@ static grpc_closure *merge_into_waiting_op(grpc_call_element *elem,
static void handle_op_after_cancellation(grpc_call_element *elem,
grpc_transport_stream_op *op,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
call_data *calld = elem->call_data;
channel_data *chand = elem->channel_data;
if (op->send_ops) {
grpc_stream_ops_unref_owned_objects(op->send_ops->ops, op->send_ops->nops);
- op->on_done_send->cb(op->on_done_send->cb_arg, 0, call_list);
+ op->on_done_send->cb(op->on_done_send->cb_arg, 0, closure_list);
}
if (op->recv_ops) {
char status[GPR_LTOA_MIN_BUFSIZE];
@@ -153,10 +153,10 @@ static void handle_op_after_cancellation(grpc_call_element *elem,
mdb.deadline = gpr_inf_future(GPR_CLOCK_REALTIME);
grpc_sopb_add_metadata(op->recv_ops, mdb);
*op->recv_state = GRPC_STREAM_CLOSED;
- op->on_done_recv->cb(op->on_done_recv->cb_arg, 1, call_list);
+ op->on_done_recv->cb(op->on_done_recv->cb_arg, 1, closure_list);
}
if (op->on_consumed) {
- op->on_consumed->cb(op->on_consumed->cb_arg, 0, call_list);
+ op->on_consumed->cb(op->on_consumed->cb_arg, 0, closure_list);
}
}
@@ -168,13 +168,13 @@ typedef struct {
static void perform_transport_stream_op(grpc_call_element *elem,
grpc_transport_stream_op *op,
int continuation,
- grpc_call_list *call_list);
+ grpc_closure_list *closure_list);
static void continue_with_pick(void *arg, int iomgr_success,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
waiting_call *wc = arg;
call_data *calld = wc->elem->call_data;
- perform_transport_stream_op(wc->elem, &calld->waiting_op, 1, call_list);
+ perform_transport_stream_op(wc->elem, &calld->waiting_op, 1, closure_list);
gpr_free(wc);
}
@@ -184,7 +184,7 @@ static void add_to_lb_policy_wait_queue_locked_state_config(
waiting_call *wc = gpr_malloc(sizeof(*wc));
grpc_closure_init(&wc->closure, continue_with_pick, wc);
wc->elem = elem;
- grpc_call_list_add(&chand->waiting_for_config_closures, &wc->closure, 1);
+ grpc_closure_list_add(&chand->waiting_for_config_closures, &wc->closure, 1);
}
static int is_empty(void *p, int len) {
@@ -197,7 +197,7 @@ static int is_empty(void *p, int len) {
}
static void started_call(void *arg, int iomgr_success,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
call_data *calld = arg;
grpc_transport_stream_op op;
int have_waiting;
@@ -207,7 +207,7 @@ static void started_call(void *arg, int iomgr_success,
memset(&op, 0, sizeof(op));
op.cancel_with_status = GRPC_STATUS_CANCELLED;
gpr_mu_unlock(&calld->mu_state);
- grpc_subchannel_call_process_op(calld->subchannel_call, &op, call_list);
+ grpc_subchannel_call_process_op(calld->subchannel_call, &op, closure_list);
} else if (calld->state == CALL_WAITING_FOR_CALL) {
have_waiting = !is_empty(&calld->waiting_op, sizeof(calld->waiting_op));
if (calld->subchannel_call != NULL) {
@@ -215,14 +215,14 @@ static void started_call(void *arg, int iomgr_success,
gpr_mu_unlock(&calld->mu_state);
if (have_waiting) {
grpc_subchannel_call_process_op(calld->subchannel_call,
- &calld->waiting_op, call_list);
+ &calld->waiting_op, closure_list);
}
} else {
calld->state = CALL_CANCELLED;
gpr_mu_unlock(&calld->mu_state);
if (have_waiting) {
handle_op_after_cancellation(calld->elem, &calld->waiting_op,
- call_list);
+ closure_list);
}
}
} else {
@@ -232,19 +232,21 @@ static void started_call(void *arg, int iomgr_success,
}
static void picked_target(void *arg, int iomgr_success,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
call_data *calld = arg;
grpc_pollset *pollset;
if (calld->picked_channel == NULL) {
/* treat this like a cancellation */
calld->waiting_op.cancel_with_status = GRPC_STATUS_UNAVAILABLE;
- perform_transport_stream_op(calld->elem, &calld->waiting_op, 1, call_list);
+ perform_transport_stream_op(calld->elem, &calld->waiting_op, 1,
+ closure_list);
} else {
gpr_mu_lock(&calld->mu_state);
if (calld->state == CALL_CANCELLED) {
gpr_mu_unlock(&calld->mu_state);
- handle_op_after_cancellation(calld->elem, &calld->waiting_op, call_list);
+ handle_op_after_cancellation(calld->elem, &calld->waiting_op,
+ closure_list);
} else {
GPR_ASSERT(calld->state == CALL_WAITING_FOR_PICK);
calld->state = CALL_WAITING_FOR_CALL;
@@ -253,7 +255,7 @@ static void picked_target(void *arg, int iomgr_success,
grpc_closure_init(&calld->async_setup_task, started_call, calld);
grpc_subchannel_create_call(calld->picked_channel, pollset,
&calld->subchannel_call,
- &calld->async_setup_task, call_list);
+ &calld->async_setup_task, closure_list);
}
}
}
@@ -287,7 +289,8 @@ static grpc_closure *merge_into_waiting_op(grpc_call_element *elem,
return consumed_op;
}
-static char *cc_get_peer(grpc_call_element *elem, grpc_call_list *call_list) {
+static char *cc_get_peer(grpc_call_element *elem,
+ grpc_closure_list *closure_list) {
call_data *calld = elem->call_data;
channel_data *chand = elem->channel_data;
grpc_subchannel_call *subchannel_call;
@@ -298,8 +301,8 @@ static char *cc_get_peer(grpc_call_element *elem, grpc_call_list *call_list) {
subchannel_call = calld->subchannel_call;
GRPC_SUBCHANNEL_CALL_REF(subchannel_call, "get_peer");
gpr_mu_unlock(&calld->mu_state);
- result = grpc_subchannel_call_get_peer(subchannel_call, call_list);
- GRPC_SUBCHANNEL_CALL_UNREF(subchannel_call, "get_peer", call_list);
+ result = grpc_subchannel_call_get_peer(subchannel_call, closure_list);
+ GRPC_SUBCHANNEL_CALL_UNREF(subchannel_call, "get_peer", closure_list);
return result;
} else {
gpr_mu_unlock(&calld->mu_state);
@@ -310,7 +313,7 @@ static char *cc_get_peer(grpc_call_element *elem, grpc_call_list *call_list) {
static void perform_transport_stream_op(grpc_call_element *elem,
grpc_transport_stream_op *op,
int continuation,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
call_data *calld = elem->call_data;
channel_data *chand = elem->channel_data;
grpc_subchannel_call *subchannel_call;
@@ -325,15 +328,15 @@ static void perform_transport_stream_op(grpc_call_element *elem,
GPR_ASSERT(!continuation);
subchannel_call = calld->subchannel_call;
gpr_mu_unlock(&calld->mu_state);
- grpc_subchannel_call_process_op(subchannel_call, op, call_list);
+ grpc_subchannel_call_process_op(subchannel_call, op, closure_list);
break;
case CALL_CANCELLED:
gpr_mu_unlock(&calld->mu_state);
- handle_op_after_cancellation(elem, op, call_list);
+ handle_op_after_cancellation(elem, op, closure_list);
break;
case CALL_WAITING_FOR_SEND:
GPR_ASSERT(!continuation);
- grpc_call_list_add(call_list, merge_into_waiting_op(elem, op), 1);
+ grpc_closure_list_add(closure_list, merge_into_waiting_op(elem, op), 1);
if (!calld->waiting_op.send_ops &&
calld->waiting_op.cancel_with_status == GRPC_STATUS_OK) {
gpr_mu_unlock(&calld->mu_state);
@@ -359,10 +362,11 @@ static void perform_transport_stream_op(grpc_call_element *elem,
op2.on_consumed = NULL;
}
gpr_mu_unlock(&calld->mu_state);
- handle_op_after_cancellation(elem, op, call_list);
- handle_op_after_cancellation(elem, &op2, call_list);
+ handle_op_after_cancellation(elem, op, closure_list);
+ handle_op_after_cancellation(elem, &op2, closure_list);
} else {
- grpc_call_list_add(call_list, merge_into_waiting_op(elem, op), 1);
+ grpc_closure_list_add(closure_list, merge_into_waiting_op(elem, op),
+ 1);
gpr_mu_unlock(&calld->mu_state);
}
break;
@@ -372,7 +376,7 @@ static void perform_transport_stream_op(grpc_call_element *elem,
if (op->cancel_with_status != GRPC_STATUS_OK) {
calld->state = CALL_CANCELLED;
gpr_mu_unlock(&calld->mu_state);
- handle_op_after_cancellation(elem, op, call_list);
+ handle_op_after_cancellation(elem, op, closure_list);
} else {
calld->waiting_op = *op;
@@ -402,9 +406,9 @@ static void perform_transport_stream_op(grpc_call_element *elem,
grpc_closure_init(&calld->async_setup_task, picked_target, calld);
grpc_lb_policy_pick(lb_policy, bind_pollset, initial_metadata,
&calld->picked_channel,
- &calld->async_setup_task, call_list);
+ &calld->async_setup_task, closure_list);
- GRPC_LB_POLICY_UNREF(lb_policy, "pick", call_list);
+ GRPC_LB_POLICY_UNREF(lb_policy, "pick", closure_list);
} else if (chand->resolver != NULL) {
calld->state = CALL_WAITING_FOR_CONFIG;
add_to_lb_policy_wait_queue_locked_state_config(elem);
@@ -413,7 +417,7 @@ static void perform_transport_stream_op(grpc_call_element *elem,
chand->started_resolving = 1;
grpc_resolver_next(chand->resolver,
&chand->incoming_configuration,
- &chand->on_config_changed, call_list);
+ &chand->on_config_changed, closure_list);
}
gpr_mu_unlock(&chand->mu_config);
gpr_mu_unlock(&calld->mu_state);
@@ -421,7 +425,7 @@ static void perform_transport_stream_op(grpc_call_element *elem,
calld->state = CALL_CANCELLED;
gpr_mu_unlock(&chand->mu_config);
gpr_mu_unlock(&calld->mu_state);
- handle_op_after_cancellation(elem, op, call_list);
+ handle_op_after_cancellation(elem, op, closure_list);
}
}
}
@@ -431,16 +435,16 @@ static void perform_transport_stream_op(grpc_call_element *elem,
static void cc_start_transport_stream_op(grpc_call_element *elem,
grpc_transport_stream_op *op,
- grpc_call_list *call_list) {
- perform_transport_stream_op(elem, op, 0, call_list);
+ grpc_closure_list *closure_list) {
+ perform_transport_stream_op(elem, op, 0, closure_list);
}
static void watch_lb_policy(channel_data *chand, grpc_lb_policy *lb_policy,
grpc_connectivity_state current_state,
- grpc_call_list *cl);
+ grpc_closure_list *cl);
static void on_lb_policy_state_changed_locked(lb_policy_connectivity_watcher *w,
- grpc_call_list *cl) {
+ grpc_closure_list *cl) {
/* check if the notification is for a stale policy */
if (w->lb_policy != w->chand->lb_policy) return;
@@ -452,20 +456,21 @@ static void on_lb_policy_state_changed_locked(lb_policy_connectivity_watcher *w,
}
static void on_lb_policy_state_changed(void *arg, int iomgr_success,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
lb_policy_connectivity_watcher *w = arg;
gpr_mu_lock(&w->chand->mu_config);
- on_lb_policy_state_changed_locked(w, call_list);
+ on_lb_policy_state_changed_locked(w, closure_list);
gpr_mu_unlock(&w->chand->mu_config);
- GRPC_CHANNEL_INTERNAL_UNREF(w->chand->master, "watch_lb_policy", call_list);
+ GRPC_CHANNEL_INTERNAL_UNREF(w->chand->master, "watch_lb_policy",
+ closure_list);
gpr_free(w);
}
static void watch_lb_policy(channel_data *chand, grpc_lb_policy *lb_policy,
grpc_connectivity_state current_state,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
lb_policy_connectivity_watcher *w = gpr_malloc(sizeof(*w));
GRPC_CHANNEL_INTERNAL_REF(chand->master, "watch_lb_policy");
@@ -474,11 +479,11 @@ static void watch_lb_policy(channel_data *chand, grpc_lb_policy *lb_policy,
w->state = current_state;
w->lb_policy = lb_policy;
grpc_lb_policy_notify_on_state_change(lb_policy, &w->state, &w->on_changed,
- call_list);
+ closure_list);
}
static void cc_on_config_changed(void *arg, int iomgr_success,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
channel_data *chand = arg;
grpc_lb_policy *lb_policy = NULL;
grpc_lb_policy *old_lb_policy;
@@ -491,10 +496,10 @@ static void cc_on_config_changed(void *arg, int iomgr_success,
if (lb_policy != NULL) {
GRPC_LB_POLICY_REF(lb_policy, "channel");
GRPC_LB_POLICY_REF(lb_policy, "config_change");
- state = grpc_lb_policy_check_connectivity(lb_policy, call_list);
+ state = grpc_lb_policy_check_connectivity(lb_policy, closure_list);
}
- grpc_client_config_unref(chand->incoming_configuration, call_list);
+ grpc_client_config_unref(chand->incoming_configuration, closure_list);
}
chand->incoming_configuration = NULL;
@@ -503,7 +508,7 @@ static void cc_on_config_changed(void *arg, int iomgr_success,
old_lb_policy = chand->lb_policy;
chand->lb_policy = lb_policy;
if (lb_policy != NULL || chand->resolver == NULL /* disconnected */) {
- grpc_call_list_move(&chand->waiting_for_config_closures, call_list);
+ grpc_closure_list_move(&chand->waiting_for_config_closures, closure_list);
}
if (lb_policy != NULL && chand->exit_idle_when_lb_policy_arrives) {
GRPC_LB_POLICY_REF(lb_policy, "exit_idle");
@@ -515,53 +520,53 @@ static void cc_on_config_changed(void *arg, int iomgr_success,
grpc_resolver *resolver = chand->resolver;
GRPC_RESOLVER_REF(resolver, "channel-next");
grpc_connectivity_state_set(&chand->state_tracker, state, "new_lb+resolver",
- call_list);
+ closure_list);
if (lb_policy != NULL) {
- watch_lb_policy(chand, lb_policy, state, call_list);
+ watch_lb_policy(chand, lb_policy, state, closure_list);
}
gpr_mu_unlock(&chand->mu_config);
GRPC_CHANNEL_INTERNAL_REF(chand->master, "resolver");
grpc_resolver_next(resolver, &chand->incoming_configuration,
- &chand->on_config_changed, call_list);
- GRPC_RESOLVER_UNREF(resolver, "channel-next", call_list);
+ &chand->on_config_changed, closure_list);
+ GRPC_RESOLVER_UNREF(resolver, "channel-next", closure_list);
} else {
old_resolver = chand->resolver;
chand->resolver = NULL;
grpc_connectivity_state_set(&chand->state_tracker,
GRPC_CHANNEL_FATAL_FAILURE, "resolver_gone",
- call_list);
+ closure_list);
gpr_mu_unlock(&chand->mu_config);
if (old_resolver != NULL) {
- grpc_resolver_shutdown(old_resolver, call_list);
- GRPC_RESOLVER_UNREF(old_resolver, "channel", call_list);
+ grpc_resolver_shutdown(old_resolver, closure_list);
+ GRPC_RESOLVER_UNREF(old_resolver, "channel", closure_list);
}
}
if (exit_idle) {
- grpc_lb_policy_exit_idle(lb_policy, call_list);
- GRPC_LB_POLICY_UNREF(lb_policy, "exit_idle", call_list);
+ grpc_lb_policy_exit_idle(lb_policy, closure_list);
+ GRPC_LB_POLICY_UNREF(lb_policy, "exit_idle", closure_list);
}
if (old_lb_policy != NULL) {
- grpc_lb_policy_shutdown(old_lb_policy, call_list);
- GRPC_LB_POLICY_UNREF(old_lb_policy, "channel", call_list);
+ grpc_lb_policy_shutdown(old_lb_policy, closure_list);
+ GRPC_LB_POLICY_UNREF(old_lb_policy, "channel", closure_list);
}
if (lb_policy != NULL) {
- GRPC_LB_POLICY_UNREF(lb_policy, "config_change", call_list);
+ GRPC_LB_POLICY_UNREF(lb_policy, "config_change", closure_list);
}
- GRPC_CHANNEL_INTERNAL_UNREF(chand->master, "resolver", call_list);
+ GRPC_CHANNEL_INTERNAL_UNREF(chand->master, "resolver", closure_list);
}
static void cc_start_transport_op(grpc_channel_element *elem,
grpc_transport_op *op,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
grpc_lb_policy *lb_policy = NULL;
channel_data *chand = elem->channel_data;
grpc_resolver *destroy_resolver = NULL;
- grpc_call_list_add(call_list, op->on_consumed, 1);
+ grpc_closure_list_add(closure_list, op->on_consumed, 1);
GPR_ASSERT(op->set_accept_stream == NULL);
GPR_ASSERT(op->bind_pollset == NULL);
@@ -570,7 +575,7 @@ static void cc_start_transport_op(grpc_channel_element *elem,
if (op->on_connectivity_state_change != NULL) {
grpc_connectivity_state_notify_on_state_change(
&chand->state_tracker, op->connectivity_state,
- op->on_connectivity_state_change, call_list);
+ op->on_connectivity_state_change, closure_list);
op->on_connectivity_state_change = NULL;
op->connectivity_state = NULL;
}
@@ -585,25 +590,25 @@ static void cc_start_transport_op(grpc_channel_element *elem,
if (op->disconnect && chand->resolver != NULL) {
grpc_connectivity_state_set(&chand->state_tracker,
GRPC_CHANNEL_FATAL_FAILURE, "disconnect",
- call_list);
+ closure_list);
destroy_resolver = chand->resolver;
chand->resolver = NULL;
if (chand->lb_policy != NULL) {
- grpc_lb_policy_shutdown(chand->lb_policy, call_list);
- GRPC_LB_POLICY_UNREF(chand->lb_policy, "channel", call_list);
+ grpc_lb_policy_shutdown(chand->lb_policy, closure_list);
+ GRPC_LB_POLICY_UNREF(chand->lb_policy, "channel", closure_list);
chand->lb_policy = NULL;
}
}
gpr_mu_unlock(&chand->mu_config);
if (destroy_resolver) {
- grpc_resolver_shutdown(destroy_resolver, call_list);
- GRPC_RESOLVER_UNREF(destroy_resolver, "channel", call_list);
+ grpc_resolver_shutdown(destroy_resolver, closure_list);
+ GRPC_RESOLVER_UNREF(destroy_resolver, "channel", closure_list);
}
if (lb_policy) {
- grpc_lb_policy_broadcast(lb_policy, op, call_list);
- GRPC_LB_POLICY_UNREF(lb_policy, "broadcast", call_list);
+ grpc_lb_policy_broadcast(lb_policy, op, closure_list);
+ GRPC_LB_POLICY_UNREF(lb_policy, "broadcast", closure_list);
}
}
@@ -611,7 +616,7 @@ static void cc_start_transport_op(grpc_channel_element *elem,
static void init_call_elem(grpc_call_element *elem,
const void *server_transport_data,
grpc_transport_stream_op *initial_op,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
call_data *calld = elem->call_data;
/* TODO(ctiller): is there something useful we can do here? */
@@ -627,7 +632,7 @@ static void init_call_elem(grpc_call_element *elem,
/* Destructor for call_data */
static void destroy_call_elem(grpc_call_element *elem,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
call_data *calld = elem->call_data;
grpc_subchannel_call *subchannel_call;
@@ -639,7 +644,8 @@ static void destroy_call_elem(grpc_call_element *elem,
case CALL_ACTIVE:
subchannel_call = calld->subchannel_call;
gpr_mu_unlock(&calld->mu_state);
- GRPC_SUBCHANNEL_CALL_UNREF(subchannel_call, "client_channel", call_list);
+ GRPC_SUBCHANNEL_CALL_UNREF(subchannel_call, "client_channel",
+ closure_list);
break;
case CALL_CREATED:
case CALL_CANCELLED:
@@ -659,7 +665,7 @@ static void destroy_call_elem(grpc_call_element *elem,
static void init_channel_elem(grpc_channel_element *elem, grpc_channel *master,
const grpc_channel_args *args,
grpc_mdctx *metadata_context, int is_first,
- int is_last, grpc_call_list *call_list) {
+ int is_last, grpc_closure_list *closure_list) {
channel_data *chand = elem->channel_data;
memset(chand, 0, sizeof(*chand));
@@ -679,17 +685,17 @@ static void init_channel_elem(grpc_channel_element *elem, grpc_channel *master,
/* Destructor for channel_data */
static void destroy_channel_elem(grpc_channel_element *elem,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
channel_data *chand = elem->channel_data;
if (chand->resolver != NULL) {
- grpc_resolver_shutdown(chand->resolver, call_list);
- GRPC_RESOLVER_UNREF(chand->resolver, "channel", call_list);
+ grpc_resolver_shutdown(chand->resolver, closure_list);
+ GRPC_RESOLVER_UNREF(chand->resolver, "channel", closure_list);
}
if (chand->lb_policy != NULL) {
- GRPC_LB_POLICY_UNREF(chand->lb_policy, "channel", call_list);
+ GRPC_LB_POLICY_UNREF(chand->lb_policy, "channel", closure_list);
}
- grpc_connectivity_state_destroy(&chand->state_tracker, call_list);
+ grpc_connectivity_state_destroy(&chand->state_tracker, closure_list);
grpc_pollset_set_destroy(&chand->pollset_set);
gpr_mu_destroy(&chand->mu_config);
}
@@ -709,7 +715,7 @@ const grpc_channel_filter grpc_client_channel_filter = {
void grpc_client_channel_set_resolver(grpc_channel_stack *channel_stack,
grpc_resolver *resolver,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
/* post construction initialization: set the transport setup pointer */
grpc_channel_element *elem = grpc_channel_stack_last_element(channel_stack);
channel_data *chand = elem->channel_data;
@@ -717,32 +723,33 @@ void grpc_client_channel_set_resolver(grpc_channel_stack *channel_stack,
GPR_ASSERT(!chand->resolver);
chand->resolver = resolver;
GRPC_RESOLVER_REF(resolver, "channel");
- if (!grpc_call_list_empty(chand->waiting_for_config_closures) ||
+ if (!grpc_closure_list_empty(chand->waiting_for_config_closures) ||
chand->exit_idle_when_lb_policy_arrives) {
chand->started_resolving = 1;
GRPC_CHANNEL_INTERNAL_REF(chand->master, "resolver");
grpc_resolver_next(resolver, &chand->incoming_configuration,
- &chand->on_config_changed, call_list);
+ &chand->on_config_changed, closure_list);
}
gpr_mu_unlock(&chand->mu_config);
}
grpc_connectivity_state grpc_client_channel_check_connectivity_state(
- grpc_channel_element *elem, int try_to_connect, grpc_call_list *call_list) {
+ grpc_channel_element *elem, int try_to_connect,
+ grpc_closure_list *closure_list) {
channel_data *chand = elem->channel_data;
grpc_connectivity_state out;
gpr_mu_lock(&chand->mu_config);
out = grpc_connectivity_state_check(&chand->state_tracker);
if (out == GRPC_CHANNEL_IDLE && try_to_connect) {
if (chand->lb_policy != NULL) {
- grpc_lb_policy_exit_idle(chand->lb_policy, call_list);
+ grpc_lb_policy_exit_idle(chand->lb_policy, closure_list);
} else {
chand->exit_idle_when_lb_policy_arrives = 1;
if (!chand->started_resolving && chand->resolver != NULL) {
GRPC_CHANNEL_INTERNAL_REF(chand->master, "resolver");
chand->started_resolving = 1;
grpc_resolver_next(chand->resolver, &chand->incoming_configuration,
- &chand->on_config_changed, call_list);
+ &chand->on_config_changed, closure_list);
}
}
}
@@ -752,11 +759,11 @@ grpc_connectivity_state grpc_client_channel_check_connectivity_state(
void grpc_client_channel_watch_connectivity_state(
grpc_channel_element *elem, grpc_connectivity_state *state,
- grpc_closure *on_complete, grpc_call_list *call_list) {
+ grpc_closure *on_complete, grpc_closure_list *closure_list) {
channel_data *chand = elem->channel_data;
gpr_mu_lock(&chand->mu_config);
grpc_connectivity_state_notify_on_state_change(&chand->state_tracker, state,
- on_complete, call_list);
+ on_complete, closure_list);
gpr_mu_unlock(&chand->mu_config);
}
@@ -768,14 +775,14 @@ grpc_pollset_set *grpc_client_channel_get_connecting_pollset_set(
void grpc_client_channel_add_interested_party(grpc_channel_element *elem,
grpc_pollset *pollset,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
channel_data *chand = elem->channel_data;
- grpc_pollset_set_add_pollset(&chand->pollset_set, pollset, call_list);
+ grpc_pollset_set_add_pollset(&chand->pollset_set, pollset, closure_list);
}
void grpc_client_channel_del_interested_party(grpc_channel_element *elem,
grpc_pollset *pollset,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
channel_data *chand = elem->channel_data;
- grpc_pollset_set_del_pollset(&chand->pollset_set, pollset, call_list);
+ grpc_pollset_set_del_pollset(&chand->pollset_set, pollset, closure_list);
}
diff --git a/src/core/channel/client_channel.h b/src/core/channel/client_channel.h
index 7afc7f8544..d200f6e4b0 100644
--- a/src/core/channel/client_channel.h
+++ b/src/core/channel/client_channel.h
@@ -51,23 +51,24 @@ extern const grpc_channel_filter grpc_client_channel_filter;
a connection */
void grpc_client_channel_set_resolver(grpc_channel_stack *channel_stack,
grpc_resolver *resolver,
- grpc_call_list *call_list);
+ grpc_closure_list *closure_list);
grpc_connectivity_state grpc_client_channel_check_connectivity_state(
- grpc_channel_element *elem, int try_to_connect, grpc_call_list *call_list);
+ grpc_channel_element *elem, int try_to_connect,
+ grpc_closure_list *closure_list);
void grpc_client_channel_watch_connectivity_state(
grpc_channel_element *elem, grpc_connectivity_state *state,
- grpc_closure *on_complete, grpc_call_list *call_list);
+ grpc_closure *on_complete, grpc_closure_list *closure_list);
grpc_pollset_set *grpc_client_channel_get_connecting_pollset_set(
grpc_channel_element *elem);
void grpc_client_channel_add_interested_party(grpc_channel_element *channel,
grpc_pollset *pollset,
- grpc_call_list *call_list);
+ grpc_closure_list *closure_list);
void grpc_client_channel_del_interested_party(grpc_channel_element *channel,
grpc_pollset *pollset,
- grpc_call_list *call_list);
+ grpc_closure_list *closure_list);
#endif /* GRPC_INTERNAL_CORE_CHANNEL_CLIENT_CHANNEL_H */
diff --git a/src/core/channel/compress_filter.c b/src/core/channel/compress_filter.c
index e2be603e26..911c689d54 100644
--- a/src/core/channel/compress_filter.c
+++ b/src/core/channel/compress_filter.c
@@ -268,22 +268,22 @@ static void process_send_ops(grpc_call_element *elem,
- a network event (or similar) from below, to receive something
op contains type and call direction information, in addition to the data
that is being sent or received. */
-static void compress_start_transport_stream_op(grpc_call_element *elem,
- grpc_transport_stream_op *op,
- grpc_call_list *call_list) {
+static void compress_start_transport_stream_op(
+ grpc_call_element *elem, grpc_transport_stream_op *op,
+ grpc_closure_list *closure_list) {
if (op->send_ops && op->send_ops->nops > 0) {
process_send_ops(elem, op->send_ops);
}
/* pass control down the stack */
- grpc_call_next_op(elem, op, call_list);
+ grpc_call_next_op(elem, op, closure_list);
}
/* Constructor for call_data */
static void init_call_elem(grpc_call_element *elem,
const void *server_transport_data,
grpc_transport_stream_op *initial_op,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
/* grab pointers to our data from the call element */
call_data *calld = elem->call_data;
@@ -301,7 +301,7 @@ static void init_call_elem(grpc_call_element *elem,
/* Destructor for call_data */
static void destroy_call_elem(grpc_call_element *elem,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
/* grab pointers to our data from the call element */
call_data *calld = elem->call_data;
gpr_slice_buffer_destroy(&calld->slices);
@@ -311,7 +311,7 @@ static void destroy_call_elem(grpc_call_element *elem,
static void init_channel_elem(grpc_channel_element *elem, grpc_channel *master,
const grpc_channel_args *args, grpc_mdctx *mdctx,
int is_first, int is_last,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
channel_data *channeld = elem->channel_data;
grpc_compression_algorithm algo_idx;
const char *supported_algorithms_names[GRPC_COMPRESS_ALGORITHMS_COUNT - 1];
@@ -374,7 +374,7 @@ static void init_channel_elem(grpc_channel_element *elem, grpc_channel *master,
/* Destructor for channel data */
static void destroy_channel_elem(grpc_channel_element *elem,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
channel_data *channeld = elem->channel_data;
grpc_compression_algorithm algo_idx;
diff --git a/src/core/channel/connected_channel.c b/src/core/channel/connected_channel.c
index 1af5eae947..b58e180a43 100644
--- a/src/core/channel/connected_channel.c
+++ b/src/core/channel/connected_channel.c
@@ -63,54 +63,55 @@ typedef struct connected_channel_call_data { void *unused; } call_data;
into transport stream operations */
static void con_start_transport_stream_op(grpc_call_element *elem,
grpc_transport_stream_op *op,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
call_data *calld = elem->call_data;
channel_data *chand = elem->channel_data;
GPR_ASSERT(elem->filter == &grpc_connected_channel_filter);
GRPC_CALL_LOG_OP(GPR_INFO, elem, op);
- grpc_transport_perform_stream_op(
- chand->transport, TRANSPORT_STREAM_FROM_CALL_DATA(calld), op, call_list);
+ grpc_transport_perform_stream_op(chand->transport,
+ TRANSPORT_STREAM_FROM_CALL_DATA(calld), op,
+ closure_list);
}
static void con_start_transport_op(grpc_channel_element *elem,
grpc_transport_op *op,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
channel_data *chand = elem->channel_data;
- grpc_transport_perform_op(chand->transport, op, call_list);
+ grpc_transport_perform_op(chand->transport, op, closure_list);
}
/* Constructor for call_data */
static void init_call_elem(grpc_call_element *elem,
const void *server_transport_data,
grpc_transport_stream_op *initial_op,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
call_data *calld = elem->call_data;
channel_data *chand = elem->channel_data;
int r;
GPR_ASSERT(elem->filter == &grpc_connected_channel_filter);
- r = grpc_transport_init_stream(chand->transport,
- TRANSPORT_STREAM_FROM_CALL_DATA(calld),
- server_transport_data, initial_op, call_list);
+ r = grpc_transport_init_stream(
+ chand->transport, TRANSPORT_STREAM_FROM_CALL_DATA(calld),
+ server_transport_data, initial_op, closure_list);
GPR_ASSERT(r == 0);
}
/* Destructor for call_data */
static void destroy_call_elem(grpc_call_element *elem,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
call_data *calld = elem->call_data;
channel_data *chand = elem->channel_data;
GPR_ASSERT(elem->filter == &grpc_connected_channel_filter);
grpc_transport_destroy_stream(
- chand->transport, TRANSPORT_STREAM_FROM_CALL_DATA(calld), call_list);
+ chand->transport, TRANSPORT_STREAM_FROM_CALL_DATA(calld), closure_list);
}
/* Constructor for channel_data */
static void init_channel_elem(grpc_channel_element *elem, grpc_channel *master,
const grpc_channel_args *args, grpc_mdctx *mdctx,
int is_first, int is_last,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
channel_data *cd = (channel_data *)elem->channel_data;
GPR_ASSERT(is_last);
GPR_ASSERT(elem->filter == &grpc_connected_channel_filter);
@@ -119,15 +120,16 @@ static void init_channel_elem(grpc_channel_element *elem, grpc_channel *master,
/* Destructor for channel_data */
static void destroy_channel_elem(grpc_channel_element *elem,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
channel_data *cd = (channel_data *)elem->channel_data;
GPR_ASSERT(elem->filter == &grpc_connected_channel_filter);
- grpc_transport_destroy(cd->transport, call_list);
+ grpc_transport_destroy(cd->transport, closure_list);
}
-static char *con_get_peer(grpc_call_element *elem, grpc_call_list *call_list) {
+static char *con_get_peer(grpc_call_element *elem,
+ grpc_closure_list *closure_list) {
channel_data *chand = elem->channel_data;
- return grpc_transport_get_peer(chand->transport, call_list);
+ return grpc_transport_get_peer(chand->transport, closure_list);
}
const grpc_channel_filter grpc_connected_channel_filter = {
diff --git a/src/core/channel/http_client_filter.c b/src/core/channel/http_client_filter.c
index 0aa708694d..6fbe4738e7 100644
--- a/src/core/channel/http_client_filter.c
+++ b/src/core/channel/http_client_filter.c
@@ -69,7 +69,7 @@ typedef struct channel_data {
typedef struct {
grpc_call_element *elem;
- grpc_call_list *call_list;
+ grpc_closure_list *closure_list;
} client_recv_filter_args;
static grpc_mdelem *client_recv_filter(void *user_data, grpc_mdelem *md) {
@@ -79,7 +79,7 @@ static grpc_mdelem *client_recv_filter(void *user_data, grpc_mdelem *md) {
if (md == channeld->status) {
return NULL;
} else if (md->key == channeld->status->key) {
- grpc_call_element_send_cancel(elem, a->call_list);
+ grpc_call_element_send_cancel(elem, a->closure_list);
return NULL;
} else if (md->key == channeld->content_type->key) {
return NULL;
@@ -88,7 +88,7 @@ static grpc_mdelem *client_recv_filter(void *user_data, grpc_mdelem *md) {
}
static void hc_on_recv(void *user_data, int success,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
grpc_call_element *elem = user_data;
call_data *calld = elem->call_data;
size_t i;
@@ -100,10 +100,10 @@ static void hc_on_recv(void *user_data, int success,
if (op->type != GRPC_OP_METADATA) continue;
calld->got_initial_metadata = 1;
a.elem = elem;
- a.call_list = call_list;
+ a.closure_list = closure_list;
grpc_metadata_batch_filter(&op->data.metadata, client_recv_filter, &a);
}
- calld->on_done_recv->cb(calld->on_done_recv->cb_arg, success, call_list);
+ calld->on_done_recv->cb(calld->on_done_recv->cb_arg, success, closure_list);
}
static grpc_mdelem *client_strip_filter(void *user_data, grpc_mdelem *md) {
@@ -158,17 +158,17 @@ static void hc_mutate_op(grpc_call_element *elem,
static void hc_start_transport_op(grpc_call_element *elem,
grpc_transport_stream_op *op,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
GRPC_CALL_LOG_OP(GPR_INFO, elem, op);
hc_mutate_op(elem, op);
- grpc_call_next_op(elem, op, call_list);
+ grpc_call_next_op(elem, op, closure_list);
}
/* Constructor for call_data */
static void init_call_elem(grpc_call_element *elem,
const void *server_transport_data,
grpc_transport_stream_op *initial_op,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
call_data *calld = elem->call_data;
calld->sent_initial_metadata = 0;
calld->got_initial_metadata = 0;
@@ -179,7 +179,7 @@ static void init_call_elem(grpc_call_element *elem,
/* Destructor for call_data */
static void destroy_call_elem(grpc_call_element *elem,
- grpc_call_list *call_list) {}
+ grpc_closure_list *closure_list) {}
static const char *scheme_from_args(const grpc_channel_args *args) {
unsigned i;
@@ -247,7 +247,7 @@ static grpc_mdstr *user_agent_from_args(grpc_mdctx *mdctx,
static void init_channel_elem(grpc_channel_element *elem, grpc_channel *master,
const grpc_channel_args *channel_args,
grpc_mdctx *mdctx, int is_first, int is_last,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
/* grab pointers to our data from the channel element */
channel_data *channeld = elem->channel_data;
@@ -271,7 +271,7 @@ static void init_channel_elem(grpc_channel_element *elem, grpc_channel *master,
/* Destructor for channel data */
static void destroy_channel_elem(grpc_channel_element *elem,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
/* grab pointers to our data from the channel element */
channel_data *channeld = elem->channel_data;
diff --git a/src/core/channel/http_server_filter.c b/src/core/channel/http_server_filter.c
index 448ce9a5b1..fb1f0b0554 100644
--- a/src/core/channel/http_server_filter.c
+++ b/src/core/channel/http_server_filter.c
@@ -76,7 +76,7 @@ typedef struct channel_data {
typedef struct {
grpc_call_element *elem;
- grpc_call_list *call_list;
+ grpc_closure_list *closure_list;
} server_filter_args;
static grpc_mdelem *server_filter(void *user_data, grpc_mdelem *md) {
@@ -123,7 +123,7 @@ static grpc_mdelem *server_filter(void *user_data, grpc_mdelem *md) {
/* swallow it and error everything out. */
/* TODO(klempner): We ought to generate more descriptive error messages
on the wire here. */
- grpc_call_element_send_cancel(elem, a->call_list);
+ grpc_call_element_send_cancel(elem, a->closure_list);
return NULL;
} else if (md->key == channeld->path_key) {
if (calld->seen_path) {
@@ -150,7 +150,7 @@ static grpc_mdelem *server_filter(void *user_data, grpc_mdelem *md) {
}
static void hs_on_recv(void *user_data, int success,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
grpc_call_element *elem = user_data;
call_data *calld = elem->call_data;
if (success) {
@@ -163,7 +163,7 @@ static void hs_on_recv(void *user_data, int success,
if (op->type != GRPC_OP_METADATA) continue;
calld->got_initial_metadata = 1;
a.elem = elem;
- a.call_list = call_list;
+ a.closure_list = closure_list;
grpc_metadata_batch_filter(&op->data.metadata, server_filter, &a);
/* Have we seen the required http2 transport headers?
(:method, :scheme, content-type, with :path and :authority covered
@@ -189,11 +189,11 @@ static void hs_on_recv(void *user_data, int success,
}
/* Error this call out */
success = 0;
- grpc_call_element_send_cancel(elem, call_list);
+ grpc_call_element_send_cancel(elem, closure_list);
}
}
}
- calld->on_done_recv->cb(calld->on_done_recv->cb_arg, success, call_list);
+ calld->on_done_recv->cb(calld->on_done_recv->cb_arg, success, closure_list);
}
static void hs_mutate_op(grpc_call_element *elem,
@@ -228,17 +228,17 @@ static void hs_mutate_op(grpc_call_element *elem,
static void hs_start_transport_op(grpc_call_element *elem,
grpc_transport_stream_op *op,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
GRPC_CALL_LOG_OP(GPR_INFO, elem, op);
hs_mutate_op(elem, op);
- grpc_call_next_op(elem, op, call_list);
+ grpc_call_next_op(elem, op, closure_list);
}
/* Constructor for call_data */
static void init_call_elem(grpc_call_element *elem,
const void *server_transport_data,
grpc_transport_stream_op *initial_op,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
/* grab pointers to our data from the call element */
call_data *calld = elem->call_data;
/* initialize members */
@@ -249,13 +249,13 @@ static void init_call_elem(grpc_call_element *elem,
/* Destructor for call_data */
static void destroy_call_elem(grpc_call_element *elem,
- grpc_call_list *call_list) {}
+ grpc_closure_list *closure_list) {}
/* Constructor for channel_data */
static void init_channel_elem(grpc_channel_element *elem, grpc_channel *master,
const grpc_channel_args *args, grpc_mdctx *mdctx,
int is_first, int is_last,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
/* grab pointers to our data from the channel element */
channel_data *channeld = elem->channel_data;
@@ -285,7 +285,7 @@ static void init_channel_elem(grpc_channel_element *elem, grpc_channel *master,
/* Destructor for channel data */
static void destroy_channel_elem(grpc_channel_element *elem,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
/* grab pointers to our data from the channel element */
channel_data *channeld = elem->channel_data;
diff --git a/src/core/channel/noop_filter.c b/src/core/channel/noop_filter.c
index de75f83654..e4f6c7f837 100644
--- a/src/core/channel/noop_filter.c
+++ b/src/core/channel/noop_filter.c
@@ -64,18 +64,18 @@ static void noop_mutate_op(grpc_call_element *elem,
that is being sent or received. */
static void noop_start_transport_stream_op(grpc_call_element *elem,
grpc_transport_stream_op *op,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
noop_mutate_op(elem, op);
/* pass control down the stack */
- grpc_call_next_op(elem, op, call_list);
+ grpc_call_next_op(elem, op, closure_list);
}
/* Constructor for call_data */
static void init_call_elem(grpc_call_element *elem,
const void *server_transport_data,
grpc_transport_stream_op *initial_op,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
/* grab pointers to our data from the call element */
call_data *calld = elem->call_data;
channel_data *channeld = elem->channel_data;
@@ -88,13 +88,13 @@ static void init_call_elem(grpc_call_element *elem,
/* Destructor for call_data */
static void destroy_call_elem(grpc_call_element *elem,
- grpc_call_list *call_list) {}
+ grpc_closure_list *closure_list) {}
/* Constructor for channel_data */
static void init_channel_elem(grpc_channel_element *elem, grpc_channel *master,
const grpc_channel_args *args, grpc_mdctx *mdctx,
int is_first, int is_last,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
/* grab pointers to our data from the channel element */
channel_data *channeld = elem->channel_data;
@@ -110,7 +110,7 @@ static void init_channel_elem(grpc_channel_element *elem, grpc_channel *master,
/* Destructor for channel data */
static void destroy_channel_elem(grpc_channel_element *elem,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
/* grab pointers to our data from the channel element */
channel_data *channeld = elem->channel_data;
diff --git a/src/core/client_config/client_config.c b/src/core/client_config/client_config.c
index 0780880473..636ab6d1da 100644
--- a/src/core/client_config/client_config.c
+++ b/src/core/client_config/client_config.c
@@ -52,9 +52,9 @@ grpc_client_config *grpc_client_config_create() {
void grpc_client_config_ref(grpc_client_config *c) { gpr_ref(&c->refs); }
void grpc_client_config_unref(grpc_client_config *c,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
if (gpr_unref(&c->refs)) {
- GRPC_LB_POLICY_UNREF(c->lb_policy, "client_config", call_list);
+ GRPC_LB_POLICY_UNREF(c->lb_policy, "client_config", closure_list);
gpr_free(c);
}
}
diff --git a/src/core/client_config/client_config.h b/src/core/client_config/client_config.h
index 76a5c66594..8281dbe662 100644
--- a/src/core/client_config/client_config.h
+++ b/src/core/client_config/client_config.h
@@ -43,7 +43,7 @@ typedef struct grpc_client_config grpc_client_config;
grpc_client_config *grpc_client_config_create();
void grpc_client_config_ref(grpc_client_config *client_config);
void grpc_client_config_unref(grpc_client_config *client_config,
- grpc_call_list *call_list);
+ grpc_closure_list *closure_list);
void grpc_client_config_set_lb_policy(grpc_client_config *client_config,
grpc_lb_policy *lb_policy);
diff --git a/src/core/client_config/connector.c b/src/core/client_config/connector.c
index a0f346faeb..39581b00fc 100644
--- a/src/core/client_config/connector.c
+++ b/src/core/client_config/connector.c
@@ -38,18 +38,20 @@ void grpc_connector_ref(grpc_connector *connector) {
}
void grpc_connector_unref(grpc_connector *connector,
- grpc_call_list *call_list) {
- connector->vtable->unref(connector, call_list);
+ grpc_closure_list *closure_list) {
+ connector->vtable->unref(connector, closure_list);
}
void grpc_connector_connect(grpc_connector *connector,
const grpc_connect_in_args *in_args,
grpc_connect_out_args *out_args,
- grpc_closure *notify, grpc_call_list *call_list) {
- connector->vtable->connect(connector, in_args, out_args, notify, call_list);
+ grpc_closure *notify,
+ grpc_closure_list *closure_list) {
+ connector->vtable->connect(connector, in_args, out_args, notify,
+ closure_list);
}
void grpc_connector_shutdown(grpc_connector *connector,
- grpc_call_list *call_list) {
- connector->vtable->shutdown(connector, call_list);
+ grpc_closure_list *closure_list) {
+ connector->vtable->shutdown(connector, closure_list);
}
diff --git a/src/core/client_config/connector.h b/src/core/client_config/connector.h
index 388f656c44..fd46392dd8 100644
--- a/src/core/client_config/connector.h
+++ b/src/core/client_config/connector.h
@@ -67,25 +67,27 @@ typedef struct {
struct grpc_connector_vtable {
void (*ref)(grpc_connector *connector);
- void (*unref)(grpc_connector *connector, grpc_call_list *call_list);
+ void (*unref)(grpc_connector *connector, grpc_closure_list *closure_list);
/** Implementation of grpc_connector_shutdown */
- void (*shutdown)(grpc_connector *connector, grpc_call_list *call_list);
+ void (*shutdown)(grpc_connector *connector, grpc_closure_list *closure_list);
/** Implementation of grpc_connector_connect */
void (*connect)(grpc_connector *connector,
const grpc_connect_in_args *in_args,
grpc_connect_out_args *out_args, grpc_closure *notify,
- grpc_call_list *call_list);
+ grpc_closure_list *closure_list);
};
void grpc_connector_ref(grpc_connector *connector);
-void grpc_connector_unref(grpc_connector *connector, grpc_call_list *call_list);
+void grpc_connector_unref(grpc_connector *connector,
+ grpc_closure_list *closure_list);
/** Connect using the connector: max one outstanding call at a time */
void grpc_connector_connect(grpc_connector *connector,
const grpc_connect_in_args *in_args,
grpc_connect_out_args *out_args,
- grpc_closure *notify, grpc_call_list *call_list);
+ grpc_closure *notify,
+ grpc_closure_list *closure_list);
/** Cancel any pending connection */
void grpc_connector_shutdown(grpc_connector *connector,
- grpc_call_list *call_list);
+ grpc_closure_list *closure_list);
#endif
diff --git a/src/core/client_config/lb_policies/pick_first.c b/src/core/client_config/lb_policies/pick_first.c
index eebc7191ba..39e9e6c0d7 100644
--- a/src/core/client_config/lb_policies/pick_first.c
+++ b/src/core/client_config/lb_policies/pick_first.c
@@ -77,91 +77,92 @@ typedef struct {
} pick_first_lb_policy;
static void del_interested_parties_locked(pick_first_lb_policy *p,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
pending_pick *pp;
for (pp = p->pending_picks; pp; pp = pp->next) {
grpc_subchannel_del_interested_party(p->subchannels[p->checking_subchannel],
- pp->pollset, call_list);
+ pp->pollset, closure_list);
}
}
static void add_interested_parties_locked(pick_first_lb_policy *p,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
pending_pick *pp;
for (pp = p->pending_picks; pp; pp = pp->next) {
grpc_subchannel_add_interested_party(p->subchannels[p->checking_subchannel],
- pp->pollset, call_list);
+ pp->pollset, closure_list);
}
}
-void pf_destroy(grpc_lb_policy *pol, grpc_call_list *call_list) {
+void pf_destroy(grpc_lb_policy *pol, grpc_closure_list *closure_list) {
pick_first_lb_policy *p = (pick_first_lb_policy *)pol;
size_t i;
GPR_ASSERT(p->pending_picks == NULL);
for (i = 0; i < p->num_subchannels; i++) {
- GRPC_SUBCHANNEL_UNREF(p->subchannels[i], "pick_first", call_list);
+ GRPC_SUBCHANNEL_UNREF(p->subchannels[i], "pick_first", closure_list);
}
- grpc_connectivity_state_destroy(&p->state_tracker, call_list);
+ grpc_connectivity_state_destroy(&p->state_tracker, closure_list);
gpr_free(p->subchannels);
gpr_mu_destroy(&p->mu);
gpr_free(p);
}
-void pf_shutdown(grpc_lb_policy *pol, grpc_call_list *call_list) {
+void pf_shutdown(grpc_lb_policy *pol, grpc_closure_list *closure_list) {
pick_first_lb_policy *p = (pick_first_lb_policy *)pol;
pending_pick *pp;
gpr_mu_lock(&p->mu);
- del_interested_parties_locked(p, call_list);
+ del_interested_parties_locked(p, closure_list);
p->shutdown = 1;
pp = p->pending_picks;
p->pending_picks = NULL;
grpc_connectivity_state_set(&p->state_tracker, GRPC_CHANNEL_FATAL_FAILURE,
- "shutdown", call_list);
+ "shutdown", closure_list);
gpr_mu_unlock(&p->mu);
while (pp != NULL) {
pending_pick *next = pp->next;
*pp->target = NULL;
- grpc_call_list_add(call_list, pp->on_complete, 1);
+ grpc_closure_list_add(closure_list, pp->on_complete, 1);
gpr_free(pp);
pp = next;
}
}
-static void start_picking(pick_first_lb_policy *p, grpc_call_list *call_list) {
+static void start_picking(pick_first_lb_policy *p,
+ grpc_closure_list *closure_list) {
p->started_picking = 1;
p->checking_subchannel = 0;
p->checking_connectivity = GRPC_CHANNEL_IDLE;
GRPC_LB_POLICY_REF(&p->base, "pick_first_connectivity");
- grpc_subchannel_notify_on_state_change(p->subchannels[p->checking_subchannel],
- &p->checking_connectivity,
- &p->connectivity_changed, call_list);
+ grpc_subchannel_notify_on_state_change(
+ p->subchannels[p->checking_subchannel], &p->checking_connectivity,
+ &p->connectivity_changed, closure_list);
}
-void pf_exit_idle(grpc_lb_policy *pol, grpc_call_list *call_list) {
+void pf_exit_idle(grpc_lb_policy *pol, grpc_closure_list *closure_list) {
pick_first_lb_policy *p = (pick_first_lb_policy *)pol;
gpr_mu_lock(&p->mu);
if (!p->started_picking) {
- start_picking(p, call_list);
+ start_picking(p, closure_list);
}
gpr_mu_unlock(&p->mu);
}
void pf_pick(grpc_lb_policy *pol, grpc_pollset *pollset,
grpc_metadata_batch *initial_metadata, grpc_subchannel **target,
- grpc_closure *on_complete, grpc_call_list *call_list) {
+ grpc_closure *on_complete, grpc_closure_list *closure_list) {
pick_first_lb_policy *p = (pick_first_lb_policy *)pol;
pending_pick *pp;
gpr_mu_lock(&p->mu);
if (p->selected) {
gpr_mu_unlock(&p->mu);
*target = p->selected;
- grpc_call_list_add(call_list, on_complete, 1);
+ grpc_closure_list_add(closure_list, on_complete, 1);
} else {
if (!p->started_picking) {
- start_picking(p, call_list);
+ start_picking(p, closure_list);
}
grpc_subchannel_add_interested_party(p->subchannels[p->checking_subchannel],
- pollset, call_list);
+ pollset, closure_list);
pp = gpr_malloc(sizeof(*pp));
pp->next = p->pending_picks;
pp->pollset = pollset;
@@ -173,7 +174,7 @@ void pf_pick(grpc_lb_policy *pol, grpc_pollset *pollset,
}
static void pf_connectivity_changed(void *arg, int iomgr_success,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
pick_first_lb_policy *p = arg;
pending_pick *pp;
@@ -181,51 +182,51 @@ static void pf_connectivity_changed(void *arg, int iomgr_success,
if (p->shutdown) {
gpr_mu_unlock(&p->mu);
- GRPC_LB_POLICY_UNREF(&p->base, "pick_first_connectivity", call_list);
+ GRPC_LB_POLICY_UNREF(&p->base, "pick_first_connectivity", closure_list);
return;
} else if (p->selected != NULL) {
grpc_connectivity_state_set(&p->state_tracker, p->checking_connectivity,
- "selected_changed", call_list);
+ "selected_changed", closure_list);
if (p->checking_connectivity != GRPC_CHANNEL_FATAL_FAILURE) {
grpc_subchannel_notify_on_state_change(
p->selected, &p->checking_connectivity, &p->connectivity_changed,
- call_list);
+ closure_list);
} else {
- GRPC_LB_POLICY_UNREF(&p->base, "pick_first_connectivity", call_list);
+ GRPC_LB_POLICY_UNREF(&p->base, "pick_first_connectivity", closure_list);
}
} else {
loop:
switch (p->checking_connectivity) {
case GRPC_CHANNEL_READY:
grpc_connectivity_state_set(&p->state_tracker, GRPC_CHANNEL_READY,
- "connecting_ready", call_list);
+ "connecting_ready", closure_list);
p->selected = p->subchannels[p->checking_subchannel];
while ((pp = p->pending_picks)) {
p->pending_picks = pp->next;
*pp->target = p->selected;
grpc_subchannel_del_interested_party(p->selected, pp->pollset,
- call_list);
- grpc_call_list_add(call_list, pp->on_complete, 1);
+ closure_list);
+ grpc_closure_list_add(closure_list, pp->on_complete, 1);
gpr_free(pp);
}
grpc_subchannel_notify_on_state_change(
p->selected, &p->checking_connectivity, &p->connectivity_changed,
- call_list);
+ closure_list);
break;
case GRPC_CHANNEL_TRANSIENT_FAILURE:
- grpc_connectivity_state_set(&p->state_tracker,
- GRPC_CHANNEL_TRANSIENT_FAILURE,
- "connecting_transient_failure", call_list);
- del_interested_parties_locked(p, call_list);
+ grpc_connectivity_state_set(
+ &p->state_tracker, GRPC_CHANNEL_TRANSIENT_FAILURE,
+ "connecting_transient_failure", closure_list);
+ del_interested_parties_locked(p, closure_list);
p->checking_subchannel =
(p->checking_subchannel + 1) % p->num_subchannels;
p->checking_connectivity = grpc_subchannel_check_connectivity(
p->subchannels[p->checking_subchannel]);
- add_interested_parties_locked(p, call_list);
+ add_interested_parties_locked(p, closure_list);
if (p->checking_connectivity == GRPC_CHANNEL_TRANSIENT_FAILURE) {
grpc_subchannel_notify_on_state_change(
p->subchannels[p->checking_subchannel], &p->checking_connectivity,
- &p->connectivity_changed, call_list);
+ &p->connectivity_changed, closure_list);
} else {
goto loop;
}
@@ -233,37 +234,38 @@ static void pf_connectivity_changed(void *arg, int iomgr_success,
case GRPC_CHANNEL_CONNECTING:
case GRPC_CHANNEL_IDLE:
grpc_connectivity_state_set(&p->state_tracker, GRPC_CHANNEL_CONNECTING,
- "connecting_changed", call_list);
+ "connecting_changed", closure_list);
grpc_subchannel_notify_on_state_change(
p->subchannels[p->checking_subchannel], &p->checking_connectivity,
- &p->connectivity_changed, call_list);
+ &p->connectivity_changed, closure_list);
break;
case GRPC_CHANNEL_FATAL_FAILURE:
- del_interested_parties_locked(p, call_list);
+ del_interested_parties_locked(p, closure_list);
GPR_SWAP(grpc_subchannel *, p->subchannels[p->checking_subchannel],
p->subchannels[p->num_subchannels - 1]);
p->num_subchannels--;
GRPC_SUBCHANNEL_UNREF(p->subchannels[p->num_subchannels], "pick_first",
- call_list);
+ closure_list);
if (p->num_subchannels == 0) {
grpc_connectivity_state_set(&p->state_tracker,
GRPC_CHANNEL_FATAL_FAILURE,
- "no_more_channels", call_list);
+ "no_more_channels", closure_list);
while ((pp = p->pending_picks)) {
p->pending_picks = pp->next;
*pp->target = NULL;
- grpc_call_list_add(call_list, pp->on_complete, 1);
+ grpc_closure_list_add(closure_list, pp->on_complete, 1);
gpr_free(pp);
}
- GRPC_LB_POLICY_UNREF(&p->base, "pick_first_connectivity", call_list);
+ GRPC_LB_POLICY_UNREF(&p->base, "pick_first_connectivity",
+ closure_list);
} else {
grpc_connectivity_state_set(&p->state_tracker,
GRPC_CHANNEL_TRANSIENT_FAILURE,
- "subchannel_failed", call_list);
+ "subchannel_failed", closure_list);
p->checking_subchannel %= p->num_subchannels;
p->checking_connectivity = grpc_subchannel_check_connectivity(
p->subchannels[p->checking_subchannel]);
- add_interested_parties_locked(p, call_list);
+ add_interested_parties_locked(p, closure_list);
goto loop;
}
}
@@ -273,7 +275,7 @@ static void pf_connectivity_changed(void *arg, int iomgr_success,
}
static void pf_broadcast(grpc_lb_policy *pol, grpc_transport_op *op,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
pick_first_lb_policy *p = (pick_first_lb_policy *)pol;
size_t i;
size_t n;
@@ -289,14 +291,14 @@ static void pf_broadcast(grpc_lb_policy *pol, grpc_transport_op *op,
gpr_mu_unlock(&p->mu);
for (i = 0; i < n; i++) {
- grpc_subchannel_process_transport_op(subchannels[i], op, call_list);
- GRPC_SUBCHANNEL_UNREF(subchannels[i], "pf_broadcast", call_list);
+ grpc_subchannel_process_transport_op(subchannels[i], op, closure_list);
+ GRPC_SUBCHANNEL_UNREF(subchannels[i], "pf_broadcast", closure_list);
}
gpr_free(subchannels);
}
static grpc_connectivity_state pf_check_connectivity(
- grpc_lb_policy *pol, grpc_call_list *call_list) {
+ grpc_lb_policy *pol, grpc_closure_list *closure_list) {
pick_first_lb_policy *p = (pick_first_lb_policy *)pol;
grpc_connectivity_state st;
gpr_mu_lock(&p->mu);
@@ -308,11 +310,11 @@ static grpc_connectivity_state pf_check_connectivity(
void pf_notify_on_state_change(grpc_lb_policy *pol,
grpc_connectivity_state *current,
grpc_closure *notify,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
pick_first_lb_policy *p = (pick_first_lb_policy *)pol;
gpr_mu_lock(&p->mu);
grpc_connectivity_state_notify_on_state_change(&p->state_tracker, current,
- notify, call_list);
+ notify, closure_list);
gpr_mu_unlock(&p->mu);
}
diff --git a/src/core/client_config/lb_policies/round_robin.c b/src/core/client_config/lb_policies/round_robin.c
index a346007aca..b4139719f4 100644
--- a/src/core/client_config/lb_policies/round_robin.c
+++ b/src/core/client_config/lb_policies/round_robin.c
@@ -202,28 +202,28 @@ static void remove_disconnected_sc_locked(round_robin_lb_policy *p,
static void del_interested_parties_locked(round_robin_lb_policy *p,
const size_t subchannel_idx,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
pending_pick *pp;
for (pp = p->pending_picks; pp; pp = pp->next) {
grpc_subchannel_del_interested_party(p->subchannels[subchannel_idx],
- pp->pollset, call_list);
+ pp->pollset, closure_list);
}
}
-void rr_destroy(grpc_lb_policy *pol, grpc_call_list *call_list) {
+void rr_destroy(grpc_lb_policy *pol, grpc_closure_list *closure_list) {
round_robin_lb_policy *p = (round_robin_lb_policy *)pol;
size_t i;
ready_list *elem;
for (i = 0; i < p->num_subchannels; i++) {
- del_interested_parties_locked(p, i, call_list);
+ del_interested_parties_locked(p, i, closure_list);
}
for (i = 0; i < p->num_subchannels; i++) {
- GRPC_SUBCHANNEL_UNREF(p->subchannels[i], "round_robin", call_list);
+ GRPC_SUBCHANNEL_UNREF(p->subchannels[i], "round_robin", closure_list);
}
gpr_free(p->connectivity_changed_cbs);
gpr_free(p->subchannel_connectivity);
- grpc_connectivity_state_destroy(&p->state_tracker, call_list);
+ grpc_connectivity_state_destroy(&p->state_tracker, closure_list);
gpr_free(p->subchannels);
gpr_mu_destroy(&p->mu);
@@ -242,29 +242,30 @@ void rr_destroy(grpc_lb_policy *pol, grpc_call_list *call_list) {
gpr_free(p);
}
-void rr_shutdown(grpc_lb_policy *pol, grpc_call_list *call_list) {
+void rr_shutdown(grpc_lb_policy *pol, grpc_closure_list *closure_list) {
size_t i;
round_robin_lb_policy *p = (round_robin_lb_policy *)pol;
pending_pick *pp;
gpr_mu_lock(&p->mu);
for (i = 0; i < p->num_subchannels; i++) {
- del_interested_parties_locked(p, i, call_list);
+ del_interested_parties_locked(p, i, closure_list);
}
p->shutdown = 1;
while ((pp = p->pending_picks)) {
p->pending_picks = pp->next;
*pp->target = NULL;
- grpc_call_list_add(call_list, pp->on_complete, 0);
+ grpc_closure_list_add(closure_list, pp->on_complete, 0);
gpr_free(pp);
}
grpc_connectivity_state_set(&p->state_tracker, GRPC_CHANNEL_FATAL_FAILURE,
- "shutdown", call_list);
+ "shutdown", closure_list);
gpr_mu_unlock(&p->mu);
}
-static void start_picking(round_robin_lb_policy *p, grpc_call_list *call_list) {
+static void start_picking(round_robin_lb_policy *p,
+ grpc_closure_list *closure_list) {
size_t i;
p->started_picking = 1;
@@ -272,23 +273,23 @@ static void start_picking(round_robin_lb_policy *p, grpc_call_list *call_list) {
p->subchannel_connectivity[i] = GRPC_CHANNEL_IDLE;
grpc_subchannel_notify_on_state_change(
p->subchannels[i], &p->subchannel_connectivity[i],
- &p->connectivity_changed_cbs[i], call_list);
+ &p->connectivity_changed_cbs[i], closure_list);
GRPC_LB_POLICY_REF(&p->base, "round_robin_connectivity");
}
}
-void rr_exit_idle(grpc_lb_policy *pol, grpc_call_list *call_list) {
+void rr_exit_idle(grpc_lb_policy *pol, grpc_closure_list *closure_list) {
round_robin_lb_policy *p = (round_robin_lb_policy *)pol;
gpr_mu_lock(&p->mu);
if (!p->started_picking) {
- start_picking(p, call_list);
+ start_picking(p, closure_list);
}
gpr_mu_unlock(&p->mu);
}
void rr_pick(grpc_lb_policy *pol, grpc_pollset *pollset,
grpc_metadata_batch *initial_metadata, grpc_subchannel **target,
- grpc_closure *on_complete, grpc_call_list *call_list) {
+ grpc_closure *on_complete, grpc_closure_list *closure_list) {
size_t i;
round_robin_lb_policy *p = (round_robin_lb_policy *)pol;
pending_pick *pp;
@@ -303,14 +304,14 @@ void rr_pick(grpc_lb_policy *pol, grpc_pollset *pollset,
}
/* only advance the last picked pointer if the selection was used */
advance_last_picked_locked(p);
- on_complete->cb(on_complete->cb_arg, 1, call_list);
+ on_complete->cb(on_complete->cb_arg, 1, closure_list);
} else {
if (!p->started_picking) {
- start_picking(p, call_list);
+ start_picking(p, closure_list);
}
for (i = 0; i < p->num_subchannels; i++) {
grpc_subchannel_add_interested_party(p->subchannels[i], pollset,
- call_list);
+ closure_list);
}
pp = gpr_malloc(sizeof(*pp));
pp->next = p->pending_picks;
@@ -323,7 +324,7 @@ void rr_pick(grpc_lb_policy *pol, grpc_pollset *pollset,
}
static void rr_connectivity_changed(void *arg, int iomgr_success,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
connectivity_changed_cb_arg *cb_arg = arg;
round_robin_lb_policy *p = cb_arg->p;
/* index over p->subchannels of this cb's subchannel */
@@ -346,7 +347,7 @@ static void rr_connectivity_changed(void *arg, int iomgr_success,
switch (*this_connectivity) {
case GRPC_CHANNEL_READY:
grpc_connectivity_state_set(&p->state_tracker, GRPC_CHANNEL_READY,
- "connecting_ready", call_list);
+ "connecting_ready", closure_list);
/* add the newly connected subchannel to the list of connected ones.
* Note that it goes to the "end of the line". */
p->subchannel_index_to_readylist_node[this_idx] =
@@ -369,28 +370,28 @@ static void rr_connectivity_changed(void *arg, int iomgr_success,
selected->subchannel, selected);
}
grpc_subchannel_del_interested_party(selected->subchannel,
- pp->pollset, call_list);
- grpc_call_list_add(call_list, pp->on_complete, 1);
+ pp->pollset, closure_list);
+ grpc_closure_list_add(closure_list, pp->on_complete, 1);
gpr_free(pp);
}
grpc_subchannel_notify_on_state_change(
p->subchannels[this_idx], this_connectivity,
- &p->connectivity_changed_cbs[this_idx], call_list);
+ &p->connectivity_changed_cbs[this_idx], closure_list);
break;
case GRPC_CHANNEL_CONNECTING:
case GRPC_CHANNEL_IDLE:
grpc_connectivity_state_set(&p->state_tracker, *this_connectivity,
- "connecting_changed", call_list);
+ "connecting_changed", closure_list);
grpc_subchannel_notify_on_state_change(
p->subchannels[this_idx], this_connectivity,
- &p->connectivity_changed_cbs[this_idx], call_list);
+ &p->connectivity_changed_cbs[this_idx], closure_list);
break;
case GRPC_CHANNEL_TRANSIENT_FAILURE:
- del_interested_parties_locked(p, this_idx, call_list);
+ del_interested_parties_locked(p, this_idx, closure_list);
/* renew state notification */
grpc_subchannel_notify_on_state_change(
p->subchannels[this_idx], this_connectivity,
- &p->connectivity_changed_cbs[this_idx], call_list);
+ &p->connectivity_changed_cbs[this_idx], closure_list);
/* remove from ready list if still present */
if (p->subchannel_index_to_readylist_node[this_idx] != NULL) {
@@ -398,12 +399,12 @@ static void rr_connectivity_changed(void *arg, int iomgr_success,
p, p->subchannel_index_to_readylist_node[this_idx]);
p->subchannel_index_to_readylist_node[this_idx] = NULL;
}
- grpc_connectivity_state_set(&p->state_tracker,
- GRPC_CHANNEL_TRANSIENT_FAILURE,
- "connecting_transient_failure", call_list);
+ grpc_connectivity_state_set(
+ &p->state_tracker, GRPC_CHANNEL_TRANSIENT_FAILURE,
+ "connecting_transient_failure", closure_list);
break;
case GRPC_CHANNEL_FATAL_FAILURE:
- del_interested_parties_locked(p, this_idx, call_list);
+ del_interested_parties_locked(p, this_idx, closure_list);
if (p->subchannel_index_to_readylist_node[this_idx] != NULL) {
remove_disconnected_sc_locked(
p, p->subchannel_index_to_readylist_node[this_idx]);
@@ -414,23 +415,23 @@ static void rr_connectivity_changed(void *arg, int iomgr_success,
p->subchannels[p->num_subchannels - 1]);
p->num_subchannels--;
GRPC_SUBCHANNEL_UNREF(p->subchannels[p->num_subchannels], "round_robin",
- call_list);
+ closure_list);
if (p->num_subchannels == 0) {
grpc_connectivity_state_set(&p->state_tracker,
GRPC_CHANNEL_FATAL_FAILURE,
- "no_more_channels", call_list);
+ "no_more_channels", closure_list);
while ((pp = p->pending_picks)) {
p->pending_picks = pp->next;
*pp->target = NULL;
- grpc_call_list_add(call_list, pp->on_complete, 1);
+ grpc_closure_list_add(closure_list, pp->on_complete, 1);
gpr_free(pp);
}
unref = 1;
} else {
grpc_connectivity_state_set(&p->state_tracker,
GRPC_CHANNEL_TRANSIENT_FAILURE,
- "subchannel_failed", call_list);
+ "subchannel_failed", closure_list);
}
} /* switch */
} /* !unref */
@@ -438,12 +439,12 @@ static void rr_connectivity_changed(void *arg, int iomgr_success,
gpr_mu_unlock(&p->mu);
if (unref) {
- GRPC_LB_POLICY_UNREF(&p->base, "round_robin_connectivity", call_list);
+ GRPC_LB_POLICY_UNREF(&p->base, "round_robin_connectivity", closure_list);
}
}
static void rr_broadcast(grpc_lb_policy *pol, grpc_transport_op *op,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
round_robin_lb_policy *p = (round_robin_lb_policy *)pol;
size_t i;
size_t n;
@@ -459,14 +460,14 @@ static void rr_broadcast(grpc_lb_policy *pol, grpc_transport_op *op,
gpr_mu_unlock(&p->mu);
for (i = 0; i < n; i++) {
- grpc_subchannel_process_transport_op(subchannels[i], op, call_list);
- GRPC_SUBCHANNEL_UNREF(subchannels[i], "rr_broadcast", call_list);
+ grpc_subchannel_process_transport_op(subchannels[i], op, closure_list);
+ GRPC_SUBCHANNEL_UNREF(subchannels[i], "rr_broadcast", closure_list);
}
gpr_free(subchannels);
}
static grpc_connectivity_state rr_check_connectivity(
- grpc_lb_policy *pol, grpc_call_list *call_list) {
+ grpc_lb_policy *pol, grpc_closure_list *closure_list) {
round_robin_lb_policy *p = (round_robin_lb_policy *)pol;
grpc_connectivity_state st;
gpr_mu_lock(&p->mu);
@@ -478,11 +479,11 @@ static grpc_connectivity_state rr_check_connectivity(
static void rr_notify_on_state_change(grpc_lb_policy *pol,
grpc_connectivity_state *current,
grpc_closure *notify,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
round_robin_lb_policy *p = (round_robin_lb_policy *)pol;
gpr_mu_lock(&p->mu);
grpc_connectivity_state_notify_on_state_change(&p->state_tracker, current,
- notify, call_list);
+ notify, closure_list);
gpr_mu_unlock(&p->mu);
}
diff --git a/src/core/client_config/lb_policy.c b/src/core/client_config/lb_policy.c
index 84a033d583..99eb69613b 100644
--- a/src/core/client_config/lb_policy.c
+++ b/src/core/client_config/lb_policy.c
@@ -51,49 +51,51 @@ void grpc_lb_policy_ref(grpc_lb_policy *policy) {
}
#ifdef GRPC_LB_POLICY_REFCOUNT_DEBUG
-void grpc_lb_policy_unref(grpc_lb_policy *policy, grpc_call_list *call_list,
- const char *file, int line, const char *reason) {
+void grpc_lb_policy_unref(grpc_lb_policy *policy,
+ grpc_closure_list *closure_list, const char *file,
+ int line, const char *reason) {
gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, "LB_POLICY:%p unref %d -> %d %s",
policy, (int)policy->refs.count, (int)policy->refs.count - 1, reason);
#else
-void grpc_lb_policy_unref(grpc_lb_policy *policy, grpc_call_list *call_list) {
+void grpc_lb_policy_unref(grpc_lb_policy *policy,
+ grpc_closure_list *closure_list) {
#endif
if (gpr_unref(&policy->refs)) {
- policy->vtable->destroy(policy, call_list);
+ policy->vtable->destroy(policy, closure_list);
}
}
void grpc_lb_policy_shutdown(grpc_lb_policy *policy,
- grpc_call_list *call_list) {
- policy->vtable->shutdown(policy, call_list);
+ grpc_closure_list *closure_list) {
+ policy->vtable->shutdown(policy, closure_list);
}
void grpc_lb_policy_pick(grpc_lb_policy *policy, grpc_pollset *pollset,
grpc_metadata_batch *initial_metadata,
grpc_subchannel **target, grpc_closure *on_complete,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
policy->vtable->pick(policy, pollset, initial_metadata, target, on_complete,
- call_list);
+ closure_list);
}
void grpc_lb_policy_broadcast(grpc_lb_policy *policy, grpc_transport_op *op,
- grpc_call_list *call_list) {
- policy->vtable->broadcast(policy, op, call_list);
+ grpc_closure_list *closure_list) {
+ policy->vtable->broadcast(policy, op, closure_list);
}
void grpc_lb_policy_exit_idle(grpc_lb_policy *policy,
- grpc_call_list *call_list) {
- policy->vtable->exit_idle(policy, call_list);
+ grpc_closure_list *closure_list) {
+ policy->vtable->exit_idle(policy, closure_list);
}
void grpc_lb_policy_notify_on_state_change(grpc_lb_policy *policy,
grpc_connectivity_state *state,
grpc_closure *closure,
- grpc_call_list *call_list) {
- policy->vtable->notify_on_state_change(policy, state, closure, call_list);
+ grpc_closure_list *closure_list) {
+ policy->vtable->notify_on_state_change(policy, state, closure, closure_list);
}
grpc_connectivity_state grpc_lb_policy_check_connectivity(
- grpc_lb_policy *policy, grpc_call_list *call_list) {
- return policy->vtable->check_connectivity(policy, call_list);
+ grpc_lb_policy *policy, grpc_closure_list *closure_list) {
+ return policy->vtable->check_connectivity(policy, closure_list);
}
diff --git a/src/core/client_config/lb_policy.h b/src/core/client_config/lb_policy.h
index f9430b4250..5e3c016eb2 100644
--- a/src/core/client_config/lb_policy.h
+++ b/src/core/client_config/lb_policy.h
@@ -51,32 +51,32 @@ struct grpc_lb_policy {
};
struct grpc_lb_policy_vtable {
- void (*destroy)(grpc_lb_policy *policy, grpc_call_list *call_list);
+ void (*destroy)(grpc_lb_policy *policy, grpc_closure_list *closure_list);
- void (*shutdown)(grpc_lb_policy *policy, grpc_call_list *call_list);
+ void (*shutdown)(grpc_lb_policy *policy, grpc_closure_list *closure_list);
/** implement grpc_lb_policy_pick */
void (*pick)(grpc_lb_policy *policy, grpc_pollset *pollset,
grpc_metadata_batch *initial_metadata, grpc_subchannel **target,
- grpc_closure *on_complete, grpc_call_list *call_list);
+ grpc_closure *on_complete, grpc_closure_list *closure_list);
/** try to enter a READY connectivity state */
- void (*exit_idle)(grpc_lb_policy *policy, grpc_call_list *call_list);
+ void (*exit_idle)(grpc_lb_policy *policy, grpc_closure_list *closure_list);
/** broadcast a transport op to all subchannels */
void (*broadcast)(grpc_lb_policy *policy, grpc_transport_op *op,
- grpc_call_list *call_list);
+ grpc_closure_list *closure_list);
/** check the current connectivity of the lb_policy */
- grpc_connectivity_state (*check_connectivity)(grpc_lb_policy *policy,
- grpc_call_list *call_list);
+ grpc_connectivity_state (*check_connectivity)(
+ grpc_lb_policy *policy, grpc_closure_list *closure_list);
/** call notify when the connectivity state of a channel changes from *state.
Updates *state with the new state of the policy */
void (*notify_on_state_change)(grpc_lb_policy *policy,
grpc_connectivity_state *state,
grpc_closure *closure,
- grpc_call_list *call_list);
+ grpc_closure_list *closure_list);
};
#ifdef GRPC_LB_POLICY_REFCOUNT_DEBUG
@@ -86,13 +86,15 @@ struct grpc_lb_policy_vtable {
grpc_lb_policy_unref((p), (cl), __FILE__, __LINE__, (r))
void grpc_lb_policy_ref(grpc_lb_policy *policy, const char *file, int line,
const char *reason);
-void grpc_lb_policy_unref(grpc_lb_policy *policy, grpc_call_list *call_list,
- const char *file, int line, const char *reason);
+void grpc_lb_policy_unref(grpc_lb_policy *policy,
+ grpc_closure_list *closure_list, const char *file,
+ int line, const char *reason);
#else
#define GRPC_LB_POLICY_REF(p, r) grpc_lb_policy_ref((p))
#define GRPC_LB_POLICY_UNREF(p, r, cl) grpc_lb_policy_unref((p), (cl))
void grpc_lb_policy_ref(grpc_lb_policy *policy);
-void grpc_lb_policy_unref(grpc_lb_policy *policy, grpc_call_list *call_list);
+void grpc_lb_policy_unref(grpc_lb_policy *policy,
+ grpc_closure_list *closure_list);
#endif
/** called by concrete implementations to initialize the base struct */
@@ -100,7 +102,8 @@ void grpc_lb_policy_init(grpc_lb_policy *policy,
const grpc_lb_policy_vtable *vtable);
/** Start shutting down (fail any pending picks) */
-void grpc_lb_policy_shutdown(grpc_lb_policy *policy, grpc_call_list *call_list);
+void grpc_lb_policy_shutdown(grpc_lb_policy *policy,
+ grpc_closure_list *closure_list);
/** Given initial metadata in \a initial_metadata, find an appropriate
target for this rpc, and 'return' it by calling \a on_complete after setting
@@ -109,20 +112,20 @@ void grpc_lb_policy_shutdown(grpc_lb_policy *policy, grpc_call_list *call_list);
void grpc_lb_policy_pick(grpc_lb_policy *policy, grpc_pollset *pollset,
grpc_metadata_batch *initial_metadata,
grpc_subchannel **target, grpc_closure *on_complete,
- grpc_call_list *call_list);
+ grpc_closure_list *closure_list);
void grpc_lb_policy_broadcast(grpc_lb_policy *policy, grpc_transport_op *op,
- grpc_call_list *call_list);
+ grpc_closure_list *closure_list);
void grpc_lb_policy_exit_idle(grpc_lb_policy *policy,
- grpc_call_list *call_list);
+ grpc_closure_list *closure_list);
void grpc_lb_policy_notify_on_state_change(grpc_lb_policy *policy,
grpc_connectivity_state *state,
grpc_closure *closure,
- grpc_call_list *call_list);
+ grpc_closure_list *closure_list);
grpc_connectivity_state grpc_lb_policy_check_connectivity(
- grpc_lb_policy *policy, grpc_call_list *call_list);
+ grpc_lb_policy *policy, grpc_closure_list *closure_list);
#endif /* GRPC_INTERNAL_CORE_CONFIG_LB_POLICY_H */
diff --git a/src/core/client_config/resolver.c b/src/core/client_config/resolver.c
index eae8ec6ddf..21186d7aa1 100644
--- a/src/core/client_config/resolver.c
+++ b/src/core/client_config/resolver.c
@@ -40,7 +40,7 @@ void grpc_resolver_init(grpc_resolver *resolver,
}
#ifdef GRPC_RESOLVER_REFCOUNT_DEBUG
-void grpc_resolver_ref(grpc_resolver *resolver, grpc_call_list *call_list,
+void grpc_resolver_ref(grpc_resolver *resolver, grpc_closure_list *closure_list,
const char *file, int line, const char *reason) {
gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, "RESOLVER:%p ref %d -> %d %s",
resolver, (int)resolver->refs.count, (int)resolver->refs.count + 1,
@@ -52,34 +52,37 @@ void grpc_resolver_ref(grpc_resolver *resolver) {
}
#ifdef GRPC_RESOLVER_REFCOUNT_DEBUG
-void grpc_resolver_unref(grpc_resolver *resolver, grpc_call_list *call_list,
- const char *file, int line, const char *reason) {
+void grpc_resolver_unref(grpc_resolver *resolver,
+ grpc_closure_list *closure_list, const char *file,
+ int line, const char *reason) {
gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, "RESOLVER:%p unref %d -> %d %s",
resolver, (int)resolver->refs.count, (int)resolver->refs.count - 1,
reason);
#else
-void grpc_resolver_unref(grpc_resolver *resolver, grpc_call_list *call_list) {
+void grpc_resolver_unref(grpc_resolver *resolver,
+ grpc_closure_list *closure_list) {
#endif
if (gpr_unref(&resolver->refs)) {
- resolver->vtable->destroy(resolver, call_list);
+ resolver->vtable->destroy(resolver, closure_list);
}
}
void grpc_resolver_shutdown(grpc_resolver *resolver,
- grpc_call_list *call_list) {
- resolver->vtable->shutdown(resolver, call_list);
+ grpc_closure_list *closure_list) {
+ resolver->vtable->shutdown(resolver, closure_list);
}
void grpc_resolver_channel_saw_error(grpc_resolver *resolver,
struct sockaddr *failing_address,
int failing_address_len,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
resolver->vtable->channel_saw_error(resolver, failing_address,
- failing_address_len, call_list);
+ failing_address_len, closure_list);
}
void grpc_resolver_next(grpc_resolver *resolver,
grpc_client_config **target_config,
- grpc_closure *on_complete, grpc_call_list *call_list) {
- resolver->vtable->next(resolver, target_config, on_complete, call_list);
+ grpc_closure *on_complete,
+ grpc_closure_list *closure_list) {
+ resolver->vtable->next(resolver, target_config, on_complete, closure_list);
}
diff --git a/src/core/client_config/resolver.h b/src/core/client_config/resolver.h
index 7960bcb92f..0c39d37018 100644
--- a/src/core/client_config/resolver.h
+++ b/src/core/client_config/resolver.h
@@ -49,13 +49,14 @@ struct grpc_resolver {
};
struct grpc_resolver_vtable {
- void (*destroy)(grpc_resolver *resolver, grpc_call_list *call_list);
- void (*shutdown)(grpc_resolver *resolver, grpc_call_list *call_list);
+ void (*destroy)(grpc_resolver *resolver, grpc_closure_list *closure_list);
+ void (*shutdown)(grpc_resolver *resolver, grpc_closure_list *closure_list);
void (*channel_saw_error)(grpc_resolver *resolver,
struct sockaddr *failing_address,
- int failing_address_len, grpc_call_list *call_list);
+ int failing_address_len,
+ grpc_closure_list *closure_list);
void (*next)(grpc_resolver *resolver, grpc_client_config **target_config,
- grpc_closure *on_complete, grpc_call_list *call_list);
+ grpc_closure *on_complete, grpc_closure_list *closure_list);
};
#ifdef GRPC_RESOLVER_REFCOUNT_DEBUG
@@ -64,26 +65,28 @@ struct grpc_resolver_vtable {
grpc_resolver_unref((p), (cl), __FILE__, __LINE__, (r))
void grpc_resolver_ref(grpc_resolver *policy, const char *file, int line,
const char *reason);
-void grpc_resolver_unref(grpc_resolver *policy, grpc_call_list *call_list,
+void grpc_resolver_unref(grpc_resolver *policy, grpc_closure_list *closure_list,
const char *file, int line, const char *reason);
#else
#define GRPC_RESOLVER_REF(p, r) grpc_resolver_ref((p))
#define GRPC_RESOLVER_UNREF(p, r, cl) grpc_resolver_unref((p), (cl))
void grpc_resolver_ref(grpc_resolver *policy);
-void grpc_resolver_unref(grpc_resolver *policy, grpc_call_list *call_list);
+void grpc_resolver_unref(grpc_resolver *policy,
+ grpc_closure_list *closure_list);
#endif
void grpc_resolver_init(grpc_resolver *resolver,
const grpc_resolver_vtable *vtable);
-void grpc_resolver_shutdown(grpc_resolver *resolver, grpc_call_list *call_list);
+void grpc_resolver_shutdown(grpc_resolver *resolver,
+ grpc_closure_list *closure_list);
/** Notification that the channel has seen an error on some address.
Can be used as a hint that re-resolution is desirable soon. */
void grpc_resolver_channel_saw_error(grpc_resolver *resolver,
struct sockaddr *failing_address,
int failing_address_len,
- grpc_call_list *call_list);
+ grpc_closure_list *closure_list);
/** Get the next client config. Called by the channel to fetch a new
configuration. Expected to set *target_config with a new configuration,
@@ -93,6 +96,7 @@ void grpc_resolver_channel_saw_error(grpc_resolver *resolver,
schedule on_complete. */
void grpc_resolver_next(grpc_resolver *resolver,
grpc_client_config **target_config,
- grpc_closure *on_complete, grpc_call_list *call_list);
+ grpc_closure *on_complete,
+ grpc_closure_list *closure_list);
#endif /* GRPC_INTERNAL_CORE_CONFIG_RESOLVER_H */
diff --git a/src/core/client_config/resolvers/dns_resolver.c b/src/core/client_config/resolvers/dns_resolver.c
index 0fc89ed864..73723350cb 100644
--- a/src/core/client_config/resolvers/dns_resolver.c
+++ b/src/core/client_config/resolvers/dns_resolver.c
@@ -74,36 +74,38 @@ typedef struct {
grpc_client_config *resolved_config;
} dns_resolver;
-static void dns_destroy(grpc_resolver *r, grpc_call_list *call_list);
+static void dns_destroy(grpc_resolver *r, grpc_closure_list *closure_list);
static void dns_start_resolving_locked(dns_resolver *r);
static void dns_maybe_finish_next_locked(dns_resolver *r,
- grpc_call_list *call_list);
+ grpc_closure_list *closure_list);
-static void dns_shutdown(grpc_resolver *r, grpc_call_list *call_list);
+static void dns_shutdown(grpc_resolver *r, grpc_closure_list *closure_list);
static void dns_channel_saw_error(grpc_resolver *r,
struct sockaddr *failing_address,
int failing_address_len,
- grpc_call_list *call_list);
+ grpc_closure_list *closure_list);
static void dns_next(grpc_resolver *r, grpc_client_config **target_config,
- grpc_closure *on_complete, grpc_call_list *call_list);
+ grpc_closure *on_complete,
+ grpc_closure_list *closure_list);
static const grpc_resolver_vtable dns_resolver_vtable = {
dns_destroy, dns_shutdown, dns_channel_saw_error, dns_next};
-static void dns_shutdown(grpc_resolver *resolver, grpc_call_list *call_list) {
+static void dns_shutdown(grpc_resolver *resolver,
+ grpc_closure_list *closure_list) {
dns_resolver *r = (dns_resolver *)resolver;
gpr_mu_lock(&r->mu);
if (r->next_completion != NULL) {
*r->target_config = NULL;
- grpc_call_list_add(call_list, r->next_completion, 1);
+ grpc_closure_list_add(closure_list, r->next_completion, 1);
r->next_completion = NULL;
}
gpr_mu_unlock(&r->mu);
}
static void dns_channel_saw_error(grpc_resolver *resolver, struct sockaddr *sa,
- int len, grpc_call_list *call_list) {
+ int len, grpc_closure_list *closure_list) {
dns_resolver *r = (dns_resolver *)resolver;
gpr_mu_lock(&r->mu);
if (!r->resolving) {
@@ -114,7 +116,8 @@ static void dns_channel_saw_error(grpc_resolver *resolver, struct sockaddr *sa,
static void dns_next(grpc_resolver *resolver,
grpc_client_config **target_config,
- grpc_closure *on_complete, grpc_call_list *call_list) {
+ grpc_closure *on_complete,
+ grpc_closure_list *closure_list) {
dns_resolver *r = (dns_resolver *)resolver;
gpr_mu_lock(&r->mu);
GPR_ASSERT(!r->next_completion);
@@ -123,13 +126,13 @@ static void dns_next(grpc_resolver *resolver,
if (r->resolved_version == 0 && !r->resolving) {
dns_start_resolving_locked(r);
} else {
- dns_maybe_finish_next_locked(r, call_list);
+ dns_maybe_finish_next_locked(r, closure_list);
}
gpr_mu_unlock(&r->mu);
}
static void dns_on_resolved(void *arg, grpc_resolved_addresses *addresses,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
dns_resolver *r = arg;
grpc_client_config *config = NULL;
grpc_subchannel **subchannels;
@@ -145,14 +148,14 @@ static void dns_on_resolved(void *arg, grpc_resolved_addresses *addresses,
args.addr = (struct sockaddr *)(addresses->addrs[i].addr);
args.addr_len = (size_t)addresses->addrs[i].len;
subchannels[i] = grpc_subchannel_factory_create_subchannel(
- r->subchannel_factory, &args, call_list);
+ r->subchannel_factory, &args, closure_list);
}
memset(&lb_policy_args, 0, sizeof(lb_policy_args));
lb_policy_args.subchannels = subchannels;
lb_policy_args.num_subchannels = addresses->naddrs;
lb_policy = grpc_lb_policy_create(r->lb_policy_name, &lb_policy_args);
grpc_client_config_set_lb_policy(config, lb_policy);
- GRPC_LB_POLICY_UNREF(lb_policy, "construction", call_list);
+ GRPC_LB_POLICY_UNREF(lb_policy, "construction", closure_list);
grpc_resolved_addresses_destroy(addresses);
gpr_free(subchannels);
}
@@ -160,14 +163,14 @@ static void dns_on_resolved(void *arg, grpc_resolved_addresses *addresses,
GPR_ASSERT(r->resolving);
r->resolving = 0;
if (r->resolved_config) {
- grpc_client_config_unref(r->resolved_config, call_list);
+ grpc_client_config_unref(r->resolved_config, closure_list);
}
r->resolved_config = config;
r->resolved_version++;
- dns_maybe_finish_next_locked(r, call_list);
+ dns_maybe_finish_next_locked(r, closure_list);
gpr_mu_unlock(&r->mu);
- GRPC_RESOLVER_UNREF(&r->base, "dns-resolving", call_list);
+ GRPC_RESOLVER_UNREF(&r->base, "dns-resolving", closure_list);
}
static void dns_start_resolving_locked(dns_resolver *r) {
@@ -178,26 +181,26 @@ static void dns_start_resolving_locked(dns_resolver *r) {
}
static void dns_maybe_finish_next_locked(dns_resolver *r,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
if (r->next_completion != NULL &&
r->resolved_version != r->published_version) {
*r->target_config = r->resolved_config;
if (r->resolved_config) {
grpc_client_config_ref(r->resolved_config);
}
- grpc_call_list_add(call_list, r->next_completion, 1);
+ grpc_closure_list_add(closure_list, r->next_completion, 1);
r->next_completion = NULL;
r->published_version = r->resolved_version;
}
}
-static void dns_destroy(grpc_resolver *gr, grpc_call_list *call_list) {
+static void dns_destroy(grpc_resolver *gr, grpc_closure_list *closure_list) {
dns_resolver *r = (dns_resolver *)gr;
gpr_mu_destroy(&r->mu);
if (r->resolved_config) {
- grpc_client_config_unref(r->resolved_config, call_list);
+ grpc_client_config_unref(r->resolved_config, closure_list);
}
- grpc_subchannel_factory_unref(r->subchannel_factory, call_list);
+ grpc_subchannel_factory_unref(r->subchannel_factory, closure_list);
gpr_free(r->name);
gpr_free(r->default_port);
gpr_free(r->lb_policy_name);
diff --git a/src/core/client_config/resolvers/sockaddr_resolver.c b/src/core/client_config/resolvers/sockaddr_resolver.c
index f0e2076244..da6b5518f8 100644
--- a/src/core/client_config/resolvers/sockaddr_resolver.c
+++ b/src/core/client_config/resolvers/sockaddr_resolver.c
@@ -76,30 +76,32 @@ typedef struct {
grpc_client_config **target_config;
} sockaddr_resolver;
-static void sockaddr_destroy(grpc_resolver *r, grpc_call_list *call_list);
+static void sockaddr_destroy(grpc_resolver *r, grpc_closure_list *closure_list);
static void sockaddr_maybe_finish_next_locked(sockaddr_resolver *r,
- grpc_call_list *call_list);
+ grpc_closure_list *closure_list);
-static void sockaddr_shutdown(grpc_resolver *r, grpc_call_list *call_list);
+static void sockaddr_shutdown(grpc_resolver *r,
+ grpc_closure_list *closure_list);
static void sockaddr_channel_saw_error(grpc_resolver *r,
struct sockaddr *failing_address,
int failing_address_len,
- grpc_call_list *call_list);
+ grpc_closure_list *closure_list);
static void sockaddr_next(grpc_resolver *r, grpc_client_config **target_config,
- grpc_closure *on_complete, grpc_call_list *call_list);
+ grpc_closure *on_complete,
+ grpc_closure_list *closure_list);
static const grpc_resolver_vtable sockaddr_resolver_vtable = {
sockaddr_destroy, sockaddr_shutdown, sockaddr_channel_saw_error,
sockaddr_next};
static void sockaddr_shutdown(grpc_resolver *resolver,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
sockaddr_resolver *r = (sockaddr_resolver *)resolver;
gpr_mu_lock(&r->mu);
if (r->next_completion != NULL) {
*r->target_config = NULL;
- grpc_call_list_add(call_list, r->next_completion, 1);
+ grpc_closure_list_add(closure_list, r->next_completion, 1);
r->next_completion = NULL;
}
gpr_mu_unlock(&r->mu);
@@ -107,23 +109,23 @@ static void sockaddr_shutdown(grpc_resolver *resolver,
static void sockaddr_channel_saw_error(grpc_resolver *resolver,
struct sockaddr *sa, int len,
- grpc_call_list *call_list) {}
+ grpc_closure_list *closure_list) {}
static void sockaddr_next(grpc_resolver *resolver,
grpc_client_config **target_config,
grpc_closure *on_complete,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
sockaddr_resolver *r = (sockaddr_resolver *)resolver;
gpr_mu_lock(&r->mu);
GPR_ASSERT(!r->next_completion);
r->next_completion = on_complete;
r->target_config = target_config;
- sockaddr_maybe_finish_next_locked(r, call_list);
+ sockaddr_maybe_finish_next_locked(r, closure_list);
gpr_mu_unlock(&r->mu);
}
static void sockaddr_maybe_finish_next_locked(sockaddr_resolver *r,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
grpc_client_config *cfg;
grpc_lb_policy *lb_policy;
grpc_lb_policy_args lb_policy_args;
@@ -139,7 +141,7 @@ static void sockaddr_maybe_finish_next_locked(sockaddr_resolver *r,
args.addr = (struct sockaddr *)&r->addrs[i];
args.addr_len = r->addrs_len[i];
subchannels[i] = grpc_subchannel_factory_create_subchannel(
- r->subchannel_factory, &args, call_list);
+ r->subchannel_factory, &args, closure_list);
}
memset(&lb_policy_args, 0, sizeof(lb_policy_args));
lb_policy_args.subchannels = subchannels;
@@ -148,18 +150,19 @@ static void sockaddr_maybe_finish_next_locked(sockaddr_resolver *r,
grpc_lb_policy_create(r->lb_policy_name, &lb_policy_args);
gpr_free(subchannels);
grpc_client_config_set_lb_policy(cfg, lb_policy);
- GRPC_LB_POLICY_UNREF(lb_policy, "sockaddr", call_list);
+ GRPC_LB_POLICY_UNREF(lb_policy, "sockaddr", closure_list);
r->published = 1;
*r->target_config = cfg;
- grpc_call_list_add(call_list, r->next_completion, 1);
+ grpc_closure_list_add(closure_list, r->next_completion, 1);
r->next_completion = NULL;
}
}
-static void sockaddr_destroy(grpc_resolver *gr, grpc_call_list *call_list) {
+static void sockaddr_destroy(grpc_resolver *gr,
+ grpc_closure_list *closure_list) {
sockaddr_resolver *r = (sockaddr_resolver *)gr;
gpr_mu_destroy(&r->mu);
- grpc_subchannel_factory_unref(r->subchannel_factory, call_list);
+ grpc_subchannel_factory_unref(r->subchannel_factory, closure_list);
gpr_free(r->addrs);
gpr_free(r->addrs_len);
gpr_free(r->lb_policy_name);
diff --git a/src/core/client_config/subchannel.c b/src/core/client_config/subchannel.c
index c570c55267..d41bf8f566 100644
--- a/src/core/client_config/subchannel.c
+++ b/src/core/client_config/subchannel.c
@@ -144,14 +144,14 @@ struct grpc_subchannel_call {
#define CHANNEL_STACK_FROM_CONNECTION(con) ((grpc_channel_stack *)((con) + 1))
static grpc_subchannel_call *create_call(connection *con,
- grpc_call_list *call_list);
+ grpc_closure_list *closure_list);
static void connectivity_state_changed_locked(grpc_subchannel *c,
const char *reason,
- grpc_call_list *call_list);
+ grpc_closure_list *closure_list);
static grpc_connectivity_state compute_connectivity_locked(grpc_subchannel *c);
static gpr_timespec compute_connect_deadline(grpc_subchannel *c);
static void subchannel_connected(void *subchannel, int iomgr_success,
- grpc_call_list *call_list);
+ grpc_closure_list *closure_list);
static void subchannel_ref_locked(
grpc_subchannel *c GRPC_SUBCHANNEL_REF_EXTRA_ARGS);
@@ -159,9 +159,10 @@ static int subchannel_unref_locked(
grpc_subchannel *c GRPC_SUBCHANNEL_REF_EXTRA_ARGS) GRPC_MUST_USE_RESULT;
static void connection_ref_locked(connection *c GRPC_SUBCHANNEL_REF_EXTRA_ARGS);
static grpc_subchannel *connection_unref_locked(
- connection *c, grpc_call_list *call_list GRPC_SUBCHANNEL_REF_EXTRA_ARGS)
- GRPC_MUST_USE_RESULT;
-static void subchannel_destroy(grpc_subchannel *c, grpc_call_list *call_list);
+ connection *c, grpc_closure_list *closure_list
+ GRPC_SUBCHANNEL_REF_EXTRA_ARGS) GRPC_MUST_USE_RESULT;
+static void subchannel_destroy(grpc_subchannel *c,
+ grpc_closure_list *closure_list);
#ifdef GRPC_SUBCHANNEL_REFCOUNT_DEBUG
#define SUBCHANNEL_REF_LOCKED(p, r) \
@@ -197,9 +198,9 @@ static void subchannel_destroy(grpc_subchannel *c, grpc_call_list *call_list);
* connection implementation
*/
-static void connection_destroy(connection *c, grpc_call_list *call_list) {
+static void connection_destroy(connection *c, grpc_closure_list *closure_list) {
GPR_ASSERT(c->refs == 0);
- grpc_channel_stack_destroy(CHANNEL_STACK_FROM_CONNECTION(c), call_list);
+ grpc_channel_stack_destroy(CHANNEL_STACK_FROM_CONNECTION(c), closure_list);
gpr_free(c);
}
@@ -211,14 +212,15 @@ static void connection_ref_locked(
}
static grpc_subchannel *connection_unref_locked(
- connection *c, grpc_call_list *call_list GRPC_SUBCHANNEL_REF_EXTRA_ARGS) {
+ connection *c,
+ grpc_closure_list *closure_list GRPC_SUBCHANNEL_REF_EXTRA_ARGS) {
grpc_subchannel *destroy = NULL;
UNREF_LOG("CONNECTION", c);
if (subchannel_unref_locked(c->subchannel REF_PASS_ARGS)) {
destroy = c->subchannel;
}
if (--c->refs == 0 && c->subchannel->active != c) {
- connection_destroy(c, call_list);
+ connection_destroy(c, closure_list);
}
return destroy;
}
@@ -246,38 +248,39 @@ void grpc_subchannel_ref(grpc_subchannel *c GRPC_SUBCHANNEL_REF_EXTRA_ARGS) {
}
void grpc_subchannel_unref(grpc_subchannel *c,
- grpc_call_list *call_list
+ grpc_closure_list *closure_list
GRPC_SUBCHANNEL_REF_EXTRA_ARGS) {
int destroy;
gpr_mu_lock(&c->mu);
destroy = subchannel_unref_locked(c REF_PASS_ARGS);
gpr_mu_unlock(&c->mu);
- if (destroy) subchannel_destroy(c, call_list);
+ if (destroy) subchannel_destroy(c, closure_list);
}
-static void subchannel_destroy(grpc_subchannel *c, grpc_call_list *call_list) {
+static void subchannel_destroy(grpc_subchannel *c,
+ grpc_closure_list *closure_list) {
if (c->active != NULL) {
- connection_destroy(c->active, call_list);
+ connection_destroy(c->active, closure_list);
}
gpr_free(c->filters);
grpc_channel_args_destroy(c->args);
gpr_free(c->addr);
grpc_mdctx_unref(c->mdctx);
- grpc_connectivity_state_destroy(&c->state_tracker, call_list);
- grpc_connector_unref(c->connector, call_list);
+ grpc_connectivity_state_destroy(&c->state_tracker, closure_list);
+ grpc_connector_unref(c->connector, closure_list);
gpr_free(c);
}
void grpc_subchannel_add_interested_party(grpc_subchannel *c,
grpc_pollset *pollset,
- grpc_call_list *call_list) {
- grpc_pollset_set_add_pollset(c->pollset_set, pollset, call_list);
+ grpc_closure_list *closure_list) {
+ grpc_pollset_set_add_pollset(c->pollset_set, pollset, closure_list);
}
void grpc_subchannel_del_interested_party(grpc_subchannel *c,
grpc_pollset *pollset,
- grpc_call_list *call_list) {
- grpc_pollset_set_del_pollset(c->pollset_set, pollset, call_list);
+ grpc_closure_list *closure_list) {
+ grpc_pollset_set_del_pollset(c->pollset_set, pollset, closure_list);
}
static gpr_uint32 random_seed() {
@@ -313,7 +316,8 @@ grpc_subchannel *grpc_subchannel_create(grpc_connector *connector,
return c;
}
-static void continue_connect(grpc_subchannel *c, grpc_call_list *call_list) {
+static void continue_connect(grpc_subchannel *c,
+ grpc_closure_list *closure_list) {
grpc_connect_in_args args;
args.interested_parties = c->pollset_set;
@@ -323,32 +327,32 @@ static void continue_connect(grpc_subchannel *c, grpc_call_list *call_list) {
args.channel_args = c->args;
grpc_connector_connect(c->connector, &args, &c->connecting_result,
- &c->connected, call_list);
+ &c->connected, closure_list);
}
-static void start_connect(grpc_subchannel *c, grpc_call_list *call_list) {
+static void start_connect(grpc_subchannel *c, grpc_closure_list *closure_list) {
c->backoff_delta = gpr_time_from_seconds(
GRPC_SUBCHANNEL_INITIAL_CONNECT_BACKOFF_SECONDS, GPR_TIMESPAN);
c->next_attempt =
gpr_time_add(gpr_now(GPR_CLOCK_MONOTONIC), c->backoff_delta);
- continue_connect(c, call_list);
+ continue_connect(c, closure_list);
}
static void continue_creating_call(void *arg, int iomgr_success,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
waiting_for_connect *w4c = arg;
grpc_subchannel_del_interested_party(w4c->subchannel, w4c->pollset,
- call_list);
+ closure_list);
grpc_subchannel_create_call(w4c->subchannel, w4c->pollset, w4c->target,
- w4c->notify, call_list);
- GRPC_SUBCHANNEL_UNREF(w4c->subchannel, "waiting_for_connect", call_list);
+ w4c->notify, closure_list);
+ GRPC_SUBCHANNEL_UNREF(w4c->subchannel, "waiting_for_connect", closure_list);
gpr_free(w4c);
}
void grpc_subchannel_create_call(grpc_subchannel *c, grpc_pollset *pollset,
grpc_subchannel_call **target,
grpc_closure *notify,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
connection *con;
gpr_mu_lock(&c->mu);
if (c->active != NULL) {
@@ -356,8 +360,8 @@ void grpc_subchannel_create_call(grpc_subchannel *c, grpc_pollset *pollset,
CONNECTION_REF_LOCKED(con, "call");
gpr_mu_unlock(&c->mu);
- *target = create_call(con, call_list);
- notify->cb(notify->cb_arg, 1, call_list);
+ *target = create_call(con, closure_list);
+ notify->cb(notify->cb_arg, 1, closure_list);
} else {
waiting_for_connect *w4c = gpr_malloc(sizeof(*w4c));
w4c->next = c->waiting;
@@ -369,16 +373,16 @@ void grpc_subchannel_create_call(grpc_subchannel *c, grpc_pollset *pollset,
SUBCHANNEL_REF_LOCKED(c, "waiting_for_connect");
grpc_closure_init(&w4c->continuation, continue_creating_call, w4c);
c->waiting = w4c;
- grpc_subchannel_add_interested_party(c, pollset, call_list);
+ grpc_subchannel_add_interested_party(c, pollset, closure_list);
if (!c->connecting) {
c->connecting = 1;
- connectivity_state_changed_locked(c, "create_call", call_list);
+ connectivity_state_changed_locked(c, "create_call", closure_list);
/* released by connection */
SUBCHANNEL_REF_LOCKED(c, "connecting");
GRPC_CHANNEL_INTERNAL_REF(c->master, "connecting");
gpr_mu_unlock(&c->mu);
- start_connect(c, call_list);
+ start_connect(c, closure_list);
} else {
gpr_mu_unlock(&c->mu);
}
@@ -396,28 +400,28 @@ grpc_connectivity_state grpc_subchannel_check_connectivity(grpc_subchannel *c) {
void grpc_subchannel_notify_on_state_change(grpc_subchannel *c,
grpc_connectivity_state *state,
grpc_closure *notify,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
int do_connect = 0;
gpr_mu_lock(&c->mu);
if (grpc_connectivity_state_notify_on_state_change(&c->state_tracker, state,
- notify, call_list)) {
+ notify, closure_list)) {
do_connect = 1;
c->connecting = 1;
/* released by connection */
SUBCHANNEL_REF_LOCKED(c, "connecting");
GRPC_CHANNEL_INTERNAL_REF(c->master, "connecting");
- connectivity_state_changed_locked(c, "state_change", call_list);
+ connectivity_state_changed_locked(c, "state_change", closure_list);
}
gpr_mu_unlock(&c->mu);
if (do_connect) {
- start_connect(c, call_list);
+ start_connect(c, closure_list);
}
}
void grpc_subchannel_process_transport_op(grpc_subchannel *c,
grpc_transport_op *op,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
connection *con = NULL;
grpc_subchannel *destroy;
int cancel_alarm = 0;
@@ -428,7 +432,7 @@ void grpc_subchannel_process_transport_op(grpc_subchannel *c,
}
if (op->disconnect) {
c->disconnected = 1;
- connectivity_state_changed_locked(c, "disconnect", call_list);
+ connectivity_state_changed_locked(c, "disconnect", closure_list);
if (c->have_alarm) {
cancel_alarm = 1;
}
@@ -439,27 +443,27 @@ void grpc_subchannel_process_transport_op(grpc_subchannel *c,
grpc_channel_stack *channel_stack = CHANNEL_STACK_FROM_CONNECTION(con);
grpc_channel_element *top_elem =
grpc_channel_stack_element(channel_stack, 0);
- top_elem->filter->start_transport_op(top_elem, op, call_list);
+ top_elem->filter->start_transport_op(top_elem, op, closure_list);
gpr_mu_lock(&c->mu);
- destroy = CONNECTION_UNREF_LOCKED(con, "transport-op", call_list);
+ destroy = CONNECTION_UNREF_LOCKED(con, "transport-op", closure_list);
gpr_mu_unlock(&c->mu);
if (destroy) {
- subchannel_destroy(destroy, call_list);
+ subchannel_destroy(destroy, closure_list);
}
}
if (cancel_alarm) {
- grpc_alarm_cancel(&c->alarm, call_list);
+ grpc_alarm_cancel(&c->alarm, closure_list);
}
if (op->disconnect) {
- grpc_connector_shutdown(c->connector, call_list);
+ grpc_connector_shutdown(c->connector, closure_list);
}
}
static void on_state_changed(void *p, int iomgr_success,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
state_watcher *sw = p;
grpc_subchannel *c = sw->subchannel;
gpr_mu *mu = &c->mu;
@@ -486,7 +490,7 @@ static void on_state_changed(void *p, int iomgr_success,
op.on_connectivity_state_change = &sw->closure;
elem = grpc_channel_stack_element(
CHANNEL_STACK_FROM_CONNECTION(c->active), 0);
- elem->filter->start_transport_op(elem, &op, call_list);
+ elem->filter->start_transport_op(elem, &op, closure_list);
/* early out */
gpr_mu_unlock(mu);
return;
@@ -500,24 +504,25 @@ static void on_state_changed(void *p, int iomgr_success,
grpc_connectivity_state_set(
&c->state_tracker, c->disconnected ? GRPC_CHANNEL_FATAL_FAILURE
: GRPC_CHANNEL_TRANSIENT_FAILURE,
- "connection_failed", call_list);
+ "connection_failed", closure_list);
break;
}
done:
- connectivity_state_changed_locked(c, "transport_state_changed", call_list);
+ connectivity_state_changed_locked(c, "transport_state_changed", closure_list);
destroy = SUBCHANNEL_UNREF_LOCKED(c, "state_watcher");
gpr_free(sw);
gpr_mu_unlock(mu);
if (destroy) {
- subchannel_destroy(c, call_list);
+ subchannel_destroy(c, closure_list);
}
if (destroy_connection != NULL) {
- connection_destroy(destroy_connection, call_list);
+ connection_destroy(destroy_connection, closure_list);
}
}
-static void publish_transport(grpc_subchannel *c, grpc_call_list *call_list) {
+static void publish_transport(grpc_subchannel *c,
+ grpc_closure_list *closure_list) {
size_t channel_stack_size;
connection *con;
grpc_channel_stack *stk;
@@ -544,7 +549,7 @@ static void publish_transport(grpc_subchannel *c, grpc_call_list *call_list) {
con->refs = 0;
con->subchannel = c;
grpc_channel_stack_init(filters, num_filters, c->master, c->args, c->mdctx,
- stk, call_list);
+ stk, closure_list);
grpc_connected_channel_bind_transport(stk, c->connecting_result.transport);
gpr_free(c->connecting_result.filters);
memset(&c->connecting_result, 0, sizeof(c->connecting_result));
@@ -561,9 +566,9 @@ static void publish_transport(grpc_subchannel *c, grpc_call_list *call_list) {
gpr_mu_unlock(&c->mu);
gpr_free(sw);
gpr_free(filters);
- grpc_channel_stack_destroy(stk, call_list);
- GRPC_CHANNEL_INTERNAL_UNREF(c->master, "connecting", call_list);
- GRPC_SUBCHANNEL_UNREF(c, "connecting", call_list);
+ grpc_channel_stack_destroy(stk, closure_list);
+ GRPC_CHANNEL_INTERNAL_UNREF(c->master, "connecting", closure_list);
+ GRPC_SUBCHANNEL_UNREF(c, "connecting", closure_list);
return;
}
@@ -583,14 +588,14 @@ static void publish_transport(grpc_subchannel *c, grpc_call_list *call_list) {
op.on_connectivity_state_change = &sw->closure;
op.bind_pollset_set = c->pollset_set;
SUBCHANNEL_REF_LOCKED(c, "state_watcher");
- GRPC_CHANNEL_INTERNAL_UNREF(c->master, "connecting", call_list);
+ GRPC_CHANNEL_INTERNAL_UNREF(c->master, "connecting", closure_list);
GPR_ASSERT(!SUBCHANNEL_UNREF_LOCKED(c, "connecting"));
elem =
grpc_channel_stack_element(CHANNEL_STACK_FROM_CONNECTION(c->active), 0);
- elem->filter->start_transport_op(elem, &op, call_list);
+ elem->filter->start_transport_op(elem, &op, closure_list);
/* signal completion */
- connectivity_state_changed_locked(c, "connected", call_list);
+ connectivity_state_changed_locked(c, "connected", closure_list);
w4c = c->waiting;
c->waiting = NULL;
@@ -598,14 +603,14 @@ static void publish_transport(grpc_subchannel *c, grpc_call_list *call_list) {
while (w4c != NULL) {
waiting_for_connect *next = w4c->next;
- grpc_call_list_add(call_list, &w4c->continuation, 1);
+ grpc_closure_list_add(closure_list, &w4c->continuation, 1);
w4c = next;
}
gpr_free(filters);
if (destroy_connection != NULL) {
- connection_destroy(destroy_connection, call_list);
+ connection_destroy(destroy_connection, closure_list);
}
}
@@ -638,36 +643,37 @@ static void update_reconnect_parameters(grpc_subchannel *c) {
gpr_time_add(c->next_attempt, gpr_time_from_millis(jitter, GPR_TIMESPAN));
}
-static void on_alarm(void *arg, int iomgr_success, grpc_call_list *call_list) {
+static void on_alarm(void *arg, int iomgr_success,
+ grpc_closure_list *closure_list) {
grpc_subchannel *c = arg;
gpr_mu_lock(&c->mu);
c->have_alarm = 0;
if (c->disconnected) {
iomgr_success = 0;
}
- connectivity_state_changed_locked(c, "alarm", call_list);
+ connectivity_state_changed_locked(c, "alarm", closure_list);
gpr_mu_unlock(&c->mu);
if (iomgr_success) {
update_reconnect_parameters(c);
- continue_connect(c, call_list);
+ continue_connect(c, closure_list);
} else {
- GRPC_CHANNEL_INTERNAL_UNREF(c->master, "connecting", call_list);
- GRPC_SUBCHANNEL_UNREF(c, "connecting", call_list);
+ GRPC_CHANNEL_INTERNAL_UNREF(c->master, "connecting", closure_list);
+ GRPC_SUBCHANNEL_UNREF(c, "connecting", closure_list);
}
}
static void subchannel_connected(void *arg, int iomgr_success,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
grpc_subchannel *c = arg;
if (c->connecting_result.transport != NULL) {
- publish_transport(c, call_list);
+ publish_transport(c, closure_list);
} else {
gpr_timespec now = gpr_now(GPR_CLOCK_MONOTONIC);
gpr_mu_lock(&c->mu);
GPR_ASSERT(!c->have_alarm);
c->have_alarm = 1;
- connectivity_state_changed_locked(c, "connect_failed", call_list);
- grpc_alarm_init(&c->alarm, c->next_attempt, on_alarm, c, now, call_list);
+ connectivity_state_changed_locked(c, "connect_failed", closure_list);
+ grpc_alarm_init(&c->alarm, c->next_attempt, on_alarm, c, now, closure_list);
gpr_mu_unlock(&c->mu);
}
}
@@ -701,9 +707,9 @@ static grpc_connectivity_state compute_connectivity_locked(grpc_subchannel *c) {
static void connectivity_state_changed_locked(grpc_subchannel *c,
const char *reason,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
grpc_connectivity_state current = compute_connectivity_locked(c);
- grpc_connectivity_state_set(&c->state_tracker, current, reason, call_list);
+ grpc_connectivity_state_set(&c->state_tracker, current, reason, closure_list);
}
/*
@@ -716,45 +722,45 @@ void grpc_subchannel_call_ref(
}
void grpc_subchannel_call_unref(grpc_subchannel_call *c,
- grpc_call_list *call_list
+ grpc_closure_list *closure_list
GRPC_SUBCHANNEL_REF_EXTRA_ARGS) {
if (gpr_unref(&c->refs)) {
gpr_mu *mu = &c->connection->subchannel->mu;
grpc_subchannel *destroy;
- grpc_call_stack_destroy(SUBCHANNEL_CALL_TO_CALL_STACK(c), call_list);
+ grpc_call_stack_destroy(SUBCHANNEL_CALL_TO_CALL_STACK(c), closure_list);
gpr_mu_lock(mu);
- destroy = CONNECTION_UNREF_LOCKED(c->connection, "call", call_list);
+ destroy = CONNECTION_UNREF_LOCKED(c->connection, "call", closure_list);
gpr_mu_unlock(mu);
gpr_free(c);
if (destroy != NULL) {
- subchannel_destroy(destroy, call_list);
+ subchannel_destroy(destroy, closure_list);
}
}
}
char *grpc_subchannel_call_get_peer(grpc_subchannel_call *call,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
grpc_call_stack *call_stack = SUBCHANNEL_CALL_TO_CALL_STACK(call);
grpc_call_element *top_elem = grpc_call_stack_element(call_stack, 0);
- return top_elem->filter->get_peer(top_elem, call_list);
+ return top_elem->filter->get_peer(top_elem, closure_list);
}
void grpc_subchannel_call_process_op(grpc_subchannel_call *call,
grpc_transport_stream_op *op,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
grpc_call_stack *call_stack = SUBCHANNEL_CALL_TO_CALL_STACK(call);
grpc_call_element *top_elem = grpc_call_stack_element(call_stack, 0);
- top_elem->filter->start_transport_stream_op(top_elem, op, call_list);
+ top_elem->filter->start_transport_stream_op(top_elem, op, closure_list);
}
static grpc_subchannel_call *create_call(connection *con,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
grpc_channel_stack *chanstk = CHANNEL_STACK_FROM_CONNECTION(con);
grpc_subchannel_call *call =
gpr_malloc(sizeof(grpc_subchannel_call) + chanstk->call_stack_size);
grpc_call_stack *callstk = SUBCHANNEL_CALL_TO_CALL_STACK(call);
call->connection = con;
gpr_ref_init(&call->refs, 1);
- grpc_call_stack_init(chanstk, NULL, NULL, callstk, call_list);
+ grpc_call_stack_init(chanstk, NULL, NULL, callstk, closure_list);
return call;
}
diff --git a/src/core/client_config/subchannel.h b/src/core/client_config/subchannel.h
index 0ebfc7c29a..57cc248fec 100644
--- a/src/core/client_config/subchannel.h
+++ b/src/core/client_config/subchannel.h
@@ -67,12 +67,12 @@ typedef struct grpc_subchannel_args grpc_subchannel_args;
void grpc_subchannel_ref(
grpc_subchannel *channel GRPC_SUBCHANNEL_REF_EXTRA_ARGS);
void grpc_subchannel_unref(grpc_subchannel *channel,
- grpc_call_list *call_list
+ grpc_closure_list *closure_list
GRPC_SUBCHANNEL_REF_EXTRA_ARGS);
void grpc_subchannel_call_ref(
grpc_subchannel_call *call GRPC_SUBCHANNEL_REF_EXTRA_ARGS);
void grpc_subchannel_call_unref(grpc_subchannel_call *call,
- grpc_call_list *call_list
+ grpc_closure_list *closure_list
GRPC_SUBCHANNEL_REF_EXTRA_ARGS);
/** construct a call (possibly asynchronously) */
@@ -80,12 +80,12 @@ void grpc_subchannel_create_call(grpc_subchannel *subchannel,
grpc_pollset *pollset,
grpc_subchannel_call **target,
grpc_closure *notify,
- grpc_call_list *call_list);
+ grpc_closure_list *closure_list);
/** process a transport level op */
void grpc_subchannel_process_transport_op(grpc_subchannel *subchannel,
grpc_transport_op *op,
- grpc_call_list *call_list);
+ grpc_closure_list *closure_list);
/** poll the current connectivity state of a channel */
grpc_connectivity_state grpc_subchannel_check_connectivity(
@@ -96,25 +96,25 @@ grpc_connectivity_state grpc_subchannel_check_connectivity(
void grpc_subchannel_notify_on_state_change(grpc_subchannel *channel,
grpc_connectivity_state *state,
grpc_closure *notify,
- grpc_call_list *call_list);
+ grpc_closure_list *closure_list);
/** express interest in \a channel's activities through \a pollset. */
void grpc_subchannel_add_interested_party(grpc_subchannel *channel,
grpc_pollset *pollset,
- grpc_call_list *call_list);
+ grpc_closure_list *closure_list);
/** stop following \a channel's activity through \a pollset. */
void grpc_subchannel_del_interested_party(grpc_subchannel *channel,
grpc_pollset *pollset,
- grpc_call_list *call_list);
+ grpc_closure_list *closure_list);
/** continue processing a transport op */
void grpc_subchannel_call_process_op(grpc_subchannel_call *subchannel_call,
grpc_transport_stream_op *op,
- grpc_call_list *call_list);
+ grpc_closure_list *closure_list);
/** continue querying for peer */
char *grpc_subchannel_call_get_peer(grpc_subchannel_call *subchannel_call,
- grpc_call_list *call_list);
+ grpc_closure_list *closure_list);
struct grpc_subchannel_args {
/** Channel filters for this channel - wrapped factories will likely
diff --git a/src/core/client_config/subchannel_factory.c b/src/core/client_config/subchannel_factory.c
index e252665000..51b805f2f5 100644
--- a/src/core/client_config/subchannel_factory.c
+++ b/src/core/client_config/subchannel_factory.c
@@ -38,12 +38,12 @@ void grpc_subchannel_factory_ref(grpc_subchannel_factory *factory) {
}
void grpc_subchannel_factory_unref(grpc_subchannel_factory *factory,
- grpc_call_list *call_list) {
- factory->vtable->unref(factory, call_list);
+ grpc_closure_list *closure_list) {
+ factory->vtable->unref(factory, closure_list);
}
grpc_subchannel *grpc_subchannel_factory_create_subchannel(
grpc_subchannel_factory *factory, grpc_subchannel_args *args,
- grpc_call_list *call_list) {
- return factory->vtable->create_subchannel(factory, args, call_list);
+ grpc_closure_list *closure_list) {
+ return factory->vtable->create_subchannel(factory, args, closure_list);
}
diff --git a/src/core/client_config/subchannel_factory.h b/src/core/client_config/subchannel_factory.h
index 2ff9d3c402..ea19ab8944 100644
--- a/src/core/client_config/subchannel_factory.h
+++ b/src/core/client_config/subchannel_factory.h
@@ -48,19 +48,20 @@ struct grpc_subchannel_factory {
struct grpc_subchannel_factory_vtable {
void (*ref)(grpc_subchannel_factory *factory);
- void (*unref)(grpc_subchannel_factory *factory, grpc_call_list *call_list);
+ void (*unref)(grpc_subchannel_factory *factory,
+ grpc_closure_list *closure_list);
grpc_subchannel *(*create_subchannel)(grpc_subchannel_factory *factory,
grpc_subchannel_args *args,
- grpc_call_list *call_list);
+ grpc_closure_list *closure_list);
};
void grpc_subchannel_factory_ref(grpc_subchannel_factory *factory);
void grpc_subchannel_factory_unref(grpc_subchannel_factory *factory,
- grpc_call_list *call_list);
+ grpc_closure_list *closure_list);
/** Create a new grpc_subchannel */
grpc_subchannel *grpc_subchannel_factory_create_subchannel(
grpc_subchannel_factory *factory, grpc_subchannel_args *args,
- grpc_call_list *call_list);
+ grpc_closure_list *closure_list);
#endif /* GRPC_INTERNAL_CORE_CLIENT_CONFIG_SUBCHANNEL_FACTORY_H */
diff --git a/src/core/client_config/subchannel_factory_decorators/merge_channel_args.c b/src/core/client_config/subchannel_factory_decorators/merge_channel_args.c
index 00dff6343c..cf5fb00cdf 100644
--- a/src/core/client_config/subchannel_factory_decorators/merge_channel_args.c
+++ b/src/core/client_config/subchannel_factory_decorators/merge_channel_args.c
@@ -48,10 +48,10 @@ static void merge_args_factory_ref(grpc_subchannel_factory *scf) {
}
static void merge_args_factory_unref(grpc_subchannel_factory *scf,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
merge_args_factory *f = (merge_args_factory *)scf;
if (gpr_unref(&f->refs)) {
- grpc_subchannel_factory_unref(f->wrapped, call_list);
+ grpc_subchannel_factory_unref(f->wrapped, closure_list);
grpc_channel_args_destroy(f->merge_args);
gpr_free(f);
}
@@ -59,13 +59,13 @@ static void merge_args_factory_unref(grpc_subchannel_factory *scf,
static grpc_subchannel *merge_args_factory_create_subchannel(
grpc_subchannel_factory *scf, grpc_subchannel_args *args,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
merge_args_factory *f = (merge_args_factory *)scf;
grpc_channel_args *final_args =
grpc_channel_args_merge(args->args, f->merge_args);
grpc_subchannel *s;
args->args = final_args;
- s = grpc_subchannel_factory_create_subchannel(f->wrapped, args, call_list);
+ s = grpc_subchannel_factory_create_subchannel(f->wrapped, args, closure_list);
grpc_channel_args_destroy(final_args);
return s;
}
diff --git a/src/core/httpcli/httpcli.c b/src/core/httpcli/httpcli.c
index fc45eda2de..6422bfb840 100644
--- a/src/core/httpcli/httpcli.c
+++ b/src/core/httpcli/httpcli.c
@@ -71,13 +71,12 @@ typedef struct {
static grpc_httpcli_get_override g_get_override = NULL;
static grpc_httpcli_post_override g_post_override = NULL;
-static void plaintext_handshake(void *arg, grpc_endpoint *endpoint,
- const char *host,
- void (*on_done)(void *arg,
- grpc_endpoint *endpoint,
- grpc_call_list *call_list),
- grpc_call_list *call_list) {
- on_done(arg, endpoint, call_list);
+static void plaintext_handshake(
+ void *arg, grpc_endpoint *endpoint, const char *host,
+ void (*on_done)(void *arg, grpc_endpoint *endpoint,
+ grpc_closure_list *closure_list),
+ grpc_closure_list *closure_list) {
+ on_done(arg, endpoint, closure_list);
}
const grpc_httpcli_handshaker grpc_httpcli_plaintext = {"http",
@@ -91,19 +90,21 @@ void grpc_httpcli_context_destroy(grpc_httpcli_context *context) {
grpc_pollset_set_destroy(&context->pollset_set);
}
-static void next_address(internal_request *req, grpc_call_list *call_list);
+static void next_address(internal_request *req,
+ grpc_closure_list *closure_list);
static void finish(internal_request *req, int success,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
grpc_pollset_set_del_pollset(&req->context->pollset_set, req->pollset,
- call_list);
- req->on_response(req->user_data, success ? &req->parser.r : NULL, call_list);
+ closure_list);
+ req->on_response(req->user_data, success ? &req->parser.r : NULL,
+ closure_list);
grpc_httpcli_parser_destroy(&req->parser);
if (req->addresses != NULL) {
grpc_resolved_addresses_destroy(req->addresses);
}
if (req->ep != NULL) {
- grpc_endpoint_destroy(req->ep, call_list);
+ grpc_endpoint_destroy(req->ep, closure_list);
}
gpr_slice_unref(req->request_text);
gpr_free(req->host);
@@ -113,13 +114,15 @@ static void finish(internal_request *req, int success,
gpr_free(req);
}
-static void on_read(void *user_data, int success, grpc_call_list *call_list);
+static void on_read(void *user_data, int success,
+ grpc_closure_list *closure_list);
-static void do_read(internal_request *req, grpc_call_list *call_list) {
- grpc_endpoint_read(req->ep, &req->incoming, &req->on_read, call_list);
+static void do_read(internal_request *req, grpc_closure_list *closure_list) {
+ grpc_endpoint_read(req->ep, &req->incoming, &req->on_read, closure_list);
}
-static void on_read(void *user_data, int success, grpc_call_list *call_list) {
+static void on_read(void *user_data, int success,
+ grpc_closure_list *closure_list) {
internal_request *req = user_data;
size_t i;
@@ -127,94 +130,98 @@ static void on_read(void *user_data, int success, grpc_call_list *call_list) {
if (GPR_SLICE_LENGTH(req->incoming.slices[i])) {
req->have_read_byte = 1;
if (!grpc_httpcli_parser_parse(&req->parser, req->incoming.slices[i])) {
- finish(req, 0, call_list);
+ finish(req, 0, closure_list);
return;
}
}
}
if (success) {
- do_read(req, call_list);
+ do_read(req, closure_list);
} else if (!req->have_read_byte) {
- next_address(req, call_list);
+ next_address(req, closure_list);
} else {
- finish(req, grpc_httpcli_parser_eof(&req->parser), call_list);
+ finish(req, grpc_httpcli_parser_eof(&req->parser), closure_list);
}
}
-static void on_written(internal_request *req, grpc_call_list *call_list) {
- do_read(req, call_list);
+static void on_written(internal_request *req, grpc_closure_list *closure_list) {
+ do_read(req, closure_list);
}
-static void done_write(void *arg, int success, grpc_call_list *call_list) {
+static void done_write(void *arg, int success,
+ grpc_closure_list *closure_list) {
internal_request *req = arg;
if (success) {
- on_written(req, call_list);
+ on_written(req, closure_list);
} else {
- next_address(req, call_list);
+ next_address(req, closure_list);
}
}
-static void start_write(internal_request *req, grpc_call_list *call_list) {
+static void start_write(internal_request *req,
+ grpc_closure_list *closure_list) {
gpr_slice_ref(req->request_text);
gpr_slice_buffer_add(&req->outgoing, req->request_text);
- grpc_endpoint_write(req->ep, &req->outgoing, &req->done_write, call_list);
+ grpc_endpoint_write(req->ep, &req->outgoing, &req->done_write, closure_list);
}
static void on_handshake_done(void *arg, grpc_endpoint *ep,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
internal_request *req = arg;
if (!ep) {
- next_address(req, call_list);
+ next_address(req, closure_list);
return;
}
req->ep = ep;
- start_write(req, call_list);
+ start_write(req, closure_list);
}
-static void on_connected(void *arg, int success, grpc_call_list *call_list) {
+static void on_connected(void *arg, int success,
+ grpc_closure_list *closure_list) {
internal_request *req = arg;
if (!req->ep) {
- next_address(req, call_list);
+ next_address(req, closure_list);
return;
}
req->handshaker->handshake(req, req->ep, req->host, on_handshake_done,
- call_list);
+ closure_list);
}
-static void next_address(internal_request *req, grpc_call_list *call_list) {
+static void next_address(internal_request *req,
+ grpc_closure_list *closure_list) {
grpc_resolved_address *addr;
if (req->next_address == req->addresses->naddrs) {
- finish(req, 0, call_list);
+ finish(req, 0, closure_list);
return;
}
addr = &req->addresses->addrs[req->next_address++];
grpc_closure_init(&req->connected, on_connected, req);
grpc_tcp_client_connect(&req->connected, &req->ep, &req->context->pollset_set,
(struct sockaddr *)&addr->addr, addr->len,
- req->deadline, call_list);
+ req->deadline, closure_list);
}
static void on_resolved(void *arg, grpc_resolved_addresses *addresses,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
internal_request *req = arg;
if (!addresses) {
- finish(req, 0, call_list);
+ finish(req, 0, closure_list);
return;
}
req->addresses = addresses;
req->next_address = 0;
- next_address(req, call_list);
+ next_address(req, closure_list);
}
static void internal_request_begin(
grpc_httpcli_context *context, grpc_pollset *pollset,
const grpc_httpcli_request *request, gpr_timespec deadline,
grpc_httpcli_response_cb on_response, void *user_data, const char *name,
- gpr_slice request_text, grpc_call_list *call_list) {
+ gpr_slice request_text, grpc_closure_list *closure_list) {
internal_request *req = gpr_malloc(sizeof(internal_request));
memset(req, 0, sizeof(*req));
req->request_text = request_text;
@@ -234,7 +241,7 @@ static void internal_request_begin(
req->host = gpr_strdup(request->host);
grpc_pollset_set_add_pollset(&req->context->pollset_set, req->pollset,
- call_list);
+ closure_list);
grpc_resolve_address(request->host, req->handshaker->default_port,
on_resolved, req);
}
@@ -243,16 +250,16 @@ void grpc_httpcli_get(grpc_httpcli_context *context, grpc_pollset *pollset,
const grpc_httpcli_request *request,
gpr_timespec deadline,
grpc_httpcli_response_cb on_response, void *user_data,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
char *name;
if (g_get_override &&
- g_get_override(request, deadline, on_response, user_data, call_list)) {
+ g_get_override(request, deadline, on_response, user_data, closure_list)) {
return;
}
gpr_asprintf(&name, "HTTP:GET:%s:%s", request->host, request->path);
- internal_request_begin(context, pollset, request, deadline, on_response,
- user_data, name,
- grpc_httpcli_format_get_request(request), call_list);
+ internal_request_begin(
+ context, pollset, request, deadline, on_response, user_data, name,
+ grpc_httpcli_format_get_request(request), closure_list);
gpr_free(name);
}
@@ -261,18 +268,18 @@ void grpc_httpcli_post(grpc_httpcli_context *context, grpc_pollset *pollset,
const char *body_bytes, size_t body_size,
gpr_timespec deadline,
grpc_httpcli_response_cb on_response, void *user_data,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
char *name;
if (g_post_override &&
g_post_override(request, body_bytes, body_size, deadline, on_response,
- user_data, call_list)) {
+ user_data, closure_list)) {
return;
}
gpr_asprintf(&name, "HTTP:POST:%s:%s", request->host, request->path);
internal_request_begin(
context, pollset, request, deadline, on_response, user_data, name,
grpc_httpcli_format_post_request(request, body_bytes, body_size),
- call_list);
+ closure_list);
gpr_free(name);
}
diff --git a/src/core/httpcli/httpcli.h b/src/core/httpcli/httpcli.h
index 6d19da37fb..2460c6ca60 100644
--- a/src/core/httpcli/httpcli.h
+++ b/src/core/httpcli/httpcli.h
@@ -63,8 +63,8 @@ typedef struct {
const char *default_port;
void (*handshake)(void *arg, grpc_endpoint *endpoint, const char *host,
void (*on_done)(void *arg, grpc_endpoint *endpoint,
- grpc_call_list *call_list),
- grpc_call_list *call_list);
+ grpc_closure_list *closure_list),
+ grpc_closure_list *closure_list);
} grpc_httpcli_handshaker;
extern const grpc_httpcli_handshaker grpc_httpcli_plaintext;
@@ -100,7 +100,7 @@ typedef struct grpc_httpcli_response {
/* Callback for grpc_httpcli_get and grpc_httpcli_post. */
typedef void (*grpc_httpcli_response_cb)(void *user_data,
const grpc_httpcli_response *response,
- grpc_call_list *call_list);
+ grpc_closure_list *closure_list);
void grpc_httpcli_context_init(grpc_httpcli_context *context);
void grpc_httpcli_context_destroy(grpc_httpcli_context *context);
@@ -119,7 +119,7 @@ void grpc_httpcli_get(grpc_httpcli_context *context, grpc_pollset *pollset,
const grpc_httpcli_request *request,
gpr_timespec deadline,
grpc_httpcli_response_cb on_response, void *user_data,
- grpc_call_list *call_list);
+ grpc_closure_list *closure_list);
/* Asynchronously perform a HTTP POST.
'context' specifies the http context under which to do the post
@@ -141,21 +141,21 @@ void grpc_httpcli_post(grpc_httpcli_context *context, grpc_pollset *pollset,
const char *body_bytes, size_t body_size,
gpr_timespec deadline,
grpc_httpcli_response_cb on_response, void *user_data,
- grpc_call_list *call_list);
+ grpc_closure_list *closure_list);
/* override functions return 1 if they handled the request, 0 otherwise */
typedef int (*grpc_httpcli_get_override)(const grpc_httpcli_request *request,
gpr_timespec deadline,
grpc_httpcli_response_cb on_response,
void *user_data,
- grpc_call_list *call_list);
+ grpc_closure_list *closure_list);
typedef int (*grpc_httpcli_post_override)(const grpc_httpcli_request *request,
const char *body_bytes,
size_t body_size,
gpr_timespec deadline,
grpc_httpcli_response_cb on_response,
void *user_data,
- grpc_call_list *call_list);
+ grpc_closure_list *closure_list);
void grpc_httpcli_set_override(grpc_httpcli_get_override get,
grpc_httpcli_post_override post);
diff --git a/src/core/httpcli/httpcli_security_connector.c b/src/core/httpcli/httpcli_security_connector.c
index a340a90c4b..1ae1d7f09b 100644
--- a/src/core/httpcli/httpcli_security_connector.c
+++ b/src/core/httpcli/httpcli_security_connector.c
@@ -62,13 +62,13 @@ static void httpcli_ssl_do_handshake(grpc_security_connector *sc,
grpc_endpoint *nonsecure_endpoint,
grpc_security_handshake_done_cb cb,
void *user_data,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
grpc_httpcli_ssl_channel_security_connector *c =
(grpc_httpcli_ssl_channel_security_connector *)sc;
tsi_result result = TSI_OK;
tsi_handshaker *handshaker;
if (c->handshaker_factory == NULL) {
- cb(user_data, GRPC_SECURITY_ERROR, nonsecure_endpoint, NULL, call_list);
+ cb(user_data, GRPC_SECURITY_ERROR, nonsecure_endpoint, NULL, closure_list);
return;
}
result = tsi_ssl_handshaker_factory_create_handshaker(
@@ -76,10 +76,10 @@ static void httpcli_ssl_do_handshake(grpc_security_connector *sc,
if (result != TSI_OK) {
gpr_log(GPR_ERROR, "Handshaker creation failed with error %s.",
tsi_result_to_string(result));
- cb(user_data, GRPC_SECURITY_ERROR, nonsecure_endpoint, NULL, call_list);
+ cb(user_data, GRPC_SECURITY_ERROR, nonsecure_endpoint, NULL, closure_list);
} else {
grpc_do_security_handshake(handshaker, sc, nonsecure_endpoint, cb,
- user_data, call_list);
+ user_data, closure_list);
}
}
@@ -143,7 +143,8 @@ static grpc_security_status httpcli_ssl_channel_security_connector_create(
/* handshaker */
typedef struct {
- void (*func)(void *arg, grpc_endpoint *endpoint, grpc_call_list *call_list);
+ void (*func)(void *arg, grpc_endpoint *endpoint,
+ grpc_closure_list *closure_list);
void *arg;
} on_done_closure;
@@ -151,28 +152,28 @@ static void on_secure_transport_setup_done(void *rp,
grpc_security_status status,
grpc_endpoint *wrapped_endpoint,
grpc_endpoint *secure_endpoint,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
on_done_closure *c = rp;
if (status != GRPC_SECURITY_OK) {
gpr_log(GPR_ERROR, "Secure transport setup failed with error %d.", status);
- c->func(c->arg, NULL, call_list);
+ c->func(c->arg, NULL, closure_list);
} else {
- c->func(c->arg, secure_endpoint, call_list);
+ c->func(c->arg, secure_endpoint, closure_list);
}
gpr_free(c);
}
static void ssl_handshake(void *arg, grpc_endpoint *tcp, const char *host,
void (*on_done)(void *arg, grpc_endpoint *endpoint,
- grpc_call_list *call_list),
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list),
+ grpc_closure_list *closure_list) {
grpc_channel_security_connector *sc = NULL;
const unsigned char *pem_root_certs = NULL;
on_done_closure *c = gpr_malloc(sizeof(*c));
size_t pem_root_certs_size = grpc_get_default_ssl_roots(&pem_root_certs);
if (pem_root_certs == NULL || pem_root_certs_size == 0) {
gpr_log(GPR_ERROR, "Could not get default pem root certs.");
- on_done(arg, NULL, call_list);
+ on_done(arg, NULL, closure_list);
gpr_free(c);
return;
}
@@ -182,7 +183,7 @@ static void ssl_handshake(void *arg, grpc_endpoint *tcp, const char *host,
pem_root_certs, pem_root_certs_size, host, &sc) ==
GRPC_SECURITY_OK);
grpc_security_connector_do_handshake(
- &sc->base, tcp, on_secure_transport_setup_done, c, call_list);
+ &sc->base, tcp, on_secure_transport_setup_done, c, closure_list);
GRPC_SECURITY_CONNECTOR_UNREF(&sc->base, "httpcli");
}
diff --git a/src/core/iomgr/alarm.c b/src/core/iomgr/alarm.c
index da265d4e50..d26dc57b09 100644
--- a/src/core/iomgr/alarm.c
+++ b/src/core/iomgr/alarm.c
@@ -73,7 +73,8 @@ static shard_type g_shards[NUM_SHARDS];
static shard_type *g_shard_queue[NUM_SHARDS];
static int run_some_expired_alarms(gpr_timespec now, gpr_timespec *next,
- int success, grpc_call_list *call_list);
+ int success,
+ grpc_closure_list *closure_list);
static gpr_timespec compute_min_deadline(shard_type *shard) {
return grpc_alarm_heap_is_empty(&shard->heap)
@@ -102,9 +103,9 @@ void grpc_alarm_list_init(gpr_timespec now) {
}
}
-void grpc_alarm_list_shutdown(grpc_call_list *call_list) {
+void grpc_alarm_list_shutdown(grpc_closure_list *closure_list) {
int i;
- run_some_expired_alarms(gpr_inf_future(g_clock_type), NULL, 0, call_list);
+ run_some_expired_alarms(gpr_inf_future(g_clock_type), NULL, 0, closure_list);
for (i = 0; i < NUM_SHARDS; i++) {
shard_type *shard = &g_shards[i];
gpr_mu_destroy(&shard->mu);
@@ -172,7 +173,7 @@ static void note_deadline_change(shard_type *shard) {
void grpc_alarm_init(grpc_alarm *alarm, gpr_timespec deadline,
grpc_iomgr_cb_func alarm_cb, void *alarm_cb_arg,
- gpr_timespec now, grpc_call_list *call_list) {
+ gpr_timespec now, grpc_closure_list *closure_list) {
int is_first_alarm = 0;
shard_type *shard = &g_shards[shard_idx(alarm)];
GPR_ASSERT(deadline.clock_type == g_clock_type);
@@ -220,11 +221,11 @@ void grpc_alarm_init(grpc_alarm *alarm, gpr_timespec deadline,
}
}
-void grpc_alarm_cancel(grpc_alarm *alarm, grpc_call_list *call_list) {
+void grpc_alarm_cancel(grpc_alarm *alarm, grpc_closure_list *closure_list) {
shard_type *shard = &g_shards[shard_idx(alarm)];
gpr_mu_lock(&shard->mu);
if (!alarm->triggered) {
- grpc_call_list_add(call_list, &alarm->closure, 0);
+ grpc_closure_list_add(closure_list, &alarm->closure, 0);
alarm->triggered = 1;
if (alarm->heap_index == INVALID_HEAP_INDEX) {
list_remove(alarm);
@@ -285,12 +286,12 @@ static grpc_alarm *pop_one(shard_type *shard, gpr_timespec now) {
/* REQUIRES: shard->mu unlocked */
static size_t pop_alarms(shard_type *shard, gpr_timespec now,
gpr_timespec *new_min_deadline, int success,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
size_t n = 0;
grpc_alarm *alarm;
gpr_mu_lock(&shard->mu);
while ((alarm = pop_one(shard, now))) {
- grpc_call_list_add(call_list, &alarm->closure, success);
+ grpc_closure_list_add(closure_list, &alarm->closure, success);
n++;
}
*new_min_deadline = compute_min_deadline(shard);
@@ -299,7 +300,8 @@ static size_t pop_alarms(shard_type *shard, gpr_timespec now,
}
static int run_some_expired_alarms(gpr_timespec now, gpr_timespec *next,
- int success, grpc_call_list *call_list) {
+ int success,
+ grpc_closure_list *closure_list) {
size_t n = 0;
/* TODO(ctiller): verify that there are any alarms (atomically) here */
@@ -314,7 +316,7 @@ static int run_some_expired_alarms(gpr_timespec now, gpr_timespec *next,
shard. This may violate perfect alarm deadline ordering, but that
shouldn't be a big deal because we don't make ordering guarantees. */
n += pop_alarms(g_shard_queue[0], now, &new_min_deadline, success,
- call_list);
+ closure_list);
/* An grpc_alarm_init() on the shard could intervene here, adding a new
alarm that is earlier than new_min_deadline. However,
@@ -337,11 +339,11 @@ static int run_some_expired_alarms(gpr_timespec now, gpr_timespec *next,
}
int grpc_alarm_check(gpr_timespec now, gpr_timespec *next,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
GPR_ASSERT(now.clock_type == g_clock_type);
return run_some_expired_alarms(
now, next, gpr_time_cmp(now, gpr_inf_future(now.clock_type)) != 0,
- call_list);
+ closure_list);
}
gpr_timespec grpc_alarm_list_next_timeout(void) {
diff --git a/src/core/iomgr/alarm.h b/src/core/iomgr/alarm.h
index 05ca7c27bb..09bfa88756 100644
--- a/src/core/iomgr/alarm.h
+++ b/src/core/iomgr/alarm.h
@@ -55,7 +55,7 @@ typedef struct grpc_alarm {
information about when to free up any user-level state. */
void grpc_alarm_init(grpc_alarm *alarm, gpr_timespec deadline,
grpc_iomgr_cb_func alarm_cb, void *alarm_cb_arg,
- gpr_timespec now, grpc_call_list *call_list);
+ gpr_timespec now, grpc_closure_list *closure_list);
/* Note that there is no alarm destroy function. This is because the
alarm is a one-time occurrence with a guarantee that the callback will
@@ -83,6 +83,6 @@ void grpc_alarm_init(grpc_alarm *alarm, gpr_timespec deadline,
matches this aim.
Requires: cancel() must happen after add() on a given alarm */
-void grpc_alarm_cancel(grpc_alarm *alarm, grpc_call_list *call_list);
+void grpc_alarm_cancel(grpc_alarm *alarm, grpc_closure_list *closure_list);
#endif /* GRPC_INTERNAL_CORE_IOMGR_ALARM_H */
diff --git a/src/core/iomgr/alarm_internal.h b/src/core/iomgr/alarm_internal.h
index a2e9946f4f..aebc789ec6 100644
--- a/src/core/iomgr/alarm_internal.h
+++ b/src/core/iomgr/alarm_internal.h
@@ -49,9 +49,9 @@
at any time slice. */
int grpc_alarm_check(gpr_timespec now, gpr_timespec *next,
- grpc_call_list *call_list);
+ grpc_closure_list *closure_list);
void grpc_alarm_list_init(gpr_timespec now);
-void grpc_alarm_list_shutdown(grpc_call_list *call_list);
+void grpc_alarm_list_shutdown(grpc_closure_list *closure_list);
gpr_timespec grpc_alarm_list_next_timeout(void);
diff --git a/src/core/iomgr/endpoint.c b/src/core/iomgr/endpoint.c
index 769f155a63..db2a738d09 100644
--- a/src/core/iomgr/endpoint.c
+++ b/src/core/iomgr/endpoint.c
@@ -34,32 +34,33 @@
#include "src/core/iomgr/endpoint.h"
void grpc_endpoint_read(grpc_endpoint *ep, gpr_slice_buffer *slices,
- grpc_closure *cb, grpc_call_list *call_list) {
- ep->vtable->read(ep, slices, cb, call_list);
+ grpc_closure *cb, grpc_closure_list *closure_list) {
+ ep->vtable->read(ep, slices, cb, closure_list);
}
void grpc_endpoint_write(grpc_endpoint *ep, gpr_slice_buffer *slices,
- grpc_closure *cb, grpc_call_list *call_list) {
- ep->vtable->write(ep, slices, cb, call_list);
+ grpc_closure *cb, grpc_closure_list *closure_list) {
+ ep->vtable->write(ep, slices, cb, closure_list);
}
void grpc_endpoint_add_to_pollset(grpc_endpoint *ep, grpc_pollset *pollset,
- grpc_call_list *call_list) {
- ep->vtable->add_to_pollset(ep, pollset, call_list);
+ grpc_closure_list *closure_list) {
+ ep->vtable->add_to_pollset(ep, pollset, closure_list);
}
void grpc_endpoint_add_to_pollset_set(grpc_endpoint *ep,
grpc_pollset_set *pollset_set,
- grpc_call_list *call_list) {
- ep->vtable->add_to_pollset_set(ep, pollset_set, call_list);
+ grpc_closure_list *closure_list) {
+ ep->vtable->add_to_pollset_set(ep, pollset_set, closure_list);
}
-void grpc_endpoint_shutdown(grpc_endpoint *ep, grpc_call_list *call_list) {
- ep->vtable->shutdown(ep, call_list);
+void grpc_endpoint_shutdown(grpc_endpoint *ep,
+ grpc_closure_list *closure_list) {
+ ep->vtable->shutdown(ep, closure_list);
}
-void grpc_endpoint_destroy(grpc_endpoint *ep, grpc_call_list *call_list) {
- ep->vtable->destroy(ep, call_list);
+void grpc_endpoint_destroy(grpc_endpoint *ep, grpc_closure_list *closure_list) {
+ ep->vtable->destroy(ep, closure_list);
}
char *grpc_endpoint_get_peer(grpc_endpoint *ep) {
diff --git a/src/core/iomgr/endpoint.h b/src/core/iomgr/endpoint.h
index f9881684ff..cb722e32e9 100644
--- a/src/core/iomgr/endpoint.h
+++ b/src/core/iomgr/endpoint.h
@@ -48,15 +48,15 @@ typedef struct grpc_endpoint_vtable grpc_endpoint_vtable;
struct grpc_endpoint_vtable {
void (*read)(grpc_endpoint *ep, gpr_slice_buffer *slices, grpc_closure *cb,
- grpc_call_list *call_list);
+ grpc_closure_list *closure_list);
void (*write)(grpc_endpoint *ep, gpr_slice_buffer *slices, grpc_closure *cb,
- grpc_call_list *call_list);
+ grpc_closure_list *closure_list);
void (*add_to_pollset)(grpc_endpoint *ep, grpc_pollset *pollset,
- grpc_call_list *call_list);
+ grpc_closure_list *closure_list);
void (*add_to_pollset_set)(grpc_endpoint *ep, grpc_pollset_set *pollset,
- grpc_call_list *call_list);
- void (*shutdown)(grpc_endpoint *ep, grpc_call_list *call_list);
- void (*destroy)(grpc_endpoint *ep, grpc_call_list *call_list);
+ grpc_closure_list *closure_list);
+ void (*shutdown)(grpc_endpoint *ep, grpc_closure_list *closure_list);
+ void (*destroy)(grpc_endpoint *ep, grpc_closure_list *closure_list);
char *(*get_peer)(grpc_endpoint *ep);
};
@@ -65,7 +65,7 @@ struct grpc_endpoint_vtable {
indicates the endpoint is closed.
Valid slices may be placed into \a slices even on callback success == 0. */
void grpc_endpoint_read(grpc_endpoint *ep, gpr_slice_buffer *slices,
- grpc_closure *cb, grpc_call_list *call_list);
+ grpc_closure *cb, grpc_closure_list *closure_list);
char *grpc_endpoint_get_peer(grpc_endpoint *ep);
@@ -80,20 +80,20 @@ char *grpc_endpoint_get_peer(grpc_endpoint *ep);
it is a valid slice buffer.
*/
void grpc_endpoint_write(grpc_endpoint *ep, gpr_slice_buffer *slices,
- grpc_closure *cb, grpc_call_list *call_list);
+ grpc_closure *cb, grpc_closure_list *closure_list);
/* Causes any pending read/write callbacks to run immediately with
success==0 */
-void grpc_endpoint_shutdown(grpc_endpoint *ep, grpc_call_list *call_list);
-void grpc_endpoint_destroy(grpc_endpoint *ep, grpc_call_list *call_list);
+void grpc_endpoint_shutdown(grpc_endpoint *ep, grpc_closure_list *closure_list);
+void grpc_endpoint_destroy(grpc_endpoint *ep, grpc_closure_list *closure_list);
/* Add an endpoint to a pollset, so that when the pollset is polled, events from
this endpoint are considered */
void grpc_endpoint_add_to_pollset(grpc_endpoint *ep, grpc_pollset *pollset,
- grpc_call_list *call_list);
+ grpc_closure_list *closure_list);
void grpc_endpoint_add_to_pollset_set(grpc_endpoint *ep,
grpc_pollset_set *pollset_set,
- grpc_call_list *call_list);
+ grpc_closure_list *closure_list);
struct grpc_endpoint {
const grpc_endpoint_vtable *vtable;
diff --git a/src/core/iomgr/fd_posix.c b/src/core/iomgr/fd_posix.c
index 7c1db32553..5e455f32d7 100644
--- a/src/core/iomgr/fd_posix.c
+++ b/src/core/iomgr/fd_posix.c
@@ -212,7 +212,7 @@ static int has_watchers(grpc_fd *fd) {
}
void grpc_fd_orphan(grpc_fd *fd, grpc_closure *on_done, const char *reason,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
fd->on_done_closure = on_done;
shutdown(fd->fd, SHUT_RDWR);
gpr_mu_lock(&fd->watcher_mu);
@@ -220,7 +220,7 @@ void grpc_fd_orphan(grpc_fd *fd, grpc_closure *on_done, const char *reason,
if (!has_watchers(fd)) {
fd->closed = 1;
close(fd->fd);
- grpc_call_list_add(call_list, fd->on_done_closure, 1);
+ grpc_closure_list_add(closure_list, fd->on_done_closure, 1);
} else {
wake_all_watchers_locked(fd);
}
@@ -245,7 +245,7 @@ void grpc_fd_unref(grpc_fd *fd) { unref_by(fd, 2); }
#endif
static void notify_on(grpc_fd *fd, gpr_atm *st, grpc_closure *closure,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
switch (gpr_atm_acq_load(st)) {
case NOT_READY:
/* There is no race if the descriptor is already ready, so we skip
@@ -267,7 +267,8 @@ static void notify_on(grpc_fd *fd, gpr_atm *st, grpc_closure *closure,
case READY:
GPR_ASSERT(gpr_atm_no_barrier_load(st) == READY);
gpr_atm_rel_store(st, NOT_READY);
- grpc_call_list_add(call_list, closure, !gpr_atm_acq_load(&fd->shutdown));
+ grpc_closure_list_add(closure_list, closure,
+ !gpr_atm_acq_load(&fd->shutdown));
return;
default: /* WAITING */
/* upcallptr was set to a different closure. This is an error! */
@@ -281,7 +282,7 @@ static void notify_on(grpc_fd *fd, gpr_atm *st, grpc_closure *closure,
}
static void set_ready_locked(grpc_fd *fd, gpr_atm *st,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
gpr_intptr state = gpr_atm_acq_load(st);
switch (state) {
@@ -300,38 +301,39 @@ static void set_ready_locked(grpc_fd *fd, gpr_atm *st,
default: /* waiting */
GPR_ASSERT(gpr_atm_no_barrier_load(st) != READY &&
gpr_atm_no_barrier_load(st) != NOT_READY);
- grpc_call_list_add(call_list, (grpc_closure *)state,
- !gpr_atm_acq_load(&fd->shutdown));
+ grpc_closure_list_add(closure_list, (grpc_closure *)state,
+ !gpr_atm_acq_load(&fd->shutdown));
gpr_atm_rel_store(st, NOT_READY);
return;
}
}
-static void set_ready(grpc_fd *fd, gpr_atm *st, grpc_call_list *call_list) {
+static void set_ready(grpc_fd *fd, gpr_atm *st,
+ grpc_closure_list *closure_list) {
/* only one set_ready can be active at once (but there may be a racing
notify_on) */
gpr_mu_lock(&fd->set_state_mu);
- set_ready_locked(fd, st, call_list);
+ set_ready_locked(fd, st, closure_list);
gpr_mu_unlock(&fd->set_state_mu);
}
-void grpc_fd_shutdown(grpc_fd *fd, grpc_call_list *call_list) {
+void grpc_fd_shutdown(grpc_fd *fd, grpc_closure_list *closure_list) {
gpr_mu_lock(&fd->set_state_mu);
GPR_ASSERT(!gpr_atm_no_barrier_load(&fd->shutdown));
gpr_atm_rel_store(&fd->shutdown, 1);
- set_ready_locked(fd, &fd->readst, call_list);
- set_ready_locked(fd, &fd->writest, call_list);
+ set_ready_locked(fd, &fd->readst, closure_list);
+ set_ready_locked(fd, &fd->writest, closure_list);
gpr_mu_unlock(&fd->set_state_mu);
}
void grpc_fd_notify_on_read(grpc_fd *fd, grpc_closure *closure,
- grpc_call_list *call_list) {
- notify_on(fd, &fd->readst, closure, call_list);
+ grpc_closure_list *closure_list) {
+ notify_on(fd, &fd->readst, closure, closure_list);
}
void grpc_fd_notify_on_write(grpc_fd *fd, grpc_closure *closure,
- grpc_call_list *call_list) {
- notify_on(fd, &fd->writest, closure, call_list);
+ grpc_closure_list *closure_list) {
+ notify_on(fd, &fd->writest, closure, closure_list);
}
gpr_uint32 grpc_fd_begin_poll(grpc_fd *fd, grpc_pollset *pollset,
@@ -378,7 +380,7 @@ gpr_uint32 grpc_fd_begin_poll(grpc_fd *fd, grpc_pollset *pollset,
}
void grpc_fd_end_poll(grpc_fd_watcher *watcher, int got_read, int got_write,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
int was_polling = 0;
int kick = 0;
grpc_fd *fd = watcher->fd;
@@ -411,19 +413,19 @@ void grpc_fd_end_poll(grpc_fd_watcher *watcher, int got_read, int got_write,
if (grpc_fd_is_orphaned(fd) && !has_watchers(fd) && !fd->closed) {
fd->closed = 1;
close(fd->fd);
- grpc_call_list_add(call_list, fd->on_done_closure, 1);
+ grpc_closure_list_add(closure_list, fd->on_done_closure, 1);
}
gpr_mu_unlock(&fd->watcher_mu);
GRPC_FD_UNREF(fd, "poll");
}
-void grpc_fd_become_readable(grpc_fd *fd, grpc_call_list *call_list) {
- set_ready(fd, &fd->readst, call_list);
+void grpc_fd_become_readable(grpc_fd *fd, grpc_closure_list *closure_list) {
+ set_ready(fd, &fd->readst, closure_list);
}
-void grpc_fd_become_writable(grpc_fd *fd, grpc_call_list *call_list) {
- set_ready(fd, &fd->writest, call_list);
+void grpc_fd_become_writable(grpc_fd *fd, grpc_closure_list *closure_list) {
+ set_ready(fd, &fd->writest, closure_list);
}
#endif
diff --git a/src/core/iomgr/fd_posix.h b/src/core/iomgr/fd_posix.h
index 607cba6181..eab0daa00d 100644
--- a/src/core/iomgr/fd_posix.h
+++ b/src/core/iomgr/fd_posix.h
@@ -112,7 +112,7 @@ grpc_fd *grpc_fd_create(int fd, const char *name);
notify_on_write.
MUST NOT be called with a pollset lock taken */
void grpc_fd_orphan(grpc_fd *fd, grpc_closure *on_done, const char *reason,
- grpc_call_list *call_list);
+ grpc_closure_list *closure_list);
/* Begin polling on an fd.
Registers that the given pollset is interested in this fd - so that if read
@@ -131,13 +131,13 @@ gpr_uint32 grpc_fd_begin_poll(grpc_fd *fd, grpc_pollset *pollset,
/* Complete polling previously started with grpc_fd_begin_poll
MUST NOT be called with a pollset lock taken */
void grpc_fd_end_poll(grpc_fd_watcher *rec, int got_read, int got_write,
- grpc_call_list *call_list);
+ grpc_closure_list *closure_list);
/* Return 1 if this fd is orphaned, 0 otherwise */
int grpc_fd_is_orphaned(grpc_fd *fd);
/* Cause any current callbacks to error out with GRPC_CALLBACK_CANCELLED. */
-void grpc_fd_shutdown(grpc_fd *fd, grpc_call_list *call_list);
+void grpc_fd_shutdown(grpc_fd *fd, grpc_closure_list *closure_list);
/* Register read interest, causing read_cb to be called once when fd becomes
readable, on deadline specified by deadline, or on shutdown triggered by
@@ -153,18 +153,18 @@ void grpc_fd_shutdown(grpc_fd *fd, grpc_call_list *call_list);
calling notify_on_read again. Users are also expected to handle spurious
events, i.e read_cb is called while nothing can be readable from fd */
void grpc_fd_notify_on_read(grpc_fd *fd, grpc_closure *closure,
- grpc_call_list *call_list);
+ grpc_closure_list *closure_list);
/* Exactly the same semantics as above, except based on writable events. */
void grpc_fd_notify_on_write(grpc_fd *fd, grpc_closure *closure,
- grpc_call_list *call_list);
+ grpc_closure_list *closure_list);
/* Notification from the poller to an fd that it has become readable or
writable.
If allow_synchronous_callback is 1, allow running the fd callback inline
in this callstack, otherwise register an asynchronous callback and return */
-void grpc_fd_become_readable(grpc_fd *fd, grpc_call_list *call_list);
-void grpc_fd_become_writable(grpc_fd *fd, grpc_call_list *call_list);
+void grpc_fd_become_readable(grpc_fd *fd, grpc_closure_list *closure_list);
+void grpc_fd_become_writable(grpc_fd *fd, grpc_closure_list *closure_list);
/* Reference counting for fds */
#ifdef GRPC_FD_REF_COUNT_DEBUG
diff --git a/src/core/iomgr/iomgr.c b/src/core/iomgr/iomgr.c
index b2c17b1ef2..9456bad716 100644
--- a/src/core/iomgr/iomgr.c
+++ b/src/core/iomgr/iomgr.c
@@ -88,7 +88,7 @@ void grpc_iomgr_shutdown(void) {
gpr_timespec shutdown_deadline = gpr_time_add(
gpr_now(GPR_CLOCK_REALTIME), gpr_time_from_seconds(10, GPR_TIMESPAN));
gpr_timespec last_warning_time = gpr_now(GPR_CLOCK_REALTIME);
- grpc_call_list call_list = GRPC_CALL_LIST_INIT;
+ grpc_closure_list closure_list = GRPC_CLOSURE_LIST_INIT;
gpr_mu_lock(&g_mu);
g_shutdown = 1;
@@ -103,9 +103,9 @@ void grpc_iomgr_shutdown(void) {
last_warning_time = gpr_now(GPR_CLOCK_REALTIME);
}
if (grpc_alarm_check(gpr_inf_future(GPR_CLOCK_MONOTONIC), NULL,
- &call_list)) {
+ &closure_list)) {
gpr_mu_unlock(&g_mu);
- grpc_call_list_run(&call_list);
+ grpc_closure_list_run(&closure_list);
gpr_mu_lock(&g_mu);
continue;
}
@@ -131,8 +131,8 @@ void grpc_iomgr_shutdown(void) {
}
gpr_mu_unlock(&g_mu);
- grpc_alarm_list_shutdown(&call_list);
- grpc_call_list_run(&call_list);
+ grpc_alarm_list_shutdown(&closure_list);
+ grpc_closure_list_run(&closure_list);
/* ensure all threads have left g_mu */
gpr_mu_lock(&g_mu);
@@ -168,36 +168,36 @@ void grpc_closure_init(grpc_closure *closure, grpc_iomgr_cb_func cb,
closure->next = NULL;
}
-void grpc_call_list_add(grpc_call_list *call_list, grpc_closure *closure,
- int success) {
+void grpc_closure_list_add(grpc_closure_list *closure_list,
+ grpc_closure *closure, int success) {
if (closure == NULL) return;
closure->next = NULL;
closure->success = success;
- if (call_list->head == NULL) {
- call_list->head = closure;
+ if (closure_list->head == NULL) {
+ closure_list->head = closure;
} else {
- call_list->tail->next = closure;
+ closure_list->tail->next = closure;
}
- call_list->tail = closure;
+ closure_list->tail = closure;
}
-void grpc_call_list_run(grpc_call_list *call_list) {
- while (!grpc_call_list_empty(*call_list)) {
- grpc_closure *c = call_list->head;
- call_list->head = call_list->tail = NULL;
+void grpc_closure_list_run(grpc_closure_list *closure_list) {
+ while (!grpc_closure_list_empty(*closure_list)) {
+ grpc_closure *c = closure_list->head;
+ closure_list->head = closure_list->tail = NULL;
while (c != NULL) {
grpc_closure *next = c->next;
- c->cb(c->cb_arg, c->success, call_list);
+ c->cb(c->cb_arg, c->success, closure_list);
c = next;
}
}
}
-int grpc_call_list_empty(grpc_call_list call_list) {
- return call_list.head == NULL;
+int grpc_closure_list_empty(grpc_closure_list closure_list) {
+ return closure_list.head == NULL;
}
-void grpc_call_list_move(grpc_call_list *src, grpc_call_list *dst) {
+void grpc_closure_list_move(grpc_closure_list *src, grpc_closure_list *dst) {
if (src->head == NULL) {
return;
}
diff --git a/src/core/iomgr/iomgr.h b/src/core/iomgr/iomgr.h
index 94f3912990..bc015706a3 100644
--- a/src/core/iomgr/iomgr.h
+++ b/src/core/iomgr/iomgr.h
@@ -37,10 +37,10 @@
struct grpc_closure;
typedef struct grpc_closure grpc_closure;
-typedef struct grpc_call_list {
+typedef struct grpc_closure_list {
grpc_closure *head;
grpc_closure *tail;
-} grpc_call_list;
+} grpc_closure_list;
/** gRPC Callback definition.
*
@@ -48,7 +48,7 @@ typedef struct grpc_call_list {
* \param success An indication on the state of the iomgr. On false, cleanup
* actions should be taken (eg, shutdown). */
typedef void (*grpc_iomgr_cb_func)(void *arg, int success,
- grpc_call_list *call_list);
+ grpc_closure_list *closure_list);
/** A closure over a grpc_iomgr_cb_func. */
struct grpc_closure {
@@ -71,14 +71,14 @@ struct grpc_closure {
void grpc_closure_init(grpc_closure *closure, grpc_iomgr_cb_func cb,
void *cb_arg);
-#define GRPC_CALL_LIST_INIT \
+#define GRPC_CLOSURE_LIST_INIT \
{ NULL, NULL }
-void grpc_call_list_add(grpc_call_list *list, grpc_closure *closure,
- int success);
-void grpc_call_list_run(grpc_call_list *list);
-void grpc_call_list_move(grpc_call_list *src, grpc_call_list *dst);
-int grpc_call_list_empty(grpc_call_list list);
+void grpc_closure_list_add(grpc_closure_list *list, grpc_closure *closure,
+ int success);
+void grpc_closure_list_run(grpc_closure_list *list);
+void grpc_closure_list_move(grpc_closure_list *src, grpc_closure_list *dst);
+int grpc_closure_list_empty(grpc_closure_list list);
/** Initializes the iomgr. */
void grpc_iomgr_init(void);
diff --git a/src/core/iomgr/pollset.h b/src/core/iomgr/pollset.h
index 95ba694ff6..b5d71bfb4c 100644
--- a/src/core/iomgr/pollset.h
+++ b/src/core/iomgr/pollset.h
@@ -56,7 +56,7 @@
void grpc_pollset_init(grpc_pollset *pollset);
void grpc_pollset_shutdown(grpc_pollset *pollset, grpc_closure *closure,
- grpc_call_list *call_list);
+ grpc_closure_list *closure_list);
void grpc_pollset_destroy(grpc_pollset *pollset);
/* Do some work on a pollset.
@@ -74,11 +74,12 @@ void grpc_pollset_destroy(grpc_pollset *pollset);
not be released by grpc_pollset_work AFTER worker has been destroyed.
Tries not to block past deadline.
- May call grpc_call_list_run on grpc_call_list, without holding the pollset
+ May call grpc_closure_list_run on grpc_closure_list, without holding the
+ pollset
lock */
void grpc_pollset_work(grpc_pollset *pollset, grpc_pollset_worker *worker,
gpr_timespec now, gpr_timespec deadline,
- grpc_call_list *call_list);
+ grpc_closure_list *closure_list);
/* Break one polling thread out of polling work for this pollset.
If specific_worker is GRPC_POLLSET_KICK_BROADCAST, kick ALL the workers.
diff --git a/src/core/iomgr/pollset_multipoller_with_epoll.c b/src/core/iomgr/pollset_multipoller_with_epoll.c
index e6e0f5cdd4..a83086572e 100644
--- a/src/core/iomgr/pollset_multipoller_with_epoll.c
+++ b/src/core/iomgr/pollset_multipoller_with_epoll.c
@@ -62,7 +62,7 @@ typedef struct {
} pollset_hdr;
static void finally_add_fd(grpc_pollset *pollset, grpc_fd *fd,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
pollset_hdr *h = pollset->data.ptr;
struct epoll_event ev;
int err;
@@ -84,15 +84,15 @@ static void finally_add_fd(grpc_pollset *pollset, grpc_fd *fd,
}
}
}
- grpc_fd_end_poll(&watcher, 0, 0, call_list);
+ grpc_fd_end_poll(&watcher, 0, 0, closure_list);
}
static void perform_delayed_add(void *arg, int iomgr_status,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
delayed_add *da = arg;
if (!grpc_fd_is_orphaned(da->fd)) {
- finally_add_fd(da->pollset, da->fd, call_list);
+ finally_add_fd(da->pollset, da->fd, closure_list);
}
gpr_mu_lock(&da->pollset->mu);
@@ -101,7 +101,7 @@ static void perform_delayed_add(void *arg, int iomgr_status,
/* We don't care about this pollset anymore. */
if (da->pollset->in_flight_cbs == 0 && !da->pollset->called_shutdown) {
da->pollset->called_shutdown = 1;
- grpc_call_list_add(call_list, da->pollset->shutdown_done, 1);
+ grpc_closure_list_add(closure_list, da->pollset->shutdown_done, 1);
}
}
gpr_mu_unlock(&da->pollset->mu);
@@ -111,13 +111,12 @@ static void perform_delayed_add(void *arg, int iomgr_status,
gpr_free(da);
}
-static void multipoll_with_epoll_pollset_add_fd(grpc_pollset *pollset,
- grpc_fd *fd,
- int and_unlock_pollset,
- grpc_call_list *call_list) {
+static void multipoll_with_epoll_pollset_add_fd(
+ grpc_pollset *pollset, grpc_fd *fd, int and_unlock_pollset,
+ grpc_closure_list *closure_list) {
if (and_unlock_pollset) {
gpr_mu_unlock(&pollset->mu);
- finally_add_fd(pollset, fd, call_list);
+ finally_add_fd(pollset, fd, closure_list);
} else {
delayed_add *da = gpr_malloc(sizeof(*da));
da->pollset = pollset;
@@ -125,14 +124,13 @@ static void multipoll_with_epoll_pollset_add_fd(grpc_pollset *pollset,
GRPC_FD_REF(fd, "delayed_add");
grpc_closure_init(&da->closure, perform_delayed_add, da);
pollset->in_flight_cbs++;
- grpc_call_list_add(call_list, &da->closure, 1);
+ grpc_closure_list_add(closure_list, &da->closure, 1);
}
}
-static void multipoll_with_epoll_pollset_del_fd(grpc_pollset *pollset,
- grpc_fd *fd,
- int and_unlock_pollset,
- grpc_call_list *call_list) {
+static void multipoll_with_epoll_pollset_del_fd(
+ grpc_pollset *pollset, grpc_fd *fd, int and_unlock_pollset,
+ grpc_closure_list *closure_list) {
pollset_hdr *h = pollset->data.ptr;
int err;
@@ -154,7 +152,7 @@ static void multipoll_with_epoll_pollset_del_fd(grpc_pollset *pollset,
static void multipoll_with_epoll_pollset_maybe_work_and_unlock(
grpc_pollset *pollset, grpc_pollset_worker *worker, gpr_timespec deadline,
- gpr_timespec now, grpc_call_list *call_list) {
+ gpr_timespec now, grpc_closure_list *closure_list) {
struct epoll_event ep_ev[GRPC_EPOLL_MAX_EVENTS];
int ep_rv;
int poll_rv;
@@ -208,10 +206,10 @@ static void multipoll_with_epoll_pollset_maybe_work_and_unlock(
int read = ep_ev[i].events & (EPOLLIN | EPOLLPRI);
int write = ep_ev[i].events & EPOLLOUT;
if (read || cancel) {
- grpc_fd_become_readable(fd, call_list);
+ grpc_fd_become_readable(fd, closure_list);
}
if (write || cancel) {
- grpc_fd_become_writable(fd, call_list);
+ grpc_fd_become_writable(fd, closure_list);
}
}
}
@@ -236,7 +234,8 @@ static const grpc_pollset_vtable multipoll_with_epoll_pollset = {
multipoll_with_epoll_pollset_destroy};
static void epoll_become_multipoller(grpc_pollset *pollset, grpc_fd **fds,
- size_t nfds, grpc_call_list *call_list) {
+ size_t nfds,
+ grpc_closure_list *closure_list) {
size_t i;
pollset_hdr *h = gpr_malloc(sizeof(pollset_hdr));
@@ -249,7 +248,7 @@ static void epoll_become_multipoller(grpc_pollset *pollset, grpc_fd **fds,
abort();
}
for (i = 0; i < nfds; i++) {
- multipoll_with_epoll_pollset_add_fd(pollset, fds[i], 0, call_list);
+ multipoll_with_epoll_pollset_add_fd(pollset, fds[i], 0, closure_list);
}
}
diff --git a/src/core/iomgr/pollset_multipoller_with_poll_posix.c b/src/core/iomgr/pollset_multipoller_with_poll_posix.c
index 03a28894f0..a3aa7e69fa 100644
--- a/src/core/iomgr/pollset_multipoller_with_poll_posix.c
+++ b/src/core/iomgr/pollset_multipoller_with_poll_posix.c
@@ -59,10 +59,9 @@ typedef struct {
grpc_fd **dels;
} pollset_hdr;
-static void multipoll_with_poll_pollset_add_fd(grpc_pollset *pollset,
- grpc_fd *fd,
- int and_unlock_pollset,
- grpc_call_list *call_list) {
+static void multipoll_with_poll_pollset_add_fd(
+ grpc_pollset *pollset, grpc_fd *fd, int and_unlock_pollset,
+ grpc_closure_list *closure_list) {
size_t i;
pollset_hdr *h = pollset->data.ptr;
/* TODO(ctiller): this is O(num_fds^2); maybe switch to a hash set here */
@@ -81,10 +80,9 @@ exit:
}
}
-static void multipoll_with_poll_pollset_del_fd(grpc_pollset *pollset,
- grpc_fd *fd,
- int and_unlock_pollset,
- grpc_call_list *call_list) {
+static void multipoll_with_poll_pollset_del_fd(
+ grpc_pollset *pollset, grpc_fd *fd, int and_unlock_pollset,
+ grpc_closure_list *closure_list) {
/* will get removed next poll cycle */
pollset_hdr *h = pollset->data.ptr;
if (h->del_count == h->del_capacity) {
@@ -100,7 +98,7 @@ static void multipoll_with_poll_pollset_del_fd(grpc_pollset *pollset,
static void multipoll_with_poll_pollset_maybe_work_and_unlock(
grpc_pollset *pollset, grpc_pollset_worker *worker, gpr_timespec deadline,
- gpr_timespec now, grpc_call_list *call_list) {
+ gpr_timespec now, grpc_closure_list *closure_list) {
int timeout;
int r;
size_t i, j, fd_count;
@@ -151,7 +149,7 @@ static void multipoll_with_poll_pollset_maybe_work_and_unlock(
for (i = 1; i < pfd_count; i++) {
grpc_fd_end_poll(&watchers[i], pfds[i].revents & POLLIN,
- pfds[i].revents & POLLOUT, call_list);
+ pfds[i].revents & POLLOUT, closure_list);
}
if (r < 0) {
@@ -169,10 +167,10 @@ static void multipoll_with_poll_pollset_maybe_work_and_unlock(
continue;
}
if (pfds[i].revents & (POLLIN | POLLHUP | POLLERR)) {
- grpc_fd_become_readable(watchers[i].fd, call_list);
+ grpc_fd_become_readable(watchers[i].fd, closure_list);
}
if (pfds[i].revents & (POLLOUT | POLLHUP | POLLERR)) {
- grpc_fd_become_writable(watchers[i].fd, call_list);
+ grpc_fd_become_writable(watchers[i].fd, closure_list);
}
}
}
@@ -209,7 +207,8 @@ static const grpc_pollset_vtable multipoll_with_poll_pollset = {
multipoll_with_poll_pollset_destroy};
void grpc_poll_become_multipoller(grpc_pollset *pollset, grpc_fd **fds,
- size_t nfds, grpc_call_list *call_list) {
+ size_t nfds,
+ grpc_closure_list *closure_list) {
size_t i;
pollset_hdr *h = gpr_malloc(sizeof(pollset_hdr));
pollset->vtable = &multipoll_with_poll_pollset;
diff --git a/src/core/iomgr/pollset_posix.c b/src/core/iomgr/pollset_posix.c
index daca2f6daa..82ef0298a2 100644
--- a/src/core/iomgr/pollset_posix.c
+++ b/src/core/iomgr/pollset_posix.c
@@ -141,9 +141,9 @@ void grpc_pollset_init(grpc_pollset *pollset) {
}
void grpc_pollset_add_fd(grpc_pollset *pollset, grpc_fd *fd,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
gpr_mu_lock(&pollset->mu);
- pollset->vtable->add_fd(pollset, fd, 1, call_list);
+ pollset->vtable->add_fd(pollset, fd, 1, closure_list);
/* the following (enabled only in debug) will reacquire and then release
our lock - meaning that if the unlocking flag passed to del_fd above is
not respected, the code will deadlock (in a way that we have a chance of
@@ -155,9 +155,9 @@ void grpc_pollset_add_fd(grpc_pollset *pollset, grpc_fd *fd,
}
void grpc_pollset_del_fd(grpc_pollset *pollset, grpc_fd *fd,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
gpr_mu_lock(&pollset->mu);
- pollset->vtable->del_fd(pollset, fd, 1, call_list);
+ pollset->vtable->del_fd(pollset, fd, 1, closure_list);
/* the following (enabled only in debug) will reacquire and then release
our lock - meaning that if the unlocking flag passed to del_fd above is
not respected, the code will deadlock (in a way that we have a chance of
@@ -168,14 +168,15 @@ void grpc_pollset_del_fd(grpc_pollset *pollset, grpc_fd *fd,
#endif
}
-static void finish_shutdown(grpc_pollset *pollset, grpc_call_list *call_list) {
+static void finish_shutdown(grpc_pollset *pollset,
+ grpc_closure_list *closure_list) {
pollset->vtable->finish_shutdown(pollset);
- grpc_call_list_add(call_list, pollset->shutdown_done, 1);
+ grpc_closure_list_add(closure_list, pollset->shutdown_done, 1);
}
void grpc_pollset_work(grpc_pollset *pollset, grpc_pollset_worker *worker,
gpr_timespec now, gpr_timespec deadline,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
/* pollset->mu already held */
int added_worker = 0;
int locked = 1;
@@ -184,11 +185,11 @@ void grpc_pollset_work(grpc_pollset *pollset, grpc_pollset_worker *worker,
/* TODO(ctiller): pool these */
grpc_wakeup_fd_init(&worker->wakeup_fd);
if (!grpc_pollset_has_workers(pollset) &&
- !grpc_call_list_empty(pollset->idle_jobs)) {
- grpc_call_list_move(&pollset->idle_jobs, call_list);
+ !grpc_closure_list_empty(pollset->idle_jobs)) {
+ grpc_closure_list_move(&pollset->idle_jobs, closure_list);
goto done;
}
- if (grpc_alarm_check(now, &deadline, call_list)) {
+ if (grpc_alarm_check(now, &deadline, closure_list)) {
goto done;
}
if (pollset->shutting_down) {
@@ -205,7 +206,7 @@ void grpc_pollset_work(grpc_pollset *pollset, grpc_pollset_worker *worker,
added_worker = 1;
gpr_tls_set(&g_current_thread_poller, (gpr_intptr)pollset);
pollset->vtable->maybe_work_and_unlock(pollset, worker, deadline, now,
- call_list);
+ closure_list);
locked = 0;
gpr_tls_set(&g_current_thread_poller, 0);
} else {
@@ -213,7 +214,7 @@ void grpc_pollset_work(grpc_pollset *pollset, grpc_pollset_worker *worker,
}
done:
if (!locked) {
- grpc_call_list_run(call_list);
+ grpc_closure_list_run(closure_list);
gpr_mu_lock(&pollset->mu);
locked = 1;
}
@@ -227,8 +228,8 @@ done:
} else if (!pollset->called_shutdown && pollset->in_flight_cbs == 0) {
pollset->called_shutdown = 1;
gpr_mu_unlock(&pollset->mu);
- finish_shutdown(pollset, call_list);
- grpc_call_list_run(call_list);
+ finish_shutdown(pollset, closure_list);
+ grpc_closure_list_run(closure_list);
/* Continuing to access pollset here is safe -- it is the caller's
* responsibility to not destroy when it has outstanding calls to
* grpc_pollset_work.
@@ -239,7 +240,7 @@ done:
}
void grpc_pollset_shutdown(grpc_pollset *pollset, grpc_closure *closure,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
int call_shutdown = 0;
gpr_mu_lock(&pollset->mu);
GPR_ASSERT(!pollset->shutting_down);
@@ -254,7 +255,7 @@ void grpc_pollset_shutdown(grpc_pollset *pollset, grpc_closure *closure,
gpr_mu_unlock(&pollset->mu);
if (call_shutdown) {
- finish_shutdown(pollset, call_list);
+ finish_shutdown(pollset, closure_list);
}
}
@@ -296,7 +297,7 @@ typedef struct grpc_unary_promote_args {
} grpc_unary_promote_args;
static void basic_do_promote(void *args, int success,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
grpc_unary_promote_args *up_args = args;
const grpc_pollset_vtable *original_vtable = up_args->original_vtable;
grpc_pollset *pollset = up_args->pollset;
@@ -327,12 +328,12 @@ static void basic_do_promote(void *args, int success,
if (pollset->in_flight_cbs == 0 && !pollset->called_shutdown) {
GPR_ASSERT(!grpc_pollset_has_workers(pollset));
pollset->called_shutdown = 1;
- grpc_call_list_add(call_list, pollset->shutdown_done, 1);
+ grpc_closure_list_add(closure_list, pollset->shutdown_done, 1);
}
} else if (grpc_fd_is_orphaned(fd)) {
/* Don't try to add it to anything, we'll drop our ref on it below */
} else if (pollset->vtable != original_vtable) {
- pollset->vtable->add_fd(pollset, fd, 0, call_list);
+ pollset->vtable->add_fd(pollset, fd, 0, closure_list);
} else if (fd != pollset->data.ptr) {
grpc_fd *fds[2];
fds[0] = pollset->data.ptr;
@@ -340,7 +341,7 @@ static void basic_do_promote(void *args, int success,
if (fds[0] && !grpc_fd_is_orphaned(fds[0])) {
grpc_platform_become_multipoller(pollset, fds, GPR_ARRAY_SIZE(fds),
- call_list);
+ closure_list);
GRPC_FD_UNREF(fds[0], "basicpoll");
} else {
/* old fd is orphaned and we haven't cleaned it up until now, so remain a
@@ -358,12 +359,12 @@ static void basic_do_promote(void *args, int success,
/* Matching ref in basic_pollset_add_fd */
GRPC_FD_UNREF(fd, "basicpoll_add");
- grpc_call_list_run(call_list);
+ grpc_closure_list_run(closure_list);
}
static void basic_pollset_add_fd(grpc_pollset *pollset, grpc_fd *fd,
int and_unlock_pollset,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
grpc_unary_promote_args *up_args;
GPR_ASSERT(fd);
if (fd == pollset->data.ptr) goto exit;
@@ -381,7 +382,7 @@ static void basic_pollset_add_fd(grpc_pollset *pollset, grpc_fd *fd,
GRPC_FD_REF(fd, "basicpoll");
} else if (!grpc_fd_is_orphaned(fds[0])) {
grpc_platform_become_multipoller(pollset, fds, GPR_ARRAY_SIZE(fds),
- call_list);
+ closure_list);
GRPC_FD_UNREF(fds[0], "basicpoll");
} else {
/* old fd is orphaned and we haven't cleaned it up until now, so remain a
@@ -404,7 +405,7 @@ static void basic_pollset_add_fd(grpc_pollset *pollset, grpc_fd *fd,
up_args->promotion_closure.cb = basic_do_promote;
up_args->promotion_closure.cb_arg = up_args;
- grpc_call_list_add(&pollset->idle_jobs, &up_args->promotion_closure, 1);
+ grpc_closure_list_add(&pollset->idle_jobs, &up_args->promotion_closure, 1);
grpc_pollset_kick(pollset, GRPC_POLLSET_KICK_BROADCAST);
exit:
@@ -415,7 +416,7 @@ exit:
static void basic_pollset_del_fd(grpc_pollset *pollset, grpc_fd *fd,
int and_unlock_pollset,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
GPR_ASSERT(fd);
if (fd == pollset->data.ptr) {
GRPC_FD_UNREF(pollset->data.ptr, "basicpoll");
@@ -427,11 +428,9 @@ static void basic_pollset_del_fd(grpc_pollset *pollset, grpc_fd *fd,
}
}
-static void basic_pollset_maybe_work_and_unlock(grpc_pollset *pollset,
- grpc_pollset_worker *worker,
- gpr_timespec deadline,
- gpr_timespec now,
- grpc_call_list *call_list) {
+static void basic_pollset_maybe_work_and_unlock(
+ grpc_pollset *pollset, grpc_pollset_worker *worker, gpr_timespec deadline,
+ gpr_timespec now, grpc_closure_list *closure_list) {
struct pollfd pfd[2];
grpc_fd *fd;
grpc_fd_watcher fd_watcher;
@@ -469,7 +468,7 @@ static void basic_pollset_maybe_work_and_unlock(grpc_pollset *pollset,
if (fd) {
grpc_fd_end_poll(&fd_watcher, pfd[1].revents & POLLIN,
- pfd[1].revents & POLLOUT, call_list);
+ pfd[1].revents & POLLOUT, closure_list);
}
if (r < 0) {
@@ -484,10 +483,10 @@ static void basic_pollset_maybe_work_and_unlock(grpc_pollset *pollset,
}
if (nfds > 1) {
if (pfd[1].revents & (POLLIN | POLLHUP | POLLERR)) {
- grpc_fd_become_readable(fd, call_list);
+ grpc_fd_become_readable(fd, closure_list);
}
if (pfd[1].revents & (POLLOUT | POLLHUP | POLLERR)) {
- grpc_fd_become_writable(fd, call_list);
+ grpc_fd_become_writable(fd, closure_list);
}
}
}
diff --git a/src/core/iomgr/pollset_posix.h b/src/core/iomgr/pollset_posix.h
index c65f25fd18..2f50cd2209 100644
--- a/src/core/iomgr/pollset_posix.h
+++ b/src/core/iomgr/pollset_posix.h
@@ -66,7 +66,7 @@ typedef struct grpc_pollset {
int called_shutdown;
int kicked_without_pollers;
grpc_closure *shutdown_done;
- grpc_call_list idle_jobs;
+ grpc_closure_list idle_jobs;
union {
int fd;
void *ptr;
@@ -75,13 +75,13 @@ typedef struct grpc_pollset {
struct grpc_pollset_vtable {
void (*add_fd)(grpc_pollset *pollset, struct grpc_fd *fd,
- int and_unlock_pollset, grpc_call_list *call_list);
+ int and_unlock_pollset, grpc_closure_list *closure_list);
void (*del_fd)(grpc_pollset *pollset, struct grpc_fd *fd,
- int and_unlock_pollset, grpc_call_list *call_list);
+ int and_unlock_pollset, grpc_closure_list *closure_list);
void (*maybe_work_and_unlock)(grpc_pollset *pollset,
grpc_pollset_worker *worker,
gpr_timespec deadline, gpr_timespec now,
- grpc_call_list *call_list);
+ grpc_closure_list *closure_list);
void (*finish_shutdown)(grpc_pollset *pollset);
void (*destroy)(grpc_pollset *pollset);
};
@@ -90,11 +90,11 @@ struct grpc_pollset_vtable {
/* Add an fd to a pollset */
void grpc_pollset_add_fd(grpc_pollset *pollset, struct grpc_fd *fd,
- grpc_call_list *call_list);
+ grpc_closure_list *closure_list);
/* Force remove an fd from a pollset (normally they are removed on the next
poll after an fd is orphaned) */
void grpc_pollset_del_fd(grpc_pollset *pollset, struct grpc_fd *fd,
- grpc_call_list *call_list);
+ grpc_closure_list *closure_list);
/* Returns the fd to listen on for kicks */
int grpc_kick_read_fd(grpc_pollset *p);
@@ -114,11 +114,12 @@ int grpc_poll_deadline_to_millis_timeout(gpr_timespec deadline,
/* turn a pollset into a multipoller: platform specific */
typedef void (*grpc_platform_become_multipoller_type)(
grpc_pollset *pollset, struct grpc_fd **fds, size_t fd_count,
- grpc_call_list *call_list);
+ grpc_closure_list *closure_list);
extern grpc_platform_become_multipoller_type grpc_platform_become_multipoller;
void grpc_poll_become_multipoller(grpc_pollset *pollset, struct grpc_fd **fds,
- size_t fd_count, grpc_call_list *call_list);
+ size_t fd_count,
+ grpc_closure_list *closure_list);
/* Return 1 if the pollset has active threads in grpc_pollset_work (pollset must
* be locked) */
diff --git a/src/core/iomgr/pollset_set.h b/src/core/iomgr/pollset_set.h
index ca667bf34e..5b5b20ef66 100644
--- a/src/core/iomgr/pollset_set.h
+++ b/src/core/iomgr/pollset_set.h
@@ -53,9 +53,9 @@ void grpc_pollset_set_init(grpc_pollset_set *pollset_set);
void grpc_pollset_set_destroy(grpc_pollset_set *pollset_set);
void grpc_pollset_set_add_pollset(grpc_pollset_set *pollset_set,
grpc_pollset *pollset,
- grpc_call_list *call_list);
+ grpc_closure_list *closure_list);
void grpc_pollset_set_del_pollset(grpc_pollset_set *pollset_set,
grpc_pollset *pollset,
- grpc_call_list *call_list);
+ grpc_closure_list *closure_list);
#endif /* GRPC_INTERNAL_CORE_IOMGR_POLLSET_H */
diff --git a/src/core/iomgr/pollset_set_posix.c b/src/core/iomgr/pollset_set_posix.c
index a2c1f47629..810543cc2e 100644
--- a/src/core/iomgr/pollset_set_posix.c
+++ b/src/core/iomgr/pollset_set_posix.c
@@ -60,7 +60,7 @@ void grpc_pollset_set_destroy(grpc_pollset_set *pollset_set) {
void grpc_pollset_set_add_pollset(grpc_pollset_set *pollset_set,
grpc_pollset *pollset,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
size_t i, j;
gpr_mu_lock(&pollset_set->mu);
if (pollset_set->pollset_count == pollset_set->pollset_capacity) {
@@ -75,7 +75,7 @@ void grpc_pollset_set_add_pollset(grpc_pollset_set *pollset_set,
if (grpc_fd_is_orphaned(pollset_set->fds[i])) {
GRPC_FD_UNREF(pollset_set->fds[i], "pollset");
} else {
- grpc_pollset_add_fd(pollset, pollset_set->fds[i], call_list);
+ grpc_pollset_add_fd(pollset, pollset_set->fds[i], closure_list);
pollset_set->fds[j++] = pollset_set->fds[i];
}
}
@@ -85,7 +85,7 @@ void grpc_pollset_set_add_pollset(grpc_pollset_set *pollset_set,
void grpc_pollset_set_del_pollset(grpc_pollset_set *pollset_set,
grpc_pollset *pollset,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
size_t i;
gpr_mu_lock(&pollset_set->mu);
for (i = 0; i < pollset_set->pollset_count; i++) {
@@ -100,7 +100,7 @@ void grpc_pollset_set_del_pollset(grpc_pollset_set *pollset_set,
}
void grpc_pollset_set_add_fd(grpc_pollset_set *pollset_set, grpc_fd *fd,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
size_t i;
gpr_mu_lock(&pollset_set->mu);
if (pollset_set->fd_count == pollset_set->fd_capacity) {
@@ -111,13 +111,13 @@ void grpc_pollset_set_add_fd(grpc_pollset_set *pollset_set, grpc_fd *fd,
GRPC_FD_REF(fd, "pollset_set");
pollset_set->fds[pollset_set->fd_count++] = fd;
for (i = 0; i < pollset_set->pollset_count; i++) {
- grpc_pollset_add_fd(pollset_set->pollsets[i], fd, call_list);
+ grpc_pollset_add_fd(pollset_set->pollsets[i], fd, closure_list);
}
gpr_mu_unlock(&pollset_set->mu);
}
void grpc_pollset_set_del_fd(grpc_pollset_set *pollset_set, grpc_fd *fd,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
size_t i;
gpr_mu_lock(&pollset_set->mu);
for (i = 0; i < pollset_set->fd_count; i++) {
diff --git a/src/core/iomgr/pollset_set_posix.h b/src/core/iomgr/pollset_set_posix.h
index e9969d2c0f..40d7a9b259 100644
--- a/src/core/iomgr/pollset_set_posix.h
+++ b/src/core/iomgr/pollset_set_posix.h
@@ -50,8 +50,8 @@ typedef struct grpc_pollset_set {
} grpc_pollset_set;
void grpc_pollset_set_add_fd(grpc_pollset_set *pollset_set, grpc_fd *fd,
- grpc_call_list *call_list);
+ grpc_closure_list *closure_list);
void grpc_pollset_set_del_fd(grpc_pollset_set *pollset_set, grpc_fd *fd,
- grpc_call_list *call_list);
+ grpc_closure_list *closure_list);
#endif /* GRPC_INTERNAL_CORE_IOMGR_POLLSET_WINDOWS_H */
diff --git a/src/core/iomgr/resolve_address.h b/src/core/iomgr/resolve_address.h
index 72b9c1cc87..174432225e 100644
--- a/src/core/iomgr/resolve_address.h
+++ b/src/core/iomgr/resolve_address.h
@@ -54,7 +54,7 @@ typedef struct {
grpc_resolved_addresses_destroy when it's done with them
On failure: addresses is NULL */
typedef void (*grpc_resolve_cb)(void *arg, grpc_resolved_addresses *addresses,
- grpc_call_list *call_list);
+ grpc_closure_list *closure_list);
/* Asynchronously resolve addr. Use default_port if a port isn't designated
in addr, otherwise use the port in addr. */
/* TODO(ctiller): add a timeout here */
diff --git a/src/core/iomgr/resolve_address_posix.c b/src/core/iomgr/resolve_address_posix.c
index ea64f8176f..f0a230bab2 100644
--- a/src/core/iomgr/resolve_address_posix.c
+++ b/src/core/iomgr/resolve_address_posix.c
@@ -146,17 +146,17 @@ done:
/* Thread function to asynch-ify grpc_blocking_resolve_address */
static void do_request_thread(void *rp) {
request *r = rp;
- grpc_call_list call_list = GRPC_CALL_LIST_INIT;
+ grpc_closure_list closure_list = GRPC_CLOSURE_LIST_INIT;
grpc_resolved_addresses *resolved =
grpc_blocking_resolve_address(r->name, r->default_port);
void *arg = r->arg;
grpc_resolve_cb cb = r->cb;
gpr_free(r->name);
gpr_free(r->default_port);
- cb(arg, resolved, &call_list);
+ cb(arg, resolved, &closure_list);
grpc_iomgr_unregister_object(&r->iomgr_object);
gpr_free(r);
- grpc_call_list_run(&call_list);
+ grpc_closure_list_run(&closure_list);
}
void grpc_resolved_addresses_destroy(grpc_resolved_addresses *addrs) {
diff --git a/src/core/iomgr/tcp_client.h b/src/core/iomgr/tcp_client.h
index 8fb5bfda1d..971e984e54 100644
--- a/src/core/iomgr/tcp_client.h
+++ b/src/core/iomgr/tcp_client.h
@@ -47,6 +47,7 @@
void grpc_tcp_client_connect(grpc_closure *on_connect, grpc_endpoint **endpoint,
grpc_pollset_set *interested_parties,
const struct sockaddr *addr, size_t addr_len,
- gpr_timespec deadline, grpc_call_list *call_list);
+ gpr_timespec deadline,
+ grpc_closure_list *closure_list);
#endif /* GRPC_INTERNAL_CORE_IOMGR_TCP_CLIENT_H */
diff --git a/src/core/iomgr/tcp_client_posix.c b/src/core/iomgr/tcp_client_posix.c
index fed832fce6..e23551c4c0 100644
--- a/src/core/iomgr/tcp_client_posix.c
+++ b/src/core/iomgr/tcp_client_posix.c
@@ -91,7 +91,8 @@ error:
return 0;
}
-static void tc_on_alarm(void *acp, int success, grpc_call_list *call_list) {
+static void tc_on_alarm(void *acp, int success,
+ grpc_closure_list *closure_list) {
int done;
async_connect *ac = acp;
if (grpc_tcp_trace) {
@@ -100,7 +101,7 @@ static void tc_on_alarm(void *acp, int success, grpc_call_list *call_list) {
}
gpr_mu_lock(&ac->mu);
if (ac->fd != NULL) {
- grpc_fd_shutdown(ac->fd, call_list);
+ grpc_fd_shutdown(ac->fd, closure_list);
}
done = (--ac->refs == 0);
gpr_mu_unlock(&ac->mu);
@@ -111,7 +112,8 @@ static void tc_on_alarm(void *acp, int success, grpc_call_list *call_list) {
}
}
-static void on_writable(void *acp, int success, grpc_call_list *call_list) {
+static void on_writable(void *acp, int success,
+ grpc_closure_list *closure_list) {
async_connect *ac = acp;
int so_error = 0;
socklen_t so_error_size;
@@ -132,7 +134,7 @@ static void on_writable(void *acp, int success, grpc_call_list *call_list) {
ac->fd = NULL;
gpr_mu_unlock(&ac->mu);
- grpc_alarm_cancel(&ac->alarm, call_list);
+ grpc_alarm_cancel(&ac->alarm, closure_list);
gpr_mu_lock(&ac->mu);
if (success) {
@@ -161,7 +163,7 @@ static void on_writable(void *acp, int success, grpc_call_list *call_list) {
don't do that! */
gpr_log(GPR_ERROR, "kernel out of buffers");
gpr_mu_unlock(&ac->mu);
- grpc_fd_notify_on_write(fd, &ac->write_closure, call_list);
+ grpc_fd_notify_on_write(fd, &ac->write_closure, closure_list);
return;
} else {
switch (so_error) {
@@ -175,7 +177,7 @@ static void on_writable(void *acp, int success, grpc_call_list *call_list) {
goto finish;
}
} else {
- grpc_pollset_set_del_fd(ac->interested_parties, fd, call_list);
+ grpc_pollset_set_del_fd(ac->interested_parties, fd, closure_list);
*ep = grpc_tcp_create(fd, GRPC_TCP_DEFAULT_READ_SLICE_SIZE, ac->addr_str);
fd = NULL;
goto finish;
@@ -189,8 +191,8 @@ static void on_writable(void *acp, int success, grpc_call_list *call_list) {
finish:
if (fd != NULL) {
- grpc_pollset_set_del_fd(ac->interested_parties, fd, call_list);
- grpc_fd_orphan(fd, NULL, "tcp_client_orphan", call_list);
+ grpc_pollset_set_del_fd(ac->interested_parties, fd, closure_list);
+ grpc_fd_orphan(fd, NULL, "tcp_client_orphan", closure_list);
fd = NULL;
}
done = (--ac->refs == 0);
@@ -200,13 +202,14 @@ finish:
gpr_free(ac->addr_str);
gpr_free(ac);
}
- grpc_call_list_add(call_list, closure, *ep != NULL);
+ grpc_closure_list_add(closure_list, closure, *ep != NULL);
}
void grpc_tcp_client_connect(grpc_closure *closure, grpc_endpoint **ep,
grpc_pollset_set *interested_parties,
const struct sockaddr *addr, size_t addr_len,
- gpr_timespec deadline, grpc_call_list *call_list) {
+ gpr_timespec deadline,
+ grpc_closure_list *closure_list) {
int fd;
grpc_dualstack_mode dsmode;
int err;
@@ -236,7 +239,7 @@ void grpc_tcp_client_connect(grpc_closure *closure, grpc_endpoint **ep,
addr_len = sizeof(addr4_copy);
}
if (!prepare_socket(addr, fd)) {
- grpc_call_list_add(call_list, closure, 0);
+ grpc_closure_list_add(closure_list, closure, 0);
return;
}
@@ -252,18 +255,18 @@ void grpc_tcp_client_connect(grpc_closure *closure, grpc_endpoint **ep,
if (err >= 0) {
*ep = grpc_tcp_create(fdobj, GRPC_TCP_DEFAULT_READ_SLICE_SIZE, addr_str);
- grpc_call_list_add(call_list, closure, 1);
+ grpc_closure_list_add(closure_list, closure, 1);
goto done;
}
if (errno != EWOULDBLOCK && errno != EINPROGRESS) {
gpr_log(GPR_ERROR, "connect error to '%s': %s", addr_str, strerror(errno));
- grpc_fd_orphan(fdobj, NULL, "tcp_client_connect_error", call_list);
- grpc_call_list_add(call_list, closure, 0);
+ grpc_fd_orphan(fdobj, NULL, "tcp_client_connect_error", closure_list);
+ grpc_closure_list_add(closure_list, closure, 0);
goto done;
}
- grpc_pollset_set_add_fd(interested_parties, fdobj, call_list);
+ grpc_pollset_set_add_fd(interested_parties, fdobj, closure_list);
ac = gpr_malloc(sizeof(async_connect));
ac->closure = closure;
@@ -285,8 +288,8 @@ void grpc_tcp_client_connect(grpc_closure *closure, grpc_endpoint **ep,
gpr_mu_lock(&ac->mu);
grpc_alarm_init(&ac->alarm,
gpr_convert_clock_type(deadline, GPR_CLOCK_MONOTONIC),
- tc_on_alarm, ac, gpr_now(GPR_CLOCK_MONOTONIC), call_list);
- grpc_fd_notify_on_write(ac->fd, &ac->write_closure, call_list);
+ tc_on_alarm, ac, gpr_now(GPR_CLOCK_MONOTONIC), closure_list);
+ grpc_fd_notify_on_write(ac->fd, &ac->write_closure, closure_list);
gpr_mu_unlock(&ac->mu);
done:
diff --git a/src/core/iomgr/tcp_posix.c b/src/core/iomgr/tcp_posix.c
index 89a85f26dc..942ab8b71d 100644
--- a/src/core/iomgr/tcp_posix.c
+++ b/src/core/iomgr/tcp_posix.c
@@ -95,17 +95,17 @@ typedef struct {
} grpc_tcp;
static void tcp_handle_read(void *arg /* grpc_tcp */, int success,
- grpc_call_list *call_list);
+ grpc_closure_list *closure_list);
static void tcp_handle_write(void *arg /* grpc_tcp */, int success,
- grpc_call_list *call_list);
+ grpc_closure_list *closure_list);
-static void tcp_shutdown(grpc_endpoint *ep, grpc_call_list *call_list) {
+static void tcp_shutdown(grpc_endpoint *ep, grpc_closure_list *closure_list) {
grpc_tcp *tcp = (grpc_tcp *)ep;
- grpc_fd_shutdown(tcp->em_fd, call_list);
+ grpc_fd_shutdown(tcp->em_fd, closure_list);
}
-static void tcp_free(grpc_tcp *tcp, grpc_call_list *call_list) {
- grpc_fd_orphan(tcp->em_fd, NULL, "tcp_unref_orphan", call_list);
+static void tcp_free(grpc_tcp *tcp, grpc_closure_list *closure_list) {
+ grpc_fd_orphan(tcp->em_fd, NULL, "tcp_unref_orphan", closure_list);
gpr_free(tcp->peer_string);
gpr_free(tcp);
}
@@ -115,12 +115,12 @@ static void tcp_free(grpc_tcp *tcp, grpc_call_list *call_list) {
#define TCP_UNREF(tcp, reason, cl) \
tcp_unref((tcp), (cl), (reason), __FILE__, __LINE__)
#define TCP_REF(tcp, reason) tcp_ref((tcp), (reason), __FILE__, __LINE__)
-static void tcp_unref(grpc_tcp *tcp, grpc_call_list *call_list,
+static void tcp_unref(grpc_tcp *tcp, grpc_closure_list *closure_list,
const char *reason, const char *file, int line) {
gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, "TCP unref %p : %s %d -> %d", tcp,
reason, tcp->refcount.count, tcp->refcount.count - 1);
if (gpr_unref(&tcp->refcount)) {
- tcp_free(tcp, call_list);
+ tcp_free(tcp, closure_list);
}
}
@@ -133,22 +133,22 @@ static void tcp_ref(grpc_tcp *tcp, const char *reason, const char *file,
#else
#define TCP_UNREF(tcp, reason, cl) tcp_unref((tcp), (cl))
#define TCP_REF(tcp, reason) tcp_ref((tcp))
-static void tcp_unref(grpc_tcp *tcp, grpc_call_list *call_list) {
+static void tcp_unref(grpc_tcp *tcp, grpc_closure_list *closure_list) {
if (gpr_unref(&tcp->refcount)) {
- tcp_free(tcp, call_list);
+ tcp_free(tcp, closure_list);
}
}
static void tcp_ref(grpc_tcp *tcp) { gpr_ref(&tcp->refcount); }
#endif
-static void tcp_destroy(grpc_endpoint *ep, grpc_call_list *call_list) {
+static void tcp_destroy(grpc_endpoint *ep, grpc_closure_list *closure_list) {
grpc_tcp *tcp = (grpc_tcp *)ep;
- TCP_UNREF(tcp, "destroy", call_list);
+ TCP_UNREF(tcp, "destroy", closure_list);
}
static void call_read_cb(grpc_tcp *tcp, int success,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
grpc_closure *cb = tcp->read_cb;
if (grpc_tcp_trace) {
@@ -164,11 +164,11 @@ static void call_read_cb(grpc_tcp *tcp, int success,
tcp->read_cb = NULL;
tcp->incoming_buffer = NULL;
- cb->cb(cb->cb_arg, success, call_list);
+ cb->cb(cb->cb_arg, success, closure_list);
}
#define MAX_READ_IOVEC 4
-static void tcp_continue_read(grpc_tcp *tcp, grpc_call_list *call_list) {
+static void tcp_continue_read(grpc_tcp *tcp, grpc_closure_list *closure_list) {
struct msghdr msg;
struct iovec iov[MAX_READ_IOVEC];
ssize_t read_bytes;
@@ -210,18 +210,18 @@ static void tcp_continue_read(grpc_tcp *tcp, grpc_call_list *call_list) {
tcp->iov_size /= 2;
}
/* We've consumed the edge, request a new one */
- grpc_fd_notify_on_read(tcp->em_fd, &tcp->read_closure, call_list);
+ grpc_fd_notify_on_read(tcp->em_fd, &tcp->read_closure, closure_list);
} else {
/* TODO(klempner): Log interesting errors */
gpr_slice_buffer_reset_and_unref(tcp->incoming_buffer);
- call_read_cb(tcp, 0, call_list);
- TCP_UNREF(tcp, "read", call_list);
+ call_read_cb(tcp, 0, closure_list);
+ TCP_UNREF(tcp, "read", closure_list);
}
} else if (read_bytes == 0) {
/* 0 read size ==> end of stream */
gpr_slice_buffer_reset_and_unref(tcp->incoming_buffer);
- call_read_cb(tcp, 0, call_list);
- TCP_UNREF(tcp, "read", call_list);
+ call_read_cb(tcp, 0, closure_list);
+ TCP_UNREF(tcp, "read", closure_list);
} else {
GPR_ASSERT((size_t)read_bytes <= tcp->incoming_buffer->length);
if ((size_t)read_bytes < tcp->incoming_buffer->length) {
@@ -232,29 +232,29 @@ static void tcp_continue_read(grpc_tcp *tcp, grpc_call_list *call_list) {
++tcp->iov_size;
}
GPR_ASSERT((size_t)read_bytes == tcp->incoming_buffer->length);
- call_read_cb(tcp, 1, call_list);
- TCP_UNREF(tcp, "read", call_list);
+ call_read_cb(tcp, 1, closure_list);
+ TCP_UNREF(tcp, "read", closure_list);
}
GRPC_TIMER_END(GRPC_PTAG_HANDLE_READ, 0);
}
static void tcp_handle_read(void *arg /* grpc_tcp */, int success,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
grpc_tcp *tcp = (grpc_tcp *)arg;
GPR_ASSERT(!tcp->finished_edge);
if (!success) {
gpr_slice_buffer_reset_and_unref(tcp->incoming_buffer);
- call_read_cb(tcp, 0, call_list);
- TCP_UNREF(tcp, "read", call_list);
+ call_read_cb(tcp, 0, closure_list);
+ TCP_UNREF(tcp, "read", closure_list);
} else {
- tcp_continue_read(tcp, call_list);
+ tcp_continue_read(tcp, closure_list);
}
}
static void tcp_read(grpc_endpoint *ep, gpr_slice_buffer *incoming_buffer,
- grpc_closure *cb, grpc_call_list *call_list) {
+ grpc_closure *cb, grpc_closure_list *closure_list) {
grpc_tcp *tcp = (grpc_tcp *)ep;
GPR_ASSERT(tcp->read_cb == NULL);
tcp->read_cb = cb;
@@ -263,9 +263,9 @@ static void tcp_read(grpc_endpoint *ep, gpr_slice_buffer *incoming_buffer,
TCP_REF(tcp, "read");
if (tcp->finished_edge) {
tcp->finished_edge = 0;
- grpc_fd_notify_on_read(tcp->em_fd, &tcp->read_closure, call_list);
+ grpc_fd_notify_on_read(tcp->em_fd, &tcp->read_closure, closure_list);
} else {
- grpc_call_list_add(call_list, &tcp->read_closure, 1);
+ grpc_closure_list_add(closure_list, &tcp->read_closure, 1);
}
}
@@ -352,7 +352,7 @@ static flush_result tcp_flush(grpc_tcp *tcp) {
}
static void tcp_handle_write(void *arg /* grpc_tcp */, int success,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
grpc_tcp *tcp = (grpc_tcp *)arg;
flush_result status;
grpc_closure *cb;
@@ -360,26 +360,26 @@ static void tcp_handle_write(void *arg /* grpc_tcp */, int success,
if (!success) {
cb = tcp->write_cb;
tcp->write_cb = NULL;
- cb->cb(cb->cb_arg, 0, call_list);
- TCP_UNREF(tcp, "write", call_list);
+ cb->cb(cb->cb_arg, 0, closure_list);
+ TCP_UNREF(tcp, "write", closure_list);
return;
}
GRPC_TIMER_BEGIN(GRPC_PTAG_TCP_CB_WRITE, 0);
status = tcp_flush(tcp);
if (status == FLUSH_PENDING) {
- grpc_fd_notify_on_write(tcp->em_fd, &tcp->write_closure, call_list);
+ grpc_fd_notify_on_write(tcp->em_fd, &tcp->write_closure, closure_list);
} else {
cb = tcp->write_cb;
tcp->write_cb = NULL;
- cb->cb(cb->cb_arg, status == FLUSH_DONE, call_list);
- TCP_UNREF(tcp, "write", call_list);
+ cb->cb(cb->cb_arg, status == FLUSH_DONE, closure_list);
+ TCP_UNREF(tcp, "write", closure_list);
}
GRPC_TIMER_END(GRPC_PTAG_TCP_CB_WRITE, 0);
}
static void tcp_write(grpc_endpoint *ep, gpr_slice_buffer *buf,
- grpc_closure *cb, grpc_call_list *call_list) {
+ grpc_closure *cb, grpc_closure_list *closure_list) {
grpc_tcp *tcp = (grpc_tcp *)ep;
flush_result status;
@@ -399,7 +399,7 @@ static void tcp_write(grpc_endpoint *ep, gpr_slice_buffer *buf,
if (buf->length == 0) {
GRPC_TIMER_END(GRPC_PTAG_TCP_WRITE, 0);
- grpc_call_list_add(call_list, cb, 1);
+ grpc_closure_list_add(closure_list, cb, 1);
return;
}
tcp->outgoing_buffer = buf;
@@ -410,25 +410,25 @@ static void tcp_write(grpc_endpoint *ep, gpr_slice_buffer *buf,
if (status == FLUSH_PENDING) {
TCP_REF(tcp, "write");
tcp->write_cb = cb;
- grpc_fd_notify_on_write(tcp->em_fd, &tcp->write_closure, call_list);
+ grpc_fd_notify_on_write(tcp->em_fd, &tcp->write_closure, closure_list);
} else {
- grpc_call_list_add(call_list, cb, status == FLUSH_DONE);
+ grpc_closure_list_add(closure_list, cb, status == FLUSH_DONE);
}
GRPC_TIMER_END(GRPC_PTAG_TCP_WRITE, 0);
}
static void tcp_add_to_pollset(grpc_endpoint *ep, grpc_pollset *pollset,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
grpc_tcp *tcp = (grpc_tcp *)ep;
- grpc_pollset_add_fd(pollset, tcp->em_fd, call_list);
+ grpc_pollset_add_fd(pollset, tcp->em_fd, closure_list);
}
static void tcp_add_to_pollset_set(grpc_endpoint *ep,
grpc_pollset_set *pollset_set,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
grpc_tcp *tcp = (grpc_tcp *)ep;
- grpc_pollset_set_add_fd(pollset_set, tcp->em_fd, call_list);
+ grpc_pollset_set_add_fd(pollset_set, tcp->em_fd, closure_list);
}
static char *tcp_get_peer(grpc_endpoint *ep) {
diff --git a/src/core/iomgr/tcp_server.h b/src/core/iomgr/tcp_server.h
index b2aab234d3..034f10eff7 100644
--- a/src/core/iomgr/tcp_server.h
+++ b/src/core/iomgr/tcp_server.h
@@ -41,7 +41,7 @@ typedef struct grpc_tcp_server grpc_tcp_server;
/* Called for newly connected TCP connections. */
typedef void (*grpc_tcp_server_cb)(void *arg, grpc_endpoint *ep,
- grpc_call_list *call_list);
+ grpc_closure_list *closure_list);
/* Create a server, initially not bound to any ports */
grpc_tcp_server *grpc_tcp_server_create(void);
@@ -50,7 +50,7 @@ grpc_tcp_server *grpc_tcp_server_create(void);
void grpc_tcp_server_start(grpc_tcp_server *server, grpc_pollset **pollsets,
size_t pollset_count,
grpc_tcp_server_cb on_accept_cb, void *cb_arg,
- grpc_call_list *call_list);
+ grpc_closure_list *closure_list);
/* Add a port to the server, returning port number on success, or negative
on failure.
@@ -74,6 +74,6 @@ int grpc_tcp_server_add_port(grpc_tcp_server *s, const void *addr,
int grpc_tcp_server_get_fd(grpc_tcp_server *s, unsigned index);
void grpc_tcp_server_destroy(grpc_tcp_server *server, grpc_closure *closure,
- grpc_call_list *call_list);
+ grpc_closure_list *closure_list);
#endif /* GRPC_INTERNAL_CORE_IOMGR_TCP_SERVER_H */
diff --git a/src/core/iomgr/tcp_server_posix.c b/src/core/iomgr/tcp_server_posix.c
index 635fdeb198..e6c6a36602 100644
--- a/src/core/iomgr/tcp_server_posix.c
+++ b/src/core/iomgr/tcp_server_posix.c
@@ -140,8 +140,9 @@ grpc_tcp_server *grpc_tcp_server_create(void) {
return s;
}
-static void finish_shutdown(grpc_tcp_server *s, grpc_call_list *call_list) {
- grpc_call_list_add(call_list, s->shutdown_complete, 1);
+static void finish_shutdown(grpc_tcp_server *s,
+ grpc_closure_list *closure_list) {
+ grpc_closure_list_add(closure_list, s->shutdown_complete, 1);
gpr_mu_destroy(&s->mu);
@@ -150,13 +151,13 @@ static void finish_shutdown(grpc_tcp_server *s, grpc_call_list *call_list) {
}
static void destroyed_port(void *server, int success,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
grpc_tcp_server *s = server;
gpr_mu_lock(&s->mu);
s->destroyed_ports++;
if (s->destroyed_ports == s->nports) {
gpr_mu_unlock(&s->mu);
- finish_shutdown(s, call_list);
+ finish_shutdown(s, closure_list);
} else {
GPR_ASSERT(s->destroyed_ports < s->nports);
gpr_mu_unlock(&s->mu);
@@ -167,7 +168,7 @@ static void destroyed_port(void *server, int success,
events will be received on them - at this point it's safe to destroy
things */
static void deactivated_all_ports(grpc_tcp_server *s,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
size_t i;
/* delete ALL the things */
@@ -187,17 +188,17 @@ static void deactivated_all_ports(grpc_tcp_server *s,
sp->destroyed_closure.cb = destroyed_port;
sp->destroyed_closure.cb_arg = s;
grpc_fd_orphan(sp->emfd, &sp->destroyed_closure, "tcp_listener_shutdown",
- call_list);
+ closure_list);
}
gpr_mu_unlock(&s->mu);
} else {
gpr_mu_unlock(&s->mu);
- finish_shutdown(s, call_list);
+ finish_shutdown(s, closure_list);
}
}
void grpc_tcp_server_destroy(grpc_tcp_server *s, grpc_closure *closure,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
size_t i;
gpr_mu_lock(&s->mu);
@@ -209,12 +210,12 @@ void grpc_tcp_server_destroy(grpc_tcp_server *s, grpc_closure *closure,
/* shutdown all fd's */
if (s->active_ports) {
for (i = 0; i < s->nports; i++) {
- grpc_fd_shutdown(s->ports[i].emfd, call_list);
+ grpc_fd_shutdown(s->ports[i].emfd, closure_list);
}
gpr_mu_unlock(&s->mu);
} else {
gpr_mu_unlock(&s->mu);
- deactivated_all_ports(s, call_list);
+ deactivated_all_ports(s, closure_list);
}
}
@@ -299,7 +300,7 @@ error:
}
/* event manager callback when reads are ready */
-static void on_read(void *arg, int success, grpc_call_list *call_list) {
+static void on_read(void *arg, int success, grpc_closure_list *closure_list) {
server_port *sp = arg;
grpc_fd *fdobj;
size_t i;
@@ -322,7 +323,7 @@ static void on_read(void *arg, int success, grpc_call_list *call_list) {
case EINTR:
continue;
case EAGAIN:
- grpc_fd_notify_on_read(sp->emfd, &sp->read_closure, call_list);
+ grpc_fd_notify_on_read(sp->emfd, &sp->read_closure, closure_list);
return;
default:
gpr_log(GPR_ERROR, "Failed accept4: %s", strerror(errno));
@@ -344,12 +345,12 @@ static void on_read(void *arg, int success, grpc_call_list *call_list) {
of channels -- we certainly should not be automatically adding every
incoming channel to every pollset owned by the server */
for (i = 0; i < sp->server->pollset_count; i++) {
- grpc_pollset_add_fd(sp->server->pollsets[i], fdobj, call_list);
+ grpc_pollset_add_fd(sp->server->pollsets[i], fdobj, closure_list);
}
sp->server->on_accept_cb(
sp->server->on_accept_cb_arg,
grpc_tcp_create(fdobj, GRPC_TCP_DEFAULT_READ_SLICE_SIZE, addr_str),
- call_list);
+ closure_list);
gpr_free(name);
gpr_free(addr_str);
@@ -361,7 +362,7 @@ error:
gpr_mu_lock(&sp->server->mu);
if (0 == --sp->server->active_ports) {
gpr_mu_unlock(&sp->server->mu);
- deactivated_all_ports(sp->server, call_list);
+ deactivated_all_ports(sp->server, closure_list);
} else {
gpr_mu_unlock(&sp->server->mu);
}
@@ -488,7 +489,8 @@ int grpc_tcp_server_get_fd(grpc_tcp_server *s, unsigned index) {
void grpc_tcp_server_start(grpc_tcp_server *s, grpc_pollset **pollsets,
size_t pollset_count,
grpc_tcp_server_cb on_accept_cb,
- void *on_accept_cb_arg, grpc_call_list *call_list) {
+ void *on_accept_cb_arg,
+ grpc_closure_list *closure_list) {
size_t i, j;
GPR_ASSERT(on_accept_cb);
gpr_mu_lock(&s->mu);
@@ -500,12 +502,12 @@ void grpc_tcp_server_start(grpc_tcp_server *s, grpc_pollset **pollsets,
s->pollset_count = pollset_count;
for (i = 0; i < s->nports; i++) {
for (j = 0; j < pollset_count; j++) {
- grpc_pollset_add_fd(pollsets[j], s->ports[i].emfd, call_list);
+ grpc_pollset_add_fd(pollsets[j], s->ports[i].emfd, closure_list);
}
s->ports[i].read_closure.cb = on_read;
s->ports[i].read_closure.cb_arg = &s->ports[i];
grpc_fd_notify_on_read(s->ports[i].emfd, &s->ports[i].read_closure,
- call_list);
+ closure_list);
s->active_ports++;
}
gpr_mu_unlock(&s->mu);
diff --git a/src/core/iomgr/udp_server.c b/src/core/iomgr/udp_server.c
index e1c2ae95fd..0f0bea82ab 100644
--- a/src/core/iomgr/udp_server.c
+++ b/src/core/iomgr/udp_server.c
@@ -133,8 +133,9 @@ grpc_udp_server *grpc_udp_server_create(void) {
return s;
}
-static void finish_shutdown(grpc_udp_server *s, grpc_call_list *call_list) {
- grpc_call_list_add(call_list, s->shutdown_complete, 1);
+static void finish_shutdown(grpc_udp_server *s,
+ grpc_closure_list *closure_list) {
+ grpc_closure_list_add(closure_list, s->shutdown_complete, 1);
gpr_mu_destroy(&s->mu);
gpr_cv_destroy(&s->cv);
@@ -144,13 +145,13 @@ static void finish_shutdown(grpc_udp_server *s, grpc_call_list *call_list) {
}
static void destroyed_port(void *server, int success,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
grpc_udp_server *s = server;
gpr_mu_lock(&s->mu);
s->destroyed_ports++;
if (s->destroyed_ports == s->nports) {
gpr_mu_unlock(&s->mu);
- finish_shutdown(s, call_list);
+ finish_shutdown(s, closure_list);
} else {
gpr_mu_unlock(&s->mu);
}
@@ -160,7 +161,7 @@ static void destroyed_port(void *server, int success,
events will be received on them - at this point it's safe to destroy
things */
static void deactivated_all_ports(grpc_udp_server *s,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
size_t i;
/* delete ALL the things */
@@ -180,17 +181,17 @@ static void deactivated_all_ports(grpc_udp_server *s,
sp->destroyed_closure.cb = destroyed_port;
sp->destroyed_closure.cb_arg = s;
grpc_fd_orphan(sp->emfd, &sp->destroyed_closure, "udp_listener_shutdown",
- call_list);
+ closure_list);
}
gpr_mu_unlock(&s->mu);
} else {
gpr_mu_unlock(&s->mu);
- finish_shutdown(s, call_list);
+ finish_shutdown(s, closure_list);
}
}
void grpc_udp_server_destroy(grpc_udp_server *s, grpc_closure *on_done,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
size_t i;
gpr_mu_lock(&s->mu);
@@ -202,12 +203,12 @@ void grpc_udp_server_destroy(grpc_udp_server *s, grpc_closure *on_done,
/* shutdown all fd's */
if (s->active_ports) {
for (i = 0; i < s->nports; i++) {
- grpc_fd_shutdown(s->ports[i].emfd, call_list);
+ grpc_fd_shutdown(s->ports[i].emfd, closure_list);
}
gpr_mu_unlock(&s->mu);
} else {
gpr_mu_unlock(&s->mu);
- deactivated_all_ports(s, call_list);
+ deactivated_all_ports(s, closure_list);
}
}
@@ -262,14 +263,14 @@ error:
}
/* event manager callback when reads are ready */
-static void on_read(void *arg, int success, grpc_call_list *call_list) {
+static void on_read(void *arg, int success, grpc_closure_list *closure_list) {
server_port *sp = arg;
if (success == 0) {
gpr_mu_lock(&sp->server->mu);
if (0 == --sp->server->active_ports) {
gpr_mu_unlock(&sp->server->mu);
- deactivated_all_ports(sp->server, call_list);
+ deactivated_all_ports(sp->server, closure_list);
} else {
gpr_mu_unlock(&sp->server->mu);
}
@@ -281,7 +282,7 @@ static void on_read(void *arg, int success, grpc_call_list *call_list) {
sp->read_cb(sp->fd);
/* Re-arm the notification event so we get another chance to read. */
- grpc_fd_notify_on_read(sp->emfd, &sp->read_closure, call_list);
+ grpc_fd_notify_on_read(sp->emfd, &sp->read_closure, closure_list);
}
static int add_socket_to_server(grpc_udp_server *s, int fd,
@@ -402,19 +403,20 @@ int grpc_udp_server_get_fd(grpc_udp_server *s, unsigned index) {
}
void grpc_udp_server_start(grpc_udp_server *s, grpc_pollset **pollsets,
- size_t pollset_count, grpc_call_list *call_list) {
+ size_t pollset_count,
+ grpc_closure_list *closure_list) {
size_t i, j;
gpr_mu_lock(&s->mu);
GPR_ASSERT(s->active_ports == 0);
s->pollsets = pollsets;
for (i = 0; i < s->nports; i++) {
for (j = 0; j < pollset_count; j++) {
- grpc_pollset_add_fd(pollsets[j], s->ports[i].emfd, call_list);
+ grpc_pollset_add_fd(pollsets[j], s->ports[i].emfd, closure_list);
}
s->ports[i].read_closure.cb = on_read;
s->ports[i].read_closure.cb_arg = &s->ports[i];
grpc_fd_notify_on_read(s->ports[i].emfd, &s->ports[i].read_closure,
- call_list);
+ closure_list);
s->active_ports++;
}
gpr_mu_unlock(&s->mu);
diff --git a/src/core/iomgr/udp_server.h b/src/core/iomgr/udp_server.h
index fa4d2147b4..b66a2d79a2 100644
--- a/src/core/iomgr/udp_server.h
+++ b/src/core/iomgr/udp_server.h
@@ -47,7 +47,8 @@ grpc_udp_server *grpc_udp_server_create(void);
/* Start listening to bound ports */
void grpc_udp_server_start(grpc_udp_server *udp_server, grpc_pollset **pollsets,
- size_t pollset_count, grpc_call_list *call_list);
+ size_t pollset_count,
+ grpc_closure_list *closure_list);
int grpc_udp_server_get_fd(grpc_udp_server *s, unsigned index);
@@ -65,7 +66,7 @@ int grpc_udp_server_add_port(grpc_udp_server *s, const void *addr,
size_t addr_len, grpc_udp_server_read_cb read_cb);
void grpc_udp_server_destroy(grpc_udp_server *server, grpc_closure *on_done,
- grpc_call_list *call_list);
+ grpc_closure_list *closure_list);
/* Write the contents of buffer to the underlying UDP socket. */
/*
diff --git a/src/core/iomgr/workqueue.h b/src/core/iomgr/workqueue.h
index ea7031a9f3..0bec714d4f 100644
--- a/src/core/iomgr/workqueue.h
+++ b/src/core/iomgr/workqueue.h
@@ -50,9 +50,10 @@ struct grpc_workqueue;
typedef struct grpc_workqueue grpc_workqueue;
/** Create a work queue */
-grpc_workqueue *grpc_workqueue_create(grpc_call_list *call_list);
+grpc_workqueue *grpc_workqueue_create(grpc_closure_list *closure_list);
-void grpc_workqueue_flush(grpc_workqueue *workqueue, grpc_call_list *call_list);
+void grpc_workqueue_flush(grpc_workqueue *workqueue,
+ grpc_closure_list *closure_list);
#define GRPC_WORKQUEUE_REFCOUNT_DEBUG
#ifdef GRPC_WORKQUEUE_REFCOUNT_DEBUG
@@ -62,19 +63,21 @@ void grpc_workqueue_flush(grpc_workqueue *workqueue, grpc_call_list *call_list);
grpc_workqueue_unref((p), (cl), __FILE__, __LINE__, (r))
void grpc_workqueue_ref(grpc_workqueue *workqueue, const char *file, int line,
const char *reason);
-void grpc_workqueue_unref(grpc_workqueue *workqueue, grpc_call_list *call_list,
- const char *file, int line, const char *reason);
+void grpc_workqueue_unref(grpc_workqueue *workqueue,
+ grpc_closure_list *closure_list, const char *file,
+ int line, const char *reason);
#else
#define GRPC_WORKQUEUE_REF(p, r) grpc_workqueue_ref((p))
#define GRPC_WORKQUEUE_UNREF(p, r, cl) grpc_workqueue_unref((p), (cl))
void grpc_workqueue_ref(grpc_workqueue *workqueue);
-void grpc_workqueue_unref(grpc_workqueue *workqueue, grpc_call_list *call_list);
+void grpc_workqueue_unref(grpc_workqueue *workqueue,
+ grpc_closure_list *closure_list);
#endif
/** Bind this workqueue to a pollset */
void grpc_workqueue_add_to_pollset(grpc_workqueue *workqueue,
grpc_pollset *pollset,
- grpc_call_list *call_list);
+ grpc_closure_list *closure_list);
/** Add a work item to a workqueue */
void grpc_workqueue_push(grpc_workqueue *workqueue, grpc_closure *closure,
diff --git a/src/core/iomgr/workqueue_posix.c b/src/core/iomgr/workqueue_posix.c
index 83249c583c..9ecd59d390 100644
--- a/src/core/iomgr/workqueue_posix.c
+++ b/src/core/iomgr/workqueue_posix.c
@@ -45,28 +45,29 @@
#include "src/core/iomgr/fd_posix.h"
-static void on_readable(void *arg, int success, grpc_call_list *call_list);
+static void on_readable(void *arg, int success,
+ grpc_closure_list *closure_list);
-grpc_workqueue *grpc_workqueue_create(grpc_call_list *call_list) {
+grpc_workqueue *grpc_workqueue_create(grpc_closure_list *closure_list) {
char name[32];
grpc_workqueue *workqueue = gpr_malloc(sizeof(grpc_workqueue));
gpr_ref_init(&workqueue->refs, 1);
gpr_mu_init(&workqueue->mu);
- workqueue->call_list.head = workqueue->call_list.tail = NULL;
+ workqueue->closure_list.head = workqueue->closure_list.tail = NULL;
grpc_wakeup_fd_init(&workqueue->wakeup_fd);
sprintf(name, "workqueue:%p", (void *)workqueue);
workqueue->wakeup_read_fd =
grpc_fd_create(GRPC_WAKEUP_FD_GET_READ_FD(&workqueue->wakeup_fd), name);
grpc_closure_init(&workqueue->read_closure, on_readable, workqueue);
grpc_fd_notify_on_read(workqueue->wakeup_read_fd, &workqueue->read_closure,
- call_list);
+ closure_list);
return workqueue;
}
static void workqueue_destroy(grpc_workqueue *workqueue,
- grpc_call_list *call_list) {
- GPR_ASSERT(grpc_call_list_empty(workqueue->call_list));
- grpc_fd_shutdown(workqueue->wakeup_read_fd, call_list);
+ grpc_closure_list *closure_list) {
+ GPR_ASSERT(grpc_closure_list_empty(workqueue->closure_list));
+ grpc_fd_shutdown(workqueue->wakeup_read_fd, closure_list);
}
#ifdef GRPC_WORKQUEUE_REFCOUNT_DEBUG
@@ -82,34 +83,36 @@ void grpc_workqueue_ref(grpc_workqueue *workqueue) {
}
#ifdef GRPC_WORKQUEUE_REFCOUNT_DEBUG
-void grpc_workqueue_unref(grpc_workqueue *workqueue, grpc_call_list *call_list,
- const char *file, int line, const char *reason) {
+void grpc_workqueue_unref(grpc_workqueue *workqueue,
+ grpc_closure_list *closure_list, const char *file,
+ int line, const char *reason) {
gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, "WORKQUEUE:%p unref %d -> %d %s",
workqueue, (int)workqueue->refs.count, (int)workqueue->refs.count - 1,
reason);
#else
void grpc_workqueue_unref(grpc_workqueue *workqueue,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
#endif
if (gpr_unref(&workqueue->refs)) {
- workqueue_destroy(workqueue, call_list);
+ workqueue_destroy(workqueue, closure_list);
}
}
void grpc_workqueue_add_to_pollset(grpc_workqueue *workqueue,
grpc_pollset *pollset,
- grpc_call_list *call_list) {
- grpc_pollset_add_fd(pollset, workqueue->wakeup_read_fd, call_list);
+ grpc_closure_list *closure_list) {
+ grpc_pollset_add_fd(pollset, workqueue->wakeup_read_fd, closure_list);
}
void grpc_workqueue_flush(grpc_workqueue *workqueue,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
gpr_mu_lock(&workqueue->mu);
- grpc_call_list_move(&workqueue->call_list, call_list);
+ grpc_closure_list_move(&workqueue->closure_list, closure_list);
gpr_mu_unlock(&workqueue->mu);
}
-static void on_readable(void *arg, int success, grpc_call_list *call_list) {
+static void on_readable(void *arg, int success,
+ grpc_closure_list *closure_list) {
grpc_workqueue *workqueue = arg;
if (!success) {
@@ -117,15 +120,15 @@ static void on_readable(void *arg, int success, grpc_call_list *call_list) {
/* HACK: let wakeup_fd code know that we stole the fd */
workqueue->wakeup_fd.read_fd = 0;
grpc_wakeup_fd_destroy(&workqueue->wakeup_fd);
- grpc_fd_orphan(workqueue->wakeup_read_fd, NULL, "destroy", call_list);
+ grpc_fd_orphan(workqueue->wakeup_read_fd, NULL, "destroy", closure_list);
gpr_free(workqueue);
} else {
gpr_mu_lock(&workqueue->mu);
- grpc_call_list_move(&workqueue->call_list, call_list);
+ grpc_closure_list_move(&workqueue->closure_list, closure_list);
grpc_wakeup_fd_consume_wakeup(&workqueue->wakeup_fd);
gpr_mu_unlock(&workqueue->mu);
grpc_fd_notify_on_read(workqueue->wakeup_read_fd, &workqueue->read_closure,
- call_list);
+ closure_list);
}
}
@@ -134,10 +137,10 @@ void grpc_workqueue_push(grpc_workqueue *workqueue, grpc_closure *closure,
closure->success = success;
closure->next = NULL;
gpr_mu_lock(&workqueue->mu);
- if (grpc_call_list_empty(workqueue->call_list)) {
+ if (grpc_closure_list_empty(workqueue->closure_list)) {
grpc_wakeup_fd_wakeup(&workqueue->wakeup_fd);
}
- grpc_call_list_add(&workqueue->call_list, closure, success);
+ grpc_closure_list_add(&workqueue->closure_list, closure, success);
gpr_mu_unlock(&workqueue->mu);
}
diff --git a/src/core/iomgr/workqueue_posix.h b/src/core/iomgr/workqueue_posix.h
index 22c48c4926..589034fe1b 100644
--- a/src/core/iomgr/workqueue_posix.h
+++ b/src/core/iomgr/workqueue_posix.h
@@ -40,7 +40,7 @@ struct grpc_workqueue {
gpr_refcount refs;
gpr_mu mu;
- grpc_call_list call_list;
+ grpc_closure_list closure_list;
grpc_wakeup_fd wakeup_fd;
struct grpc_fd *wakeup_read_fd;
diff --git a/src/core/security/client_auth_filter.c b/src/core/security/client_auth_filter.c
index 43a37c2077..5955b84962 100644
--- a/src/core/security/client_auth_filter.c
+++ b/src/core/security/client_auth_filter.c
@@ -84,18 +84,19 @@ static void reset_service_url(call_data *calld) {
}
static void bubble_up_error(grpc_call_element *elem, grpc_status_code status,
- const char *error_msg, grpc_call_list *call_list) {
+ const char *error_msg,
+ grpc_closure_list *closure_list) {
call_data *calld = elem->call_data;
gpr_log(GPR_ERROR, "Client side authentication failure: %s", error_msg);
grpc_transport_stream_op_add_cancellation(&calld->op, status);
- grpc_call_next_op(elem, &calld->op, call_list);
+ grpc_call_next_op(elem, &calld->op, closure_list);
}
static void on_credentials_metadata(void *user_data,
grpc_credentials_md *md_elems,
size_t num_md,
grpc_credentials_status status,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
grpc_call_element *elem = (grpc_call_element *)user_data;
call_data *calld = elem->call_data;
channel_data *chand = elem->channel_data;
@@ -105,7 +106,7 @@ static void on_credentials_metadata(void *user_data,
reset_service_url(calld);
if (status != GRPC_CREDENTIALS_OK) {
bubble_up_error(elem, GRPC_STATUS_UNAUTHENTICATED,
- "Credentials failed to get metadata.", call_list);
+ "Credentials failed to get metadata.", closure_list);
return;
}
GPR_ASSERT(num_md <= MAX_CREDENTIALS_METADATA_COUNT);
@@ -118,7 +119,7 @@ static void on_credentials_metadata(void *user_data,
grpc_mdelem_from_slices(chand->md_ctx, gpr_slice_ref(md_elems[i].key),
gpr_slice_ref(md_elems[i].value)));
}
- grpc_call_next_op(elem, op, call_list);
+ grpc_call_next_op(elem, op, closure_list);
}
void build_service_url(const char *url_scheme, call_data *calld) {
@@ -142,7 +143,7 @@ void build_service_url(const char *url_scheme, call_data *calld) {
static void send_security_metadata(grpc_call_element *elem,
grpc_transport_stream_op *op,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
call_data *calld = elem->call_data;
channel_data *chand = elem->channel_data;
grpc_client_security_context *ctx =
@@ -157,7 +158,7 @@ static void send_security_metadata(grpc_call_element *elem,
if (!channel_creds_has_md && !call_creds_has_md) {
/* Skip sending metadata altogether. */
- grpc_call_next_op(elem, op, call_list);
+ grpc_call_next_op(elem, op, closure_list);
return;
}
@@ -167,7 +168,7 @@ static void send_security_metadata(grpc_call_element *elem,
if (calld->creds == NULL) {
bubble_up_error(elem, GRPC_STATUS_INVALID_ARGUMENT,
"Incompatible credentials set on channel and call.",
- call_list);
+ closure_list);
return;
}
} else {
@@ -180,21 +181,22 @@ static void send_security_metadata(grpc_call_element *elem,
GPR_ASSERT(calld->pollset);
grpc_credentials_get_request_metadata(
calld->creds, calld->pollset, calld->service_url, on_credentials_metadata,
- elem, call_list);
+ elem, closure_list);
}
static void on_host_checked(void *user_data, grpc_security_status status,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
grpc_call_element *elem = (grpc_call_element *)user_data;
call_data *calld = elem->call_data;
if (status == GRPC_SECURITY_OK) {
- send_security_metadata(elem, &calld->op, call_list);
+ send_security_metadata(elem, &calld->op, closure_list);
} else {
char *error_msg;
gpr_asprintf(&error_msg, "Invalid host %s set in :authority metadata.",
grpc_mdstr_as_c_string(calld->host));
- bubble_up_error(elem, GRPC_STATUS_INVALID_ARGUMENT, error_msg, call_list);
+ bubble_up_error(elem, GRPC_STATUS_INVALID_ARGUMENT, error_msg,
+ closure_list);
gpr_free(error_msg);
}
}
@@ -206,7 +208,7 @@ static void on_host_checked(void *user_data, grpc_security_status status,
that is being sent or received. */
static void auth_start_transport_op(grpc_call_element *elem,
grpc_transport_stream_op *op,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
/* grab pointers to our data from the call element */
call_data *calld = elem->call_data;
channel_data *chand = elem->channel_data;
@@ -259,7 +261,7 @@ static void auth_start_transport_op(grpc_call_element *elem,
calld->op = *op; /* Copy op (originates from the caller's stack). */
status = grpc_channel_security_connector_check_call_host(
chand->security_connector, call_host, on_host_checked, elem,
- call_list);
+ closure_list);
if (status != GRPC_SECURITY_OK) {
if (status == GRPC_SECURITY_ERROR) {
char *error_msg;
@@ -267,26 +269,26 @@ static void auth_start_transport_op(grpc_call_element *elem,
"Invalid host %s set in :authority metadata.",
call_host);
bubble_up_error(elem, GRPC_STATUS_INVALID_ARGUMENT, error_msg,
- call_list);
+ closure_list);
gpr_free(error_msg);
}
return; /* early exit */
}
}
- send_security_metadata(elem, op, call_list);
+ send_security_metadata(elem, op, closure_list);
return; /* early exit */
}
}
/* pass control down the stack */
- grpc_call_next_op(elem, op, call_list);
+ grpc_call_next_op(elem, op, closure_list);
}
/* Constructor for call_data */
static void init_call_elem(grpc_call_element *elem,
const void *server_transport_data,
grpc_transport_stream_op *initial_op,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
call_data *calld = elem->call_data;
memset(calld, 0, sizeof(*calld));
GPR_ASSERT(!initial_op || !initial_op->send_ops);
@@ -294,7 +296,7 @@ static void init_call_elem(grpc_call_element *elem,
/* Destructor for call_data */
static void destroy_call_elem(grpc_call_element *elem,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
call_data *calld = elem->call_data;
grpc_credentials_unref(calld->creds);
if (calld->host != NULL) {
@@ -310,7 +312,7 @@ static void destroy_call_elem(grpc_call_element *elem,
static void init_channel_elem(grpc_channel_element *elem, grpc_channel *master,
const grpc_channel_args *args,
grpc_mdctx *metadata_context, int is_first,
- int is_last, grpc_call_list *call_list) {
+ int is_last, grpc_closure_list *closure_list) {
grpc_security_connector *sc = grpc_find_security_connector_in_args(args);
/* grab pointers to our data from the channel element */
channel_data *chand = elem->channel_data;
@@ -337,7 +339,7 @@ static void init_channel_elem(grpc_channel_element *elem, grpc_channel *master,
/* Destructor for channel data */
static void destroy_channel_elem(grpc_channel_element *elem,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
/* grab pointers to our data from the channel element */
channel_data *chand = elem->channel_data;
grpc_channel_security_connector *ctx = chand->security_connector;
diff --git a/src/core/security/credentials.c b/src/core/security/credentials.c
index 80e0a79447..0a49834d40 100644
--- a/src/core/security/credentials.c
+++ b/src/core/security/credentials.c
@@ -109,16 +109,16 @@ void grpc_credentials_get_request_metadata(grpc_credentials *creds,
const char *service_url,
grpc_credentials_metadata_cb cb,
void *user_data,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
if (creds == NULL || !grpc_credentials_has_request_metadata(creds) ||
creds->vtable->get_request_metadata == NULL) {
if (cb != NULL) {
- cb(user_data, NULL, 0, GRPC_CREDENTIALS_OK, call_list);
+ cb(user_data, NULL, 0, GRPC_CREDENTIALS_OK, closure_list);
}
return;
}
creds->vtable->get_request_metadata(creds, pollset, service_url, cb,
- user_data, call_list);
+ user_data, closure_list);
}
grpc_security_status grpc_credentials_create_security_connector(
@@ -377,7 +377,7 @@ static void jwt_get_request_metadata(grpc_credentials *creds,
const char *service_url,
grpc_credentials_metadata_cb cb,
void *user_data,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
grpc_service_account_jwt_access_credentials *c =
(grpc_service_account_jwt_access_credentials *)creds;
gpr_timespec refresh_threshold = gpr_time_from_seconds(
@@ -422,10 +422,10 @@ static void jwt_get_request_metadata(grpc_credentials *creds,
if (jwt_md != NULL) {
cb(user_data, jwt_md->entries, jwt_md->num_entries, GRPC_CREDENTIALS_OK,
- call_list);
+ closure_list);
grpc_credentials_md_store_unref(jwt_md);
} else {
- cb(user_data, NULL, 0, GRPC_CREDENTIALS_ERROR, call_list);
+ cb(user_data, NULL, 0, GRPC_CREDENTIALS_ERROR, closure_list);
}
}
@@ -572,7 +572,7 @@ end:
static void on_oauth2_token_fetcher_http_response(
void *user_data, const grpc_httpcli_response *response,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
grpc_credentials_metadata_request *r =
(grpc_credentials_metadata_request *)user_data;
grpc_oauth2_token_fetcher_credentials *c =
@@ -587,10 +587,10 @@ static void on_oauth2_token_fetcher_http_response(
c->token_expiration =
gpr_time_add(gpr_now(GPR_CLOCK_REALTIME), token_lifetime);
r->cb(r->user_data, c->access_token_md->entries,
- c->access_token_md->num_entries, status, call_list);
+ c->access_token_md->num_entries, status, closure_list);
} else {
c->token_expiration = gpr_inf_past(GPR_CLOCK_REALTIME);
- r->cb(r->user_data, NULL, 0, status, call_list);
+ r->cb(r->user_data, NULL, 0, status, closure_list);
}
gpr_mu_unlock(&c->mu);
grpc_credentials_metadata_request_destroy(r);
@@ -599,7 +599,7 @@ static void on_oauth2_token_fetcher_http_response(
static void oauth2_token_fetcher_get_request_metadata(
grpc_credentials *creds, grpc_pollset *pollset, const char *service_url,
grpc_credentials_metadata_cb cb, void *user_data,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
grpc_oauth2_token_fetcher_credentials *c =
(grpc_oauth2_token_fetcher_credentials *)creds;
gpr_timespec refresh_threshold = gpr_time_from_seconds(
@@ -618,14 +618,14 @@ static void oauth2_token_fetcher_get_request_metadata(
}
if (cached_access_token_md != NULL) {
cb(user_data, cached_access_token_md->entries,
- cached_access_token_md->num_entries, GRPC_CREDENTIALS_OK, call_list);
+ cached_access_token_md->num_entries, GRPC_CREDENTIALS_OK, closure_list);
grpc_credentials_md_store_unref(cached_access_token_md);
} else {
c->fetch_func(
grpc_credentials_metadata_request_create(creds, cb, user_data),
&c->httpcli_context, pollset, on_oauth2_token_fetcher_http_response,
gpr_time_add(gpr_now(GPR_CLOCK_REALTIME), refresh_threshold),
- call_list);
+ closure_list);
}
}
@@ -651,7 +651,7 @@ static void compute_engine_fetch_oauth2(
grpc_credentials_metadata_request *metadata_req,
grpc_httpcli_context *httpcli_context, grpc_pollset *pollset,
grpc_httpcli_response_cb response_cb, gpr_timespec deadline,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
grpc_httpcli_header header = {"Metadata-Flavor", "Google"};
grpc_httpcli_request request;
memset(&request, 0, sizeof(grpc_httpcli_request));
@@ -660,7 +660,7 @@ static void compute_engine_fetch_oauth2(
request.hdr_count = 1;
request.hdrs = &header;
grpc_httpcli_get(httpcli_context, pollset, &request, deadline, response_cb,
- metadata_req, call_list);
+ metadata_req, closure_list);
}
grpc_credentials *grpc_google_compute_engine_credentials_create(
@@ -691,7 +691,7 @@ static void refresh_token_fetch_oauth2(
grpc_credentials_metadata_request *metadata_req,
grpc_httpcli_context *httpcli_context, grpc_pollset *pollset,
grpc_httpcli_response_cb response_cb, gpr_timespec deadline,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
grpc_google_refresh_token_credentials *c =
(grpc_google_refresh_token_credentials *)metadata_req->creds;
grpc_httpcli_header header = {"Content-Type",
@@ -708,7 +708,7 @@ static void refresh_token_fetch_oauth2(
request.hdrs = &header;
request.handshaker = &grpc_httpcli_ssl;
grpc_httpcli_post(httpcli_context, pollset, &request, body, strlen(body),
- deadline, response_cb, metadata_req, call_list);
+ deadline, response_cb, metadata_req, closure_list);
gpr_free(body);
}
@@ -755,11 +755,11 @@ static void on_simulated_token_fetch_done(void *user_data) {
grpc_credentials_metadata_request *r =
(grpc_credentials_metadata_request *)user_data;
grpc_md_only_test_credentials *c = (grpc_md_only_test_credentials *)r->creds;
- grpc_call_list call_list = GRPC_CALL_LIST_INIT;
+ grpc_closure_list closure_list = GRPC_CLOSURE_LIST_INIT;
r->cb(r->user_data, c->md_store->entries, c->md_store->num_entries,
- GRPC_CREDENTIALS_OK, &call_list);
+ GRPC_CREDENTIALS_OK, &closure_list);
grpc_credentials_metadata_request_destroy(r);
- grpc_call_list_run(&call_list);
+ grpc_closure_list_run(&closure_list);
}
static void md_only_test_get_request_metadata(grpc_credentials *creds,
@@ -767,7 +767,7 @@ static void md_only_test_get_request_metadata(grpc_credentials *creds,
const char *service_url,
grpc_credentials_metadata_cb cb,
void *user_data,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
grpc_md_only_test_credentials *c = (grpc_md_only_test_credentials *)creds;
if (c->is_async) {
@@ -776,7 +776,7 @@ static void md_only_test_get_request_metadata(grpc_credentials *creds,
grpc_credentials_metadata_request_create(creds, cb, user_data);
gpr_thd_new(&thd_id, on_simulated_token_fetch_done, cb_arg, NULL);
} else {
- cb(user_data, c->md_store->entries, 1, GRPC_CREDENTIALS_OK, call_list);
+ cb(user_data, c->md_store->entries, 1, GRPC_CREDENTIALS_OK, closure_list);
}
}
@@ -821,9 +821,10 @@ static void access_token_get_request_metadata(grpc_credentials *creds,
const char *service_url,
grpc_credentials_metadata_cb cb,
void *user_data,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
grpc_access_token_credentials *c = (grpc_access_token_credentials *)creds;
- cb(user_data, c->access_token_md->entries, 1, GRPC_CREDENTIALS_OK, call_list);
+ cb(user_data, c->access_token_md->entries, 1, GRPC_CREDENTIALS_OK,
+ closure_list);
}
static grpc_credentials_vtable access_token_vtable = {
@@ -971,11 +972,11 @@ static void composite_md_context_destroy(
static void composite_metadata_cb(void *user_data,
grpc_credentials_md *md_elems, size_t num_md,
grpc_credentials_status status,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
grpc_composite_credentials_metadata_context *ctx =
(grpc_composite_credentials_metadata_context *)user_data;
if (status != GRPC_CREDENTIALS_OK) {
- ctx->cb(ctx->user_data, NULL, 0, status, call_list);
+ ctx->cb(ctx->user_data, NULL, 0, status, closure_list);
return;
}
@@ -995,16 +996,16 @@ static void composite_metadata_cb(void *user_data,
if (grpc_credentials_has_request_metadata(inner_creds)) {
grpc_credentials_get_request_metadata(
inner_creds, ctx->pollset, ctx->service_url, composite_metadata_cb,
- ctx, call_list);
+ ctx, closure_list);
return;
}
}
/* We're done!. */
ctx->cb(ctx->user_data, ctx->md_elems->entries, ctx->md_elems->num_entries,
- GRPC_CREDENTIALS_OK, call_list);
+ GRPC_CREDENTIALS_OK, closure_list);
composite_md_context_destroy(ctx);
- grpc_call_list_run(call_list);
+ grpc_closure_list_run(closure_list);
}
static void composite_get_request_metadata(grpc_credentials *creds,
@@ -1012,11 +1013,11 @@ static void composite_get_request_metadata(grpc_credentials *creds,
const char *service_url,
grpc_credentials_metadata_cb cb,
void *user_data,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
grpc_composite_credentials *c = (grpc_composite_credentials *)creds;
grpc_composite_credentials_metadata_context *ctx;
if (!grpc_credentials_has_request_metadata(creds)) {
- cb(user_data, NULL, 0, GRPC_CREDENTIALS_OK, call_list);
+ cb(user_data, NULL, 0, GRPC_CREDENTIALS_OK, closure_list);
return;
}
ctx = gpr_malloc(sizeof(grpc_composite_credentials_metadata_context));
@@ -1032,7 +1033,7 @@ static void composite_get_request_metadata(grpc_credentials *creds,
if (grpc_credentials_has_request_metadata(inner_creds)) {
grpc_credentials_get_request_metadata(inner_creds, pollset, service_url,
composite_metadata_cb, ctx,
- call_list);
+ closure_list);
return;
}
}
@@ -1169,10 +1170,10 @@ static void iam_get_request_metadata(grpc_credentials *creds,
const char *service_url,
grpc_credentials_metadata_cb cb,
void *user_data,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
grpc_google_iam_credentials *c = (grpc_google_iam_credentials *)creds;
cb(user_data, c->iam_md->entries, c->iam_md->num_entries, GRPC_CREDENTIALS_OK,
- call_list);
+ closure_list);
}
static grpc_credentials_vtable iam_vtable = {
@@ -1226,14 +1227,14 @@ static void plugin_md_request_metadata_ready(void *request,
grpc_status_code status,
const char *error_details) {
/* called from application code */
- grpc_call_list call_list = GRPC_CALL_LIST_INIT;
+ grpc_closure_list closure_list = GRPC_CLOSURE_LIST_INIT;
grpc_metadata_plugin_request *r = (grpc_metadata_plugin_request *)request;
if (status != GRPC_STATUS_OK) {
if (error_details != NULL) {
gpr_log(GPR_ERROR, "Getting metadata from plugin failed with error: %s",
error_details);
}
- r->cb(r->user_data, NULL, 0, GRPC_CREDENTIALS_ERROR, &call_list);
+ r->cb(r->user_data, NULL, 0, GRPC_CREDENTIALS_ERROR, &closure_list);
} else {
size_t i;
grpc_credentials_md *md_array = NULL;
@@ -1245,7 +1246,7 @@ static void plugin_md_request_metadata_ready(void *request,
gpr_slice_from_copied_buffer(md[i].value, md[i].value_length);
}
}
- r->cb(r->user_data, md_array, num_md, GRPC_CREDENTIALS_OK, &call_list);
+ r->cb(r->user_data, md_array, num_md, GRPC_CREDENTIALS_OK, &closure_list);
if (md_array != NULL) {
for (i = 0; i < num_md; i++) {
gpr_slice_unref(md_array[i].key);
@@ -1262,7 +1263,7 @@ static void plugin_get_request_metadata(grpc_credentials *creds,
const char *service_url,
grpc_credentials_metadata_cb cb,
void *user_data,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
grpc_plugin_credentials *c = (grpc_plugin_credentials *)creds;
if (c->plugin.get_metadata != NULL) {
grpc_metadata_plugin_request *request = gpr_malloc(sizeof(*request));
@@ -1272,7 +1273,7 @@ static void plugin_get_request_metadata(grpc_credentials *creds,
c->plugin.get_metadata(c->plugin.state, service_url,
plugin_md_request_metadata_ready, request);
} else {
- cb(user_data, NULL, 0, GRPC_CREDENTIALS_OK, call_list);
+ cb(user_data, NULL, 0, GRPC_CREDENTIALS_OK, closure_list);
}
}
diff --git a/src/core/security/credentials.h b/src/core/security/credentials.h
index 090767d237..edc0a61f03 100644
--- a/src/core/security/credentials.h
+++ b/src/core/security/credentials.h
@@ -128,7 +128,7 @@ typedef void (*grpc_credentials_metadata_cb)(void *user_data,
grpc_credentials_md *md_elems,
size_t num_md,
grpc_credentials_status status,
- grpc_call_list *call_list);
+ grpc_closure_list *closure_list);
typedef struct {
void (*destruct)(grpc_credentials *c);
@@ -137,7 +137,7 @@ typedef struct {
void (*get_request_metadata)(grpc_credentials *c, grpc_pollset *pollset,
const char *service_url,
grpc_credentials_metadata_cb cb, void *user_data,
- grpc_call_list *call_list);
+ grpc_closure_list *closure_list);
grpc_security_status (*create_security_connector)(
grpc_credentials *c, const char *target, const grpc_channel_args *args,
grpc_credentials *request_metadata_creds,
@@ -159,7 +159,7 @@ void grpc_credentials_get_request_metadata(grpc_credentials *creds,
const char *service_url,
grpc_credentials_metadata_cb cb,
void *user_data,
- grpc_call_list *call_list);
+ grpc_closure_list *closure_list);
/* Creates a security connector for the channel. May also create new channel
args for the channel to be used in place of the passed in const args if
@@ -278,7 +278,7 @@ typedef void (*grpc_fetch_oauth2_func)(grpc_credentials_metadata_request *req,
grpc_pollset *pollset,
grpc_httpcli_response_cb response_cb,
gpr_timespec deadline,
- grpc_call_list *call_list);
+ grpc_closure_list *closure_list);
typedef struct {
grpc_credentials base;
diff --git a/src/core/security/google_default_credentials.c b/src/core/security/google_default_credentials.c
index 8c3d85cc58..4a7ab53c1e 100644
--- a/src/core/security/google_default_credentials.c
+++ b/src/core/security/google_default_credentials.c
@@ -64,7 +64,7 @@ typedef struct {
static void on_compute_engine_detection_http_response(
void *user_data, const grpc_httpcli_response *response,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
compute_engine_detector *detector = (compute_engine_detector *)user_data;
if (response != NULL && response->status == 200 && response->hdr_count > 0) {
/* Internet providers can return a generic response to all requests, so
@@ -85,7 +85,7 @@ static void on_compute_engine_detection_http_response(
gpr_mu_unlock(GRPC_POLLSET_MU(&detector->pollset));
}
-static void destroy_pollset(void *p, int s, grpc_call_list *call_list) {
+static void destroy_pollset(void *p, int s, grpc_closure_list *closure_list) {
grpc_pollset_destroy(p);
}
@@ -93,7 +93,7 @@ static int is_stack_running_on_compute_engine(void) {
compute_engine_detector detector;
grpc_httpcli_request request;
grpc_httpcli_context context;
- grpc_call_list call_list = GRPC_CALL_LIST_INIT;
+ grpc_closure_list closure_list = GRPC_CLOSURE_LIST_INIT;
grpc_closure destroy_closure;
/* The http call is local. If it takes more than one sec, it is for sure not
@@ -113,9 +113,9 @@ static int is_stack_running_on_compute_engine(void) {
grpc_httpcli_get(
&context, &detector.pollset, &request,
gpr_time_add(gpr_now(GPR_CLOCK_REALTIME), max_detection_delay),
- on_compute_engine_detection_http_response, &detector, &call_list);
+ on_compute_engine_detection_http_response, &detector, &closure_list);
- grpc_call_list_run(&call_list);
+ grpc_closure_list_run(&closure_list);
/* Block until we get the response. This is not ideal but this should only be
called once for the lifetime of the process by the default credentials. */
@@ -123,14 +123,14 @@ static int is_stack_running_on_compute_engine(void) {
while (!detector.is_done) {
grpc_pollset_worker worker;
grpc_pollset_work(&detector.pollset, &worker, gpr_now(GPR_CLOCK_MONOTONIC),
- gpr_inf_future(GPR_CLOCK_MONOTONIC), &call_list);
+ gpr_inf_future(GPR_CLOCK_MONOTONIC), &closure_list);
}
gpr_mu_unlock(GRPC_POLLSET_MU(&detector.pollset));
grpc_httpcli_context_destroy(&context);
grpc_closure_init(&destroy_closure, destroy_pollset, &detector.pollset);
- grpc_pollset_shutdown(&detector.pollset, &destroy_closure, &call_list);
- grpc_call_list_run(&call_list);
+ grpc_pollset_shutdown(&detector.pollset, &destroy_closure, &closure_list);
+ grpc_closure_list_run(&closure_list);
return detector.success;
}
diff --git a/src/core/security/handshake.c b/src/core/security/handshake.c
index e3206c2e12..caad12a653 100644
--- a/src/core/security/handshake.c
+++ b/src/core/security/handshake.c
@@ -58,26 +58,26 @@ typedef struct {
grpc_closure on_handshake_data_received_from_peer;
} grpc_security_handshake;
-static void on_handshake_data_received_from_peer(void *setup, int success,
- grpc_call_list *call_list);
+static void on_handshake_data_received_from_peer(
+ void *setup, int success, grpc_closure_list *closure_list);
static void on_handshake_data_sent_to_peer(void *setup, int success,
- grpc_call_list *call_list);
+ grpc_closure_list *closure_list);
static void security_handshake_done(grpc_security_handshake *h, int is_success,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
if (is_success) {
h->cb(h->user_data, GRPC_SECURITY_OK, h->wrapped_endpoint,
- h->secure_endpoint, call_list);
+ h->secure_endpoint, closure_list);
} else {
if (h->secure_endpoint != NULL) {
- grpc_endpoint_shutdown(h->secure_endpoint, call_list);
- grpc_endpoint_destroy(h->secure_endpoint, call_list);
+ grpc_endpoint_shutdown(h->secure_endpoint, closure_list);
+ grpc_endpoint_destroy(h->secure_endpoint, closure_list);
} else {
- grpc_endpoint_destroy(h->wrapped_endpoint, call_list);
+ grpc_endpoint_destroy(h->wrapped_endpoint, closure_list);
}
h->cb(h->user_data, GRPC_SECURITY_ERROR, h->wrapped_endpoint, NULL,
- call_list);
+ closure_list);
}
if (h->handshaker != NULL) tsi_handshaker_destroy(h->handshaker);
if (h->handshake_buffer != NULL) gpr_free(h->handshake_buffer);
@@ -89,13 +89,13 @@ static void security_handshake_done(grpc_security_handshake *h, int is_success,
}
static void on_peer_checked(void *user_data, grpc_security_status status,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
grpc_security_handshake *h = user_data;
tsi_frame_protector *protector;
tsi_result result;
if (status != GRPC_SECURITY_OK) {
gpr_log(GPR_ERROR, "Error checking peer.");
- security_handshake_done(h, 0, call_list);
+ security_handshake_done(h, 0, closure_list);
return;
}
result =
@@ -103,7 +103,7 @@ static void on_peer_checked(void *user_data, grpc_security_status status,
if (result != TSI_OK) {
gpr_log(GPR_ERROR, "Frame protector creation failed with error %s.",
tsi_result_to_string(result));
- security_handshake_done(h, 0, call_list);
+ security_handshake_done(h, 0, closure_list);
return;
}
h->secure_endpoint =
@@ -111,11 +111,12 @@ static void on_peer_checked(void *user_data, grpc_security_status status,
h->left_overs.slices, h->left_overs.count);
h->left_overs.count = 0;
h->left_overs.length = 0;
- security_handshake_done(h, 1, call_list);
+ security_handshake_done(h, 1, closure_list);
return;
}
-static void check_peer(grpc_security_handshake *h, grpc_call_list *call_list) {
+static void check_peer(grpc_security_handshake *h,
+ grpc_closure_list *closure_list) {
grpc_security_status peer_status;
tsi_peer peer;
tsi_result result = tsi_handshaker_extract_peer(h->handshaker, &peer);
@@ -123,22 +124,22 @@ static void check_peer(grpc_security_handshake *h, grpc_call_list *call_list) {
if (result != TSI_OK) {
gpr_log(GPR_ERROR, "Peer extraction failed with error %s",
tsi_result_to_string(result));
- security_handshake_done(h, 0, call_list);
+ security_handshake_done(h, 0, closure_list);
return;
}
peer_status = grpc_security_connector_check_peer(h->connector, peer,
on_peer_checked, h);
if (peer_status == GRPC_SECURITY_ERROR) {
gpr_log(GPR_ERROR, "Peer check failed.");
- security_handshake_done(h, 0, call_list);
+ security_handshake_done(h, 0, closure_list);
return;
} else if (peer_status == GRPC_SECURITY_OK) {
- on_peer_checked(h, peer_status, call_list);
+ on_peer_checked(h, peer_status, closure_list);
}
}
static void send_handshake_bytes_to_peer(grpc_security_handshake *h,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
size_t offset = 0;
tsi_result result = TSI_OK;
gpr_slice to_send;
@@ -158,7 +159,7 @@ static void send_handshake_bytes_to_peer(grpc_security_handshake *h,
if (result != TSI_OK) {
gpr_log(GPR_ERROR, "Handshake failed with error %s",
tsi_result_to_string(result));
- security_handshake_done(h, 0, call_list);
+ security_handshake_done(h, 0, closure_list);
return;
}
@@ -169,11 +170,11 @@ static void send_handshake_bytes_to_peer(grpc_security_handshake *h,
/* TODO(klempner,jboeuf): This should probably use the client setup
deadline */
grpc_endpoint_write(h->wrapped_endpoint, &h->outgoing,
- &h->on_handshake_data_sent_to_peer, call_list);
+ &h->on_handshake_data_sent_to_peer, closure_list);
}
-static void on_handshake_data_received_from_peer(void *handshake, int success,
- grpc_call_list *call_list) {
+static void on_handshake_data_received_from_peer(
+ void *handshake, int success, grpc_closure_list *closure_list) {
grpc_security_handshake *h = handshake;
size_t consumed_slice_size = 0;
tsi_result result = TSI_OK;
@@ -183,7 +184,7 @@ static void on_handshake_data_received_from_peer(void *handshake, int success,
if (!success) {
gpr_log(GPR_ERROR, "Read failed.");
- security_handshake_done(h, 0, call_list);
+ security_handshake_done(h, 0, closure_list);
return;
}
@@ -199,10 +200,11 @@ static void on_handshake_data_received_from_peer(void *handshake, int success,
/* We may need more data. */
if (result == TSI_INCOMPLETE_DATA) {
grpc_endpoint_read(h->wrapped_endpoint, &h->incoming,
- &h->on_handshake_data_received_from_peer, call_list);
+ &h->on_handshake_data_received_from_peer,
+ closure_list);
return;
} else {
- send_handshake_bytes_to_peer(h, call_list);
+ send_handshake_bytes_to_peer(h, closure_list);
return;
}
}
@@ -210,7 +212,7 @@ static void on_handshake_data_received_from_peer(void *handshake, int success,
if (result != TSI_OK) {
gpr_log(GPR_ERROR, "Handshake failed with error %s",
tsi_result_to_string(result));
- security_handshake_done(h, 0, call_list);
+ security_handshake_done(h, 0, closure_list);
return;
}
@@ -220,7 +222,7 @@ static void on_handshake_data_received_from_peer(void *handshake, int success,
num_left_overs =
(has_left_overs_in_current_slice ? 1 : 0) + h->incoming.count - i - 1;
if (num_left_overs == 0) {
- check_peer(h, call_list);
+ check_peer(h, closure_list);
return;
}
@@ -235,18 +237,18 @@ static void on_handshake_data_received_from_peer(void *handshake, int success,
gpr_slice_buffer_addn(
&h->left_overs, &h->incoming.slices[i + 1],
num_left_overs - (size_t)has_left_overs_in_current_slice);
- check_peer(h, call_list);
+ check_peer(h, closure_list);
}
/* If handshake is NULL, the handshake is done. */
static void on_handshake_data_sent_to_peer(void *handshake, int success,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
grpc_security_handshake *h = handshake;
/* Make sure that write is OK. */
if (!success) {
gpr_log(GPR_ERROR, "Write failed.");
- if (handshake != NULL) security_handshake_done(h, 0, call_list);
+ if (handshake != NULL) security_handshake_done(h, 0, closure_list);
return;
}
@@ -255,9 +257,9 @@ static void on_handshake_data_sent_to_peer(void *handshake, int success,
/* TODO(klempner,jboeuf): This should probably use the client setup
deadline */
grpc_endpoint_read(h->wrapped_endpoint, &h->incoming,
- &h->on_handshake_data_received_from_peer, call_list);
+ &h->on_handshake_data_received_from_peer, closure_list);
} else {
- check_peer(h, call_list);
+ check_peer(h, closure_list);
}
}
@@ -265,7 +267,8 @@ void grpc_do_security_handshake(tsi_handshaker *handshaker,
grpc_security_connector *connector,
grpc_endpoint *nonsecure_endpoint,
grpc_security_handshake_done_cb cb,
- void *user_data, grpc_call_list *call_list) {
+ void *user_data,
+ grpc_closure_list *closure_list) {
grpc_security_handshake *h = gpr_malloc(sizeof(grpc_security_handshake));
memset(h, 0, sizeof(grpc_security_handshake));
h->handshaker = handshaker;
@@ -282,5 +285,5 @@ void grpc_do_security_handshake(tsi_handshaker *handshaker,
gpr_slice_buffer_init(&h->left_overs);
gpr_slice_buffer_init(&h->outgoing);
gpr_slice_buffer_init(&h->incoming);
- send_handshake_bytes_to_peer(h, call_list);
+ send_handshake_bytes_to_peer(h, closure_list);
}
diff --git a/src/core/security/handshake.h b/src/core/security/handshake.h
index d492de5059..368e8bf5e1 100644
--- a/src/core/security/handshake.h
+++ b/src/core/security/handshake.h
@@ -42,6 +42,7 @@ void grpc_do_security_handshake(tsi_handshaker *handshaker,
grpc_security_connector *connector,
grpc_endpoint *nonsecure_endpoint,
grpc_security_handshake_done_cb cb,
- void *user_data, grpc_call_list *call_list);
+ void *user_data,
+ grpc_closure_list *closure_list);
#endif /* GRPC_INTERNAL_CORE_SECURITY_HANDSHAKE_H */
diff --git a/src/core/security/jwt_verifier.c b/src/core/security/jwt_verifier.c
index a6736c922c..be86169346 100644
--- a/src/core/security/jwt_verifier.c
+++ b/src/core/security/jwt_verifier.c
@@ -571,7 +571,7 @@ end:
static void on_keys_retrieved(void *user_data,
const grpc_httpcli_response *response,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
grpc_json *json = json_from_http(response);
verifier_cb_ctx *ctx = (verifier_cb_ctx *)user_data;
EVP_PKEY *verification_key = NULL;
@@ -613,7 +613,7 @@ end:
static void on_openid_config_retrieved(void *user_data,
const grpc_httpcli_response *response,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
const grpc_json *cur;
grpc_json *json = json_from_http(response);
verifier_cb_ctx *ctx = (verifier_cb_ctx *)user_data;
@@ -645,7 +645,7 @@ static void on_openid_config_retrieved(void *user_data,
grpc_httpcli_get(
&ctx->verifier->http_ctx, ctx->pollset, &req,
gpr_time_add(gpr_now(GPR_CLOCK_REALTIME), grpc_jwt_verifier_max_delay),
- on_keys_retrieved, ctx, call_list);
+ on_keys_retrieved, ctx, closure_list);
grpc_json_destroy(json);
gpr_free(req.host);
return;
@@ -685,7 +685,7 @@ static void verifier_put_mapping(grpc_jwt_verifier *v, const char *email_domain,
/* Takes ownership of ctx. */
static void retrieve_key_and_verify(verifier_cb_ctx *ctx,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
const char *at_sign;
grpc_httpcli_response_cb http_cb;
char *path_prefix = NULL;
@@ -748,7 +748,7 @@ static void retrieve_key_and_verify(verifier_cb_ctx *ctx,
grpc_httpcli_get(
&ctx->verifier->http_ctx, ctx->pollset, &req,
gpr_time_add(gpr_now(GPR_CLOCK_REALTIME), grpc_jwt_verifier_max_delay),
- http_cb, ctx, call_list);
+ http_cb, ctx, closure_list);
gpr_free(req.host);
gpr_free(req.path);
return;
@@ -762,7 +762,7 @@ void grpc_jwt_verifier_verify(grpc_jwt_verifier *verifier,
grpc_pollset *pollset, const char *jwt,
const char *audience,
grpc_jwt_verification_done_cb cb, void *user_data,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
const char *dot = NULL;
grpc_json *json;
jose_header *header = NULL;
@@ -796,7 +796,7 @@ void grpc_jwt_verifier_verify(grpc_jwt_verifier *verifier,
retrieve_key_and_verify(
verifier_cb_ctx_create(verifier, pollset, header, claims, audience,
signature, jwt, signed_jwt_len, user_data, cb),
- call_list);
+ closure_list);
return;
error:
diff --git a/src/core/security/jwt_verifier.h b/src/core/security/jwt_verifier.h
index 394935302b..b270280cc1 100644
--- a/src/core/security/jwt_verifier.h
+++ b/src/core/security/jwt_verifier.h
@@ -124,7 +124,7 @@ void grpc_jwt_verifier_verify(grpc_jwt_verifier *verifier,
grpc_pollset *pollset, const char *jwt,
const char *audience,
grpc_jwt_verification_done_cb cb, void *user_data,
- grpc_call_list *call_list);
+ grpc_closure_list *closure_list);
/* --- TESTING ONLY exposed functions. --- */
diff --git a/src/core/security/secure_endpoint.c b/src/core/security/secure_endpoint.c
index a647345796..a6fc7e94a0 100644
--- a/src/core/security/secure_endpoint.c
+++ b/src/core/security/secure_endpoint.c
@@ -67,9 +67,10 @@ typedef struct {
int grpc_trace_secure_endpoint = 0;
-static void destroy(secure_endpoint *secure_ep, grpc_call_list *call_list) {
+static void destroy(secure_endpoint *secure_ep,
+ grpc_closure_list *closure_list) {
secure_endpoint *ep = secure_ep;
- grpc_endpoint_destroy(ep->wrapped_ep, call_list);
+ grpc_endpoint_destroy(ep->wrapped_ep, closure_list);
tsi_frame_protector_destroy(ep->protector);
gpr_slice_buffer_destroy(&ep->leftover_bytes);
gpr_slice_unref(ep->read_staging_buffer);
@@ -87,12 +88,13 @@ static void destroy(secure_endpoint *secure_ep, grpc_call_list *call_list) {
#define SECURE_ENDPOINT_REF(ep, reason) \
secure_endpoint_ref((ep), (reason), __FILE__, __LINE__)
static void secure_endpoint_unref(secure_endpoint *ep,
- grpc_call_list *call_list, const char *reason,
- const char *file, int line) {
+ grpc_closure_list *closure_list,
+ const char *reason, const char *file,
+ int line) {
gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, "SECENDP unref %p : %s %d -> %d",
ep, reason, ep->ref.count, ep->ref.count - 1);
if (gpr_unref(&ep->ref)) {
- destroy(ep, call_list);
+ destroy(ep, closure_list);
}
}
@@ -106,9 +108,9 @@ static void secure_endpoint_ref(secure_endpoint *ep, const char *reason,
#define SECURE_ENDPOINT_UNREF(ep, reason, cl) secure_endpoint_unref((ep), (cl))
#define SECURE_ENDPOINT_REF(ep, reason) secure_endpoint_ref((ep))
static void secure_endpoint_unref(secure_endpoint *ep,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
if (gpr_unref(&ep->ref)) {
- destroy(ep, call_list);
+ destroy(ep, closure_list);
}
}
@@ -124,7 +126,7 @@ static void flush_read_staging_buffer(secure_endpoint *ep, gpr_uint8 **cur,
}
static void call_read_cb(secure_endpoint *ep, int success,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
if (grpc_trace_secure_endpoint) {
size_t i;
for (i = 0; i < ep->read_buffer->count; i++) {
@@ -135,11 +137,12 @@ static void call_read_cb(secure_endpoint *ep, int success,
}
}
ep->read_buffer = NULL;
- grpc_call_list_add(call_list, ep->read_cb, success);
- SECURE_ENDPOINT_UNREF(ep, "read", call_list);
+ grpc_closure_list_add(closure_list, ep->read_cb, success);
+ SECURE_ENDPOINT_UNREF(ep, "read", closure_list);
}
-static void on_read(void *user_data, int success, grpc_call_list *call_list) {
+static void on_read(void *user_data, int success,
+ grpc_closure_list *closure_list) {
unsigned i;
gpr_uint8 keep_looping = 0;
tsi_result result = TSI_OK;
@@ -149,7 +152,7 @@ static void on_read(void *user_data, int success, grpc_call_list *call_list) {
if (!success) {
gpr_slice_buffer_reset_and_unref(ep->read_buffer);
- call_read_cb(ep, 0, call_list);
+ call_read_cb(ep, 0, closure_list);
return;
}
@@ -206,15 +209,15 @@ static void on_read(void *user_data, int success, grpc_call_list *call_list) {
if (result != TSI_OK) {
gpr_slice_buffer_reset_and_unref(ep->read_buffer);
- call_read_cb(ep, 0, call_list);
+ call_read_cb(ep, 0, closure_list);
return;
}
- call_read_cb(ep, 1, call_list);
+ call_read_cb(ep, 1, closure_list);
}
static void endpoint_read(grpc_endpoint *secure_ep, gpr_slice_buffer *slices,
- grpc_closure *cb, grpc_call_list *call_list) {
+ grpc_closure *cb, grpc_closure_list *closure_list) {
secure_endpoint *ep = (secure_endpoint *)secure_ep;
ep->read_cb = cb;
ep->read_buffer = slices;
@@ -224,12 +227,12 @@ static void endpoint_read(grpc_endpoint *secure_ep, gpr_slice_buffer *slices,
if (ep->leftover_bytes.count) {
gpr_slice_buffer_swap(&ep->leftover_bytes, &ep->source_buffer);
GPR_ASSERT(ep->leftover_bytes.count == 0);
- on_read(ep, 1, call_list);
+ on_read(ep, 1, closure_list);
return;
}
grpc_endpoint_read(ep->wrapped_ep, &ep->source_buffer, &ep->on_read,
- call_list);
+ closure_list);
}
static void flush_write_staging_buffer(secure_endpoint *ep, gpr_uint8 **cur,
@@ -241,7 +244,7 @@ static void flush_write_staging_buffer(secure_endpoint *ep, gpr_uint8 **cur,
}
static void endpoint_write(grpc_endpoint *secure_ep, gpr_slice_buffer *slices,
- grpc_closure *cb, grpc_call_list *call_list) {
+ grpc_closure *cb, grpc_closure_list *closure_list) {
unsigned i;
tsi_result result = TSI_OK;
secure_endpoint *ep = (secure_endpoint *)secure_ep;
@@ -313,37 +316,37 @@ static void endpoint_write(grpc_endpoint *secure_ep, gpr_slice_buffer *slices,
if (result != TSI_OK) {
/* TODO(yangg) do different things according to the error type? */
gpr_slice_buffer_reset_and_unref(&ep->output_buffer);
- grpc_call_list_add(call_list, cb, 0);
+ grpc_closure_list_add(closure_list, cb, 0);
return;
}
- grpc_endpoint_write(ep->wrapped_ep, &ep->output_buffer, cb, call_list);
+ grpc_endpoint_write(ep->wrapped_ep, &ep->output_buffer, cb, closure_list);
}
static void endpoint_shutdown(grpc_endpoint *secure_ep,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
secure_endpoint *ep = (secure_endpoint *)secure_ep;
- grpc_endpoint_shutdown(ep->wrapped_ep, call_list);
+ grpc_endpoint_shutdown(ep->wrapped_ep, closure_list);
}
static void endpoint_destroy(grpc_endpoint *secure_ep,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
secure_endpoint *ep = (secure_endpoint *)secure_ep;
- SECURE_ENDPOINT_UNREF(ep, "destroy", call_list);
+ SECURE_ENDPOINT_UNREF(ep, "destroy", closure_list);
}
static void endpoint_add_to_pollset(grpc_endpoint *secure_ep,
grpc_pollset *pollset,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
secure_endpoint *ep = (secure_endpoint *)secure_ep;
- grpc_endpoint_add_to_pollset(ep->wrapped_ep, pollset, call_list);
+ grpc_endpoint_add_to_pollset(ep->wrapped_ep, pollset, closure_list);
}
static void endpoint_add_to_pollset_set(grpc_endpoint *secure_ep,
grpc_pollset_set *pollset_set,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
secure_endpoint *ep = (secure_endpoint *)secure_ep;
- grpc_endpoint_add_to_pollset_set(ep->wrapped_ep, pollset_set, call_list);
+ grpc_endpoint_add_to_pollset_set(ep->wrapped_ep, pollset_set, closure_list);
}
static char *endpoint_get_peer(grpc_endpoint *secure_ep) {
diff --git a/src/core/security/security_connector.c b/src/core/security/security_connector.c
index 07e2490981..280036bc0e 100644
--- a/src/core/security/security_connector.c
+++ b/src/core/security/security_connector.c
@@ -106,11 +106,12 @@ void grpc_security_connector_do_handshake(grpc_security_connector *sc,
grpc_endpoint *nonsecure_endpoint,
grpc_security_handshake_done_cb cb,
void *user_data,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
if (sc == NULL || nonsecure_endpoint == NULL) {
- cb(user_data, GRPC_SECURITY_ERROR, nonsecure_endpoint, NULL, call_list);
+ cb(user_data, GRPC_SECURITY_ERROR, nonsecure_endpoint, NULL, closure_list);
} else {
- sc->vtable->do_handshake(sc, nonsecure_endpoint, cb, user_data, call_list);
+ sc->vtable->do_handshake(sc, nonsecure_endpoint, cb, user_data,
+ closure_list);
}
}
@@ -126,9 +127,10 @@ grpc_security_status grpc_security_connector_check_peer(
grpc_security_status grpc_channel_security_connector_check_call_host(
grpc_channel_security_connector *sc, const char *host,
- grpc_security_check_cb cb, void *user_data, grpc_call_list *call_list) {
+ grpc_security_check_cb cb, void *user_data,
+ grpc_closure_list *closure_list) {
if (sc == NULL || sc->check_call_host == NULL) return GRPC_SECURITY_ERROR;
- return sc->check_call_host(sc, host, cb, user_data, call_list);
+ return sc->check_call_host(sc, host, cb, user_data, closure_list);
}
#ifdef GRPC_SECURITY_CONNECTOR_REFCOUNT_DEBUG
@@ -270,11 +272,12 @@ end:
static grpc_security_status fake_channel_check_call_host(
grpc_channel_security_connector *sc, const char *host,
- grpc_security_check_cb cb, void *user_data, grpc_call_list *call_list) {
+ grpc_security_check_cb cb, void *user_data,
+ grpc_closure_list *closure_list) {
grpc_fake_channel_security_connector *c =
(grpc_fake_channel_security_connector *)sc;
if (c->call_host_check_is_async) {
- cb(user_data, GRPC_SECURITY_OK, call_list);
+ cb(user_data, GRPC_SECURITY_OK, closure_list);
return GRPC_SECURITY_PENDING;
} else {
return GRPC_SECURITY_OK;
@@ -285,18 +288,18 @@ static void fake_channel_do_handshake(grpc_security_connector *sc,
grpc_endpoint *nonsecure_endpoint,
grpc_security_handshake_done_cb cb,
void *user_data,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
grpc_do_security_handshake(tsi_create_fake_handshaker(1), sc,
- nonsecure_endpoint, cb, user_data, call_list);
+ nonsecure_endpoint, cb, user_data, closure_list);
}
static void fake_server_do_handshake(grpc_security_connector *sc,
grpc_endpoint *nonsecure_endpoint,
grpc_security_handshake_done_cb cb,
void *user_data,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
grpc_do_security_handshake(tsi_create_fake_handshaker(0), sc,
- nonsecure_endpoint, cb, user_data, call_list);
+ nonsecure_endpoint, cb, user_data, closure_list);
}
static grpc_security_connector_vtable fake_channel_vtable = {
@@ -389,7 +392,7 @@ static void ssl_channel_do_handshake(grpc_security_connector *sc,
grpc_endpoint *nonsecure_endpoint,
grpc_security_handshake_done_cb cb,
void *user_data,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
grpc_ssl_channel_security_connector *c =
(grpc_ssl_channel_security_connector *)sc;
tsi_handshaker *handshaker;
@@ -399,10 +402,10 @@ static void ssl_channel_do_handshake(grpc_security_connector *sc,
: c->target_name,
&handshaker);
if (status != GRPC_SECURITY_OK) {
- cb(user_data, status, nonsecure_endpoint, NULL, call_list);
+ cb(user_data, status, nonsecure_endpoint, NULL, closure_list);
} else {
grpc_do_security_handshake(handshaker, sc, nonsecure_endpoint, cb,
- user_data, call_list);
+ user_data, closure_list);
}
}
@@ -410,17 +413,17 @@ static void ssl_server_do_handshake(grpc_security_connector *sc,
grpc_endpoint *nonsecure_endpoint,
grpc_security_handshake_done_cb cb,
void *user_data,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
grpc_ssl_server_security_connector *c =
(grpc_ssl_server_security_connector *)sc;
tsi_handshaker *handshaker;
grpc_security_status status =
ssl_create_handshaker(c->handshaker_factory, 0, NULL, &handshaker);
if (status != GRPC_SECURITY_OK) {
- cb(user_data, status, nonsecure_endpoint, NULL, call_list);
+ cb(user_data, status, nonsecure_endpoint, NULL, closure_list);
} else {
grpc_do_security_handshake(handshaker, sc, nonsecure_endpoint, cb,
- user_data, call_list);
+ user_data, closure_list);
}
}
@@ -529,7 +532,8 @@ static grpc_security_status ssl_server_check_peer(grpc_security_connector *sc,
static grpc_security_status ssl_channel_check_call_host(
grpc_channel_security_connector *sc, const char *host,
- grpc_security_check_cb cb, void *user_data, grpc_call_list *call_list) {
+ grpc_security_check_cb cb, void *user_data,
+ grpc_closure_list *closure_list) {
grpc_ssl_channel_security_connector *c =
(grpc_ssl_channel_security_connector *)sc;
diff --git a/src/core/security/security_connector.h b/src/core/security/security_connector.h
index 276fa47940..0f161d0e37 100644
--- a/src/core/security/security_connector.h
+++ b/src/core/security/security_connector.h
@@ -62,21 +62,20 @@ typedef struct grpc_security_connector grpc_security_connector;
typedef void (*grpc_security_check_cb)(void *user_data,
grpc_security_status status,
- grpc_call_list *call_list);
+ grpc_closure_list *closure_list);
/* Ownership of the secure_endpoint is transfered. */
-typedef void (*grpc_security_handshake_done_cb)(void *user_data,
- grpc_security_status status,
- grpc_endpoint *wrapped_endpoint,
- grpc_endpoint *secure_endpoint,
- grpc_call_list *call_list);
+typedef void (*grpc_security_handshake_done_cb)(
+ void *user_data, grpc_security_status status,
+ grpc_endpoint *wrapped_endpoint, grpc_endpoint *secure_endpoint,
+ grpc_closure_list *closure_list);
typedef struct {
void (*destroy)(grpc_security_connector *sc);
void (*do_handshake)(grpc_security_connector *sc,
grpc_endpoint *nonsecure_endpoint,
grpc_security_handshake_done_cb cb, void *user_data,
- grpc_call_list *call_list);
+ grpc_closure_list *closure_list);
grpc_security_status (*check_peer)(grpc_security_connector *sc, tsi_peer peer,
grpc_security_check_cb cb,
void *user_data);
@@ -115,7 +114,7 @@ void grpc_security_connector_do_handshake(grpc_security_connector *connector,
grpc_endpoint *nonsecure_endpoint,
grpc_security_handshake_done_cb cb,
void *user_data,
- grpc_call_list *call_list);
+ grpc_closure_list *closure_list);
/* Check the peer.
Implementations can choose to check the peer either synchronously or
@@ -152,7 +151,7 @@ struct grpc_channel_security_connector {
const char *host,
grpc_security_check_cb cb,
void *user_data,
- grpc_call_list *call_list);
+ grpc_closure_list *closure_list);
};
/* Checks that the host that will be set for a call is acceptable.
@@ -162,7 +161,8 @@ struct grpc_channel_security_connector {
GRPC_SECURITY_PENDING unless an error is detected early on. */
grpc_security_status grpc_channel_security_connector_check_call_host(
grpc_channel_security_connector *sc, const char *host,
- grpc_security_check_cb cb, void *user_data, grpc_call_list *call_list);
+ grpc_security_check_cb cb, void *user_data,
+ grpc_closure_list *closure_list);
/* --- Creation security connectors. --- */
diff --git a/src/core/security/server_auth_filter.c b/src/core/security/server_auth_filter.c
index 201288bbdd..e65578e479 100644
--- a/src/core/security/server_auth_filter.c
+++ b/src/core/security/server_auth_filter.c
@@ -116,7 +116,7 @@ static void on_md_processing_done(
grpc_status_code status, const char *error_details) {
grpc_call_element *elem = user_data;
call_data *calld = elem->call_data;
- grpc_call_list call_list = GRPC_CALL_LIST_INIT;
+ grpc_closure_list closure_list = GRPC_CLOSURE_LIST_INIT;
/* TODO(jboeuf): Implement support for response_md. */
if (response_md != NULL && num_response_md > 0) {
@@ -131,7 +131,7 @@ static void on_md_processing_done(
grpc_metadata_batch_filter(&calld->md_op->data.metadata, remove_consumed_md,
elem);
grpc_metadata_array_destroy(&calld->md);
- calld->on_done_recv->cb(calld->on_done_recv->cb_arg, 1, &call_list);
+ calld->on_done_recv->cb(calld->on_done_recv->cb_arg, 1, &closure_list);
} else {
gpr_slice message;
grpc_metadata_array_destroy(&calld->md);
@@ -141,14 +141,14 @@ static void on_md_processing_done(
message = gpr_slice_from_copied_string(error_details);
grpc_sopb_reset(calld->recv_ops);
grpc_transport_stream_op_add_close(&calld->transport_op, status, &message);
- grpc_call_next_op(elem, &calld->transport_op, &call_list);
+ grpc_call_next_op(elem, &calld->transport_op, &closure_list);
}
- grpc_call_list_run(&call_list);
+ grpc_closure_list_run(&closure_list);
}
static void auth_on_recv(void *user_data, int success,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
grpc_call_element *elem = user_data;
call_data *calld = elem->call_data;
channel_data *chand = elem->channel_data;
@@ -169,7 +169,7 @@ static void auth_on_recv(void *user_data, int success,
return;
}
}
- calld->on_done_recv->cb(calld->on_done_recv->cb_arg, success, call_list);
+ calld->on_done_recv->cb(calld->on_done_recv->cb_arg, success, closure_list);
}
static void set_recv_ops_md_callbacks(grpc_call_element *elem,
@@ -192,16 +192,16 @@ static void set_recv_ops_md_callbacks(grpc_call_element *elem,
that is being sent or received. */
static void auth_start_transport_op(grpc_call_element *elem,
grpc_transport_stream_op *op,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
set_recv_ops_md_callbacks(elem, op);
- grpc_call_next_op(elem, op, call_list);
+ grpc_call_next_op(elem, op, closure_list);
}
/* Constructor for call_data */
static void init_call_elem(grpc_call_element *elem,
const void *server_transport_data,
grpc_transport_stream_op *initial_op,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
/* grab pointers to our data from the call element */
call_data *calld = elem->call_data;
channel_data *chand = elem->channel_data;
@@ -235,13 +235,13 @@ static void init_call_elem(grpc_call_element *elem,
/* Destructor for call_data */
static void destroy_call_elem(grpc_call_element *elem,
- grpc_call_list *call_list) {}
+ grpc_closure_list *closure_list) {}
/* Constructor for channel_data */
static void init_channel_elem(grpc_channel_element *elem, grpc_channel *master,
const grpc_channel_args *args, grpc_mdctx *mdctx,
int is_first, int is_last,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
grpc_security_connector *sc = grpc_find_security_connector_in_args(args);
grpc_auth_metadata_processor *processor =
grpc_find_auth_metadata_processor_in_args(args);
@@ -266,7 +266,7 @@ static void init_channel_elem(grpc_channel_element *elem, grpc_channel *master,
/* Destructor for channel data */
static void destroy_channel_elem(grpc_channel_element *elem,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
/* grab pointers to our data from the channel element */
channel_data *chand = elem->channel_data;
GRPC_SECURITY_CONNECTOR_UNREF(chand->security_connector,
diff --git a/src/core/security/server_secure_chttp2.c b/src/core/security/server_secure_chttp2.c
index 2ecb615140..268ae58280 100644
--- a/src/core/security/server_secure_chttp2.c
+++ b/src/core/security/server_secure_chttp2.c
@@ -86,7 +86,8 @@ static void state_unref(grpc_server_secure_state *state) {
}
static void setup_transport(void *statep, grpc_transport *transport,
- grpc_mdctx *mdctx, grpc_call_list *call_list) {
+ grpc_mdctx *mdctx,
+ grpc_closure_list *closure_list) {
static grpc_channel_filter const *extra_filters[] = {
&grpc_server_auth_filter, &grpc_http_server_filter};
grpc_server_secure_state *state = statep;
@@ -100,7 +101,7 @@ static void setup_transport(void *statep, grpc_transport *transport,
GPR_ARRAY_SIZE(args_to_add));
grpc_server_setup_transport(state->server, transport, extra_filters,
GPR_ARRAY_SIZE(extra_filters), mdctx, args_copy,
- call_list);
+ closure_list);
grpc_channel_args_destroy(args_copy);
}
@@ -128,7 +129,7 @@ static int remove_tcp_from_list_locked(grpc_server_secure_state *state,
static void on_secure_handshake_done(void *statep, grpc_security_status status,
grpc_endpoint *wrapped_endpoint,
grpc_endpoint *secure_endpoint,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
grpc_server_secure_state *state = statep;
grpc_transport *transport;
grpc_mdctx *mdctx;
@@ -139,13 +140,13 @@ static void on_secure_handshake_done(void *statep, grpc_security_status status,
mdctx = grpc_mdctx_create();
transport = grpc_create_chttp2_transport(
grpc_server_get_channel_args(state->server), secure_endpoint, mdctx,
- 0, call_list);
- setup_transport(state, transport, mdctx, call_list);
- grpc_chttp2_transport_start_reading(transport, NULL, 0, call_list);
+ 0, closure_list);
+ setup_transport(state, transport, mdctx, closure_list);
+ grpc_chttp2_transport_start_reading(transport, NULL, 0, closure_list);
} else {
/* We need to consume this here, because the server may already have gone
* away. */
- grpc_endpoint_destroy(secure_endpoint, call_list);
+ grpc_endpoint_destroy(secure_endpoint, closure_list);
}
gpr_mu_unlock(&state->mu);
} else {
@@ -158,7 +159,7 @@ static void on_secure_handshake_done(void *statep, grpc_security_status status,
}
static void on_accept(void *statep, grpc_endpoint *tcp,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
grpc_server_secure_state *state = statep;
tcp_endpoint_list *node;
state_ref(state);
@@ -169,25 +170,26 @@ static void on_accept(void *statep, grpc_endpoint *tcp,
state->handshaking_tcp_endpoints = node;
gpr_mu_unlock(&state->mu);
grpc_security_connector_do_handshake(state->sc, tcp, on_secure_handshake_done,
- state, call_list);
+ state, closure_list);
}
/* Server callback: start listening on our ports */
static void start(grpc_server *server, void *statep, grpc_pollset **pollsets,
- size_t pollset_count, grpc_call_list *call_list) {
+ size_t pollset_count, grpc_closure_list *closure_list) {
grpc_server_secure_state *state = statep;
grpc_tcp_server_start(state->tcp, pollsets, pollset_count, on_accept, state,
- call_list);
+ closure_list);
}
-static void destroy_done(void *statep, int success, grpc_call_list *call_list) {
+static void destroy_done(void *statep, int success,
+ grpc_closure_list *closure_list) {
grpc_server_secure_state *state = statep;
state->destroy_callback->cb(state->destroy_callback->cb_arg, success,
- call_list);
+ closure_list);
gpr_mu_lock(&state->mu);
while (state->handshaking_tcp_endpoints != NULL) {
grpc_endpoint_shutdown(state->handshaking_tcp_endpoints->tcp_endpoint,
- call_list);
+ closure_list);
remove_tcp_from_list_locked(state,
state->handshaking_tcp_endpoints->tcp_endpoint);
}
@@ -198,7 +200,7 @@ static void destroy_done(void *statep, int success, grpc_call_list *call_list) {
/* Server callback: destroy the tcp listener (so we don't generate further
callbacks) */
static void destroy(grpc_server *server, void *statep, grpc_closure *callback,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
grpc_server_secure_state *state = statep;
grpc_tcp_server *tcp;
gpr_mu_lock(&state->mu);
@@ -207,7 +209,7 @@ static void destroy(grpc_server *server, void *statep, grpc_closure *callback,
tcp = state->tcp;
gpr_mu_unlock(&state->mu);
grpc_closure_init(&state->destroy_closure, destroy_done, state);
- grpc_tcp_server_destroy(tcp, &state->destroy_closure, call_list);
+ grpc_tcp_server_destroy(tcp, &state->destroy_closure, closure_list);
}
int grpc_server_add_secure_http2_port(grpc_server *server, const char *addr,
@@ -221,7 +223,7 @@ int grpc_server_add_secure_http2_port(grpc_server *server, const char *addr,
int port_temp;
grpc_security_status status = GRPC_SECURITY_ERROR;
grpc_security_connector *sc = NULL;
- grpc_call_list call_list = GRPC_CALL_LIST_INIT;
+ grpc_closure_list closure_list = GRPC_CLOSURE_LIST_INIT;
/* create security context */
if (creds == NULL) goto error;
@@ -282,9 +284,9 @@ int grpc_server_add_secure_http2_port(grpc_server *server, const char *addr,
gpr_ref_init(&state->refcount, 1);
/* Register with the server only upon success */
- grpc_server_add_listener(server, state, start, destroy, &call_list);
+ grpc_server_add_listener(server, state, start, destroy, &closure_list);
- grpc_call_list_run(&call_list);
+ grpc_closure_list_run(&closure_list);
return port_num;
/* Error path: cleanup and return */
@@ -296,11 +298,11 @@ error:
grpc_resolved_addresses_destroy(resolved);
}
if (tcp) {
- grpc_tcp_server_destroy(tcp, NULL, &call_list);
+ grpc_tcp_server_destroy(tcp, NULL, &closure_list);
}
if (state) {
gpr_free(state);
}
- grpc_call_list_run(&call_list);
+ grpc_closure_list_run(&closure_list);
return 0;
}
diff --git a/src/core/surface/call.c b/src/core/surface/call.c
index 9920e0daaf..1e371a4cbc 100644
--- a/src/core/surface/call.c
+++ b/src/core/surface/call.c
@@ -277,24 +277,24 @@ struct grpc_call {
CALL_FROM_CALL_STACK(grpc_call_stack_from_top_element(top_elem))
static void set_deadline_alarm(grpc_call *call, gpr_timespec deadline,
- grpc_call_list *call_list);
+ grpc_closure_list *closure_list);
static void call_on_done_recv(void *call, int success,
- grpc_call_list *call_list);
+ grpc_closure_list *closure_list);
static void call_on_done_send(void *call, int success,
- grpc_call_list *call_list);
+ grpc_closure_list *closure_list);
static int fill_send_ops(grpc_call *call, grpc_transport_stream_op *op);
static void execute_op(grpc_call *call, grpc_transport_stream_op *op,
- grpc_call_list *call_list);
+ grpc_closure_list *closure_list);
static void recv_metadata(grpc_call *call, grpc_metadata_batch *metadata,
- grpc_call_list *call_list);
+ grpc_closure_list *closure_list);
static void finish_read_ops(grpc_call *call);
static grpc_call_error cancel_with_status(grpc_call *c, grpc_status_code status,
const char *description);
static void finished_loose_op(void *call, int success,
- grpc_call_list *call_list);
+ grpc_closure_list *closure_list);
static void lock(grpc_call *call);
-static void unlock(grpc_call *call, grpc_call_list *call_list);
+static void unlock(grpc_call *call, grpc_closure_list *closure_list);
grpc_call *grpc_call_create(grpc_channel *channel, grpc_call *parent_call,
gpr_uint32 propagation_mask,
@@ -307,7 +307,7 @@ grpc_call *grpc_call_create(grpc_channel *channel, grpc_call *parent_call,
grpc_transport_stream_op initial_op;
grpc_transport_stream_op *initial_op_ptr = NULL;
grpc_channel_stack *channel_stack = grpc_channel_get_channel_stack(channel);
- grpc_call_list call_list = GRPC_CALL_LIST_INIT;
+ grpc_closure_list closure_list = GRPC_CLOSURE_LIST_INIT;
grpc_call *call =
gpr_malloc(sizeof(grpc_call) + channel_stack->call_stack_size);
memset(call, 0, sizeof(grpc_call));
@@ -356,7 +356,7 @@ grpc_call *grpc_call_create(grpc_channel *channel, grpc_call *parent_call,
initial_op_ptr = &initial_op;
}
grpc_call_stack_init(channel_stack, server_transport_data, initial_op_ptr,
- CALL_STACK_FROM_CALL(call), &call_list);
+ CALL_STACK_FROM_CALL(call), &closure_list);
if (parent_call != NULL) {
GRPC_CALL_INTERNAL_REF(parent_call, "child");
GPR_ASSERT(call->is_client);
@@ -400,20 +400,20 @@ grpc_call *grpc_call_create(grpc_channel *channel, grpc_call *parent_call,
}
if (gpr_time_cmp(send_deadline, gpr_inf_future(send_deadline.clock_type)) !=
0) {
- set_deadline_alarm(call, send_deadline, &call_list);
+ set_deadline_alarm(call, send_deadline, &closure_list);
}
- grpc_call_list_run(&call_list);
+ grpc_closure_list_run(&closure_list);
return call;
}
void grpc_call_set_completion_queue(grpc_call *call, grpc_completion_queue *cq,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
lock(call);
call->cq = cq;
if (cq) {
GRPC_CQ_INTERNAL_REF(cq, "bind");
}
- unlock(call, call_list);
+ unlock(call, closure_list);
}
grpc_completion_queue *grpc_call_get_completion_queue(grpc_call *call) {
@@ -436,13 +436,13 @@ static grpc_cq_completion *allocate_completion(grpc_call *call) {
}
static void done_completion(void *call, grpc_cq_completion *completion,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
grpc_call *c = call;
gpr_mu_lock(&c->completion_mu);
c->allocated_completions &=
(gpr_uint8) ~(1u << (completion - c->completions));
gpr_mu_unlock(&c->completion_mu);
- GRPC_CALL_INTERNAL_UNREF(c, "completion", call_list);
+ GRPC_CALL_INTERNAL_UNREF(c, "completion", closure_list);
}
#ifdef GRPC_CALL_REF_COUNT_DEBUG
@@ -455,11 +455,11 @@ void grpc_call_internal_ref(grpc_call *c) {
gpr_ref(&c->internal_refcount);
}
-static void destroy_call(grpc_call *call, grpc_call_list *call_list) {
+static void destroy_call(grpc_call *call, grpc_closure_list *closure_list) {
size_t i;
grpc_call *c = call;
- grpc_call_stack_destroy(CALL_STACK_FROM_CALL(c), call_list);
- GRPC_CHANNEL_INTERNAL_UNREF(c->channel, "call", call_list);
+ grpc_call_stack_destroy(CALL_STACK_FROM_CALL(c), closure_list);
+ GRPC_CHANNEL_INTERNAL_UNREF(c->channel, "call", closure_list);
gpr_mu_destroy(&c->mu);
gpr_mu_destroy(&c->completion_mu);
for (i = 0; i < STATUS_SOURCE_COUNT; i++) {
@@ -494,14 +494,14 @@ static void destroy_call(grpc_call *call, grpc_call_list *call_list) {
#ifdef GRPC_CALL_REF_COUNT_DEBUG
void grpc_call_internal_unref(grpc_call *c, const char *reason,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
gpr_log(GPR_DEBUG, "CALL: unref %p %d -> %d [%s]", c,
c->internal_refcount.count, c->internal_refcount.count - 1, reason);
#else
-void grpc_call_internal_unref(grpc_call *c, grpc_call_list *call_list) {
+void grpc_call_internal_unref(grpc_call *c, grpc_closure_list *closure_list) {
#endif
if (gpr_unref(&c->internal_refcount)) {
- destroy_call(c, call_list);
+ destroy_call(c, closure_list);
}
}
@@ -600,7 +600,7 @@ static int need_more_data(grpc_call *call) {
(call->cancel_with_status != GRPC_STATUS_OK) || call->destroy_called;
}
-static void unlock(grpc_call *call, grpc_call_list *call_list) {
+static void unlock(grpc_call *call, grpc_closure_list *closure_list) {
grpc_transport_stream_op op;
completed_request completed_requests[GRPC_IOREQ_OP_COUNT];
int completing_requests = 0;
@@ -665,19 +665,19 @@ static void unlock(grpc_call *call, grpc_call_list *call_list) {
gpr_mu_unlock(&call->mu);
if (start_op) {
- execute_op(call, &op, call_list);
+ execute_op(call, &op, closure_list);
}
if (completing_requests > 0) {
for (i = 0; i < completing_requests; i++) {
completed_requests[i].on_complete(call, completed_requests[i].success,
completed_requests[i].user_data,
- call_list);
+ closure_list);
}
lock(call);
call->completing = 0;
- unlock(call, call_list);
- GRPC_CALL_INTERNAL_UNREF(call, "completing", call_list);
+ unlock(call, closure_list);
+ GRPC_CALL_INTERNAL_UNREF(call, "completing", closure_list);
}
}
@@ -823,7 +823,7 @@ static void early_out_write_ops(grpc_call *call) {
}
static void call_on_done_send(void *pc, int success,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
grpc_call *call = pc;
lock(call);
if (call->last_send_contains & (1 << GRPC_IOREQ_SEND_INITIAL_METADATA)) {
@@ -846,8 +846,8 @@ static void call_on_done_send(void *pc, int success,
call->send_ops.nops = 0;
call->last_send_contains = 0;
call->sending = 0;
- unlock(call, call_list);
- GRPC_CALL_INTERNAL_UNREF(call, "sending", call_list);
+ unlock(call, closure_list);
+ GRPC_CALL_INTERNAL_UNREF(call, "sending", closure_list);
}
static void finish_message(grpc_call *call) {
@@ -954,7 +954,7 @@ static int add_slice_to_message(grpc_call *call, gpr_slice slice) {
}
static void call_on_done_recv(void *pc, int success,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
grpc_call *call = pc;
grpc_call *child_call;
grpc_call *next_child_call;
@@ -969,7 +969,7 @@ static void call_on_done_recv(void *pc, int success,
case GRPC_NO_OP:
break;
case GRPC_OP_METADATA:
- recv_metadata(call, &op->data.metadata, call_list);
+ recv_metadata(call, &op->data.metadata, closure_list);
break;
case GRPC_OP_BEGIN_MESSAGE:
success = begin_message(call, op->data.begin_message);
@@ -991,7 +991,7 @@ static void call_on_done_recv(void *pc, int success,
GPR_ASSERT(call->read_state <= READ_STATE_STREAM_CLOSED);
call->read_state = READ_STATE_STREAM_CLOSED;
if (call->have_alarm) {
- grpc_alarm_cancel(&call->alarm, call_list);
+ grpc_alarm_cancel(&call->alarm, closure_list);
}
/* propagate cancellation to any interested children */
child_call = call->first_child;
@@ -1001,12 +1001,13 @@ static void call_on_done_recv(void *pc, int success,
if (child_call->cancellation_is_inherited) {
GRPC_CALL_INTERNAL_REF(child_call, "propagate_cancel");
grpc_call_cancel(child_call, NULL);
- GRPC_CALL_INTERNAL_UNREF(child_call, "propagate_cancel", call_list);
+ GRPC_CALL_INTERNAL_UNREF(child_call, "propagate_cancel",
+ closure_list);
}
child_call = next_child_call;
} while (child_call != call->first_child);
}
- GRPC_CALL_INTERNAL_UNREF(call, "closed", call_list);
+ GRPC_CALL_INTERNAL_UNREF(call, "closed", closure_list);
}
finish_read_ops(call);
} else {
@@ -1018,9 +1019,9 @@ static void call_on_done_recv(void *pc, int success,
finish_ioreq_op(call, GRPC_IOREQ_RECV_STATUS_DETAILS, 0);
}
call->recv_ops.nops = 0;
- unlock(call, call_list);
+ unlock(call, closure_list);
- GRPC_CALL_INTERNAL_UNREF(call, "receiving", call_list);
+ GRPC_CALL_INTERNAL_UNREF(call, "receiving", closure_list);
GRPC_TIMER_END(GRPC_PTAG_CALL_ON_DONE_RECV, 0);
}
@@ -1273,18 +1274,18 @@ static grpc_call_error start_ioreq(grpc_call *call, const grpc_ioreq *reqs,
grpc_call_error grpc_call_start_ioreq_and_call_back(
grpc_call *call, const grpc_ioreq *reqs, size_t nreqs,
grpc_ioreq_completion_func on_complete, void *user_data,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
grpc_call_error err;
lock(call);
err = start_ioreq(call, reqs, nreqs, on_complete, user_data);
- unlock(call, call_list);
+ unlock(call, closure_list);
return err;
}
void grpc_call_destroy(grpc_call *c) {
int cancel;
grpc_call *parent = c->parent;
- grpc_call_list call_list = GRPC_CALL_LIST_INIT;
+ grpc_closure_list closure_list = GRPC_CLOSURE_LIST_INIT;
if (parent) {
gpr_mu_lock(&parent->mu);
@@ -1297,20 +1298,20 @@ void grpc_call_destroy(grpc_call *c) {
c->sibling_next->sibling_prev = c->sibling_prev;
}
gpr_mu_unlock(&parent->mu);
- GRPC_CALL_INTERNAL_UNREF(parent, "child", &call_list);
+ GRPC_CALL_INTERNAL_UNREF(parent, "child", &closure_list);
}
lock(c);
GPR_ASSERT(!c->destroy_called);
c->destroy_called = 1;
if (c->have_alarm) {
- grpc_alarm_cancel(&c->alarm, &call_list);
+ grpc_alarm_cancel(&c->alarm, &closure_list);
}
cancel = c->read_state != READ_STATE_STREAM_CLOSED;
- unlock(c, &call_list);
+ unlock(c, &closure_list);
if (cancel) grpc_call_cancel(c, NULL);
- GRPC_CALL_INTERNAL_UNREF(c, "destroy", &call_list);
- grpc_call_list_run(&call_list);
+ GRPC_CALL_INTERNAL_UNREF(c, "destroy", &closure_list);
+ grpc_closure_list_run(&closure_list);
}
grpc_call_error grpc_call_cancel(grpc_call *call, void *reserved) {
@@ -1324,12 +1325,12 @@ grpc_call_error grpc_call_cancel_with_status(grpc_call *c,
const char *description,
void *reserved) {
grpc_call_error r;
- grpc_call_list call_list = GRPC_CALL_LIST_INIT;
+ grpc_closure_list closure_list = GRPC_CLOSURE_LIST_INIT;
GPR_ASSERT(reserved == NULL);
lock(c);
r = cancel_with_status(c, status, description);
- unlock(c, &call_list);
- grpc_call_list_run(&call_list);
+ unlock(c, &closure_list);
+ grpc_closure_list_run(&closure_list);
return r;
}
@@ -1350,8 +1351,8 @@ static grpc_call_error cancel_with_status(grpc_call *c, grpc_status_code status,
}
static void finished_loose_op(void *call, int success_ignored,
- grpc_call_list *call_list) {
- GRPC_CALL_INTERNAL_UNREF(call, "loose-op", call_list);
+ grpc_closure_list *closure_list) {
+ GRPC_CALL_INTERNAL_UNREF(call, "loose-op", closure_list);
}
typedef struct {
@@ -1360,14 +1361,14 @@ typedef struct {
} finished_loose_op_allocated_args;
static void finished_loose_op_allocated(void *alloc, int success,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
finished_loose_op_allocated_args *args = alloc;
- finished_loose_op(args->call, success, call_list);
+ finished_loose_op(args->call, success, closure_list);
gpr_free(args);
}
static void execute_op(grpc_call *call, grpc_transport_stream_op *op,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
grpc_call_element *elem;
GPR_ASSERT(op->on_consumed == NULL);
@@ -1385,14 +1386,14 @@ static void execute_op(grpc_call *call, grpc_transport_stream_op *op,
elem = CALL_ELEM_FROM_CALL(call, 0);
op->context = call->context;
- elem->filter->start_transport_stream_op(elem, op, call_list);
+ elem->filter->start_transport_stream_op(elem, op, closure_list);
}
char *grpc_call_get_peer(grpc_call *call) {
grpc_call_element *elem = CALL_ELEM_FROM_CALL(call, 0);
- grpc_call_list call_list = GRPC_CALL_LIST_INIT;
- char *result = elem->filter->get_peer(elem, &call_list);
- grpc_call_list_run(&call_list);
+ grpc_closure_list closure_list = GRPC_CLOSURE_LIST_INIT;
+ char *result = elem->filter->get_peer(elem, &closure_list);
+ grpc_closure_list_run(&closure_list);
return result;
}
@@ -1400,7 +1401,8 @@ grpc_call *grpc_call_from_top_element(grpc_call_element *elem) {
return CALL_FROM_TOP_ELEM(elem);
}
-static void call_alarm(void *arg, int success, grpc_call_list *call_list) {
+static void call_alarm(void *arg, int success,
+ grpc_closure_list *closure_list) {
grpc_call *call = arg;
lock(call);
call->have_alarm = 0;
@@ -1409,12 +1411,12 @@ static void call_alarm(void *arg, int success, grpc_call_list *call_list) {
"Deadline Exceeded");
}
finish_read_ops(call);
- unlock(call, call_list);
- GRPC_CALL_INTERNAL_UNREF(call, "alarm", call_list);
+ unlock(call, closure_list);
+ GRPC_CALL_INTERNAL_UNREF(call, "alarm", closure_list);
}
static void set_deadline_alarm(grpc_call *call, gpr_timespec deadline,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
if (call->have_alarm) {
gpr_log(GPR_ERROR, "Attempt to set deadline alarm twice");
assert(0);
@@ -1424,7 +1426,7 @@ static void set_deadline_alarm(grpc_call *call, gpr_timespec deadline,
call->have_alarm = 1;
call->send_deadline = gpr_convert_clock_type(deadline, GPR_CLOCK_MONOTONIC);
grpc_alarm_init(&call->alarm, call->send_deadline, call_alarm, call,
- gpr_now(GPR_CLOCK_MONOTONIC), call_list);
+ gpr_now(GPR_CLOCK_MONOTONIC), closure_list);
}
/* we offset status by a small amount when storing it into transport metadata
@@ -1476,7 +1478,7 @@ static gpr_uint32 decode_compression(grpc_mdelem *md) {
}
static void recv_metadata(grpc_call *call, grpc_metadata_batch *md,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
grpc_linked_mdelem *l;
grpc_metadata_array *dest;
grpc_metadata *mdusr;
@@ -1523,7 +1525,7 @@ static void recv_metadata(grpc_call *call, grpc_metadata_batch *md,
if (gpr_time_cmp(md->deadline, gpr_inf_future(md->deadline.clock_type)) !=
0 &&
!call->is_client) {
- set_deadline_alarm(call, md->deadline, call_list);
+ set_deadline_alarm(call, md->deadline, closure_list);
}
if (!is_trailing) {
call->read_state = READ_STATE_GOT_INITIAL_METADATA;
@@ -1556,15 +1558,15 @@ static void set_cancelled_value(grpc_status_code status, void *dest) {
}
static void finish_batch(grpc_call *call, int success, void *tag,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
grpc_cq_end_op(call->cq, tag, success, done_completion, call,
- allocate_completion(call), call_list);
+ allocate_completion(call), closure_list);
}
static void finish_batch_with_close(grpc_call *call, int success, void *tag,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
grpc_cq_end_op(call->cq, tag, 1, done_completion, call,
- allocate_completion(call), call_list);
+ allocate_completion(call), closure_list);
}
static int are_write_flags_valid(gpr_uint32 flags) {
@@ -1582,10 +1584,10 @@ grpc_call_error grpc_call_start_batch(grpc_call *call, const grpc_op *ops,
size_t out;
const grpc_op *op;
grpc_ioreq *req;
- void (*finish_func)(grpc_call *, int, void *, grpc_call_list *) =
+ void (*finish_func)(grpc_call *, int, void *, grpc_closure_list *) =
finish_batch;
grpc_call_error error;
- grpc_call_list call_list = GRPC_CALL_LIST_INIT;
+ grpc_closure_list closure_list = GRPC_CLOSURE_LIST_INIT;
if (reserved != NULL) {
error = GRPC_CALL_ERROR;
@@ -1598,7 +1600,7 @@ grpc_call_error grpc_call_start_batch(grpc_call *call, const grpc_op *ops,
grpc_cq_begin_op(call->cq);
GRPC_CALL_INTERNAL_REF(call, "completion");
grpc_cq_end_op(call->cq, tag, 1, done_completion, call,
- allocate_completion(call), &call_list);
+ allocate_completion(call), &closure_list);
error = GRPC_CALL_OK;
goto done;
}
@@ -1817,9 +1819,9 @@ grpc_call_error grpc_call_start_batch(grpc_call *call, const grpc_op *ops,
grpc_cq_begin_op(call->cq);
error = grpc_call_start_ioreq_and_call_back(call, reqs, out, finish_func, tag,
- &call_list);
+ &closure_list);
done:
- grpc_call_list_run(&call_list);
+ grpc_closure_list_run(&closure_list);
return error;
}
diff --git a/src/core/surface/call.h b/src/core/surface/call.h
index 144aa7cef2..4476ab915b 100644
--- a/src/core/surface/call.h
+++ b/src/core/surface/call.h
@@ -88,7 +88,7 @@ typedef struct {
typedef void (*grpc_ioreq_completion_func)(grpc_call *call, int success,
void *user_data,
- grpc_call_list *call_list);
+ grpc_closure_list *closure_list);
grpc_call *grpc_call_create(grpc_channel *channel, grpc_call *parent_call,
gpr_uint32 propagation_mask,
@@ -99,29 +99,29 @@ grpc_call *grpc_call_create(grpc_channel *channel, grpc_call *parent_call,
gpr_timespec send_deadline);
void grpc_call_set_completion_queue(grpc_call *call, grpc_completion_queue *cq,
- grpc_call_list *call_list);
+ grpc_closure_list *closure_list);
grpc_completion_queue *grpc_call_get_completion_queue(grpc_call *call);
#ifdef GRPC_CALL_REF_COUNT_DEBUG
void grpc_call_internal_ref(grpc_call *call, const char *reason);
void grpc_call_internal_unref(grpc_call *call, const char *reason,
- grpc_call_list *call_list);
+ grpc_closure_list *closure_list);
#define GRPC_CALL_INTERNAL_REF(call, reason) \
grpc_call_internal_ref(call, reason)
-#define GRPC_CALL_INTERNAL_UNREF(call, reason, call_list) \
- grpc_call_internal_unref(call, reason, call_list)
+#define GRPC_CALL_INTERNAL_UNREF(call, reason, closure_list) \
+ grpc_call_internal_unref(call, reason, closure_list)
#else
void grpc_call_internal_ref(grpc_call *call);
-void grpc_call_internal_unref(grpc_call *call, grpc_call_list *call_list);
+void grpc_call_internal_unref(grpc_call *call, grpc_closure_list *closure_list);
#define GRPC_CALL_INTERNAL_REF(call, reason) grpc_call_internal_ref(call)
-#define GRPC_CALL_INTERNAL_UNREF(call, reason, call_list) \
- grpc_call_internal_unref(call, call_list)
+#define GRPC_CALL_INTERNAL_UNREF(call, reason, closure_list) \
+ grpc_call_internal_unref(call, closure_list)
#endif
grpc_call_error grpc_call_start_ioreq_and_call_back(
grpc_call *call, const grpc_ioreq *reqs, size_t nreqs,
grpc_ioreq_completion_func on_complete, void *user_data,
- grpc_call_list *call_list);
+ grpc_closure_list *closure_list);
grpc_call_stack *grpc_call_get_call_stack(grpc_call *call);
diff --git a/src/core/surface/channel.c b/src/core/surface/channel.c
index b00096f6fa..1214425e09 100644
--- a/src/core/surface/channel.c
+++ b/src/core/surface/channel.c
@@ -92,7 +92,7 @@ struct grpc_channel {
grpc_channel *grpc_channel_create_from_filters(
const char *target, const grpc_channel_filter **filters, size_t num_filters,
const grpc_channel_args *args, grpc_mdctx *mdctx, int is_client,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
size_t i;
size_t size =
sizeof(grpc_channel) + grpc_channel_stack_size(filters, num_filters);
@@ -179,7 +179,7 @@ grpc_channel *grpc_channel_create_from_filters(
grpc_channel_stack_init(filters, num_filters, channel, args,
channel->metadata_context,
- CHANNEL_STACK_FROM_CHANNEL(channel), call_list);
+ CHANNEL_STACK_FROM_CHANNEL(channel), closure_list);
return channel;
}
@@ -270,9 +270,10 @@ void grpc_channel_internal_ref(grpc_channel *c) {
gpr_ref(&c->refs);
}
-static void destroy_channel(grpc_channel *channel, grpc_call_list *call_list) {
+static void destroy_channel(grpc_channel *channel,
+ grpc_closure_list *closure_list) {
size_t i;
- grpc_channel_stack_destroy(CHANNEL_STACK_FROM_CHANNEL(channel), call_list);
+ grpc_channel_stack_destroy(CHANNEL_STACK_FROM_CHANNEL(channel), closure_list);
for (i = 0; i < NUM_CACHED_STATUS_ELEMS; i++) {
GRPC_MDELEM_UNREF(channel->grpc_status_elem[i]);
}
@@ -302,30 +303,30 @@ static void destroy_channel(grpc_channel *channel, grpc_call_list *call_list) {
#ifdef GRPC_CHANNEL_REF_COUNT_DEBUG
void grpc_channel_internal_unref(grpc_channel *channel, const char *reason,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
gpr_log(GPR_DEBUG, "CHANNEL: unref %p %d -> %d [%s]", channel,
channel->refs.count, channel->refs.count - 1, reason);
#else
void grpc_channel_internal_unref(grpc_channel *channel,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
#endif
if (gpr_unref(&channel->refs)) {
- destroy_channel(channel, call_list);
+ destroy_channel(channel, closure_list);
}
}
void grpc_channel_destroy(grpc_channel *channel) {
grpc_transport_op op;
grpc_channel_element *elem;
- grpc_call_list call_list = GRPC_CALL_LIST_INIT;
+ grpc_closure_list closure_list = GRPC_CLOSURE_LIST_INIT;
memset(&op, 0, sizeof(op));
op.disconnect = 1;
elem = grpc_channel_stack_element(CHANNEL_STACK_FROM_CHANNEL(channel), 0);
- elem->filter->start_transport_op(elem, &op, &call_list);
+ elem->filter->start_transport_op(elem, &op, &closure_list);
- GRPC_CHANNEL_INTERNAL_UNREF(channel, "channel", &call_list);
+ GRPC_CHANNEL_INTERNAL_UNREF(channel, "channel", &closure_list);
- grpc_call_list_run(&call_list);
+ grpc_closure_list_run(&closure_list);
}
grpc_channel_stack *grpc_channel_get_channel_stack(grpc_channel *channel) {
diff --git a/src/core/surface/channel.h b/src/core/surface/channel.h
index 2a249c9c51..e9c2948147 100644
--- a/src/core/surface/channel.h
+++ b/src/core/surface/channel.h
@@ -40,7 +40,7 @@
grpc_channel *grpc_channel_create_from_filters(
const char *target, const grpc_channel_filter **filters, size_t count,
const grpc_channel_args *args, grpc_mdctx *mdctx, int is_client,
- grpc_call_list *call_list);
+ grpc_closure_list *closure_list);
/** Get a (borrowed) pointer to this channels underlying channel stack */
grpc_channel_stack *grpc_channel_get_channel_stack(grpc_channel *channel);
@@ -65,19 +65,19 @@ gpr_uint32 grpc_channel_get_max_message_length(grpc_channel *channel);
#ifdef GRPC_CHANNEL_REF_COUNT_DEBUG
void grpc_channel_internal_ref(grpc_channel *channel, const char *reason);
void grpc_channel_internal_unref(grpc_channel *channel, const char *reason,
- grpc_call_list *call_list);
+ grpc_closure_list *closure_list);
#define GRPC_CHANNEL_INTERNAL_REF(channel, reason) \
grpc_channel_internal_ref(channel, reason)
-#define GRPC_CHANNEL_INTERNAL_UNREF(channel, reason, call_list) \
- grpc_channel_internal_unref(channel, reason, call_list)
+#define GRPC_CHANNEL_INTERNAL_UNREF(channel, reason, closure_list) \
+ grpc_channel_internal_unref(channel, reason, closure_list)
#else
void grpc_channel_internal_ref(grpc_channel *channel);
void grpc_channel_internal_unref(grpc_channel *channel,
- grpc_call_list *call_list);
+ grpc_closure_list *closure_list);
#define GRPC_CHANNEL_INTERNAL_REF(channel, reason) \
grpc_channel_internal_ref(channel)
-#define GRPC_CHANNEL_INTERNAL_UNREF(channel, reason, call_list) \
- grpc_channel_internal_unref(channel, call_list)
+#define GRPC_CHANNEL_INTERNAL_UNREF(channel, reason, closure_list) \
+ grpc_channel_internal_unref(channel, closure_list)
#endif
#endif /* GRPC_INTERNAL_CORE_SURFACE_CHANNEL_H */
diff --git a/src/core/surface/channel_connectivity.c b/src/core/surface/channel_connectivity.c
index 3e34e84f60..d09e9bef79 100644
--- a/src/core/surface/channel_connectivity.c
+++ b/src/core/surface/channel_connectivity.c
@@ -45,7 +45,7 @@ grpc_connectivity_state grpc_channel_check_connectivity_state(
/* forward through to the underlying client channel */
grpc_channel_element *client_channel_elem =
grpc_channel_stack_last_element(grpc_channel_get_channel_stack(channel));
- grpc_call_list call_list = GRPC_CALL_LIST_INIT;
+ grpc_closure_list closure_list = GRPC_CLOSURE_LIST_INIT;
grpc_connectivity_state state;
if (client_channel_elem->filter != &grpc_client_channel_filter) {
gpr_log(GPR_ERROR,
@@ -55,8 +55,8 @@ grpc_connectivity_state grpc_channel_check_connectivity_state(
return GRPC_CHANNEL_FATAL_FAILURE;
}
state = grpc_client_channel_check_connectivity_state(
- client_channel_elem, try_to_connect, &call_list);
- grpc_call_list_run(&call_list);
+ client_channel_elem, try_to_connect, &closure_list);
+ grpc_closure_list_run(&closure_list);
return state;
}
@@ -81,14 +81,15 @@ typedef struct {
void *tag;
} state_watcher;
-static void delete_state_watcher(state_watcher *w, grpc_call_list *call_list) {
- GRPC_CHANNEL_INTERNAL_UNREF(w->channel, "watch_connectivity", call_list);
+static void delete_state_watcher(state_watcher *w,
+ grpc_closure_list *closure_list) {
+ GRPC_CHANNEL_INTERNAL_UNREF(w->channel, "watch_connectivity", closure_list);
gpr_mu_destroy(&w->mu);
gpr_free(w);
}
static void finished_completion(void *pw, grpc_cq_completion *ignored,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
int delete = 0;
state_watcher *w = pw;
gpr_mu_lock(&w->mu);
@@ -108,12 +109,12 @@ static void finished_completion(void *pw, grpc_cq_completion *ignored,
gpr_mu_unlock(&w->mu);
if (delete) {
- delete_state_watcher(w, call_list);
+ delete_state_watcher(w, closure_list);
}
}
static void partly_done(state_watcher *w, int due_to_completion,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
int delete = 0;
grpc_channel_element *client_channel_elem = NULL;
@@ -122,15 +123,15 @@ static void partly_done(state_watcher *w, int due_to_completion,
w->removed = 1;
client_channel_elem = grpc_channel_stack_last_element(
grpc_channel_get_channel_stack(w->channel));
- grpc_client_channel_del_interested_party(client_channel_elem,
- grpc_cq_pollset(w->cq), call_list);
+ grpc_client_channel_del_interested_party(
+ client_channel_elem, grpc_cq_pollset(w->cq), closure_list);
}
gpr_mu_unlock(&w->mu);
if (due_to_completion) {
gpr_mu_lock(&w->mu);
w->success = 1;
gpr_mu_unlock(&w->mu);
- grpc_alarm_cancel(&w->alarm, call_list);
+ grpc_alarm_cancel(&w->alarm, closure_list);
}
gpr_mu_lock(&w->mu);
@@ -138,7 +139,7 @@ static void partly_done(state_watcher *w, int due_to_completion,
case WAITING:
w->phase = CALLING_BACK;
grpc_cq_end_op(w->cq, w->tag, w->success, finished_completion, w,
- &w->completion_storage, call_list);
+ &w->completion_storage, closure_list);
break;
case CALLING_BACK:
w->phase = CALLING_BACK_AND_FINISHED;
@@ -154,16 +155,18 @@ static void partly_done(state_watcher *w, int due_to_completion,
gpr_mu_unlock(&w->mu);
if (delete) {
- delete_state_watcher(w, call_list);
+ delete_state_watcher(w, closure_list);
}
}
-static void watch_complete(void *pw, int success, grpc_call_list *call_list) {
- partly_done(pw, 1, call_list);
+static void watch_complete(void *pw, int success,
+ grpc_closure_list *closure_list) {
+ partly_done(pw, 1, closure_list);
}
-static void timeout_complete(void *pw, int success, grpc_call_list *call_list) {
- partly_done(pw, 0, call_list);
+static void timeout_complete(void *pw, int success,
+ grpc_closure_list *closure_list) {
+ partly_done(pw, 0, closure_list);
}
void grpc_channel_watch_connectivity_state(
@@ -171,7 +174,7 @@ void grpc_channel_watch_connectivity_state(
gpr_timespec deadline, grpc_completion_queue *cq, void *tag) {
grpc_channel_element *client_channel_elem =
grpc_channel_stack_last_element(grpc_channel_get_channel_stack(channel));
- grpc_call_list call_list = GRPC_CALL_LIST_INIT;
+ grpc_closure_list closure_list = GRPC_CLOSURE_LIST_INIT;
state_watcher *w = gpr_malloc(sizeof(*w));
grpc_cq_begin_op(cq);
@@ -188,21 +191,21 @@ void grpc_channel_watch_connectivity_state(
grpc_alarm_init(
&w->alarm, gpr_convert_clock_type(deadline, GPR_CLOCK_MONOTONIC),
- timeout_complete, w, gpr_now(GPR_CLOCK_MONOTONIC), &call_list);
+ timeout_complete, w, gpr_now(GPR_CLOCK_MONOTONIC), &closure_list);
if (client_channel_elem->filter != &grpc_client_channel_filter) {
gpr_log(GPR_ERROR,
"grpc_channel_watch_connectivity_state called on something that is "
"not a client channel, but '%s'",
client_channel_elem->filter->name);
- grpc_call_list_add(&call_list, &w->on_complete, 1);
+ grpc_closure_list_add(&closure_list, &w->on_complete, 1);
} else {
GRPC_CHANNEL_INTERNAL_REF(channel, "watch_connectivity");
- grpc_client_channel_add_interested_party(client_channel_elem,
- grpc_cq_pollset(cq), &call_list);
- grpc_client_channel_watch_connectivity_state(client_channel_elem, &w->state,
- &w->on_complete, &call_list);
+ grpc_client_channel_add_interested_party(
+ client_channel_elem, grpc_cq_pollset(cq), &closure_list);
+ grpc_client_channel_watch_connectivity_state(
+ client_channel_elem, &w->state, &w->on_complete, &closure_list);
}
- grpc_call_list_run(&call_list);
+ grpc_closure_list_run(&closure_list);
}
diff --git a/src/core/surface/channel_create.c b/src/core/surface/channel_create.c
index f48fa4ed83..fc9ed58491 100644
--- a/src/core/surface/channel_create.c
+++ b/src/core/surface/channel_create.c
@@ -68,7 +68,8 @@ static void connector_ref(grpc_connector *con) {
gpr_ref(&c->refs);
}
-static void connector_unref(grpc_connector *con, grpc_call_list *call_list) {
+static void connector_unref(grpc_connector *con,
+ grpc_closure_list *closure_list) {
connector *c = (connector *)con;
if (gpr_unref(&c->refs)) {
grpc_mdctx_unref(c->mdctx);
@@ -76,15 +77,15 @@ static void connector_unref(grpc_connector *con, grpc_call_list *call_list) {
}
}
-static void connected(void *arg, int success, grpc_call_list *call_list) {
+static void connected(void *arg, int success, grpc_closure_list *closure_list) {
connector *c = arg;
grpc_closure *notify;
grpc_endpoint *tcp = c->tcp;
if (tcp != NULL) {
c->result->transport = grpc_create_chttp2_transport(
- c->args.channel_args, tcp, c->mdctx, 1, call_list);
+ c->args.channel_args, tcp, c->mdctx, 1, closure_list);
grpc_chttp2_transport_start_reading(c->result->transport, NULL, 0,
- call_list);
+ closure_list);
GPR_ASSERT(c->result->transport);
c->result->filters = gpr_malloc(sizeof(grpc_channel_filter *));
c->result->filters[0] = &grpc_http_client_filter;
@@ -94,16 +95,17 @@ static void connected(void *arg, int success, grpc_call_list *call_list) {
}
notify = c->notify;
c->notify = NULL;
- notify->cb(notify->cb_arg, 1, call_list);
+ notify->cb(notify->cb_arg, 1, closure_list);
}
-static void connector_shutdown(grpc_connector *con, grpc_call_list *call_list) {
-}
+static void connector_shutdown(grpc_connector *con,
+ grpc_closure_list *closure_list) {}
static void connector_connect(grpc_connector *con,
const grpc_connect_in_args *args,
grpc_connect_out_args *result,
- grpc_closure *notify, grpc_call_list *call_list) {
+ grpc_closure *notify,
+ grpc_closure_list *closure_list) {
connector *c = (connector *)con;
GPR_ASSERT(c->notify == NULL);
GPR_ASSERT(notify->cb);
@@ -114,7 +116,7 @@ static void connector_connect(grpc_connector *con,
grpc_closure_init(&c->connected, connected, c);
grpc_tcp_client_connect(&c->connected, &c->tcp, args->interested_parties,
args->addr, args->addr_len, args->deadline,
- call_list);
+ closure_list);
}
static const grpc_connector_vtable connector_vtable = {
@@ -134,10 +136,10 @@ static void subchannel_factory_ref(grpc_subchannel_factory *scf) {
}
static void subchannel_factory_unref(grpc_subchannel_factory *scf,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
subchannel_factory *f = (subchannel_factory *)scf;
if (gpr_unref(&f->refs)) {
- GRPC_CHANNEL_INTERNAL_UNREF(f->master, "subchannel_factory", call_list);
+ GRPC_CHANNEL_INTERNAL_UNREF(f->master, "subchannel_factory", closure_list);
grpc_channel_args_destroy(f->merge_args);
grpc_mdctx_unref(f->mdctx);
gpr_free(f);
@@ -146,7 +148,7 @@ static void subchannel_factory_unref(grpc_subchannel_factory *scf,
static grpc_subchannel *subchannel_factory_create_subchannel(
grpc_subchannel_factory *scf, grpc_subchannel_args *args,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
subchannel_factory *f = (subchannel_factory *)scf;
connector *c = gpr_malloc(sizeof(*c));
grpc_channel_args *final_args =
@@ -161,7 +163,7 @@ static grpc_subchannel *subchannel_factory_create_subchannel(
args->args = final_args;
args->master = f->master;
s = grpc_subchannel_create(&c->base, args);
- grpc_connector_unref(&c->base, call_list);
+ grpc_connector_unref(&c->base, closure_list);
grpc_channel_args_destroy(final_args);
return s;
}
@@ -183,7 +185,7 @@ grpc_channel *grpc_insecure_channel_create(const char *target,
grpc_resolver *resolver;
subchannel_factory *f;
grpc_mdctx *mdctx = grpc_mdctx_create();
- grpc_call_list call_list = GRPC_CALL_LIST_INIT;
+ grpc_closure_list closure_list = GRPC_CLOSURE_LIST_INIT;
size_t n = 0;
GPR_ASSERT(!reserved);
if (grpc_channel_args_is_census_enabled(args)) {
@@ -194,7 +196,7 @@ grpc_channel *grpc_insecure_channel_create(const char *target,
GPR_ASSERT(n <= MAX_FILTERS);
channel = grpc_channel_create_from_filters(target, filters, n, args, mdctx, 1,
- &call_list);
+ &closure_list);
f = gpr_malloc(sizeof(*f));
f->base.vtable = &subchannel_factory_vtable;
@@ -210,11 +212,11 @@ grpc_channel *grpc_insecure_channel_create(const char *target,
}
grpc_client_channel_set_resolver(grpc_channel_get_channel_stack(channel),
- resolver, &call_list);
- GRPC_RESOLVER_UNREF(resolver, "create", &call_list);
- grpc_subchannel_factory_unref(&f->base, &call_list);
+ resolver, &closure_list);
+ GRPC_RESOLVER_UNREF(resolver, "create", &closure_list);
+ grpc_subchannel_factory_unref(&f->base, &closure_list);
- grpc_call_list_run(&call_list);
+ grpc_closure_list_run(&closure_list);
return channel;
}
diff --git a/src/core/surface/completion_queue.c b/src/core/surface/completion_queue.c
index 49dfc3c0e1..cb839b069d 100644
--- a/src/core/surface/completion_queue.c
+++ b/src/core/surface/completion_queue.c
@@ -71,7 +71,7 @@ struct grpc_completion_queue {
};
static void on_pollset_destroy_done(void *cc, int success,
- grpc_call_list *call_list);
+ grpc_closure_list *closure_list);
grpc_completion_queue *grpc_completion_queue_create(void *reserved) {
grpc_completion_queue *cc = gpr_malloc(sizeof(grpc_completion_queue));
@@ -100,7 +100,7 @@ void grpc_cq_internal_ref(grpc_completion_queue *cc) {
}
static void on_pollset_destroy_done(void *arg, int success,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
grpc_completion_queue *cc = arg;
GRPC_CQ_INTERNAL_UNREF(cc, "pollset_destroy");
}
@@ -134,9 +134,9 @@ void grpc_cq_begin_op(grpc_completion_queue *cc) {
/* Queue a GRPC_OP_COMPLETED operation */
void grpc_cq_end_op(grpc_completion_queue *cc, void *tag, int success,
void (*done)(void *done_arg, grpc_cq_completion *storage,
- grpc_call_list *call_list),
+ grpc_closure_list *closure_list),
void *done_arg, grpc_cq_completion *storage,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
int shutdown;
int i;
grpc_pollset_worker *pluck_worker;
@@ -170,7 +170,8 @@ void grpc_cq_end_op(grpc_completion_queue *cc, void *tag, int success,
GPR_ASSERT(cc->shutdown_called);
cc->shutdown = 1;
gpr_mu_unlock(GRPC_POLLSET_MU(&cc->pollset));
- grpc_pollset_shutdown(&cc->pollset, &cc->pollset_destroy_done, call_list);
+ grpc_pollset_shutdown(&cc->pollset, &cc->pollset_destroy_done,
+ closure_list);
}
}
@@ -180,7 +181,7 @@ grpc_event grpc_completion_queue_next(grpc_completion_queue *cc,
grpc_pollset_worker worker;
int first_loop = 1;
gpr_timespec now;
- grpc_call_list call_list = GRPC_CALL_LIST_INIT;
+ grpc_closure_list closure_list = GRPC_CLOSURE_LIST_INIT;
GPR_ASSERT(!reserved);
@@ -199,7 +200,7 @@ grpc_event grpc_completion_queue_next(grpc_completion_queue *cc,
ret.type = GRPC_OP_COMPLETE;
ret.success = c->next & 1u;
ret.tag = c->tag;
- c->done(c->done_arg, c, &call_list);
+ c->done(c->done_arg, c, &closure_list);
break;
}
if (cc->shutdown) {
@@ -216,11 +217,11 @@ grpc_event grpc_completion_queue_next(grpc_completion_queue *cc,
break;
}
first_loop = 0;
- grpc_pollset_work(&cc->pollset, &worker, now, deadline, &call_list);
+ grpc_pollset_work(&cc->pollset, &worker, now, deadline, &closure_list);
}
GRPC_SURFACE_TRACE_RETURNED_EVENT(cc, &ret);
GRPC_CQ_INTERNAL_UNREF(cc, "next");
- grpc_call_list_run(&call_list);
+ grpc_closure_list_run(&closure_list);
return ret;
}
@@ -257,7 +258,7 @@ grpc_event grpc_completion_queue_pluck(grpc_completion_queue *cc, void *tag,
grpc_pollset_worker worker;
gpr_timespec now;
int first_loop = 1;
- grpc_call_list call_list = GRPC_CALL_LIST_INIT;
+ grpc_closure_list closure_list = GRPC_CLOSURE_LIST_INIT;
GPR_ASSERT(!reserved);
@@ -279,7 +280,7 @@ grpc_event grpc_completion_queue_pluck(grpc_completion_queue *cc, void *tag,
ret.type = GRPC_OP_COMPLETE;
ret.success = c->next & 1u;
ret.tag = c->tag;
- c->done(c->done_arg, c, &call_list);
+ c->done(c->done_arg, c, &closure_list);
goto done;
}
prev = c;
@@ -310,20 +311,20 @@ grpc_event grpc_completion_queue_pluck(grpc_completion_queue *cc, void *tag,
break;
}
first_loop = 0;
- grpc_pollset_work(&cc->pollset, &worker, now, deadline, &call_list);
+ grpc_pollset_work(&cc->pollset, &worker, now, deadline, &closure_list);
del_plucker(cc, tag, &worker);
}
done:
GRPC_SURFACE_TRACE_RETURNED_EVENT(cc, &ret);
GRPC_CQ_INTERNAL_UNREF(cc, "pluck");
- grpc_call_list_run(&call_list);
+ grpc_closure_list_run(&closure_list);
return ret;
}
/* Shutdown simply drops a ref that we reserved at creation time; if we drop
to zero here, then enter shutdown mode and wake up any waiters */
void grpc_completion_queue_shutdown(grpc_completion_queue *cc) {
- grpc_call_list call_list = GRPC_CALL_LIST_INIT;
+ grpc_closure_list closure_list = GRPC_CLOSURE_LIST_INIT;
gpr_mu_lock(GRPC_POLLSET_MU(&cc->pollset));
if (cc->shutdown_called) {
gpr_mu_unlock(GRPC_POLLSET_MU(&cc->pollset));
@@ -337,9 +338,10 @@ void grpc_completion_queue_shutdown(grpc_completion_queue *cc) {
GPR_ASSERT(!cc->shutdown);
cc->shutdown = 1;
gpr_mu_unlock(GRPC_POLLSET_MU(&cc->pollset));
- grpc_pollset_shutdown(&cc->pollset, &cc->pollset_destroy_done, &call_list);
+ grpc_pollset_shutdown(&cc->pollset, &cc->pollset_destroy_done,
+ &closure_list);
}
- grpc_call_list_run(&call_list);
+ grpc_closure_list_run(&closure_list);
}
void grpc_completion_queue_destroy(grpc_completion_queue *cc) {
diff --git a/src/core/surface/completion_queue.h b/src/core/surface/completion_queue.h
index 6d8d1ce959..7e88b471da 100644
--- a/src/core/surface/completion_queue.h
+++ b/src/core/surface/completion_queue.h
@@ -45,7 +45,7 @@ typedef struct grpc_cq_completion {
/** done callback - called when this queue element is no longer
needed by the completion queue */
void (*done)(void *done_arg, struct grpc_cq_completion *c,
- grpc_call_list *call_list);
+ grpc_closure_list *closure_list);
void *done_arg;
/** next pointer; low bit is used to indicate success or not */
gpr_uintptr next;
@@ -74,9 +74,9 @@ void grpc_cq_begin_op(grpc_completion_queue *cc);
/* Queue a GRPC_OP_COMPLETED operation */
void grpc_cq_end_op(grpc_completion_queue *cc, void *tag, int success,
void (*done)(void *done_arg, grpc_cq_completion *storage,
- grpc_call_list *call_list),
+ grpc_closure_list *closure_list),
void *done_arg, grpc_cq_completion *storage,
- grpc_call_list *call_list);
+ grpc_closure_list *closure_list);
grpc_pollset *grpc_cq_pollset(grpc_completion_queue *cc);
diff --git a/src/core/surface/lame_client.c b/src/core/surface/lame_client.c
index 2af028960d..53334e7c5b 100644
--- a/src/core/surface/lame_client.c
+++ b/src/core/surface/lame_client.c
@@ -56,13 +56,13 @@ typedef struct {
static void lame_start_transport_stream_op(grpc_call_element *elem,
grpc_transport_stream_op *op,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
call_data *calld = elem->call_data;
channel_data *chand = elem->channel_data;
GRPC_CALL_LOG_OP(GPR_INFO, elem, op);
if (op->send_ops != NULL) {
grpc_stream_ops_unref_owned_objects(op->send_ops->ops, op->send_ops->nops);
- op->on_done_send->cb(op->on_done_send->cb_arg, 0, call_list);
+ op->on_done_send->cb(op->on_done_send->cb_arg, 0, closure_list);
}
if (op->recv_ops != NULL) {
char tmp[GPR_LTOA_MIN_BUFSIZE];
@@ -81,48 +81,49 @@ static void lame_start_transport_stream_op(grpc_call_element *elem,
mdb.deadline = gpr_inf_future(GPR_CLOCK_REALTIME);
grpc_sopb_add_metadata(op->recv_ops, mdb);
*op->recv_state = GRPC_STREAM_CLOSED;
- op->on_done_recv->cb(op->on_done_recv->cb_arg, 1, call_list);
+ op->on_done_recv->cb(op->on_done_recv->cb_arg, 1, closure_list);
}
if (op->on_consumed != NULL) {
- op->on_consumed->cb(op->on_consumed->cb_arg, 0, call_list);
+ op->on_consumed->cb(op->on_consumed->cb_arg, 0, closure_list);
}
}
-static char *lame_get_peer(grpc_call_element *elem, grpc_call_list *call_list) {
+static char *lame_get_peer(grpc_call_element *elem,
+ grpc_closure_list *closure_list) {
channel_data *chand = elem->channel_data;
return grpc_channel_get_target(chand->master);
}
static void lame_start_transport_op(grpc_channel_element *elem,
grpc_transport_op *op,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
if (op->on_connectivity_state_change) {
GPR_ASSERT(*op->connectivity_state != GRPC_CHANNEL_FATAL_FAILURE);
*op->connectivity_state = GRPC_CHANNEL_FATAL_FAILURE;
op->on_connectivity_state_change->cb(
- op->on_connectivity_state_change->cb_arg, 1, call_list);
+ op->on_connectivity_state_change->cb_arg, 1, closure_list);
}
if (op->on_consumed != NULL) {
- op->on_consumed->cb(op->on_consumed->cb_arg, 1, call_list);
+ op->on_consumed->cb(op->on_consumed->cb_arg, 1, closure_list);
}
}
static void init_call_elem(grpc_call_element *elem,
const void *transport_server_data,
grpc_transport_stream_op *initial_op,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
if (initial_op) {
- grpc_transport_stream_op_finish_with_failure(initial_op, call_list);
+ grpc_transport_stream_op_finish_with_failure(initial_op, closure_list);
}
}
static void destroy_call_elem(grpc_call_element *elem,
- grpc_call_list *call_list) {}
+ grpc_closure_list *closure_list) {}
static void init_channel_elem(grpc_channel_element *elem, grpc_channel *master,
const grpc_channel_args *args, grpc_mdctx *mdctx,
int is_first, int is_last,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
channel_data *chand = elem->channel_data;
GPR_ASSERT(is_first);
GPR_ASSERT(is_last);
@@ -131,7 +132,7 @@ static void init_channel_elem(grpc_channel_element *elem, grpc_channel *master,
}
static void destroy_channel_elem(grpc_channel_element *elem,
- grpc_call_list *call_list) {}
+ grpc_closure_list *closure_list) {}
static const grpc_channel_filter lame_filter = {
lame_start_transport_stream_op,
@@ -154,15 +155,15 @@ grpc_channel *grpc_lame_client_channel_create(const char *target,
grpc_channel *channel;
grpc_channel_element *elem;
channel_data *chand;
- grpc_call_list call_list = GRPC_CALL_LIST_INIT;
+ grpc_closure_list closure_list = GRPC_CLOSURE_LIST_INIT;
static const grpc_channel_filter *filters[] = {&lame_filter};
channel = grpc_channel_create_from_filters(
- target, filters, 1, NULL, grpc_mdctx_create(), 1, &call_list);
+ target, filters, 1, NULL, grpc_mdctx_create(), 1, &closure_list);
elem = grpc_channel_stack_element(grpc_channel_get_channel_stack(channel), 0);
GPR_ASSERT(elem->filter == &lame_filter);
chand = (channel_data *)elem->channel_data;
chand->error_code = error_code;
chand->error_message = error_message;
- grpc_call_list_run(&call_list);
+ grpc_closure_list_run(&closure_list);
return channel;
}
diff --git a/src/core/surface/secure_channel_create.c b/src/core/surface/secure_channel_create.c
index c2d571d955..45567428e9 100644
--- a/src/core/surface/secure_channel_create.c
+++ b/src/core/surface/secure_channel_create.c
@@ -75,7 +75,8 @@ static void connector_ref(grpc_connector *con) {
gpr_ref(&c->refs);
}
-static void connector_unref(grpc_connector *con, grpc_call_list *call_list) {
+static void connector_unref(grpc_connector *con,
+ grpc_closure_list *closure_list) {
connector *c = (connector *)con;
if (gpr_unref(&c->refs)) {
grpc_mdctx_unref(c->mdctx);
@@ -86,7 +87,7 @@ static void connector_unref(grpc_connector *con, grpc_call_list *call_list) {
static void on_secure_handshake_done(void *arg, grpc_security_status status,
grpc_endpoint *wrapped_endpoint,
grpc_endpoint *secure_endpoint,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
connector *c = arg;
grpc_closure *notify;
gpr_mu_lock(&c->mu);
@@ -104,9 +105,9 @@ static void on_secure_handshake_done(void *arg, grpc_security_status status,
c->connecting_endpoint = NULL;
gpr_mu_unlock(&c->mu);
c->result->transport = grpc_create_chttp2_transport(
- c->args.channel_args, secure_endpoint, c->mdctx, 1, call_list);
+ c->args.channel_args, secure_endpoint, c->mdctx, 1, closure_list);
grpc_chttp2_transport_start_reading(c->result->transport, NULL, 0,
- call_list);
+ closure_list);
c->result->filters = gpr_malloc(sizeof(grpc_channel_filter *) * 2);
c->result->filters[0] = &grpc_http_client_filter;
c->result->filters[1] = &grpc_client_auth_filter;
@@ -114,10 +115,10 @@ static void on_secure_handshake_done(void *arg, grpc_security_status status,
}
notify = c->notify;
c->notify = NULL;
- notify->cb(notify->cb_arg, 1, call_list);
+ notify->cb(notify->cb_arg, 1, closure_list);
}
-static void connected(void *arg, int success, grpc_call_list *call_list) {
+static void connected(void *arg, int success, grpc_closure_list *closure_list) {
connector *c = arg;
grpc_closure *notify;
grpc_endpoint *tcp = c->newly_connecting_endpoint;
@@ -128,16 +129,17 @@ static void connected(void *arg, int success, grpc_call_list *call_list) {
gpr_mu_unlock(&c->mu);
grpc_security_connector_do_handshake(&c->security_connector->base, tcp,
on_secure_handshake_done, c,
- call_list);
+ closure_list);
} else {
memset(c->result, 0, sizeof(*c->result));
notify = c->notify;
c->notify = NULL;
- notify->cb(notify->cb_arg, 1, call_list);
+ notify->cb(notify->cb_arg, 1, closure_list);
}
}
-static void connector_shutdown(grpc_connector *con, grpc_call_list *call_list) {
+static void connector_shutdown(grpc_connector *con,
+ grpc_closure_list *closure_list) {
connector *c = (connector *)con;
grpc_endpoint *ep;
gpr_mu_lock(&c->mu);
@@ -145,14 +147,15 @@ static void connector_shutdown(grpc_connector *con, grpc_call_list *call_list) {
c->connecting_endpoint = NULL;
gpr_mu_unlock(&c->mu);
if (ep) {
- grpc_endpoint_shutdown(ep, call_list);
+ grpc_endpoint_shutdown(ep, closure_list);
}
}
static void connector_connect(grpc_connector *con,
const grpc_connect_in_args *args,
grpc_connect_out_args *result,
- grpc_closure *notify, grpc_call_list *call_list) {
+ grpc_closure *notify,
+ grpc_closure_list *closure_list) {
connector *c = (connector *)con;
GPR_ASSERT(c->notify == NULL);
GPR_ASSERT(notify->cb);
@@ -165,7 +168,7 @@ static void connector_connect(grpc_connector *con,
grpc_closure_init(&c->connected_closure, connected, c);
grpc_tcp_client_connect(&c->connected_closure, &c->newly_connecting_endpoint,
args->interested_parties, args->addr, args->addr_len,
- args->deadline, call_list);
+ args->deadline, closure_list);
}
static const grpc_connector_vtable connector_vtable = {
@@ -186,12 +189,12 @@ static void subchannel_factory_ref(grpc_subchannel_factory *scf) {
}
static void subchannel_factory_unref(grpc_subchannel_factory *scf,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
subchannel_factory *f = (subchannel_factory *)scf;
if (gpr_unref(&f->refs)) {
GRPC_SECURITY_CONNECTOR_UNREF(&f->security_connector->base,
"subchannel_factory");
- GRPC_CHANNEL_INTERNAL_UNREF(f->master, "subchannel_factory", call_list);
+ GRPC_CHANNEL_INTERNAL_UNREF(f->master, "subchannel_factory", closure_list);
grpc_channel_args_destroy(f->merge_args);
grpc_mdctx_unref(f->mdctx);
gpr_free(f);
@@ -200,7 +203,7 @@ static void subchannel_factory_unref(grpc_subchannel_factory *scf,
static grpc_subchannel *subchannel_factory_create_subchannel(
grpc_subchannel_factory *scf, grpc_subchannel_args *args,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
subchannel_factory *f = (subchannel_factory *)scf;
connector *c = gpr_malloc(sizeof(*c));
grpc_channel_args *final_args =
@@ -216,7 +219,7 @@ static grpc_subchannel *subchannel_factory_create_subchannel(
args->master = f->master;
args->mdctx = f->mdctx;
s = grpc_subchannel_create(&c->base, args);
- grpc_connector_unref(&c->base, call_list);
+ grpc_connector_unref(&c->base, closure_list);
grpc_channel_args_destroy(final_args);
return s;
}
@@ -243,7 +246,7 @@ grpc_channel *grpc_secure_channel_create(grpc_credentials *creds,
subchannel_factory *f;
#define MAX_FILTERS 3
const grpc_channel_filter *filters[MAX_FILTERS];
- grpc_call_list call_list = GRPC_CALL_LIST_INIT;
+ grpc_closure_list closure_list = GRPC_CLOSURE_LIST_INIT;
size_t n = 0;
GPR_ASSERT(reserved == NULL);
@@ -275,7 +278,7 @@ grpc_channel *grpc_secure_channel_create(grpc_credentials *creds,
GPR_ASSERT(n <= MAX_FILTERS);
channel = grpc_channel_create_from_filters(target, filters, n, args_copy,
- mdctx, 1, &call_list);
+ mdctx, 1, &closure_list);
f = gpr_malloc(sizeof(*f));
f->base.vtable = &subchannel_factory_vtable;
@@ -293,9 +296,9 @@ grpc_channel *grpc_secure_channel_create(grpc_credentials *creds,
}
grpc_client_channel_set_resolver(grpc_channel_get_channel_stack(channel),
- resolver, &call_list);
- GRPC_RESOLVER_UNREF(resolver, "create", &call_list);
- grpc_subchannel_factory_unref(&f->base, &call_list);
+ resolver, &closure_list);
+ GRPC_RESOLVER_UNREF(resolver, "create", &closure_list);
+ grpc_subchannel_factory_unref(&f->base, &closure_list);
GRPC_SECURITY_CONNECTOR_UNREF(&connector->base, "channel_create");
grpc_channel_args_destroy(args_copy);
@@ -303,7 +306,7 @@ grpc_channel *grpc_secure_channel_create(grpc_credentials *creds,
grpc_channel_args_destroy(new_args_from_connector);
}
- grpc_call_list_run(&call_list);
+ grpc_closure_list_run(&closure_list);
return channel;
}
diff --git a/src/core/surface/server.c b/src/core/surface/server.c
index 4249e6f9bd..520065a484 100644
--- a/src/core/surface/server.c
+++ b/src/core/surface/server.c
@@ -57,9 +57,9 @@
typedef struct listener {
void *arg;
void (*start)(grpc_server *server, void *arg, grpc_pollset **pollsets,
- size_t pollset_count, grpc_call_list *call_list);
+ size_t pollset_count, grpc_closure_list *closure_list);
void (*destroy)(grpc_server *server, void *arg, grpc_closure *closure,
- grpc_call_list *call_list);
+ grpc_closure_list *closure_list);
struct listener *next;
grpc_closure destroy_done;
} listener;
@@ -227,13 +227,13 @@ struct grpc_server {
(((channel_data *)(elem)->channel_data)->server)
static void begin_call(grpc_server *server, call_data *calld,
- requested_call *rc, grpc_call_list *call_list);
+ requested_call *rc, grpc_closure_list *closure_list);
static void fail_call(grpc_server *server, requested_call *rc,
- grpc_call_list *call_list);
+ grpc_closure_list *closure_list);
/* Before calling maybe_finish_shutdown, we must hold mu_global and not
hold mu_call */
static void maybe_finish_shutdown(grpc_server *server,
- grpc_call_list *call_list);
+ grpc_closure_list *closure_list);
/*
* channel broadcaster
@@ -261,14 +261,15 @@ struct shutdown_cleanup_args {
};
static void shutdown_cleanup(void *arg, int iomgr_status_ignored,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
struct shutdown_cleanup_args *a = arg;
gpr_slice_unref(a->slice);
gpr_free(a);
}
static void send_shutdown(grpc_channel *channel, int send_goaway,
- int send_disconnect, grpc_call_list *call_list) {
+ int send_disconnect,
+ grpc_closure_list *closure_list) {
grpc_transport_op op;
struct shutdown_cleanup_args *sc;
grpc_channel_element *elem;
@@ -284,17 +285,17 @@ static void send_shutdown(grpc_channel *channel, int send_goaway,
op.on_consumed = &sc->closure;
elem = grpc_channel_stack_element(grpc_channel_get_channel_stack(channel), 0);
- elem->filter->start_transport_op(elem, &op, call_list);
+ elem->filter->start_transport_op(elem, &op, closure_list);
}
static void channel_broadcaster_shutdown(channel_broadcaster *cb,
int send_goaway, int force_disconnect,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
size_t i;
for (i = 0; i < cb->num_channels; i++) {
- send_shutdown(cb->channels[i], send_goaway, force_disconnect, call_list);
- GRPC_CHANNEL_INTERNAL_UNREF(cb->channels[i], "broadcast", call_list);
+ send_shutdown(cb->channels[i], send_goaway, force_disconnect, closure_list);
+ GRPC_CHANNEL_INTERNAL_UNREF(cb->channels[i], "broadcast", closure_list);
}
gpr_free(cb->channels);
}
@@ -314,12 +315,13 @@ static void request_matcher_destroy(request_matcher *request_matcher) {
gpr_stack_lockfree_destroy(request_matcher->requests);
}
-static void kill_zombie(void *elem, int success, grpc_call_list *call_list) {
+static void kill_zombie(void *elem, int success,
+ grpc_closure_list *closure_list) {
grpc_call_destroy(grpc_call_from_top_element(elem));
}
static void request_matcher_zombify_all_pending_calls(
- request_matcher *request_matcher, grpc_call_list *call_list) {
+ request_matcher *request_matcher, grpc_closure_list *closure_list) {
while (request_matcher->pending_head) {
call_data *calld = request_matcher->pending_head;
request_matcher->pending_head = calld->pending_next;
@@ -329,16 +331,16 @@ static void request_matcher_zombify_all_pending_calls(
grpc_closure_init(
&calld->kill_zombie_closure, kill_zombie,
grpc_call_stack_element(grpc_call_get_call_stack(calld->call), 0));
- grpc_call_list_add(call_list, &calld->kill_zombie_closure, 1);
+ grpc_closure_list_add(closure_list, &calld->kill_zombie_closure, 1);
}
}
static void request_matcher_kill_requests(grpc_server *server,
request_matcher *rm,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
int request_id;
while ((request_id = gpr_stack_lockfree_pop(rm->requests)) != -1) {
- fail_call(server, &server->requested_calls[request_id], call_list);
+ fail_call(server, &server->requested_calls[request_id], closure_list);
}
}
@@ -350,7 +352,8 @@ static void server_ref(grpc_server *server) {
gpr_ref(&server->internal_refcount);
}
-static void server_delete(grpc_server *server, grpc_call_list *call_list) {
+static void server_delete(grpc_server *server,
+ grpc_closure_list *closure_list) {
registered_method *rm;
size_t i;
grpc_channel_args_destroy(server->channel_args);
@@ -376,9 +379,9 @@ static void server_delete(grpc_server *server, grpc_call_list *call_list) {
gpr_free(server);
}
-static void server_unref(grpc_server *server, grpc_call_list *call_list) {
+static void server_unref(grpc_server *server, grpc_closure_list *closure_list) {
if (gpr_unref(&server->internal_refcount)) {
- server_delete(server, call_list);
+ server_delete(server, closure_list);
}
}
@@ -393,28 +396,30 @@ static void orphan_channel(channel_data *chand) {
}
static void finish_destroy_channel(void *cd, int success,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
channel_data *chand = cd;
grpc_server *server = chand->server;
gpr_log(GPR_DEBUG, "finish_destroy_channel: %p", chand->channel);
- GRPC_CHANNEL_INTERNAL_UNREF(chand->channel, "server", call_list);
- server_unref(server, call_list);
+ GRPC_CHANNEL_INTERNAL_UNREF(chand->channel, "server", closure_list);
+ server_unref(server, closure_list);
}
-static void destroy_channel(channel_data *chand, grpc_call_list *call_list) {
+static void destroy_channel(channel_data *chand,
+ grpc_closure_list *closure_list) {
if (is_channel_orphaned(chand)) return;
GPR_ASSERT(chand->server != NULL);
orphan_channel(chand);
server_ref(chand->server);
- maybe_finish_shutdown(chand->server, call_list);
+ maybe_finish_shutdown(chand->server, closure_list);
chand->finish_destroy_channel_closure.cb = finish_destroy_channel;
chand->finish_destroy_channel_closure.cb_arg = chand;
- grpc_call_list_add(call_list, &chand->finish_destroy_channel_closure, 1);
+ grpc_closure_list_add(closure_list, &chand->finish_destroy_channel_closure,
+ 1);
}
static void finish_start_new_rpc(grpc_server *server, grpc_call_element *elem,
request_matcher *request_matcher,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
call_data *calld = elem->call_data;
int request_id;
@@ -423,7 +428,7 @@ static void finish_start_new_rpc(grpc_server *server, grpc_call_element *elem,
calld->state = ZOMBIED;
gpr_mu_unlock(&calld->mu_state);
grpc_closure_init(&calld->kill_zombie_closure, kill_zombie, elem);
- grpc_call_list_add(call_list, &calld->kill_zombie_closure, 1);
+ grpc_closure_list_add(closure_list, &calld->kill_zombie_closure, 1);
return;
}
@@ -445,11 +450,13 @@ static void finish_start_new_rpc(grpc_server *server, grpc_call_element *elem,
gpr_mu_lock(&calld->mu_state);
calld->state = ACTIVATED;
gpr_mu_unlock(&calld->mu_state);
- begin_call(server, calld, &server->requested_calls[request_id], call_list);
+ begin_call(server, calld, &server->requested_calls[request_id],
+ closure_list);
}
}
-static void start_new_rpc(grpc_call_element *elem, grpc_call_list *call_list) {
+static void start_new_rpc(grpc_call_element *elem,
+ grpc_closure_list *closure_list) {
channel_data *chand = elem->channel_data;
call_data *calld = elem->call_data;
grpc_server *server = chand->server;
@@ -469,7 +476,7 @@ static void start_new_rpc(grpc_call_element *elem, grpc_call_list *call_list) {
if (rm->method != calld->path) continue;
finish_start_new_rpc(server, elem,
&rm->server_registered_method->request_matcher,
- call_list);
+ closure_list);
return;
}
/* check for a wildcard method definition (no host set) */
@@ -482,12 +489,12 @@ static void start_new_rpc(grpc_call_element *elem, grpc_call_list *call_list) {
if (rm->method != calld->path) continue;
finish_start_new_rpc(server, elem,
&rm->server_registered_method->request_matcher,
- call_list);
+ closure_list);
return;
}
}
finish_start_new_rpc(server, elem, &server->unregistered_request_matcher,
- call_list);
+ closure_list);
}
static int num_listeners(grpc_server *server) {
@@ -500,8 +507,8 @@ static int num_listeners(grpc_server *server) {
}
static void done_shutdown_event(void *server, grpc_cq_completion *completion,
- grpc_call_list *call_list) {
- server_unref(server, call_list);
+ grpc_closure_list *closure_list) {
+ server_unref(server, closure_list);
}
static int num_channels(grpc_server *server) {
@@ -515,26 +522,27 @@ static int num_channels(grpc_server *server) {
}
static void kill_pending_work_locked(grpc_server *server,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
registered_method *rm;
request_matcher_kill_requests(server, &server->unregistered_request_matcher,
- call_list);
+ closure_list);
request_matcher_zombify_all_pending_calls(
- &server->unregistered_request_matcher, call_list);
+ &server->unregistered_request_matcher, closure_list);
for (rm = server->registered_methods; rm; rm = rm->next) {
- request_matcher_kill_requests(server, &rm->request_matcher, call_list);
- request_matcher_zombify_all_pending_calls(&rm->request_matcher, call_list);
+ request_matcher_kill_requests(server, &rm->request_matcher, closure_list);
+ request_matcher_zombify_all_pending_calls(&rm->request_matcher,
+ closure_list);
}
}
static void maybe_finish_shutdown(grpc_server *server,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
size_t i;
if (!gpr_atm_acq_load(&server->shutdown_flag) || server->shutdown_published) {
return;
}
- kill_pending_work_locked(server, call_list);
+ kill_pending_work_locked(server, closure_list);
if (server->root_channel_data.next != &server->root_channel_data ||
server->listeners_destroyed < num_listeners(server)) {
@@ -556,7 +564,7 @@ static void maybe_finish_shutdown(grpc_server *server,
server_ref(server);
grpc_cq_end_op(server->shutdown_tags[i].cq, server->shutdown_tags[i].tag, 1,
done_shutdown_event, server,
- &server->shutdown_tags[i].completion, call_list);
+ &server->shutdown_tags[i].completion, closure_list);
}
}
@@ -574,7 +582,8 @@ static grpc_mdelem *server_filter(void *user_data, grpc_mdelem *md) {
return md;
}
-static void server_on_recv(void *ptr, int success, grpc_call_list *call_list) {
+static void server_on_recv(void *ptr, int success,
+ grpc_closure_list *closure_list) {
grpc_call_element *elem = ptr;
call_data *calld = elem->call_data;
gpr_timespec op_deadline;
@@ -594,7 +603,7 @@ static void server_on_recv(void *ptr, int success, grpc_call_list *call_list) {
}
if (calld->host && calld->path) {
calld->got_initial_metadata = 1;
- start_new_rpc(elem, call_list);
+ start_new_rpc(elem, closure_list);
}
break;
}
@@ -611,7 +620,7 @@ static void server_on_recv(void *ptr, int success, grpc_call_list *call_list) {
calld->state = ZOMBIED;
gpr_mu_unlock(&calld->mu_state);
grpc_closure_init(&calld->kill_zombie_closure, kill_zombie, elem);
- grpc_call_list_add(call_list, &calld->kill_zombie_closure, 1);
+ grpc_closure_list_add(closure_list, &calld->kill_zombie_closure, 1);
} else {
gpr_mu_unlock(&calld->mu_state);
}
@@ -622,7 +631,7 @@ static void server_on_recv(void *ptr, int success, grpc_call_list *call_list) {
calld->state = ZOMBIED;
gpr_mu_unlock(&calld->mu_state);
grpc_closure_init(&calld->kill_zombie_closure, kill_zombie, elem);
- grpc_call_list_add(call_list, &calld->kill_zombie_closure, 1);
+ grpc_closure_list_add(closure_list, &calld->kill_zombie_closure, 1);
} else if (calld->state == PENDING) {
calld->state = ZOMBIED;
gpr_mu_unlock(&calld->mu_state);
@@ -634,7 +643,7 @@ static void server_on_recv(void *ptr, int success, grpc_call_list *call_list) {
break;
}
- calld->on_done_recv->cb(calld->on_done_recv->cb_arg, success, call_list);
+ calld->on_done_recv->cb(calld->on_done_recv->cb_arg, success, closure_list);
}
static void server_mutate_op(grpc_call_element *elem,
@@ -652,10 +661,10 @@ static void server_mutate_op(grpc_call_element *elem,
static void server_start_transport_stream_op(grpc_call_element *elem,
grpc_transport_stream_op *op,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
GRPC_CALL_LOG_OP(GPR_INFO, elem, op);
server_mutate_op(elem, op);
- grpc_call_next_op(elem, op, call_list);
+ grpc_call_next_op(elem, op, closure_list);
}
static void accept_stream(void *cd, grpc_transport *transport,
@@ -667,7 +676,7 @@ static void accept_stream(void *cd, grpc_transport *transport,
}
static void channel_connectivity_changed(void *cd, int iomgr_status_ignored,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
channel_data *chand = cd;
grpc_server *server = chand->server;
if (chand->connectivity_state != GRPC_CHANNEL_FATAL_FAILURE) {
@@ -677,19 +686,19 @@ static void channel_connectivity_changed(void *cd, int iomgr_status_ignored,
op.connectivity_state = &chand->connectivity_state;
grpc_channel_next_op(grpc_channel_stack_element(
grpc_channel_get_channel_stack(chand->channel), 0),
- &op, call_list);
+ &op, closure_list);
} else {
gpr_mu_lock(&server->mu_global);
- destroy_channel(chand, call_list);
+ destroy_channel(chand, closure_list);
gpr_mu_unlock(&server->mu_global);
- GRPC_CHANNEL_INTERNAL_UNREF(chand->channel, "connectivity", call_list);
+ GRPC_CHANNEL_INTERNAL_UNREF(chand->channel, "connectivity", closure_list);
}
}
static void init_call_elem(grpc_call_element *elem,
const void *server_transport_data,
grpc_transport_stream_op *initial_op,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
call_data *calld = elem->call_data;
channel_data *chand = elem->channel_data;
memset(calld, 0, sizeof(call_data));
@@ -705,7 +714,7 @@ static void init_call_elem(grpc_call_element *elem,
}
static void destroy_call_elem(grpc_call_element *elem,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
channel_data *chand = elem->channel_data;
call_data *calld = elem->call_data;
@@ -720,13 +729,13 @@ static void destroy_call_elem(grpc_call_element *elem,
gpr_mu_destroy(&calld->mu_state);
- server_unref(chand->server, call_list);
+ server_unref(chand->server, closure_list);
}
static void init_channel_elem(grpc_channel_element *elem, grpc_channel *master,
const grpc_channel_args *args,
grpc_mdctx *metadata_context, int is_first,
- int is_last, grpc_call_list *call_list) {
+ int is_last, grpc_closure_list *closure_list) {
channel_data *chand = elem->channel_data;
GPR_ASSERT(is_first);
GPR_ASSERT(!is_last);
@@ -743,7 +752,7 @@ static void init_channel_elem(grpc_channel_element *elem, grpc_channel *master,
}
static void destroy_channel_elem(grpc_channel_element *elem,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
size_t i;
channel_data *chand = elem->channel_data;
if (chand->registered_methods) {
@@ -762,11 +771,11 @@ static void destroy_channel_elem(grpc_channel_element *elem,
chand->next->prev = chand->prev;
chand->prev->next = chand->next;
chand->next = chand->prev = chand;
- maybe_finish_shutdown(chand->server, call_list);
+ maybe_finish_shutdown(chand->server, closure_list);
gpr_mu_unlock(&chand->server->mu_global);
GRPC_MDSTR_UNREF(chand->path_key);
GRPC_MDSTR_UNREF(chand->authority_key);
- server_unref(chand->server, call_list);
+ server_unref(chand->server, closure_list);
}
}
@@ -890,7 +899,7 @@ void *grpc_server_register_method(grpc_server *server, const char *method,
void grpc_server_start(grpc_server *server) {
listener *l;
size_t i;
- grpc_call_list call_list = GRPC_CALL_LIST_INIT;
+ grpc_closure_list closure_list = GRPC_CLOSURE_LIST_INIT;
server->pollsets = gpr_malloc(sizeof(grpc_pollset *) * server->cq_count);
for (i = 0; i < server->cq_count; i++) {
@@ -898,17 +907,17 @@ void grpc_server_start(grpc_server *server) {
}
for (l = server->listeners; l; l = l->next) {
- l->start(server, l->arg, server->pollsets, server->cq_count, &call_list);
+ l->start(server, l->arg, server->pollsets, server->cq_count, &closure_list);
}
- grpc_call_list_run(&call_list);
+ grpc_closure_list_run(&closure_list);
}
void grpc_server_setup_transport(grpc_server *s, grpc_transport *transport,
grpc_channel_filter const **extra_filters,
size_t num_extra_filters, grpc_mdctx *mdctx,
const grpc_channel_args *args,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
size_t num_filters = s->channel_filter_count + num_extra_filters + 1;
grpc_channel_filter const **filters =
gpr_malloc(sizeof(grpc_channel_filter *) * num_filters);
@@ -938,11 +947,11 @@ void grpc_server_setup_transport(grpc_server *s, grpc_transport *transport,
for (i = 0; i < s->cq_count; i++) {
memset(&op, 0, sizeof(op));
op.bind_pollset = grpc_cq_pollset(s->cqs[i]);
- grpc_transport_perform_op(transport, &op, call_list);
+ grpc_transport_perform_op(transport, &op, closure_list);
}
channel = grpc_channel_create_from_filters(NULL, filters, num_filters, args,
- mdctx, 0, call_list);
+ mdctx, 0, closure_list);
chand = (channel_data *)grpc_channel_stack_element(
grpc_channel_get_channel_stack(channel), 0)
->channel_data;
@@ -998,21 +1007,21 @@ void grpc_server_setup_transport(grpc_server *s, grpc_transport *transport,
op.on_connectivity_state_change = &chand->channel_connectivity_changed;
op.connectivity_state = &chand->connectivity_state;
op.disconnect = gpr_atm_acq_load(&s->shutdown_flag) != 0;
- grpc_transport_perform_op(transport, &op, call_list);
+ grpc_transport_perform_op(transport, &op, closure_list);
}
void done_published_shutdown(void *done_arg, grpc_cq_completion *storage,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
(void) done_arg;
gpr_free(storage);
}
static void listener_destroy_done(void *s, int success,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
grpc_server *server = s;
gpr_mu_lock(&server->mu_global);
server->listeners_destroyed++;
- maybe_finish_shutdown(server, call_list);
+ maybe_finish_shutdown(server, closure_list);
gpr_mu_unlock(&server->mu_global);
}
@@ -1021,7 +1030,7 @@ void grpc_server_shutdown_and_notify(grpc_server *server,
listener *l;
shutdown_tag *sdt;
channel_broadcaster broadcaster;
- grpc_call_list call_list = GRPC_CALL_LIST_INIT;
+ grpc_closure_list closure_list = GRPC_CLOSURE_LIST_INIT;
GRPC_SERVER_LOG_SHUTDOWN(GPR_INFO, server, cq, tag);
@@ -1030,7 +1039,7 @@ void grpc_server_shutdown_and_notify(grpc_server *server,
grpc_cq_begin_op(cq);
if (server->shutdown_published) {
grpc_cq_end_op(cq, tag, 1, done_published_shutdown, NULL,
- gpr_malloc(sizeof(grpc_cq_completion)), &call_list);
+ gpr_malloc(sizeof(grpc_cq_completion)), &closure_list);
gpr_mu_unlock(&server->mu_global);
goto done;
}
@@ -1051,40 +1060,40 @@ void grpc_server_shutdown_and_notify(grpc_server *server,
/* collect all unregistered then registered calls */
gpr_mu_lock(&server->mu_call);
- kill_pending_work_locked(server, &call_list);
+ kill_pending_work_locked(server, &closure_list);
gpr_mu_unlock(&server->mu_call);
gpr_atm_rel_store(&server->shutdown_flag, 1);
- maybe_finish_shutdown(server, &call_list);
+ maybe_finish_shutdown(server, &closure_list);
gpr_mu_unlock(&server->mu_global);
/* Shutdown listeners */
for (l = server->listeners; l; l = l->next) {
grpc_closure_init(&l->destroy_done, listener_destroy_done, server);
- l->destroy(server, l->arg, &l->destroy_done, &call_list);
+ l->destroy(server, l->arg, &l->destroy_done, &closure_list);
}
- channel_broadcaster_shutdown(&broadcaster, 1, 0, &call_list);
+ channel_broadcaster_shutdown(&broadcaster, 1, 0, &closure_list);
done:
- grpc_call_list_run(&call_list);
+ grpc_closure_list_run(&closure_list);
}
void grpc_server_cancel_all_calls(grpc_server *server) {
channel_broadcaster broadcaster;
- grpc_call_list call_list = GRPC_CALL_LIST_INIT;
+ grpc_closure_list closure_list = GRPC_CLOSURE_LIST_INIT;
gpr_mu_lock(&server->mu_global);
channel_broadcaster_init(server, &broadcaster);
gpr_mu_unlock(&server->mu_global);
- channel_broadcaster_shutdown(&broadcaster, 0, 1, &call_list);
- grpc_call_list_run(&call_list);
+ channel_broadcaster_shutdown(&broadcaster, 0, 1, &closure_list);
+ grpc_closure_list_run(&closure_list);
}
void grpc_server_destroy(grpc_server *server) {
listener *l;
- grpc_call_list call_list = GRPC_CALL_LIST_INIT;
+ grpc_closure_list closure_list = GRPC_CLOSURE_LIST_INIT;
gpr_mu_lock(&server->mu_global);
GPR_ASSERT(gpr_atm_acq_load(&server->shutdown_flag) || !server->listeners);
@@ -1098,17 +1107,17 @@ void grpc_server_destroy(grpc_server *server) {
gpr_mu_unlock(&server->mu_global);
- server_unref(server, &call_list);
- grpc_call_list_run(&call_list);
+ server_unref(server, &closure_list);
+ grpc_closure_list_run(&closure_list);
}
void grpc_server_add_listener(
grpc_server *server, void *arg,
void (*start)(grpc_server *server, void *arg, grpc_pollset **pollsets,
- size_t pollset_count, grpc_call_list *call_list),
+ size_t pollset_count, grpc_closure_list *closure_list),
void (*destroy)(grpc_server *server, void *arg, grpc_closure *on_done,
- grpc_call_list *call_list),
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list),
+ grpc_closure_list *closure_list) {
listener *l = gpr_malloc(sizeof(listener));
l->arg = arg;
l->start = start;
@@ -1119,18 +1128,18 @@ void grpc_server_add_listener(
static grpc_call_error queue_call_request(grpc_server *server,
requested_call *rc,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
call_data *calld = NULL;
request_matcher *request_matcher = NULL;
int request_id;
if (gpr_atm_acq_load(&server->shutdown_flag)) {
- fail_call(server, rc, call_list);
+ fail_call(server, rc, closure_list);
return GRPC_CALL_OK;
}
request_id = gpr_stack_lockfree_pop(server->request_freelist);
if (request_id == -1) {
/* out of request ids: just fail this one */
- fail_call(server, rc, call_list);
+ fail_call(server, rc, closure_list);
return GRPC_CALL_OK;
}
switch (rc->type) {
@@ -1158,13 +1167,13 @@ static grpc_call_error queue_call_request(grpc_server *server,
grpc_closure_init(
&calld->kill_zombie_closure, kill_zombie,
grpc_call_stack_element(grpc_call_get_call_stack(calld->call), 0));
- grpc_call_list_add(call_list, &calld->kill_zombie_closure, 1);
+ grpc_closure_list_add(closure_list, &calld->kill_zombie_closure, 1);
} else {
GPR_ASSERT(calld->state == PENDING);
calld->state = ACTIVATED;
gpr_mu_unlock(&calld->mu_state);
begin_call(server, calld, &server->requested_calls[request_id],
- call_list);
+ closure_list);
}
gpr_mu_lock(&server->mu_call);
}
@@ -1179,7 +1188,7 @@ grpc_call_error grpc_server_request_call(
grpc_completion_queue *cq_bound_to_call,
grpc_completion_queue *cq_for_notification, void *tag) {
grpc_call_error error;
- grpc_call_list call_list = GRPC_CALL_LIST_INIT;
+ grpc_closure_list closure_list = GRPC_CLOSURE_LIST_INIT;
requested_call *rc = gpr_malloc(sizeof(*rc));
GRPC_SERVER_LOG_REQUEST_CALL(GPR_INFO, server, call, details,
initial_metadata, cq_bound_to_call,
@@ -1199,9 +1208,9 @@ grpc_call_error grpc_server_request_call(
rc->call = call;
rc->data.batch.details = details;
rc->data.batch.initial_metadata = initial_metadata;
- error = queue_call_request(server, rc, &call_list);
+ error = queue_call_request(server, rc, &closure_list);
done:
- grpc_call_list_run(&call_list);
+ grpc_closure_list_run(&closure_list);
return error;
}
@@ -1211,7 +1220,7 @@ grpc_call_error grpc_server_request_registered_call(
grpc_completion_queue *cq_bound_to_call,
grpc_completion_queue *cq_for_notification, void *tag) {
grpc_call_error error;
- grpc_call_list call_list = GRPC_CALL_LIST_INIT;
+ grpc_closure_list closure_list = GRPC_CLOSURE_LIST_INIT;
requested_call *rc = gpr_malloc(sizeof(*rc));
registered_method *registered_method = rm;
if (!grpc_cq_is_server_cq(cq_for_notification)) {
@@ -1230,16 +1239,16 @@ grpc_call_error grpc_server_request_registered_call(
rc->data.registered.deadline = deadline;
rc->data.registered.initial_metadata = initial_metadata;
rc->data.registered.optional_payload = optional_payload;
- error = queue_call_request(server, rc, &call_list);
+ error = queue_call_request(server, rc, &closure_list);
done:
- grpc_call_list_run(&call_list);
+ grpc_closure_list_run(&closure_list);
return error;
}
static void publish_registered_or_batch(grpc_call *call, int success, void *tag,
- grpc_call_list *call_list);
+ grpc_closure_list *closure_list);
static void publish_was_not_set(grpc_call *call, int success, void *tag,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
abort();
}
@@ -1255,7 +1264,7 @@ static void cpstr(char **dest, size_t *capacity, grpc_mdstr *value) {
}
static void begin_call(grpc_server *server, call_data *calld,
- requested_call *rc, grpc_call_list *call_list) {
+ requested_call *rc, grpc_closure_list *closure_list) {
grpc_ioreq_completion_func publish = publish_was_not_set;
grpc_ioreq req[2];
grpc_ioreq *r = req;
@@ -1266,7 +1275,8 @@ static void begin_call(grpc_server *server, call_data *calld,
fill in the metadata array passed by the client, we need to perform
an ioreq op, that should complete immediately. */
- grpc_call_set_completion_queue(calld->call, rc->cq_bound_to_call, call_list);
+ grpc_call_set_completion_queue(calld->call, rc->cq_bound_to_call,
+ closure_list);
*rc->call = calld->call;
calld->cq_new = rc->cq_for_notification;
switch (rc->type) {
@@ -1302,11 +1312,11 @@ static void begin_call(grpc_server *server, call_data *calld,
GRPC_CALL_INTERNAL_REF(calld->call, "server");
grpc_call_start_ioreq_and_call_back(calld->call, req, (size_t)(r - req),
- publish, rc, call_list);
+ publish, rc, closure_list);
}
static void done_request_event(void *req, grpc_cq_completion *c,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
requested_call *rc = req;
grpc_server *server = rc->server;
@@ -1319,11 +1329,11 @@ static void done_request_event(void *req, grpc_cq_completion *c,
gpr_free(req);
}
- server_unref(server, call_list);
+ server_unref(server, closure_list);
}
static void fail_call(grpc_server *server, requested_call *rc,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
*rc->call = NULL;
switch (rc->type) {
case BATCH_CALL:
@@ -1335,11 +1345,11 @@ static void fail_call(grpc_server *server, requested_call *rc,
}
server_ref(server);
grpc_cq_end_op(rc->cq_for_notification, rc->tag, 0, done_request_event, rc,
- &rc->completion, call_list);
+ &rc->completion, closure_list);
}
static void publish_registered_or_batch(grpc_call *call, int success, void *prc,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
grpc_call_element *elem =
grpc_call_stack_element(grpc_call_get_call_stack(call), 0);
requested_call *rc = prc;
@@ -1347,8 +1357,8 @@ static void publish_registered_or_batch(grpc_call *call, int success, void *prc,
channel_data *chand = elem->channel_data;
server_ref(chand->server);
grpc_cq_end_op(calld->cq_new, rc->tag, success, done_request_event, rc,
- &rc->completion, call_list);
- GRPC_CALL_INTERNAL_UNREF(call, "server", call_list);
+ &rc->completion, closure_list);
+ GRPC_CALL_INTERNAL_UNREF(call, "server", closure_list);
}
const grpc_channel_args *grpc_server_get_channel_args(grpc_server *server) {
diff --git a/src/core/surface/server.h b/src/core/surface/server.h
index d08a038639..985fb01893 100644
--- a/src/core/surface/server.h
+++ b/src/core/surface/server.h
@@ -48,10 +48,10 @@ grpc_server *grpc_server_create_from_filters(
void grpc_server_add_listener(
grpc_server *server, void *listener,
void (*start)(grpc_server *server, void *arg, grpc_pollset **pollsets,
- size_t npollsets, grpc_call_list *call_list),
+ size_t npollsets, grpc_closure_list *closure_list),
void (*destroy)(grpc_server *server, void *arg, grpc_closure *on_done,
- grpc_call_list *call_list),
- grpc_call_list *call_list);
+ grpc_closure_list *closure_list),
+ grpc_closure_list *closure_list);
/* Setup a transport - creates a channel stack, binds the transport to the
server */
@@ -59,7 +59,7 @@ void grpc_server_setup_transport(grpc_server *server, grpc_transport *transport,
grpc_channel_filter const **extra_filters,
size_t num_extra_filters, grpc_mdctx *mdctx,
const grpc_channel_args *args,
- grpc_call_list *call_list);
+ grpc_closure_list *closure_list);
const grpc_channel_args *grpc_server_get_channel_args(grpc_server *server);
diff --git a/src/core/surface/server_chttp2.c b/src/core/surface/server_chttp2.c
index 395c88827d..ad44aed73b 100644
--- a/src/core/surface/server_chttp2.c
+++ b/src/core/surface/server_chttp2.c
@@ -43,16 +43,17 @@
#include <grpc/support/useful.h>
static void setup_transport(void *server, grpc_transport *transport,
- grpc_mdctx *mdctx, grpc_call_list *call_list) {
+ grpc_mdctx *mdctx,
+ grpc_closure_list *closure_list) {
static grpc_channel_filter const *extra_filters[] = {
&grpc_http_server_filter};
- grpc_server_setup_transport(server, transport, extra_filters,
- GPR_ARRAY_SIZE(extra_filters), mdctx,
- grpc_server_get_channel_args(server), call_list);
+ grpc_server_setup_transport(
+ server, transport, extra_filters, GPR_ARRAY_SIZE(extra_filters), mdctx,
+ grpc_server_get_channel_args(server), closure_list);
}
static void new_transport(void *server, grpc_endpoint *tcp,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
/*
* Beware that the call to grpc_create_chttp2_transport() has to happen before
* grpc_tcp_server_destroy(). This is fine here, but similar code
@@ -62,25 +63,25 @@ static void new_transport(void *server, grpc_endpoint *tcp,
*/
grpc_mdctx *mdctx = grpc_mdctx_create();
grpc_transport *transport = grpc_create_chttp2_transport(
- grpc_server_get_channel_args(server), tcp, mdctx, 0, call_list);
- setup_transport(server, transport, mdctx, call_list);
- grpc_chttp2_transport_start_reading(transport, NULL, 0, call_list);
+ grpc_server_get_channel_args(server), tcp, mdctx, 0, closure_list);
+ setup_transport(server, transport, mdctx, closure_list);
+ grpc_chttp2_transport_start_reading(transport, NULL, 0, closure_list);
}
/* Server callback: start listening on our ports */
static void start(grpc_server *server, void *tcpp, grpc_pollset **pollsets,
- size_t pollset_count, grpc_call_list *call_list) {
+ size_t pollset_count, grpc_closure_list *closure_list) {
grpc_tcp_server *tcp = tcpp;
grpc_tcp_server_start(tcp, pollsets, pollset_count, new_transport, server,
- call_list);
+ closure_list);
}
/* Server callback: destroy the tcp listener (so we don't generate further
callbacks) */
static void destroy(grpc_server *server, void *tcpp, grpc_closure *destroy_done,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
grpc_tcp_server *tcp = tcpp;
- grpc_tcp_server_destroy(tcp, destroy_done, call_list);
+ grpc_tcp_server_destroy(tcp, destroy_done, closure_list);
}
int grpc_server_add_insecure_http2_port(grpc_server *server, const char *addr) {
@@ -90,7 +91,7 @@ int grpc_server_add_insecure_http2_port(grpc_server *server, const char *addr) {
unsigned count = 0;
int port_num = -1;
int port_temp;
- grpc_call_list call_list = GRPC_CALL_LIST_INIT;
+ grpc_closure_list closure_list = GRPC_CLOSURE_LIST_INIT;
resolved = grpc_blocking_resolve_address(addr, "http");
if (!resolved) {
@@ -127,7 +128,7 @@ int grpc_server_add_insecure_http2_port(grpc_server *server, const char *addr) {
grpc_resolved_addresses_destroy(resolved);
/* Register with the server only upon success */
- grpc_server_add_listener(server, tcp, start, destroy, &call_list);
+ grpc_server_add_listener(server, tcp, start, destroy, &closure_list);
goto done;
/* Error path: cleanup and return */
@@ -141,6 +142,6 @@ error:
port_num = 0;
done:
- grpc_call_list_run(&call_list);
+ grpc_closure_list_run(&closure_list);
return port_num;
}
diff --git a/src/core/transport/chttp2/frame_data.c b/src/core/transport/chttp2/frame_data.c
index ef12c910cd..a58189a136 100644
--- a/src/core/transport/chttp2/frame_data.c
+++ b/src/core/transport/chttp2/frame_data.c
@@ -72,7 +72,7 @@ grpc_chttp2_parse_error grpc_chttp2_data_parser_begin_frame(
grpc_chttp2_parse_error grpc_chttp2_data_parser_parse(
void *parser, grpc_chttp2_transport_parsing *transport_parsing,
grpc_chttp2_stream_parsing *stream_parsing, gpr_slice slice, int is_last,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
gpr_uint8 *const beg = GPR_SLICE_START_PTR(slice);
gpr_uint8 *const end = GPR_SLICE_END_PTR(slice);
gpr_uint8 *cur = beg;
diff --git a/src/core/transport/chttp2/frame_data.h b/src/core/transport/chttp2/frame_data.h
index 7530f0f644..89a503eb7c 100644
--- a/src/core/transport/chttp2/frame_data.h
+++ b/src/core/transport/chttp2/frame_data.h
@@ -76,7 +76,7 @@ grpc_chttp2_parse_error grpc_chttp2_data_parser_begin_frame(
grpc_chttp2_parse_error grpc_chttp2_data_parser_parse(
void *parser, grpc_chttp2_transport_parsing *transport_parsing,
grpc_chttp2_stream_parsing *stream_parsing, gpr_slice slice, int is_last,
- grpc_call_list *call_list);
+ grpc_closure_list *closure_list);
/* create a slice with an empty data frame and is_last set */
gpr_slice grpc_chttp2_data_frame_create_empty_close(gpr_uint32 id);
diff --git a/src/core/transport/chttp2/frame_goaway.c b/src/core/transport/chttp2/frame_goaway.c
index 1c2bce6736..d338b56611 100644
--- a/src/core/transport/chttp2/frame_goaway.c
+++ b/src/core/transport/chttp2/frame_goaway.c
@@ -65,7 +65,7 @@ grpc_chttp2_parse_error grpc_chttp2_goaway_parser_begin_frame(
grpc_chttp2_parse_error grpc_chttp2_goaway_parser_parse(
void *parser, grpc_chttp2_transport_parsing *transport_parsing,
grpc_chttp2_stream_parsing *stream_parsing, gpr_slice slice, int is_last,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
gpr_uint8 *const beg = GPR_SLICE_START_PTR(slice);
gpr_uint8 *const end = GPR_SLICE_END_PTR(slice);
gpr_uint8 *cur = beg;
diff --git a/src/core/transport/chttp2/frame_goaway.h b/src/core/transport/chttp2/frame_goaway.h
index ec991f4350..6f9ce94a0c 100644
--- a/src/core/transport/chttp2/frame_goaway.h
+++ b/src/core/transport/chttp2/frame_goaway.h
@@ -68,7 +68,7 @@ grpc_chttp2_parse_error grpc_chttp2_goaway_parser_begin_frame(
grpc_chttp2_parse_error grpc_chttp2_goaway_parser_parse(
void *parser, grpc_chttp2_transport_parsing *transport_parsing,
grpc_chttp2_stream_parsing *stream_parsing, gpr_slice slice, int is_last,
- grpc_call_list *call_list);
+ grpc_closure_list *closure_list);
void grpc_chttp2_goaway_append(gpr_uint32 last_stream_id, gpr_uint32 error_code,
gpr_slice debug_data,
diff --git a/src/core/transport/chttp2/frame_ping.c b/src/core/transport/chttp2/frame_ping.c
index 2fb8850a45..d4bf43eb37 100644
--- a/src/core/transport/chttp2/frame_ping.c
+++ b/src/core/transport/chttp2/frame_ping.c
@@ -71,7 +71,7 @@ grpc_chttp2_parse_error grpc_chttp2_ping_parser_begin_frame(
grpc_chttp2_parse_error grpc_chttp2_ping_parser_parse(
void *parser, grpc_chttp2_transport_parsing *transport_parsing,
grpc_chttp2_stream_parsing *stream_parsing, gpr_slice slice, int is_last,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
gpr_uint8 *const beg = GPR_SLICE_START_PTR(slice);
gpr_uint8 *const end = GPR_SLICE_END_PTR(slice);
gpr_uint8 *cur = beg;
@@ -90,7 +90,7 @@ grpc_chttp2_parse_error grpc_chttp2_ping_parser_parse(
for (ping = transport_parsing->pings.next;
ping != &transport_parsing->pings; ping = ping->next) {
if (0 == memcmp(p->opaque_8bytes, ping->id, 8)) {
- grpc_call_list_add(call_list, ping->on_recv, 1);
+ grpc_closure_list_add(closure_list, ping->on_recv, 1);
}
ping->next->prev = ping->prev;
ping->prev->next = ping->next;
diff --git a/src/core/transport/chttp2/frame_ping.h b/src/core/transport/chttp2/frame_ping.h
index 70e19eb8ab..fb31147ed4 100644
--- a/src/core/transport/chttp2/frame_ping.h
+++ b/src/core/transport/chttp2/frame_ping.h
@@ -51,6 +51,6 @@ grpc_chttp2_parse_error grpc_chttp2_ping_parser_begin_frame(
grpc_chttp2_parse_error grpc_chttp2_ping_parser_parse(
void *parser, grpc_chttp2_transport_parsing *transport_parsing,
grpc_chttp2_stream_parsing *stream_parsing, gpr_slice slice, int is_last,
- grpc_call_list *call_list);
+ grpc_closure_list *closure_list);
#endif /* GRPC_INTERNAL_CORE_TRANSPORT_CHTTP2_FRAME_PING_H */
diff --git a/src/core/transport/chttp2/frame_rst_stream.c b/src/core/transport/chttp2/frame_rst_stream.c
index 7cf8abe88f..4d8323c11d 100644
--- a/src/core/transport/chttp2/frame_rst_stream.c
+++ b/src/core/transport/chttp2/frame_rst_stream.c
@@ -73,7 +73,7 @@ grpc_chttp2_parse_error grpc_chttp2_rst_stream_parser_begin_frame(
grpc_chttp2_parse_error grpc_chttp2_rst_stream_parser_parse(
void *parser, grpc_chttp2_transport_parsing *transport_parsing,
grpc_chttp2_stream_parsing *stream_parsing, gpr_slice slice, int is_last,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
gpr_uint8 *const beg = GPR_SLICE_START_PTR(slice);
gpr_uint8 *const end = GPR_SLICE_END_PTR(slice);
gpr_uint8 *cur = beg;
diff --git a/src/core/transport/chttp2/frame_rst_stream.h b/src/core/transport/chttp2/frame_rst_stream.h
index 17d57fae5e..05d9e560f4 100644
--- a/src/core/transport/chttp2/frame_rst_stream.h
+++ b/src/core/transport/chttp2/frame_rst_stream.h
@@ -50,6 +50,6 @@ grpc_chttp2_parse_error grpc_chttp2_rst_stream_parser_begin_frame(
grpc_chttp2_parse_error grpc_chttp2_rst_stream_parser_parse(
void *parser, grpc_chttp2_transport_parsing *transport_parsing,
grpc_chttp2_stream_parsing *stream_parsing, gpr_slice slice, int is_last,
- grpc_call_list *call_list);
+ grpc_closure_list *closure_list);
#endif /* GRPC_INTERNAL_CORE_TRANSPORT_CHTTP2_FRAME_RST_STREAM_H */
diff --git a/src/core/transport/chttp2/frame_settings.c b/src/core/transport/chttp2/frame_settings.c
index 78bd4bb09d..235ff5a352 100644
--- a/src/core/transport/chttp2/frame_settings.c
+++ b/src/core/transport/chttp2/frame_settings.c
@@ -140,7 +140,7 @@ grpc_chttp2_parse_error grpc_chttp2_settings_parser_begin_frame(
grpc_chttp2_parse_error grpc_chttp2_settings_parser_parse(
void *p, grpc_chttp2_transport_parsing *transport_parsing,
grpc_chttp2_stream_parsing *stream_parsing, gpr_slice slice, int is_last,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
grpc_chttp2_settings_parser *parser = p;
const gpr_uint8 *cur = GPR_SLICE_START_PTR(slice);
const gpr_uint8 *end = GPR_SLICE_END_PTR(slice);
diff --git a/src/core/transport/chttp2/frame_settings.h b/src/core/transport/chttp2/frame_settings.h
index a04a28b7da..7931b8b2ca 100644
--- a/src/core/transport/chttp2/frame_settings.h
+++ b/src/core/transport/chttp2/frame_settings.h
@@ -97,6 +97,6 @@ grpc_chttp2_parse_error grpc_chttp2_settings_parser_begin_frame(
grpc_chttp2_parse_error grpc_chttp2_settings_parser_parse(
void *parser, grpc_chttp2_transport_parsing *transport_parsing,
grpc_chttp2_stream_parsing *stream_parsing, gpr_slice slice, int is_last,
- grpc_call_list *call_list);
+ grpc_closure_list *closure_list);
#endif /* GRPC_INTERNAL_CORE_TRANSPORT_CHTTP2_FRAME_SETTINGS_H */
diff --git a/src/core/transport/chttp2/frame_window_update.c b/src/core/transport/chttp2/frame_window_update.c
index 51eb261346..b0f5f8698b 100644
--- a/src/core/transport/chttp2/frame_window_update.c
+++ b/src/core/transport/chttp2/frame_window_update.c
@@ -76,7 +76,7 @@ grpc_chttp2_parse_error grpc_chttp2_window_update_parser_begin_frame(
grpc_chttp2_parse_error grpc_chttp2_window_update_parser_parse(
void *parser, grpc_chttp2_transport_parsing *transport_parsing,
grpc_chttp2_stream_parsing *stream_parsing, gpr_slice slice, int is_last,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
gpr_uint8 *const beg = GPR_SLICE_START_PTR(slice);
gpr_uint8 *const end = GPR_SLICE_END_PTR(slice);
gpr_uint8 *cur = beg;
diff --git a/src/core/transport/chttp2/frame_window_update.h b/src/core/transport/chttp2/frame_window_update.h
index 7f1168e551..08931044e4 100644
--- a/src/core/transport/chttp2/frame_window_update.h
+++ b/src/core/transport/chttp2/frame_window_update.h
@@ -53,6 +53,6 @@ grpc_chttp2_parse_error grpc_chttp2_window_update_parser_begin_frame(
grpc_chttp2_parse_error grpc_chttp2_window_update_parser_parse(
void *parser, grpc_chttp2_transport_parsing *transport_parsing,
grpc_chttp2_stream_parsing *stream_parsing, gpr_slice slice, int is_last,
- grpc_call_list *call_list);
+ grpc_closure_list *closure_list);
#endif /* GRPC_INTERNAL_CORE_TRANSPORT_CHTTP2_FRAME_WINDOW_UPDATE_H */
diff --git a/src/core/transport/chttp2/hpack_parser.c b/src/core/transport/chttp2/hpack_parser.c
index e3b8e54e8d..e66a918fcd 100644
--- a/src/core/transport/chttp2/hpack_parser.c
+++ b/src/core/transport/chttp2/hpack_parser.c
@@ -1380,7 +1380,7 @@ int grpc_chttp2_hpack_parser_parse(grpc_chttp2_hpack_parser *p,
grpc_chttp2_parse_error grpc_chttp2_header_parser_parse(
void *hpack_parser, grpc_chttp2_transport_parsing *transport_parsing,
grpc_chttp2_stream_parsing *stream_parsing, gpr_slice slice, int is_last,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
grpc_chttp2_hpack_parser *parser = hpack_parser;
if (!grpc_chttp2_hpack_parser_parse(parser, GPR_SLICE_START_PTR(slice),
GPR_SLICE_END_PTR(slice))) {
diff --git a/src/core/transport/chttp2/hpack_parser.h b/src/core/transport/chttp2/hpack_parser.h
index c9ae6a9767..946f8e34ef 100644
--- a/src/core/transport/chttp2/hpack_parser.h
+++ b/src/core/transport/chttp2/hpack_parser.h
@@ -110,6 +110,6 @@ int grpc_chttp2_hpack_parser_parse(grpc_chttp2_hpack_parser *p,
grpc_chttp2_parse_error grpc_chttp2_header_parser_parse(
void *hpack_parser, grpc_chttp2_transport_parsing *transport_parsing,
grpc_chttp2_stream_parsing *stream_parsing, gpr_slice slice, int is_last,
- grpc_call_list *call_list);
+ grpc_closure_list *closure_list);
#endif /* GRPC_INTERNAL_CORE_TRANSPORT_CHTTP2_HPACK_PARSER_H */
diff --git a/src/core/transport/chttp2/internal.h b/src/core/transport/chttp2/internal.h
index b9dbbc25ee..14a6c909ee 100644
--- a/src/core/transport/chttp2/internal.h
+++ b/src/core/transport/chttp2/internal.h
@@ -268,7 +268,7 @@ struct grpc_chttp2_transport_parsing {
grpc_chttp2_parse_error (*parser)(
void *parser_user_data, grpc_chttp2_transport_parsing *transport_parsing,
grpc_chttp2_stream_parsing *stream_parsing, gpr_slice slice, int is_last,
- grpc_call_list *call_list);
+ grpc_closure_list *closure_list);
/* received settings */
gpr_uint32 settings[GRPC_CHTTP2_NUM_SETTINGS];
@@ -469,22 +469,22 @@ int grpc_chttp2_unlocking_check_writes(grpc_chttp2_transport_global *global,
grpc_chttp2_transport_writing *writing);
void grpc_chttp2_perform_writes(
grpc_chttp2_transport_writing *transport_writing, grpc_endpoint *endpoint,
- grpc_call_list *call_list);
+ grpc_closure_list *closure_list);
void grpc_chttp2_terminate_writing(void *transport_writing, int success,
- grpc_call_list *call_list);
+ grpc_closure_list *closure_list);
void grpc_chttp2_cleanup_writing(grpc_chttp2_transport_global *global,
grpc_chttp2_transport_writing *writing,
- grpc_call_list *call_list);
+ grpc_closure_list *closure_list);
void grpc_chttp2_prepare_to_read(grpc_chttp2_transport_global *global,
grpc_chttp2_transport_parsing *parsing);
/** Process one slice of incoming data; return 1 if the connection is still
viable after reading, or 0 if the connection should be torn down */
int grpc_chttp2_perform_read(grpc_chttp2_transport_parsing *transport_parsing,
- gpr_slice slice, grpc_call_list *call_list);
+ gpr_slice slice, grpc_closure_list *closure_list);
void grpc_chttp2_publish_reads(grpc_chttp2_transport_global *global,
grpc_chttp2_transport_parsing *parsing,
- grpc_call_list *call_list);
+ grpc_closure_list *closure_list);
/** Get a writable stream
returns non-zero if there was a stream available */
@@ -577,7 +577,7 @@ grpc_chttp2_stream_parsing *grpc_chttp2_parsing_accept_stream(
void grpc_chttp2_add_incoming_goaway(
grpc_chttp2_transport_global *transport_global, gpr_uint32 goaway_error,
- gpr_slice goaway_text, grpc_call_list *call_list);
+ gpr_slice goaway_text, grpc_closure_list *closure_list);
void grpc_chttp2_register_stream(grpc_chttp2_transport *t,
grpc_chttp2_stream *s);
diff --git a/src/core/transport/chttp2/parsing.c b/src/core/transport/chttp2/parsing.c
index 2d95963f1f..f6ce35f9ac 100644
--- a/src/core/transport/chttp2/parsing.c
+++ b/src/core/transport/chttp2/parsing.c
@@ -60,7 +60,7 @@ static int init_skip_frame_parser(
static int parse_frame_slice(grpc_chttp2_transport_parsing *transport_parsing,
gpr_slice slice, int is_last,
- grpc_call_list *call_list);
+ grpc_closure_list *closure_list);
void grpc_chttp2_prepare_to_read(
grpc_chttp2_transport_global *transport_global,
@@ -93,7 +93,7 @@ void grpc_chttp2_prepare_to_read(
void grpc_chttp2_publish_reads(grpc_chttp2_transport_global *transport_global,
grpc_chttp2_transport_parsing *transport_parsing,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
grpc_chttp2_stream_global *stream_global;
grpc_chttp2_stream_parsing *stream_parsing;
@@ -131,9 +131,9 @@ void grpc_chttp2_publish_reads(grpc_chttp2_transport_global *transport_global,
/* move goaway to the global state if we received one (it will be
published later */
if (transport_parsing->goaway_received) {
- grpc_chttp2_add_incoming_goaway(transport_global,
- (gpr_uint32)transport_parsing->goaway_error,
- transport_parsing->goaway_text, call_list);
+ grpc_chttp2_add_incoming_goaway(
+ transport_global, (gpr_uint32)transport_parsing->goaway_error,
+ transport_parsing->goaway_text, closure_list);
transport_parsing->goaway_text = gpr_empty_slice();
transport_parsing->goaway_received = 0;
}
@@ -236,7 +236,7 @@ void grpc_chttp2_publish_reads(grpc_chttp2_transport_global *transport_global,
}
int grpc_chttp2_perform_read(grpc_chttp2_transport_parsing *transport_parsing,
- gpr_slice slice, grpc_call_list *call_list) {
+ gpr_slice slice, grpc_closure_list *closure_list) {
gpr_uint8 *beg = GPR_SLICE_START_PTR(slice);
gpr_uint8 *end = GPR_SLICE_END_PTR(slice);
gpr_uint8 *cur = beg;
@@ -366,7 +366,7 @@ int grpc_chttp2_perform_read(grpc_chttp2_transport_parsing *transport_parsing,
}
if (transport_parsing->incoming_frame_size == 0) {
if (!parse_frame_slice(transport_parsing, gpr_empty_slice(), 1,
- call_list)) {
+ closure_list)) {
return 0;
}
transport_parsing->incoming_stream = NULL;
@@ -386,7 +386,7 @@ int grpc_chttp2_perform_read(grpc_chttp2_transport_parsing *transport_parsing,
if (!parse_frame_slice(transport_parsing,
gpr_slice_sub_no_ref(slice, (size_t)(cur - beg),
(size_t)(end - beg)),
- 1, call_list)) {
+ 1, closure_list)) {
return 0;
}
transport_parsing->deframe_state = GRPC_DTS_FH_0;
@@ -400,7 +400,7 @@ int grpc_chttp2_perform_read(grpc_chttp2_transport_parsing *transport_parsing,
gpr_slice_sub_no_ref(
slice, cur_offset,
cur_offset + transport_parsing->incoming_frame_size),
- 1, call_list)) {
+ 1, closure_list)) {
return 0;
}
cur += transport_parsing->incoming_frame_size;
@@ -410,7 +410,7 @@ int grpc_chttp2_perform_read(grpc_chttp2_transport_parsing *transport_parsing,
if (!parse_frame_slice(transport_parsing,
gpr_slice_sub_no_ref(slice, (size_t)(cur - beg),
(size_t)(end - beg)),
- 0, call_list)) {
+ 0, closure_list)) {
return 0;
}
transport_parsing->incoming_frame_size -= (gpr_uint32)(end - cur);
@@ -473,7 +473,7 @@ static int init_frame_parser(grpc_chttp2_transport_parsing *transport_parsing) {
static grpc_chttp2_parse_error skip_parser(
void *parser, grpc_chttp2_transport_parsing *transport_parsing,
grpc_chttp2_stream_parsing *stream_parsing, gpr_slice slice, int is_last,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
return GRPC_CHTTP2_PARSE_OK;
}
@@ -793,12 +793,12 @@ static int is_window_update_legal(gpr_int64 window_update, gpr_int64 window) {
static int parse_frame_slice(grpc_chttp2_transport_parsing *transport_parsing,
gpr_slice slice, int is_last,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
grpc_chttp2_stream_parsing *stream_parsing =
transport_parsing->incoming_stream;
switch (transport_parsing->parser(transport_parsing->parser_data,
transport_parsing, stream_parsing, slice,
- is_last, call_list)) {
+ is_last, closure_list)) {
case GRPC_CHTTP2_PARSE_OK:
if (stream_parsing) {
grpc_chttp2_list_add_parsing_seen_stream(transport_parsing,
diff --git a/src/core/transport/chttp2/writing.c b/src/core/transport/chttp2/writing.c
index 18f4bfbc77..e6f169c280 100644
--- a/src/core/transport/chttp2/writing.c
+++ b/src/core/transport/chttp2/writing.c
@@ -164,7 +164,7 @@ int grpc_chttp2_unlocking_check_writes(
void grpc_chttp2_perform_writes(
grpc_chttp2_transport_writing *transport_writing, grpc_endpoint *endpoint,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
GPR_ASSERT(transport_writing->outbuf.count > 0 ||
grpc_chttp2_list_have_writing_streams(transport_writing));
@@ -174,7 +174,7 @@ void grpc_chttp2_perform_writes(
GPR_ASSERT(endpoint);
grpc_endpoint_write(endpoint, &transport_writing->outbuf,
- &transport_writing->done_cb, call_list);
+ &transport_writing->done_cb, closure_list);
}
static void finalize_outbuf(grpc_chttp2_transport_writing *transport_writing) {
@@ -213,7 +213,7 @@ static void finalize_outbuf(grpc_chttp2_transport_writing *transport_writing) {
void grpc_chttp2_cleanup_writing(
grpc_chttp2_transport_global *transport_global,
grpc_chttp2_transport_writing *transport_writing,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
grpc_chttp2_stream_writing *stream_writing;
grpc_chttp2_stream_global *stream_global;
@@ -231,7 +231,8 @@ void grpc_chttp2_cleanup_writing(
stream_global->outgoing_sopb->nops == 0) {
GPR_ASSERT(stream_global->write_state != GRPC_WRITE_STATE_QUEUED_CLOSE);
stream_global->outgoing_sopb = NULL;
- grpc_call_list_add(call_list, stream_global->send_done_closure, 1);
+ grpc_closure_list_add(closure_list, stream_global->send_done_closure,
+ 1);
}
}
stream_global->writing_now = 0;
diff --git a/src/core/transport/chttp2_transport.c b/src/core/transport/chttp2_transport.c
index acd7cbdc1d..766b55b5fa 100644
--- a/src/core/transport/chttp2_transport.c
+++ b/src/core/transport/chttp2_transport.c
@@ -78,31 +78,31 @@ int grpc_flowctl_trace = 0;
static const grpc_transport_vtable vtable;
static void lock(grpc_chttp2_transport *t);
-static void unlock(grpc_chttp2_transport *t, grpc_call_list *call_list);
+static void unlock(grpc_chttp2_transport *t, grpc_closure_list *closure_list);
static void unlock_check_read_write_state(grpc_chttp2_transport *t,
- grpc_call_list *call_list);
+ grpc_closure_list *closure_list);
/* forward declarations of various callbacks that we'll build closures around */
static void writing_action(void *t, int iomgr_success_ignored,
- grpc_call_list *call_list);
+ grpc_closure_list *closure_list);
/** Set a transport level setting, and push it to our peer */
static void push_setting(grpc_chttp2_transport *t, grpc_chttp2_setting_id id,
gpr_uint32 value);
/** Endpoint callback to process incoming data */
-static void recv_data(void *tp, int success, grpc_call_list *call_list);
+static void recv_data(void *tp, int success, grpc_closure_list *closure_list);
/** Start disconnection chain */
static void drop_connection(grpc_chttp2_transport *t,
- grpc_call_list *call_list);
+ grpc_closure_list *closure_list);
/** Perform a transport_op */
static void perform_stream_op_locked(
grpc_chttp2_transport_global *transport_global,
grpc_chttp2_stream_global *stream_global, grpc_transport_stream_op *op,
- grpc_call_list *call_list);
+ grpc_closure_list *closure_list);
/** Cancel a stream: coming from the transport API */
static void cancel_from_api(grpc_chttp2_transport_global *transport_global,
@@ -117,26 +117,27 @@ static void close_from_api(grpc_chttp2_transport_global *transport_global,
/** Add endpoint from this transport to pollset */
static void add_to_pollset_locked(grpc_chttp2_transport *t,
grpc_pollset *pollset,
- grpc_call_list *call_list);
+ grpc_closure_list *closure_list);
static void add_to_pollset_set_locked(grpc_chttp2_transport *t,
grpc_pollset_set *pollset_set,
- grpc_call_list *call_list);
+ grpc_closure_list *closure_list);
/** Start new streams that have been created if we can */
static void maybe_start_some_streams(
- grpc_chttp2_transport_global *transport_global, grpc_call_list *call_list);
+ grpc_chttp2_transport_global *transport_global,
+ grpc_closure_list *closure_list);
static void connectivity_state_set(
grpc_chttp2_transport_global *transport_global,
grpc_connectivity_state state, const char *reason,
- grpc_call_list *call_list);
+ grpc_closure_list *closure_list);
/*
* CONSTRUCTION/DESTRUCTION/REFCOUNTING
*/
static void destruct_transport(grpc_chttp2_transport *t,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
size_t i;
gpr_mu_lock(&t->mu);
@@ -166,7 +167,7 @@ static void destruct_transport(grpc_chttp2_transport *t,
grpc_chttp2_stream_map_destroy(&t->parsing_stream_map);
grpc_chttp2_stream_map_destroy(&t->new_stream_map);
grpc_connectivity_state_destroy(&t->channel_callback.state_tracker,
- call_list);
+ closure_list);
gpr_mu_unlock(&t->mu);
gpr_mu_destroy(&t->mu);
@@ -175,7 +176,7 @@ static void destruct_transport(grpc_chttp2_transport *t,
and maybe they hold resources that need to be freed */
while (t->global.pings.next != &t->global.pings) {
grpc_chttp2_outstanding_ping *ping = t->global.pings.next;
- grpc_call_list_add(call_list, ping->on_recv, 0);
+ grpc_closure_list_add(closure_list, ping->on_recv, 0);
ping->next->prev = ping->prev;
ping->prev->next = ping->next;
gpr_free(ping);
@@ -190,12 +191,13 @@ static void destruct_transport(grpc_chttp2_transport *t,
#ifdef REFCOUNTING_DEBUG
#define REF_TRANSPORT(t, r) ref_transport(t, r, __FILE__, __LINE__)
#define UNREF_TRANSPORT(t, r, cl) unref_transport(t, cl, r, __FILE__, __LINE__)
-static void unref_transport(grpc_chttp2_transport *t, grpc_call_list *call_list,
- const char *reason, const char *file, int line) {
+static void unref_transport(grpc_chttp2_transport *t,
+ grpc_closure_list *closure_list, const char *reason,
+ const char *file, int line) {
gpr_log(GPR_DEBUG, "chttp2:unref:%p %d->%d %s [%s:%d]", t, t->refs.count,
t->refs.count - 1, reason, file, line);
if (!gpr_unref(&t->refs)) return;
- destruct_transport(t, call_list);
+ destruct_transport(t, closure_list);
}
static void ref_transport(grpc_chttp2_transport *t, const char *reason,
@@ -208,9 +210,9 @@ static void ref_transport(grpc_chttp2_transport *t, const char *reason,
#define REF_TRANSPORT(t, r) ref_transport(t)
#define UNREF_TRANSPORT(t, r, cl) unref_transport(t, cl)
static void unref_transport(grpc_chttp2_transport *t,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
if (!gpr_unref(&t->refs)) return;
- destruct_transport(t, call_list);
+ destruct_transport(t, closure_list);
}
static void ref_transport(grpc_chttp2_transport *t) { gpr_ref(&t->refs); }
@@ -219,7 +221,8 @@ static void ref_transport(grpc_chttp2_transport *t) { gpr_ref(&t->refs); }
static void init_transport(grpc_chttp2_transport *t,
const grpc_channel_args *channel_args,
grpc_endpoint *ep, grpc_mdctx *mdctx,
- gpr_uint8 is_client, grpc_call_list *call_list) {
+ gpr_uint8 is_client,
+ grpc_closure_list *closure_list) {
size_t i;
int j;
@@ -339,15 +342,16 @@ static void init_transport(grpc_chttp2_transport *t,
}
}
-static void destroy_transport(grpc_transport *gt, grpc_call_list *call_list) {
+static void destroy_transport(grpc_transport *gt,
+ grpc_closure_list *closure_list) {
grpc_chttp2_transport *t = (grpc_chttp2_transport *)gt;
lock(t);
t->destroying = 1;
- drop_connection(t, call_list);
- unlock(t, call_list);
+ drop_connection(t, closure_list);
+ unlock(t, closure_list);
- UNREF_TRANSPORT(t, "destroy", call_list);
+ UNREF_TRANSPORT(t, "destroy", closure_list);
}
/** block grpc_endpoint_shutdown being called until a paired
@@ -358,41 +362,41 @@ static void prevent_endpoint_shutdown(grpc_chttp2_transport *t) {
}
static void allow_endpoint_shutdown_locked(grpc_chttp2_transport *t,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
if (gpr_unref(&t->shutdown_ep_refs)) {
if (t->ep) {
- grpc_endpoint_shutdown(t->ep, call_list);
+ grpc_endpoint_shutdown(t->ep, closure_list);
}
}
}
static void allow_endpoint_shutdown_unlocked(grpc_chttp2_transport *t,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
if (gpr_unref(&t->shutdown_ep_refs)) {
gpr_mu_lock(&t->mu);
if (t->ep) {
- grpc_endpoint_shutdown(t->ep, call_list);
+ grpc_endpoint_shutdown(t->ep, closure_list);
}
gpr_mu_unlock(&t->mu);
}
}
static void destroy_endpoint(grpc_chttp2_transport *t,
- grpc_call_list *call_list) {
- grpc_endpoint_destroy(t->ep, call_list);
+ grpc_closure_list *closure_list) {
+ grpc_endpoint_destroy(t->ep, closure_list);
t->ep = NULL;
/* safe because we'll still have the ref for write */
- UNREF_TRANSPORT(t, "disconnect", call_list);
+ UNREF_TRANSPORT(t, "disconnect", closure_list);
}
static void close_transport_locked(grpc_chttp2_transport *t,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
if (!t->closed) {
t->closed = 1;
connectivity_state_set(&t->global, GRPC_CHANNEL_FATAL_FAILURE,
- "close_transport", call_list);
+ "close_transport", closure_list);
if (t->ep) {
- allow_endpoint_shutdown_locked(t, call_list);
+ allow_endpoint_shutdown_locked(t, closure_list);
}
}
}
@@ -400,7 +404,7 @@ static void close_transport_locked(grpc_chttp2_transport *t,
static int init_stream(grpc_transport *gt, grpc_stream *gs,
const void *server_data,
grpc_transport_stream_op *initial_op,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
grpc_chttp2_transport *t = (grpc_chttp2_transport *)gt;
grpc_chttp2_stream *s = (grpc_chttp2_stream *)gs;
@@ -432,14 +436,14 @@ static int init_stream(grpc_transport *gt, grpc_stream *gs,
}
if (initial_op)
- perform_stream_op_locked(&t->global, &s->global, initial_op, call_list);
- unlock(t, call_list);
+ perform_stream_op_locked(&t->global, &s->global, initial_op, closure_list);
+ unlock(t, closure_list);
return 0;
}
static void destroy_stream(grpc_transport *gt, grpc_stream *gs,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
grpc_chttp2_transport *t = (grpc_chttp2_transport *)gt;
grpc_chttp2_stream *s = (grpc_chttp2_stream *)gs;
int i;
@@ -450,7 +454,7 @@ static void destroy_stream(grpc_transport *gt, grpc_stream *gs,
s->global.id == 0);
GPR_ASSERT(!s->global.in_stream_map);
if (grpc_chttp2_unregister_stream(t, s) && t->global.sent_goaway) {
- close_transport_locked(t, call_list);
+ close_transport_locked(t, closure_list);
}
if (!t->parsing_active && s->global.id) {
GPR_ASSERT(grpc_chttp2_stream_map_find(&t->parsing_stream_map,
@@ -480,7 +484,7 @@ static void destroy_stream(grpc_transport *gt, grpc_stream *gs,
grpc_chttp2_incoming_metadata_live_op_buffer_end(
&s->global.outstanding_metadata);
- UNREF_TRANSPORT(t, "stream", call_list);
+ UNREF_TRANSPORT(t, "stream", closure_list);
}
grpc_chttp2_stream_parsing *grpc_chttp2_parsing_lookup_stream(
@@ -515,13 +519,13 @@ grpc_chttp2_stream_parsing *grpc_chttp2_parsing_accept_stream(
static void lock(grpc_chttp2_transport *t) { gpr_mu_lock(&t->mu); }
-static void unlock(grpc_chttp2_transport *t, grpc_call_list *call_list) {
- unlock_check_read_write_state(t, call_list);
+static void unlock(grpc_chttp2_transport *t, grpc_closure_list *closure_list) {
+ unlock_check_read_write_state(t, closure_list);
if (!t->writing_active && !t->closed &&
grpc_chttp2_unlocking_check_writes(&t->global, &t->writing)) {
t->writing_active = 1;
REF_TRANSPORT(t, "writing");
- grpc_call_list_add(call_list, &t->writing_action, 1);
+ grpc_closure_list_add(closure_list, &t->writing_action, 1);
prevent_endpoint_shutdown(t);
}
@@ -548,53 +552,54 @@ static void push_setting(grpc_chttp2_transport *t, grpc_chttp2_setting_id id,
}
void grpc_chttp2_terminate_writing(void *transport_writing_ptr, int success,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
grpc_chttp2_transport_writing *transport_writing = transport_writing_ptr;
grpc_chttp2_transport *t = TRANSPORT_FROM_WRITING(transport_writing);
lock(t);
- allow_endpoint_shutdown_locked(t, call_list);
+ allow_endpoint_shutdown_locked(t, closure_list);
if (!success) {
- drop_connection(t, call_list);
+ drop_connection(t, closure_list);
}
/* cleanup writing related jazz */
- grpc_chttp2_cleanup_writing(&t->global, &t->writing, call_list);
+ grpc_chttp2_cleanup_writing(&t->global, &t->writing, closure_list);
/* leave the writing flag up on shutdown to prevent further writes in unlock()
from starting */
t->writing_active = 0;
if (t->ep && !t->endpoint_reading) {
- destroy_endpoint(t, call_list);
+ destroy_endpoint(t, closure_list);
}
- unlock(t, call_list);
+ unlock(t, closure_list);
- UNREF_TRANSPORT(t, "writing", call_list);
+ UNREF_TRANSPORT(t, "writing", closure_list);
}
static void writing_action(void *gt, int iomgr_success_ignored,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
grpc_chttp2_transport *t = gt;
- grpc_chttp2_perform_writes(&t->writing, t->ep, call_list);
+ grpc_chttp2_perform_writes(&t->writing, t->ep, closure_list);
}
void grpc_chttp2_add_incoming_goaway(
grpc_chttp2_transport_global *transport_global, gpr_uint32 goaway_error,
- gpr_slice goaway_text, grpc_call_list *call_list) {
+ gpr_slice goaway_text, grpc_closure_list *closure_list) {
char *msg = gpr_dump_slice(goaway_text, GPR_DUMP_HEX | GPR_DUMP_ASCII);
gpr_log(GPR_DEBUG, "got goaway [%d]: %s", goaway_error, msg);
gpr_free(msg);
gpr_slice_unref(goaway_text);
transport_global->seen_goaway = 1;
connectivity_state_set(transport_global, GRPC_CHANNEL_FATAL_FAILURE,
- "got_goaway", call_list);
+ "got_goaway", closure_list);
}
static void maybe_start_some_streams(
- grpc_chttp2_transport_global *transport_global, grpc_call_list *call_list) {
+ grpc_chttp2_transport_global *transport_global,
+ grpc_closure_list *closure_list) {
grpc_chttp2_stream_global *stream_global;
/* start streams where we have free grpc_chttp2_stream ids and free
* concurrency */
@@ -616,7 +621,7 @@ static void maybe_start_some_streams(
if (transport_global->next_stream_id >= MAX_CLIENT_STREAM_ID) {
connectivity_state_set(transport_global, GRPC_CHANNEL_TRANSIENT_FAILURE,
- "no_more_stream_ids", call_list);
+ "no_more_stream_ids", closure_list);
}
stream_global->outgoing_window =
@@ -647,7 +652,7 @@ static void maybe_start_some_streams(
static void perform_stream_op_locked(
grpc_chttp2_transport_global *transport_global,
grpc_chttp2_stream_global *stream_global, grpc_transport_stream_op *op,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
if (op->cancel_with_status != GRPC_STATUS_OK) {
cancel_from_api(transport_global, stream_global, op->cancel_with_status);
}
@@ -674,13 +679,13 @@ static void perform_stream_op_locked(
transport_global->is_client ? "CLI" : "SVR", stream_global));
grpc_chttp2_list_add_waiting_for_concurrency(transport_global,
stream_global);
- maybe_start_some_streams(transport_global, call_list);
+ maybe_start_some_streams(transport_global, closure_list);
} else if (stream_global->outgoing_window > 0) {
grpc_chttp2_list_add_writable_stream(transport_global, stream_global);
}
} else {
grpc_sopb_reset(op->send_ops);
- grpc_call_list_add(call_list, stream_global->send_done_closure, 0);
+ grpc_closure_list_add(closure_list, stream_global->send_done_closure, 0);
}
}
@@ -715,21 +720,21 @@ static void perform_stream_op_locked(
if (op->bind_pollset) {
add_to_pollset_locked(TRANSPORT_FROM_GLOBAL(transport_global),
- op->bind_pollset, call_list);
+ op->bind_pollset, closure_list);
}
- grpc_call_list_add(call_list, op->on_consumed, 1);
+ grpc_closure_list_add(closure_list, op->on_consumed, 1);
}
static void perform_stream_op(grpc_transport *gt, grpc_stream *gs,
grpc_transport_stream_op *op,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
grpc_chttp2_transport *t = (grpc_chttp2_transport *)gt;
grpc_chttp2_stream *s = (grpc_chttp2_stream *)gs;
lock(t);
- perform_stream_op_locked(&t->global, &s->global, op, call_list);
- unlock(t, call_list);
+ perform_stream_op_locked(&t->global, &s->global, op, closure_list);
+ unlock(t, closure_list);
}
static void send_ping_locked(grpc_chttp2_transport *t, grpc_closure *on_recv) {
@@ -750,18 +755,18 @@ static void send_ping_locked(grpc_chttp2_transport *t, grpc_closure *on_recv) {
}
static void perform_transport_op(grpc_transport *gt, grpc_transport_op *op,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
grpc_chttp2_transport *t = (grpc_chttp2_transport *)gt;
int close_transport = 0;
lock(t);
- grpc_call_list_add(call_list, op->on_consumed, 1);
+ grpc_closure_list_add(closure_list, op->on_consumed, 1);
if (op->on_connectivity_state_change) {
grpc_connectivity_state_notify_on_state_change(
&t->channel_callback.state_tracker, op->connectivity_state,
- op->on_connectivity_state_change, call_list);
+ op->on_connectivity_state_change, closure_list);
}
if (op->send_goaway) {
@@ -780,11 +785,11 @@ static void perform_transport_op(grpc_transport *gt, grpc_transport_op *op,
}
if (op->bind_pollset) {
- add_to_pollset_locked(t, op->bind_pollset, call_list);
+ add_to_pollset_locked(t, op->bind_pollset, closure_list);
}
if (op->bind_pollset_set) {
- add_to_pollset_set_locked(t, op->bind_pollset_set, call_list);
+ add_to_pollset_set_locked(t, op->bind_pollset_set, closure_list);
}
if (op->send_ping) {
@@ -792,15 +797,15 @@ static void perform_transport_op(grpc_transport *gt, grpc_transport_op *op,
}
if (op->disconnect) {
- close_transport_locked(t, call_list);
+ close_transport_locked(t, closure_list);
}
- unlock(t, call_list);
+ unlock(t, closure_list);
if (close_transport) {
lock(t);
- close_transport_locked(t, call_list);
- unlock(t, call_list);
+ close_transport_locked(t, closure_list);
+ unlock(t, closure_list);
}
}
@@ -817,7 +822,7 @@ static grpc_stream_state compute_state(gpr_uint8 write_closed,
}
static void remove_stream(grpc_chttp2_transport *t, gpr_uint32 id,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
size_t new_stream_count;
grpc_chttp2_stream *s =
grpc_chttp2_stream_map_delete(&t->parsing_stream_map, id);
@@ -832,7 +837,7 @@ static void remove_stream(grpc_chttp2_transport *t, gpr_uint32 id,
grpc_chttp2_parsing_become_skip_parser(&t->parsing);
}
if (grpc_chttp2_unregister_stream(t, s) && t->global.sent_goaway) {
- close_transport_locked(t, call_list);
+ close_transport_locked(t, closure_list);
}
new_stream_count = grpc_chttp2_stream_map_size(&t->parsing_stream_map) +
@@ -840,12 +845,12 @@ static void remove_stream(grpc_chttp2_transport *t, gpr_uint32 id,
GPR_ASSERT(new_stream_count <= GPR_UINT32_MAX);
if (new_stream_count != t->global.concurrent_stream_count) {
t->global.concurrent_stream_count = (gpr_uint32)new_stream_count;
- maybe_start_some_streams(&t->global, call_list);
+ maybe_start_some_streams(&t->global, closure_list);
}
}
static void unlock_check_read_write_state(grpc_chttp2_transport *t,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
grpc_chttp2_transport_global *transport_global = &t->global;
grpc_chttp2_stream_global *stream_global;
grpc_stream_state state;
@@ -859,7 +864,7 @@ static void unlock_check_read_write_state(grpc_chttp2_transport *t,
GPR_ASSERT(stream_global->in_stream_map);
GPR_ASSERT(stream_global->write_state != GRPC_WRITE_STATE_OPEN);
GPR_ASSERT(stream_global->read_closed);
- remove_stream(t, stream_global->id, call_list);
+ remove_stream(t, stream_global->id, closure_list);
grpc_chttp2_list_add_read_write_state_changed(transport_global,
stream_global);
}
@@ -885,7 +890,8 @@ static void unlock_check_read_write_state(grpc_chttp2_transport *t,
if (stream_global->outgoing_sopb != NULL) {
grpc_sopb_reset(stream_global->outgoing_sopb);
stream_global->outgoing_sopb = NULL;
- grpc_call_list_add(call_list, stream_global->send_done_closure, 1);
+ grpc_closure_list_add(closure_list, stream_global->send_done_closure,
+ 1);
}
stream_global->read_closed = 1;
if (!stream_global->published_cancelled) {
@@ -907,7 +913,7 @@ static void unlock_check_read_write_state(grpc_chttp2_transport *t,
grpc_chttp2_list_add_closed_waiting_for_parsing(transport_global,
stream_global);
} else {
- remove_stream(t, stream_global->id, call_list);
+ remove_stream(t, stream_global->id, closure_list);
}
}
if (!stream_global->publish_sopb) {
@@ -935,7 +941,7 @@ static void unlock_check_read_write_state(grpc_chttp2_transport *t,
&stream_global->outstanding_metadata);
grpc_sopb_swap(stream_global->publish_sopb, &stream_global->incoming_sopb);
stream_global->published_state = *stream_global->publish_state = state;
- grpc_call_list_add(call_list, stream_global->recv_done_closure, 1);
+ grpc_closure_list_add(closure_list, stream_global->recv_done_closure, 1);
stream_global->recv_done_closure = NULL;
stream_global->publish_sopb = NULL;
stream_global->publish_state = NULL;
@@ -1071,8 +1077,8 @@ static void end_all_the_calls(grpc_chttp2_transport *t) {
}
static void drop_connection(grpc_chttp2_transport *t,
- grpc_call_list *call_list) {
- close_transport_locked(t, call_list);
+ grpc_closure_list *closure_list) {
+ close_transport_locked(t, closure_list);
end_all_the_calls(t);
}
@@ -1098,15 +1104,15 @@ static void update_global_window(void *args, gpr_uint32 id, void *stream) {
}
static void read_error_locked(grpc_chttp2_transport *t,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
t->endpoint_reading = 0;
if (!t->writing_active && t->ep) {
- destroy_endpoint(t, call_list);
+ destroy_endpoint(t, closure_list);
}
}
/* tcp read callback */
-static void recv_data(void *tp, int success, grpc_call_list *call_list) {
+static void recv_data(void *tp, int success, grpc_closure_list *closure_list) {
size_t i;
int keep_reading = 0;
grpc_chttp2_transport *t = tp;
@@ -1123,12 +1129,12 @@ static void recv_data(void *tp, int success, grpc_call_list *call_list) {
gpr_mu_unlock(&t->mu);
for (; i < t->read_buffer.count &&
grpc_chttp2_perform_read(&t->parsing, t->read_buffer.slices[i],
- call_list);
+ closure_list);
i++)
;
gpr_mu_lock(&t->mu);
if (i != t->read_buffer.count) {
- drop_connection(t, call_list);
+ drop_connection(t, closure_list);
}
/* merge stream lists */
grpc_chttp2_stream_map_move_into(&t->new_stream_map,
@@ -1141,26 +1147,26 @@ static void recv_data(void *tp, int success, grpc_call_list *call_list) {
t->parsing.initial_window_update = 0;
}
/* handle higher level things */
- grpc_chttp2_publish_reads(&t->global, &t->parsing, call_list);
+ grpc_chttp2_publish_reads(&t->global, &t->parsing, closure_list);
t->parsing_active = 0;
}
if (!success || i != t->read_buffer.count) {
- drop_connection(t, call_list);
- read_error_locked(t, call_list);
+ drop_connection(t, closure_list);
+ read_error_locked(t, closure_list);
} else if (!t->closed) {
keep_reading = 1;
REF_TRANSPORT(t, "keep_reading");
prevent_endpoint_shutdown(t);
}
gpr_slice_buffer_reset_and_unref(&t->read_buffer);
- unlock(t, call_list);
+ unlock(t, closure_list);
if (keep_reading) {
- grpc_endpoint_read(t->ep, &t->read_buffer, &t->recv_data, call_list);
- allow_endpoint_shutdown_unlocked(t, call_list);
- UNREF_TRANSPORT(t, "keep_reading", call_list);
+ grpc_endpoint_read(t->ep, &t->read_buffer, &t->recv_data, closure_list);
+ allow_endpoint_shutdown_unlocked(t, closure_list);
+ UNREF_TRANSPORT(t, "keep_reading", closure_list);
} else {
- UNREF_TRANSPORT(t, "recv_data", call_list);
+ UNREF_TRANSPORT(t, "recv_data", closure_list);
}
}
@@ -1171,12 +1177,12 @@ static void recv_data(void *tp, int success, grpc_call_list *call_list) {
static void connectivity_state_set(
grpc_chttp2_transport_global *transport_global,
grpc_connectivity_state state, const char *reason,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
GRPC_CHTTP2_IF_TRACING(
gpr_log(GPR_DEBUG, "set connectivity_state=%d", state));
grpc_connectivity_state_set(
&TRANSPORT_FROM_GLOBAL(transport_global)->channel_callback.state_tracker,
- state, reason, call_list);
+ state, reason, closure_list);
}
/*
@@ -1185,17 +1191,17 @@ static void connectivity_state_set(
static void add_to_pollset_locked(grpc_chttp2_transport *t,
grpc_pollset *pollset,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
if (t->ep) {
- grpc_endpoint_add_to_pollset(t->ep, pollset, call_list);
+ grpc_endpoint_add_to_pollset(t->ep, pollset, closure_list);
}
}
static void add_to_pollset_set_locked(grpc_chttp2_transport *t,
grpc_pollset_set *pollset_set,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
if (t->ep) {
- grpc_endpoint_add_to_pollset_set(t->ep, pollset_set, call_list);
+ grpc_endpoint_add_to_pollset_set(t->ep, pollset_set, closure_list);
}
}
@@ -1234,7 +1240,8 @@ void grpc_chttp2_flowctl_trace(const char *file, int line, const char *reason,
* INTEGRATION GLUE
*/
-static char *chttp2_get_peer(grpc_transport *t, grpc_call_list *call_list) {
+static char *chttp2_get_peer(grpc_transport *t,
+ grpc_closure_list *closure_list) {
return gpr_strdup(((grpc_chttp2_transport *)t)->peer_string);
}
@@ -1248,17 +1255,17 @@ static const grpc_transport_vtable vtable = {sizeof(grpc_chttp2_stream),
grpc_transport *grpc_create_chttp2_transport(
const grpc_channel_args *channel_args, grpc_endpoint *ep, grpc_mdctx *mdctx,
- int is_client, grpc_call_list *call_list) {
+ int is_client, grpc_closure_list *closure_list) {
grpc_chttp2_transport *t = gpr_malloc(sizeof(grpc_chttp2_transport));
- init_transport(t, channel_args, ep, mdctx, is_client != 0, call_list);
+ init_transport(t, channel_args, ep, mdctx, is_client != 0, closure_list);
return &t->base;
}
void grpc_chttp2_transport_start_reading(grpc_transport *transport,
gpr_slice *slices, size_t nslices,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
grpc_chttp2_transport *t = (grpc_chttp2_transport *)transport;
REF_TRANSPORT(t, "recv_data"); /* matches unref inside recv_data */
gpr_slice_buffer_addn(&t->read_buffer, slices, nslices);
- recv_data(t, 1, call_list);
+ recv_data(t, 1, closure_list);
}
diff --git a/src/core/transport/chttp2_transport.h b/src/core/transport/chttp2_transport.h
index e963e16707..93a654bc83 100644
--- a/src/core/transport/chttp2_transport.h
+++ b/src/core/transport/chttp2_transport.h
@@ -42,10 +42,11 @@ extern int grpc_flowctl_trace;
grpc_transport *grpc_create_chttp2_transport(
const grpc_channel_args *channel_args, grpc_endpoint *ep,
- grpc_mdctx *metadata_context, int is_client, grpc_call_list *call_list);
+ grpc_mdctx *metadata_context, int is_client,
+ grpc_closure_list *closure_list);
void grpc_chttp2_transport_start_reading(grpc_transport *transport,
gpr_slice *slices, size_t nslices,
- grpc_call_list *call_list);
+ grpc_closure_list *closure_list);
#endif /* GRPC_INTERNAL_CORE_TRANSPORT_CHTTP2_TRANSPORT_H */
diff --git a/src/core/transport/connectivity_state.c b/src/core/transport/connectivity_state.c
index d04c3a2209..638ec62e73 100644
--- a/src/core/transport/connectivity_state.c
+++ b/src/core/transport/connectivity_state.c
@@ -67,7 +67,7 @@ void grpc_connectivity_state_init(grpc_connectivity_state_tracker *tracker,
}
void grpc_connectivity_state_destroy(grpc_connectivity_state_tracker *tracker,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
int success;
grpc_connectivity_state_watcher *w;
while ((w = tracker->watchers)) {
@@ -79,7 +79,7 @@ void grpc_connectivity_state_destroy(grpc_connectivity_state_tracker *tracker,
} else {
success = 0;
}
- grpc_call_list_add(call_list, w->notify, success);
+ grpc_closure_list_add(closure_list, w->notify, success);
gpr_free(w);
}
gpr_free(tracker->name);
@@ -96,7 +96,7 @@ grpc_connectivity_state grpc_connectivity_state_check(
int grpc_connectivity_state_notify_on_state_change(
grpc_connectivity_state_tracker *tracker, grpc_connectivity_state *current,
- grpc_closure *notify, grpc_call_list *call_list) {
+ grpc_closure *notify, grpc_closure_list *closure_list) {
if (grpc_connectivity_state_trace) {
gpr_log(GPR_DEBUG, "CONWATCH: %s: from %s [cur=%s] notify=%p",
tracker->name, grpc_connectivity_state_name(*current),
@@ -104,7 +104,7 @@ int grpc_connectivity_state_notify_on_state_change(
}
if (tracker->current_state != *current) {
*current = tracker->current_state;
- grpc_call_list_add(call_list, notify, 1);
+ grpc_closure_list_add(closure_list, notify, 1);
} else {
grpc_connectivity_state_watcher *w = gpr_malloc(sizeof(*w));
w->current = current;
@@ -118,7 +118,7 @@ int grpc_connectivity_state_notify_on_state_change(
void grpc_connectivity_state_set(grpc_connectivity_state_tracker *tracker,
grpc_connectivity_state state,
const char *reason,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
grpc_connectivity_state_watcher *w;
if (grpc_connectivity_state_trace) {
gpr_log(GPR_DEBUG, "SET: %s: %s --> %s [%s]", tracker->name,
@@ -133,7 +133,7 @@ void grpc_connectivity_state_set(grpc_connectivity_state_tracker *tracker,
while ((w = tracker->watchers) != NULL) {
*w->current = tracker->current_state;
tracker->watchers = w->next;
- grpc_call_list_add(call_list, w->notify, 1);
+ grpc_closure_list_add(closure_list, w->notify, 1);
gpr_free(w);
}
}
diff --git a/src/core/transport/connectivity_state.h b/src/core/transport/connectivity_state.h
index 6ade8e19f7..26f8874fbc 100644
--- a/src/core/transport/connectivity_state.h
+++ b/src/core/transport/connectivity_state.h
@@ -61,13 +61,14 @@ void grpc_connectivity_state_init(grpc_connectivity_state_tracker *tracker,
grpc_connectivity_state init_state,
const char *name);
void grpc_connectivity_state_destroy(grpc_connectivity_state_tracker *tracker,
- grpc_call_list *call_list);
+ grpc_closure_list *closure_list);
/** Set connectivity state; not thread safe; access must be serialized with an
* external lock */
void grpc_connectivity_state_set(grpc_connectivity_state_tracker *tracker,
grpc_connectivity_state state,
- const char *reason, grpc_call_list *call_list);
+ const char *reason,
+ grpc_closure_list *closure_list);
grpc_connectivity_state grpc_connectivity_state_check(
grpc_connectivity_state_tracker *tracker);
@@ -75,6 +76,6 @@ grpc_connectivity_state grpc_connectivity_state_check(
/** Return 1 if the channel should start connecting, 0 otherwise */
int grpc_connectivity_state_notify_on_state_change(
grpc_connectivity_state_tracker *tracker, grpc_connectivity_state *current,
- grpc_closure *notify, grpc_call_list *call_list);
+ grpc_closure *notify, grpc_closure_list *closure_list);
#endif /* GRPC_INTERNAL_CORE_TRANSPORT_CONNECTIVITY_STATE_H */
diff --git a/src/core/transport/transport.c b/src/core/transport/transport.c
index f7c87c1e90..24d549a29b 100644
--- a/src/core/transport/transport.c
+++ b/src/core/transport/transport.c
@@ -41,46 +41,46 @@ size_t grpc_transport_stream_size(grpc_transport *transport) {
}
void grpc_transport_destroy(grpc_transport *transport,
- grpc_call_list *call_list) {
- transport->vtable->destroy(transport, call_list);
+ grpc_closure_list *closure_list) {
+ transport->vtable->destroy(transport, closure_list);
}
int grpc_transport_init_stream(grpc_transport *transport, grpc_stream *stream,
const void *server_data,
grpc_transport_stream_op *initial_op,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
return transport->vtable->init_stream(transport, stream, server_data,
- initial_op, call_list);
+ initial_op, closure_list);
}
void grpc_transport_perform_stream_op(grpc_transport *transport,
grpc_stream *stream,
grpc_transport_stream_op *op,
- grpc_call_list *call_list) {
- transport->vtable->perform_stream_op(transport, stream, op, call_list);
+ grpc_closure_list *closure_list) {
+ transport->vtable->perform_stream_op(transport, stream, op, closure_list);
}
void grpc_transport_perform_op(grpc_transport *transport, grpc_transport_op *op,
- grpc_call_list *call_list) {
- transport->vtable->perform_op(transport, op, call_list);
+ grpc_closure_list *closure_list) {
+ transport->vtable->perform_op(transport, op, closure_list);
}
void grpc_transport_destroy_stream(grpc_transport *transport,
grpc_stream *stream,
- grpc_call_list *call_list) {
- transport->vtable->destroy_stream(transport, stream, call_list);
+ grpc_closure_list *closure_list) {
+ transport->vtable->destroy_stream(transport, stream, closure_list);
}
char *grpc_transport_get_peer(grpc_transport *transport,
- grpc_call_list *call_list) {
- return transport->vtable->get_peer(transport, call_list);
+ grpc_closure_list *closure_list) {
+ return transport->vtable->get_peer(transport, closure_list);
}
-void grpc_transport_stream_op_finish_with_failure(grpc_transport_stream_op *op,
- grpc_call_list *call_list) {
- grpc_call_list_add(call_list, op->on_done_recv, 0);
- grpc_call_list_add(call_list, op->on_done_send, 0);
- grpc_call_list_add(call_list, op->on_consumed, 0);
+void grpc_transport_stream_op_finish_with_failure(
+ grpc_transport_stream_op *op, grpc_closure_list *closure_list) {
+ grpc_closure_list_add(closure_list, op->on_done_recv, 0);
+ grpc_closure_list_add(closure_list, op->on_done_send, 0);
+ grpc_closure_list_add(closure_list, op->on_consumed, 0);
}
void grpc_transport_stream_op_add_cancellation(grpc_transport_stream_op *op,
@@ -105,11 +105,11 @@ typedef struct {
} close_message_data;
static void free_message(void *p, int iomgr_success,
- grpc_call_list *call_list) {
+ grpc_closure_list *closure_list) {
close_message_data *cmd = p;
gpr_slice_unref(cmd->message);
if (cmd->then_call != NULL) {
- cmd->then_call->cb(cmd->then_call->cb_arg, iomgr_success, call_list);
+ cmd->then_call->cb(cmd->then_call->cb_arg, iomgr_success, closure_list);
}
gpr_free(cmd);
}
diff --git a/src/core/transport/transport.h b/src/core/transport/transport.h
index d5383ad11a..1d6dd1e735 100644
--- a/src/core/transport/transport.h
+++ b/src/core/transport/transport.h
@@ -137,7 +137,7 @@ size_t grpc_transport_stream_size(grpc_transport *transport);
int grpc_transport_init_stream(grpc_transport *transport, grpc_stream *stream,
const void *server_data,
grpc_transport_stream_op *initial_op,
- grpc_call_list *call_list);
+ grpc_closure_list *closure_list);
/* Destroy transport data for a stream.
@@ -151,10 +151,10 @@ int grpc_transport_init_stream(grpc_transport *transport, grpc_stream *stream,
caller, but any child memory must be cleaned up) */
void grpc_transport_destroy_stream(grpc_transport *transport,
grpc_stream *stream,
- grpc_call_list *call_list);
+ grpc_closure_list *closure_list);
-void grpc_transport_stream_op_finish_with_failure(grpc_transport_stream_op *op,
- grpc_call_list *call_list);
+void grpc_transport_stream_op_finish_with_failure(
+ grpc_transport_stream_op *op, grpc_closure_list *closure_list);
void grpc_transport_stream_op_add_cancellation(grpc_transport_stream_op *op,
grpc_status_code status);
@@ -177,10 +177,10 @@ char *grpc_transport_stream_op_string(grpc_transport_stream_op *op);
void grpc_transport_perform_stream_op(grpc_transport *transport,
grpc_stream *stream,
grpc_transport_stream_op *op,
- grpc_call_list *call_list);
+ grpc_closure_list *closure_list);
void grpc_transport_perform_op(grpc_transport *transport, grpc_transport_op *op,
- grpc_call_list *call_list);
+ grpc_closure_list *closure_list);
/* Send a ping on a transport
@@ -196,10 +196,10 @@ void grpc_transport_close(grpc_transport *transport);
/* Destroy the transport */
void grpc_transport_destroy(grpc_transport *transport,
- grpc_call_list *call_list);
+ grpc_closure_list *closure_list);
/* Get the transports peer */
char *grpc_transport_get_peer(grpc_transport *transport,
- grpc_call_list *call_list);
+ grpc_closure_list *closure_list);
#endif /* GRPC_INTERNAL_CORE_TRANSPORT_TRANSPORT_H */
diff --git a/src/core/transport/transport_impl.h b/src/core/transport/transport_impl.h
index 9adb16b941..c7eebc9bb2 100644
--- a/src/core/transport/transport_impl.h
+++ b/src/core/transport/transport_impl.h
@@ -45,26 +45,26 @@ typedef struct grpc_transport_vtable {
int (*init_stream)(grpc_transport *self, grpc_stream *stream,
const void *server_data,
grpc_transport_stream_op *initial_op,
- grpc_call_list *call_list);
+ grpc_closure_list *closure_list);
/* implementation of grpc_transport_perform_stream_op */
void (*perform_stream_op)(grpc_transport *self, grpc_stream *stream,
grpc_transport_stream_op *op,
- grpc_call_list *call_list);
+ grpc_closure_list *closure_list);
/* implementation of grpc_transport_perform_op */
void (*perform_op)(grpc_transport *self, grpc_transport_op *op,
- grpc_call_list *call_list);
+ grpc_closure_list *closure_list);
/* implementation of grpc_transport_destroy_stream */
void (*destroy_stream)(grpc_transport *self, grpc_stream *stream,
- grpc_call_list *call_list);
+ grpc_closure_list *closure_list);
/* implementation of grpc_transport_destroy */
- void (*destroy)(grpc_transport *self, grpc_call_list *call_list);
+ void (*destroy)(grpc_transport *self, grpc_closure_list *closure_list);
/* implementation of grpc_transport_get_peer */
- char *(*get_peer)(grpc_transport *self, grpc_call_list *call_list);
+ char *(*get_peer)(grpc_transport *self, grpc_closure_list *closure_list);
} grpc_transport_vtable;
/* an instance of a grpc transport */