aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Craig Tiller <ctiller@google.com>2015-02-11 16:23:01 -0800
committerGravatar Craig Tiller <ctiller@google.com>2015-02-11 16:23:01 -0800
commit0ef1a928186f9b5afba1b1677bc492130142720e (patch)
tree63fe0f414707a68cc68bf371341da6135f1ee161
parentdcf9c0e588fce023b0644010c837681b4f303c20 (diff)
Fix hash table
-rw-r--r--src/core/surface/server.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/core/surface/server.c b/src/core/surface/server.c
index 3f1c2add55..3f76138d1c 100644
--- a/src/core/surface/server.c
+++ b/src/core/surface/server.c
@@ -296,7 +296,7 @@ static void finish_start_new_rpc_and_unlock(grpc_server *server,
call_list_join(pending_root, calld, PENDING_START);
gpr_mu_unlock(&server->mu);
} else {
- rc = server->requested_calls.calls[--server->requested_calls.count];
+ rc = array->calls[--array->count];
calld->state = ACTIVATED;
gpr_mu_unlock(&server->mu);
begin_call(server, calld, &rc);
@@ -328,7 +328,7 @@ static void start_new_rpc(grpc_call_element *elem) {
}
/* check for a wildcard method definition (no host set) */
hash = GRPC_MDSTR_KV_HASH(0, calld->path->hash);
- for (i = 0; i < chand->registered_method_max_probes; i++) {
+ for (i = 0; i <= chand->registered_method_max_probes; i++) {
rm = &chand->registered_methods[(hash + i) %
chand->registered_method_slots];
if (!rm) break;
@@ -828,6 +828,7 @@ void grpc_server_add_listener(grpc_server *server, void *arg,
static grpc_call_error queue_call_request(grpc_server *server,
requested_call *rc) {
call_data *calld = NULL;
+ requested_call_array *requested_calls = NULL;
gpr_mu_lock(&server->mu);
if (server->shutdown) {
gpr_mu_unlock(&server->mu);
@@ -839,10 +840,12 @@ static grpc_call_error queue_call_request(grpc_server *server,
case BATCH_CALL:
calld =
call_list_remove_head(&server->lists[PENDING_START], PENDING_START);
+ requested_calls = &server->requested_calls;
break;
case REGISTERED_CALL:
calld = call_list_remove_head(
&rc->data.registered.registered_method->pending, PENDING_START);
+ requested_calls = &rc->data.registered.registered_method->requested;
break;
}
if (calld) {
@@ -852,7 +855,7 @@ static grpc_call_error queue_call_request(grpc_server *server,
begin_call(server, calld, rc);
return GRPC_CALL_OK;
} else {
- *requested_call_array_add(&server->requested_calls) = *rc;
+ *requested_call_array_add(requested_calls) = *rc;
gpr_mu_unlock(&server->mu);
return GRPC_CALL_OK;
}