diff options
Diffstat (limited to 'src/core/transport/chttp2_transport.c')
-rw-r--r-- | src/core/transport/chttp2_transport.c | 33 |
1 files changed, 20 insertions, 13 deletions
diff --git a/src/core/transport/chttp2_transport.c b/src/core/transport/chttp2_transport.c index 4561c0bfa9..70f7eed4fe 100644 --- a/src/core/transport/chttp2_transport.c +++ b/src/core/transport/chttp2_transport.c @@ -134,7 +134,12 @@ static void connectivity_state_set( static void check_read_ops(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport_global *transport_global); -static void fail_pending_writes(grpc_exec_ctx *exec_ctx, +static void incoming_byte_stream_update_flow_control( + grpc_chttp2_transport_global *transport_global, + grpc_chttp2_stream_global *stream_global, size_t max_size_hint, + size_t have_already); + +static void fail_pending_writes(grpc_exec_ctx *exec_ctx, grpc_chttp2_stream_global *stream_global); /* @@ -532,7 +537,7 @@ static void destroy_stream(grpc_exec_ctx *exec_ctx, grpc_transport *gt, while ( (bs = grpc_chttp2_incoming_frame_queue_pop(&s->global.incoming_frames))) { - grpc_byte_stream_destroy(bs); + grpc_byte_stream_destroy(exec_ctx, bs); } GPR_ASSERT(s->global.send_initial_metadata_finished == NULL); @@ -642,7 +647,8 @@ void grpc_chttp2_terminate_writing(grpc_exec_ctx *exec_ctx, grpc_chttp2_cleanup_writing(exec_ctx, &t->global, &t->writing); - while (grpc_chttp2_list_pop_closed_waiting_for_writing(&t->global, &stream_global)) { + while (grpc_chttp2_list_pop_closed_waiting_for_writing(&t->global, + &stream_global)) { fail_pending_writes(exec_ctx, stream_global); GRPC_CHTTP2_STREAM_UNREF(exec_ctx, stream_global, "finish_writes"); } @@ -867,6 +873,13 @@ static void perform_stream_op_locked( GPR_ASSERT(stream_global->recv_message_ready == NULL); stream_global->recv_message_ready = op->recv_message_ready; stream_global->recv_message = op->recv_message; + if (stream_global->id != 0 && + (stream_global->incoming_frames.head == NULL || + stream_global->incoming_frames.head->is_tail)) { + incoming_byte_stream_update_flow_control( + transport_global, stream_global, transport_global->stream_lookahead, + 0); + } grpc_chttp2_list_add_check_read_ops(transport_global, stream_global); } @@ -1021,7 +1034,7 @@ static void check_read_ops(grpc_exec_ctx *exec_ctx, while (stream_global->seen_error && (bs = grpc_chttp2_incoming_frame_queue_pop( &stream_global->incoming_frames)) != NULL) { - grpc_byte_stream_destroy(bs); + grpc_byte_stream_destroy(exec_ctx, bs); } if (stream_global->incoming_frames.head == NULL) { grpc_chttp2_incoming_metadata_buffer_publish( @@ -1122,7 +1135,7 @@ void grpc_chttp2_fake_status(grpc_exec_ctx *exec_ctx, } } -static void fail_pending_writes(grpc_exec_ctx *exec_ctx, +static void fail_pending_writes(grpc_exec_ctx *exec_ctx, grpc_chttp2_stream_global *stream_global) { grpc_chttp2_complete_closure_step( exec_ctx, &stream_global->send_initial_metadata_finished, 0); @@ -1528,7 +1541,8 @@ static void incoming_byte_stream_unref(grpc_chttp2_incoming_byte_stream *bs) { } } -static void incoming_byte_stream_destroy(grpc_byte_stream *byte_stream) { +static void incoming_byte_stream_destroy(grpc_exec_ctx *exec_ctx, + grpc_byte_stream *byte_stream) { incoming_byte_stream_unref((grpc_chttp2_incoming_byte_stream *)byte_stream); } @@ -1598,13 +1612,6 @@ grpc_chttp2_incoming_byte_stream *grpc_chttp2_incoming_byte_stream_create( add_to_queue->tail->next_message = incoming_byte_stream; } add_to_queue->tail = incoming_byte_stream; - if (frame_size == 0) { - lock(TRANSPORT_FROM_PARSING(transport_parsing)); - incoming_byte_stream_update_flow_control( - &TRANSPORT_FROM_PARSING(transport_parsing)->global, - &STREAM_FROM_PARSING(stream_parsing)->global, 0, 0); - unlock(exec_ctx, TRANSPORT_FROM_PARSING(transport_parsing)); - } return incoming_byte_stream; } |