Fix flow control issue

pull/1394/head
Yang Gao 10 years ago
parent 5324c6a8b9
commit c9e39c0728
  1. 14
      src/core/transport/chttp2_transport.c

@ -582,16 +582,18 @@ static int init_stream(grpc_transport *gt, grpc_stream *gs,
if (!server_data) { if (!server_data) {
lock(t); lock(t);
s->id = 0; s->id = 0;
s->outgoing_window = 0;
s->incoming_window = 0;
} else { } else {
s->id = (gpr_uint32)(gpr_uintptr)server_data; s->id = (gpr_uint32)(gpr_uintptr)server_data;
t->incoming_stream = s;
grpc_chttp2_stream_map_add(&t->stream_map, s->id, s);
}
s->outgoing_window = s->outgoing_window =
t->settings[PEER_SETTINGS][GRPC_CHTTP2_SETTINGS_INITIAL_WINDOW_SIZE]; t->settings[PEER_SETTINGS][GRPC_CHTTP2_SETTINGS_INITIAL_WINDOW_SIZE];
s->incoming_window = s->incoming_window =
t->settings[SENT_SETTINGS][GRPC_CHTTP2_SETTINGS_INITIAL_WINDOW_SIZE]; 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->queued_write_closed = 0; s->queued_write_closed = 0;
s->sending_write_closed = 0; s->sending_write_closed = 0;
s->sent_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); GPR_ASSERT(s->id == 0);
s->id = t->next_stream_id; s->id = t->next_stream_id;
t->next_stream_id += 2; 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); grpc_chttp2_stream_map_add(&t->stream_map, s->id, s);
stream_list_join(t, s, WRITABLE); stream_list_join(t, s, WRITABLE);
} }

Loading…
Cancel
Save