Fix non-listening cq registration so that calls can be queued against them

pull/6612/head
Craig Tiller 9 years ago
parent ae09d9dca9
commit 509b30e739
  1. 20
      src/core/lib/surface/server.c

@ -933,16 +933,15 @@ static void register_completion_queue(grpc_server *server,
grpc_cq_mark_server_cq(cq);
/* Non-listening completion queues are not added to server->cqs */
if (is_non_listening) {
grpc_cq_mark_non_listening_server_cq(cq);
} else {
GRPC_CQ_INTERNAL_REF(cq, "server");
n = server->cq_count++;
server->cqs = gpr_realloc(
server->cqs, server->cq_count * sizeof(grpc_completion_queue *));
server->cqs[n] = cq;
}
GRPC_CQ_INTERNAL_REF(cq, "server");
n = server->cq_count++;
server->cqs = gpr_realloc(server->cqs,
server->cq_count * sizeof(grpc_completion_queue *));
server->cqs[n] = cq;
}
void grpc_server_register_completion_queue(grpc_server *server,
@ -1049,9 +1048,12 @@ void grpc_server_start(grpc_server *server) {
GRPC_API_TRACE("grpc_server_start(server=%p)", 1, (server));
server->started = true;
size_t pollset_count = 0;
server->pollsets = gpr_malloc(sizeof(grpc_pollset *) * server->cq_count);
for (i = 0; i < server->cq_count; i++) {
server->pollsets[i] = grpc_cq_pollset(server->cqs[i]);
if (!grpc_cq_is_non_listening_server_cq(server->cqs[i])) {
server->pollsets[pollset_count++] = grpc_cq_pollset(server->cqs[i]);
}
}
request_matcher_init(&server->unregistered_request_matcher,
server->max_requested_calls, server);
@ -1061,7 +1063,7 @@ void grpc_server_start(grpc_server *server) {
}
for (l = server->listeners; l; l = l->next) {
l->start(&exec_ctx, server, l->arg, server->pollsets, server->cq_count);
l->start(&exec_ctx, server, l->arg, server->pollsets, pollset_count);
}
grpc_exec_ctx_finish(&exec_ctx);

Loading…
Cancel
Save