diff options
author | Craig Tiller <ctiller@google.com> | 2016-05-21 12:32:39 -0700 |
---|---|---|
committer | Craig Tiller <ctiller@google.com> | 2016-05-21 12:32:39 -0700 |
commit | 509b30e7396b617693a3c93f4c2fd4ec417a96a1 (patch) | |
tree | cb48f915c51e206b1a6c9e71059ee9afd46bfae0 /src/core/lib/surface | |
parent | ae09d9dca9ac0f6d6c6e877e2935ad8cfba9da05 (diff) |
Fix non-listening cq registration so that calls can be queued against them
Diffstat (limited to 'src/core/lib/surface')
-rw-r--r-- | src/core/lib/surface/server.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/src/core/lib/surface/server.c b/src/core/lib/surface/server.c index 165e20a062..b1d8b575a7 100644 --- a/src/core/lib/surface/server.c +++ b/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); |