|
|
|
@ -974,7 +974,7 @@ const grpc_channel_filter grpc_server_top_filter = { |
|
|
|
|
|
|
|
|
|
static void register_completion_queue(grpc_server *server, |
|
|
|
|
grpc_completion_queue *cq, |
|
|
|
|
bool is_non_listening, void *reserved) { |
|
|
|
|
void *reserved) { |
|
|
|
|
size_t i, n; |
|
|
|
|
GPR_ASSERT(!reserved); |
|
|
|
|
for (i = 0; i < server->cq_count; i++) { |
|
|
|
@ -983,10 +983,6 @@ static void register_completion_queue(grpc_server *server, |
|
|
|
|
|
|
|
|
|
grpc_cq_mark_server_cq(cq); |
|
|
|
|
|
|
|
|
|
if (is_non_listening) { |
|
|
|
|
grpc_cq_mark_non_listening_server_cq(cq); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
GRPC_CQ_INTERNAL_REF(cq, "server"); |
|
|
|
|
n = server->cq_count++; |
|
|
|
|
server->cqs = gpr_realloc(server->cqs, |
|
|
|
@ -1009,16 +1005,7 @@ void grpc_server_register_completion_queue(grpc_server *server, |
|
|
|
|
calls grpc_completion_queue_pluck() on server completion queues */ |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
register_completion_queue(server, cq, false, reserved); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void grpc_server_register_non_listening_completion_queue( |
|
|
|
|
grpc_server *server, grpc_completion_queue *cq, void *reserved) { |
|
|
|
|
GRPC_API_TRACE( |
|
|
|
|
"grpc_server_register_non_listening_completion_queue(server=%p, cq=%p, " |
|
|
|
|
"reserved=%p)", |
|
|
|
|
3, (server, cq, reserved)); |
|
|
|
|
register_completion_queue(server, cq, true, reserved); |
|
|
|
|
register_completion_queue(server, cq, reserved); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
grpc_server *grpc_server_create(const grpc_channel_args *args, void *reserved) { |
|
|
|
@ -1101,9 +1088,9 @@ void grpc_server_start(grpc_server *server) { |
|
|
|
|
server->requested_calls_per_cq = |
|
|
|
|
gpr_malloc(sizeof(*server->requested_calls_per_cq) * server->cq_count); |
|
|
|
|
for (i = 0; i < server->cq_count; i++) { |
|
|
|
|
if (!grpc_cq_is_non_listening_server_cq(server->cqs[i])) { |
|
|
|
|
grpc_pollset *pollset = grpc_cq_pollset(server->cqs[i]); |
|
|
|
|
if (pollset != NULL) server->pollsets[server->pollset_count++] = pollset; |
|
|
|
|
if (grpc_cq_can_listen(server->cqs[i])) { |
|
|
|
|
server->pollsets[server->pollset_count++] = |
|
|
|
|
grpc_cq_pollset(server->cqs[i]); |
|
|
|
|
} |
|
|
|
|
server->request_freelist_per_cq[i] = |
|
|
|
|
gpr_stack_lockfree_create((size_t)server->max_requested_calls_per_cq); |
|
|
|
|