aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/ext/transport
diff options
context:
space:
mode:
authorGravatar Craig Tiller <ctiller@google.com>2016-04-04 13:42:04 -0700
committerGravatar Craig Tiller <ctiller@google.com>2016-04-04 13:42:04 -0700
commitc48ca71614f04a6e2b19fc1c100ace8bfcfc45a8 (patch)
tree3d6356158d38b8898545676e83772e7c9ec19bc5 /src/core/ext/transport
parent4a9a2b96342d8b9e23110bb8ecd58aaebeada13b (diff)
Add a test demonstrating forced closure of a stream, and make it work
Diffstat (limited to 'src/core/ext/transport')
-rw-r--r--src/core/ext/transport/chttp2/transport/chttp2_transport.c20
1 files changed, 11 insertions, 9 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);
}