Skip to content

Commit

Permalink
Merge pull request grpc#4479 from ctiller/aarons-bug
Browse files Browse the repository at this point in the history
Fix double read at end of stream bug
  • Loading branch information
yang-g committed Dec 16, 2015
2 parents 9e38c21 + ca9a637 commit 5ff97a2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/core/surface/call.c
Original file line number Diff line number Diff line change
Expand Up @@ -1068,6 +1068,7 @@ static void receiving_stream_ready(grpc_exec_ctx *exec_ctx, void *bctlp,

if (call->receiving_stream == NULL) {
*call->receiving_buffer = NULL;
call->receiving_message = 0;
if (gpr_unref(&bctl->steps_to_complete)) {
post_batch_completion(exec_ctx, bctl);
}
Expand All @@ -1078,6 +1079,7 @@ static void receiving_stream_ready(grpc_exec_ctx *exec_ctx, void *bctlp,
grpc_byte_stream_destroy(call->receiving_stream);
call->receiving_stream = NULL;
*call->receiving_buffer = NULL;
call->receiving_message = 0;
if (gpr_unref(&bctl->steps_to_complete)) {
post_batch_completion(exec_ctx, bctl);
}
Expand Down
1 change: 1 addition & 0 deletions test/cpp/end2end/end2end_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -543,6 +543,7 @@ TEST_P(End2endTest, BidiStream) {

stream->WritesDone();
EXPECT_FALSE(stream->Read(&response));
EXPECT_FALSE(stream->Read(&response));

Status s = stream->Finish();
EXPECT_TRUE(s.ok());
Expand Down

0 comments on commit 5ff97a2

Please sign in to comment.