aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/surface/server.c
diff options
context:
space:
mode:
authorGravatar David Garcia Quintas <dgq@google.com>2015-05-26 19:58:50 -0700
committerGravatar David Garcia Quintas <dgq@google.com>2015-05-31 12:45:10 -0700
commit5f228f5001c7c1f85c0d1965640bd6258d7b9188 (patch)
tree15c767d330d3c302420ee4b45d6330f5693ffefa /src/core/surface/server.c
parent2e378c89f89820941d1b30ad8c8b501fefa213b0 (diff)
Adapted the following to the new iomgr's cb API:
alarm_test, tcp_posix, fd_posix, pollset_posix, credentials, call, channel, server, child_channel
Diffstat (limited to 'src/core/surface/server.c')
-rw-r--r--src/core/surface/server.c25
1 files changed, 19 insertions, 6 deletions
diff --git a/src/core/surface/server.c b/src/core/surface/server.c
index 60606c75e4..a10b921456 100644
--- a/src/core/surface/server.c
+++ b/src/core/surface/server.c
@@ -122,6 +122,8 @@ struct channel_data {
channel_registered_method *registered_methods;
gpr_uint32 registered_method_slots;
gpr_uint32 registered_method_max_probes;
+ grpc_iomgr_closure finish_shutdown_channel_iocb;
+ grpc_iomgr_closure finish_destroy_channel_iocb;
};
struct grpc_server {
@@ -304,7 +306,10 @@ static void destroy_channel(channel_data *chand) {
GPR_ASSERT(chand->server != NULL);
orphan_channel(chand);
server_ref(chand->server);
- grpc_iomgr_add_callback(finish_destroy_channel, chand);
+ chand->finish_destroy_channel_iocb.cb = finish_destroy_channel;
+ chand->finish_destroy_channel_iocb.cb_arg = chand;
+ chand->finish_destroy_channel_iocb.is_ext_managed = 1;
+ grpc_iomgr_add_callback(&chand->finish_destroy_channel_iocb);
}
static void finish_start_new_rpc_and_unlock(grpc_server *server,
@@ -416,7 +421,8 @@ static void server_on_recv(void *ptr, int success) {
gpr_mu_lock(&chand->server->mu);
if (calld->state == NOT_STARTED) {
calld->state = ZOMBIED;
- grpc_iomgr_add_callback(kill_zombie, elem);
+ grpc_iomgr_add_callback(
+ grpc_iomgr_cb_create(kill_zombie, elem, 0 /* GPR_FALSE */));
}
gpr_mu_unlock(&chand->server->mu);
break;
@@ -424,11 +430,13 @@ static void server_on_recv(void *ptr, int success) {
gpr_mu_lock(&chand->server->mu);
if (calld->state == NOT_STARTED) {
calld->state = ZOMBIED;
- grpc_iomgr_add_callback(kill_zombie, elem);
+ grpc_iomgr_add_callback(
+ grpc_iomgr_cb_create(kill_zombie, elem, 0 /* GPR_FALSE */));
} else if (calld->state == PENDING) {
call_list_remove(calld, PENDING_START);
calld->state = ZOMBIED;
- grpc_iomgr_add_callback(kill_zombie, elem);
+ grpc_iomgr_add_callback(
+ grpc_iomgr_cb_create(kill_zombie, elem, 0 /* GPR_FALSE */));
}
gpr_mu_unlock(&chand->server->mu);
break;
@@ -502,7 +510,10 @@ static void finish_shutdown_channel(void *cd, int success) {
static void shutdown_channel(channel_data *chand) {
grpc_channel_internal_ref(chand->channel);
- grpc_iomgr_add_callback(finish_shutdown_channel, chand);
+ chand->finish_shutdown_channel_iocb.cb = finish_shutdown_channel;
+ chand->finish_shutdown_channel_iocb.cb_arg = chand;
+ chand->finish_shutdown_channel_iocb.is_ext_managed = 1;
+ grpc_iomgr_add_callback(&chand->finish_shutdown_channel_iocb);
}
static void init_call_elem(grpc_call_element *elem,
@@ -943,8 +954,10 @@ void grpc_server_destroy(grpc_server *server) {
gpr_log(GPR_DEBUG, "server destroys call %p", calld->call);
calld->state = ZOMBIED;
grpc_iomgr_add_callback(
+ grpc_iomgr_cb_create(
kill_zombie,
- grpc_call_stack_element(grpc_call_get_call_stack(calld->call), 0));
+ grpc_call_stack_element(grpc_call_get_call_stack(calld->call), 0),
+ 0)); /* XXX */
}
for (c = server->root_channel_data.next; c != &server->root_channel_data;