aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core
diff options
context:
space:
mode:
authorGravatar Craig Tiller <ctiller@google.com>2016-04-06 16:28:46 -0700
committerGravatar Craig Tiller <ctiller@google.com>2016-04-06 16:28:46 -0700
commit5db5e132934404ae64bcfd34f0e70dd4193daee7 (patch)
tree5612ba2a211963d2bcd80ab550100ec4d8eb44d8 /src/core
parent30e53cd4c491b4d80d1c95a567ab7bda2db5e51d (diff)
parent2879aa1b1db9a72299c62cb9e9f2aa74e3e3e762 (diff)
Merge github.com:grpc/grpc into strong-includes
Diffstat (limited to 'src/core')
-rw-r--r--src/core/ext/transport/chttp2/transport/chttp2_transport.c20
-rw-r--r--src/core/ext/transport/chttp2/transport/parsing.c6
-rw-r--r--src/core/lib/surface/call.c31
-rw-r--r--src/core/lib/surface/server.c8
-rw-r--r--src/core/lib/transport/metadata.c6
-rw-r--r--src/core/lib/transport/transport.h2
6 files changed, 46 insertions, 27 deletions
diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.c b/src/core/ext/transport/chttp2/transport/chttp2_transport.c
index 62f0c53e0d..b4cd185e62 100644
--- a/src/core/ext/transport/chttp2/transport/chttp2_transport.c
+++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.c
@@ -1147,16 +1147,18 @@ static void cancel_from_api(grpc_exec_ctx *exec_ctx,
grpc_chttp2_transport_global *transport_global,
grpc_chttp2_stream_global *stream_global,
grpc_status_code status) {
- if (stream_global->id != 0) {
- gpr_slice_buffer_add(
- &transport_global->qbuf,
- grpc_chttp2_rst_stream_create(
- stream_global->id,
- (uint32_t)grpc_chttp2_grpc_status_to_http2_error(status),
- &stream_global->stats.outgoing));
+ if (!stream_global->read_closed || !stream_global->write_closed) {
+ if (stream_global->id != 0) {
+ gpr_slice_buffer_add(
+ &transport_global->qbuf,
+ grpc_chttp2_rst_stream_create(
+ stream_global->id,
+ (uint32_t)grpc_chttp2_grpc_status_to_http2_error(status),
+ &stream_global->stats.outgoing));
+ }
+ grpc_chttp2_fake_status(exec_ctx, transport_global, stream_global, status,
+ NULL);
}
- grpc_chttp2_fake_status(exec_ctx, transport_global, stream_global, status,
- NULL);
grpc_chttp2_mark_stream_closed(exec_ctx, transport_global, stream_global, 1,
1);
}
diff --git a/src/core/ext/transport/chttp2/transport/parsing.c b/src/core/ext/transport/chttp2/transport/parsing.c
index c754c6005e..e827a43f7a 100644
--- a/src/core/ext/transport/chttp2/transport/parsing.c
+++ b/src/core/ext/transport/chttp2/transport/parsing.c
@@ -112,7 +112,7 @@ void grpc_chttp2_publish_reads(
GOAWAY last-grpc_chttp2_stream-id=0 in this case. */
if (!transport_parsing->is_client) {
transport_global->last_incoming_stream_id =
- transport_parsing->incoming_stream_id;
+ transport_parsing->last_incoming_stream_id;
}
/* update global settings */
@@ -371,7 +371,9 @@ int grpc_chttp2_perform_read(grpc_exec_ctx *exec_ctx,
if (!init_frame_parser(exec_ctx, transport_parsing)) {
return 0;
}
- if (transport_parsing->incoming_stream_id) {
+ if (transport_parsing->incoming_stream_id != 0 &&
+ transport_parsing->incoming_stream_id >
+ transport_parsing->last_incoming_stream_id) {
transport_parsing->last_incoming_stream_id =
transport_parsing->incoming_stream_id;
}
diff --git a/src/core/lib/surface/call.c b/src/core/lib/surface/call.c
index ba94852f9a..6581bbd3d1 100644
--- a/src/core/lib/surface/call.c
+++ b/src/core/lib/surface/call.c
@@ -1074,24 +1074,29 @@ static void receiving_initial_metadata_ready(grpc_exec_ctx *exec_ctx,
gpr_mu_lock(&call->mu);
- grpc_metadata_batch *md =
- &call->metadata_batch[1 /* is_receiving */][0 /* is_trailing */];
- grpc_metadata_batch_filter(md, recv_initial_filter, call);
- call->has_initial_md_been_received = true;
-
- if (gpr_time_cmp(md->deadline, gpr_inf_future(md->deadline.clock_type)) !=
- 0 &&
- !call->is_client) {
- GPR_TIMER_BEGIN("set_deadline_alarm", 0);
- set_deadline_alarm(exec_ctx, call, md->deadline);
- GPR_TIMER_END("set_deadline_alarm", 0);
+ if (!success) {
+ bctl->success = false;
+ } else {
+ grpc_metadata_batch *md =
+ &call->metadata_batch[1 /* is_receiving */][0 /* is_trailing */];
+ grpc_metadata_batch_filter(md, recv_initial_filter, call);
+
+ if (gpr_time_cmp(md->deadline, gpr_inf_future(md->deadline.clock_type)) !=
+ 0 &&
+ !call->is_client) {
+ GPR_TIMER_BEGIN("set_deadline_alarm", 0);
+ set_deadline_alarm(exec_ctx, call, md->deadline);
+ GPR_TIMER_END("set_deadline_alarm", 0);
+ }
}
+ call->has_initial_md_been_received = true;
if (call->saved_receiving_stream_ready_ctx.bctlp != NULL) {
grpc_closure *saved_rsr_closure = grpc_closure_create(
receiving_stream_ready, call->saved_receiving_stream_ready_ctx.bctlp);
- grpc_exec_ctx_enqueue(exec_ctx, saved_rsr_closure,
- call->saved_receiving_stream_ready_ctx.success, NULL);
+ grpc_exec_ctx_enqueue(
+ exec_ctx, saved_rsr_closure,
+ call->saved_receiving_stream_ready_ctx.success && success, NULL);
call->saved_receiving_stream_ready_ctx.bctlp = NULL;
}
diff --git a/src/core/lib/surface/server.c b/src/core/lib/surface/server.c
index 37cc2bd101..ad8ee8c7a9 100644
--- a/src/core/lib/surface/server.c
+++ b/src/core/lib/surface/server.c
@@ -685,10 +685,14 @@ static grpc_mdelem *server_filter(void *user_data, grpc_mdelem *md) {
grpc_call_element *elem = user_data;
call_data *calld = elem->call_data;
if (md->key == GRPC_MDSTR_PATH) {
- calld->path = GRPC_MDSTR_REF(md->value);
+ if (calld->path == NULL) {
+ calld->path = GRPC_MDSTR_REF(md->value);
+ }
return NULL;
} else if (md->key == GRPC_MDSTR_AUTHORITY) {
- calld->host = GRPC_MDSTR_REF(md->value);
+ if (calld->host == NULL) {
+ calld->host = GRPC_MDSTR_REF(md->value);
+ }
return NULL;
}
return md;
diff --git a/src/core/lib/transport/metadata.c b/src/core/lib/transport/metadata.c
index bf14e72b0f..7de871a9c6 100644
--- a/src/core/lib/transport/metadata.c
+++ b/src/core/lib/transport/metadata.c
@@ -243,6 +243,12 @@ void grpc_mdctx_global_shutdown(void) {
if (shard->count != 0) {
gpr_log(GPR_DEBUG, "WARNING: %d metadata strings were leaked",
shard->count);
+ for (size_t j = 0; j < shard->capacity; j++) {
+ for (internal_string *s = shard->strs[j]; s; s = s->bucket_next) {
+ gpr_log(GPR_DEBUG, "LEAKED: %s",
+ grpc_mdstr_as_c_string((grpc_mdstr *)s));
+ }
+ }
if (grpc_iomgr_abort_on_leaks()) {
abort();
}
diff --git a/src/core/lib/transport/transport.h b/src/core/lib/transport/transport.h
index bb1120ee3a..1eb446312b 100644
--- a/src/core/lib/transport/transport.h
+++ b/src/core/lib/transport/transport.h
@@ -50,7 +50,7 @@ typedef struct grpc_transport grpc_transport;
for a stream. */
typedef struct grpc_stream grpc_stream;
-/*#define GRPC_STREAM_REFCOUNT_DEBUG*/
+//#define GRPC_STREAM_REFCOUNT_DEBUG
typedef struct grpc_stream_refcount {
gpr_refcount refs;