bm_fullstack runs

reviewable/pr8842/r1
Craig Tiller 8 years ago
parent b0f3bca0ef
commit 0960818e54
  1. 13
      src/core/ext/transport/chttp2/transport/incoming_metadata.c
  2. 14
      src/core/lib/channel/http_server_filter.c
  3. 71
      src/core/lib/surface/call.c
  4. 1
      src/core/lib/transport/metadata_batch.c

@ -80,16 +80,11 @@ void grpc_chttp2_incoming_metadata_buffer_publish(
buffer->published = 1;
if (buffer->count > 0) {
size_t i;
for (i = 1; i < buffer->count; i++) {
buffer->elems[i].prev = &buffer->elems[i - 1];
}
for (i = 0; i < buffer->count - 1; i++) {
buffer->elems[i].next = &buffer->elems[i + 1];
for (i = 0; i < buffer->count; i++) {
GRPC_LOG_IF_ERROR(
"grpc_chttp2_incoming_metadata_buffer_publish",
grpc_metadata_batch_link_tail(batch, &buffer->elems[i]));
}
buffer->elems[0].prev = NULL;
buffer->elems[buffer->count - 1].next = NULL;
batch->list.head = &buffer->elems[0];
batch->list.tail = &buffer->elems[buffer->count - 1];
} else {
batch->list.head = batch->list.tail = NULL;
}

@ -99,7 +99,11 @@ static grpc_error *server_filter_outgoing_metadata(grpc_exec_ctx *exec_ctx,
static void add_error(const char *error_name, grpc_error **cumulative,
grpc_error *new) {
abort();
if (new == GRPC_ERROR_NONE) return;
if (*cumulative == GRPC_ERROR_NONE) {
*cumulative = GRPC_ERROR_CREATE(error_name);
}
*cumulative = grpc_error_add_child(*cumulative, new);
}
static grpc_error *server_filter_incoming_metadata(grpc_exec_ctx *exec_ctx,
@ -145,12 +149,12 @@ static grpc_error *server_filter_incoming_metadata(grpc_exec_ctx *exec_ctx,
}
if (b->idx.named.scheme != NULL) {
if (!grpc_mdelem_eq(b->idx.named.te->md, GRPC_MDELEM_SCHEME_HTTP) &&
!grpc_mdelem_eq(b->idx.named.te->md, GRPC_MDELEM_SCHEME_HTTPS) &&
!grpc_mdelem_eq(b->idx.named.te->md, GRPC_MDELEM_SCHEME_GRPC)) {
if (!grpc_mdelem_eq(b->idx.named.scheme->md, GRPC_MDELEM_SCHEME_HTTP) &&
!grpc_mdelem_eq(b->idx.named.scheme->md, GRPC_MDELEM_SCHEME_HTTPS) &&
!grpc_mdelem_eq(b->idx.named.scheme->md, GRPC_MDELEM_SCHEME_GRPC)) {
add_error(error_name, &error,
grpc_attach_md_to_error(GRPC_ERROR_CREATE("Bad header"),
b->idx.named.te->md));
b->idx.named.scheme->md));
}
grpc_metadata_batch_remove(b, b->idx.named.scheme);
} else {

@ -623,73 +623,19 @@ static int prepare_application_metadata(
if (call->send_extra_metadata_count == 0) {
prepend_extra_metadata = 0;
} else {
for (i = 1; i < call->send_extra_metadata_count; i++) {
call->send_extra_metadata[i].prev = &call->send_extra_metadata[i - 1];
}
for (i = 0; i < call->send_extra_metadata_count - 1; i++) {
call->send_extra_metadata[i].next = &call->send_extra_metadata[i + 1];
for (i = 0; i < call->send_extra_metadata_count; i++) {
GRPC_LOG_IF_ERROR("prepare_application_metadata",
grpc_metadata_batch_link_tail(
batch, &call->send_extra_metadata[i]));
}
}
}
for (i = 1; i < total_count; i++) {
grpc_metadata *md = get_md_elem(metadata, additional_metadata, i, count);
grpc_metadata *prev_md =
get_md_elem(metadata, additional_metadata, i - 1, count);
linked_from_md(md)->prev = linked_from_md(prev_md);
}
for (i = 0; i < total_count - 1; i++) {
for (i = 0; i < total_count; i++) {
grpc_metadata *md = get_md_elem(metadata, additional_metadata, i, count);
grpc_metadata *next_md =
get_md_elem(metadata, additional_metadata, i + 1, count);
linked_from_md(md)->next = linked_from_md(next_md);
}
switch (prepend_extra_metadata * 2 + (total_count != 0)) {
case 0:
/* no prepend, no metadata => nothing to do */
batch->list.head = batch->list.tail = NULL;
break;
case 1: {
/* metadata, but no prepend */
grpc_metadata *first_md =
get_md_elem(metadata, additional_metadata, 0, count);
grpc_metadata *last_md =
get_md_elem(metadata, additional_metadata, total_count - 1, count);
batch->list.head = linked_from_md(first_md);
batch->list.tail = linked_from_md(last_md);
batch->list.head->prev = NULL;
batch->list.tail->next = NULL;
break;
}
case 2:
/* prepend, but no md */
batch->list.head = &call->send_extra_metadata[0];
batch->list.tail =
&call->send_extra_metadata[call->send_extra_metadata_count - 1];
batch->list.head->prev = NULL;
batch->list.tail->next = NULL;
call->send_extra_metadata_count = 0;
break;
case 3: {
/* prepend AND md */
grpc_metadata *first_md =
get_md_elem(metadata, additional_metadata, 0, count);
grpc_metadata *last_md =
get_md_elem(metadata, additional_metadata, total_count - 1, count);
batch->list.head = &call->send_extra_metadata[0];
call->send_extra_metadata[call->send_extra_metadata_count - 1].next =
linked_from_md(first_md);
linked_from_md(first_md)->prev =
&call->send_extra_metadata[call->send_extra_metadata_count - 1];
batch->list.tail = linked_from_md(last_md);
batch->list.head->prev = NULL;
batch->list.tail->next = NULL;
call->send_extra_metadata_count = 0;
break;
}
default:
GPR_UNREACHABLE_CODE(return 0);
GRPC_LOG_IF_ERROR("prepare_application_metadata",
grpc_metadata_batch_link_tail(batch, linked_from_md(md)));
}
call->send_extra_metadata_count = 0;
return 1;
}
@ -936,6 +882,7 @@ static void recv_common_filter(grpc_exec_ctx *exec_ctx, grpc_call *call,
static void publish_app_metadata(grpc_call *call, grpc_metadata_batch *b,
int is_trailing) {
if (b->list.count == 0) return;
GPR_TIMER_BEGIN("publish_app_metadata", 0);
grpc_metadata_array *dest;
grpc_metadata *mdusr;

@ -194,6 +194,7 @@ static void link_tail(grpc_mdelem_list *list, grpc_linked_mdelem *storage) {
list->head = storage;
}
list->tail = storage;
list->count++;
assert_valid_list(list);
}

Loading…
Cancel
Save