Skip to content

Commit

Permalink
Merge pull request grpc#5347 from yang-g/check_error_in_read
Browse files Browse the repository at this point in the history
Discard the read buffer on stream error
  • Loading branch information
sreecha committed Feb 23, 2016
2 parents 349bba9 + 857c470 commit acbcdb6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/core/transport/chttp2_transport.c
Original file line number Diff line number Diff line change
Expand Up @@ -1019,6 +1019,11 @@ static void check_read_ops(grpc_exec_ctx *exec_ctx,
stream_global->recv_initial_metadata_ready = NULL;
}
if (stream_global->recv_message_ready != NULL) {
while (stream_global->seen_error &&
(bs = grpc_chttp2_incoming_frame_queue_pop(
&stream_global->incoming_frames)) != NULL) {
grpc_byte_stream_destroy(exec_ctx, bs);
}
if (stream_global->incoming_frames.head != NULL) {
*stream_global->recv_message = grpc_chttp2_incoming_frame_queue_pop(
&stream_global->incoming_frames);
Expand Down
4 changes: 4 additions & 0 deletions test/cpp/end2end/async_end2end_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -989,6 +989,10 @@ class AsyncEnd2endServerTryCancelTest : public AsyncEnd2endTest {

if (server_try_cancel == CANCEL_AFTER_PROCESSING) {
ServerTryCancel(&srv_ctx);

// Client reads may fail bacause it is notified that the stream is
// cancelled.
ignore_cq_result = true;
}

// Client attemts to read the three messages from the server
Expand Down

0 comments on commit acbcdb6

Please sign in to comment.