From c9e39c0728da270c1bced4938ee9745aeb208890 Mon Sep 17 00:00:00 2001 From: Yang Gao Date: Tue, 28 Apr 2015 10:30:28 -0700 Subject: Fix flow control issue --- src/core/transport/chttp2_transport.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'src/core/transport') diff --git a/src/core/transport/chttp2_transport.c b/src/core/transport/chttp2_transport.c index e32ee284e0..786d9cf6eb 100644 --- a/src/core/transport/chttp2_transport.c +++ b/src/core/transport/chttp2_transport.c @@ -582,16 +582,18 @@ static int init_stream(grpc_transport *gt, grpc_stream *gs, if (!server_data) { lock(t); s->id = 0; + s->outgoing_window = 0; + s->incoming_window = 0; } else { s->id = (gpr_uint32)(gpr_uintptr)server_data; + s->outgoing_window = + t->settings[PEER_SETTINGS][GRPC_CHTTP2_SETTINGS_INITIAL_WINDOW_SIZE]; + s->incoming_window = + t->settings[SENT_SETTINGS][GRPC_CHTTP2_SETTINGS_INITIAL_WINDOW_SIZE]; t->incoming_stream = s; grpc_chttp2_stream_map_add(&t->stream_map, s->id, s); } - s->outgoing_window = - t->settings[PEER_SETTINGS][GRPC_CHTTP2_SETTINGS_INITIAL_WINDOW_SIZE]; - s->incoming_window = - t->settings[SENT_SETTINGS][GRPC_CHTTP2_SETTINGS_INITIAL_WINDOW_SIZE]; s->queued_write_closed = 0; s->sending_write_closed = 0; s->sent_write_closed = 0; @@ -983,6 +985,10 @@ static void maybe_start_some_streams(transport *t) { GPR_ASSERT(s->id == 0); s->id = t->next_stream_id; t->next_stream_id += 2; + s->outgoing_window = + t->settings[PEER_SETTINGS][GRPC_CHTTP2_SETTINGS_INITIAL_WINDOW_SIZE]; + s->incoming_window = + t->settings[SENT_SETTINGS][GRPC_CHTTP2_SETTINGS_INITIAL_WINDOW_SIZE]; grpc_chttp2_stream_map_add(&t->stream_map, s->id, s); stream_list_join(t, s, WRITABLE); } -- cgit v1.2.3