src: Use nghttp2_session_set_local_window_size()

This commit is contained in:
Tatsuhiro Tsujikawa 2016-05-29 23:34:38 +09:00
parent 204f9a3ec7
commit e4dc6cf432
6 changed files with 20 additions and 25 deletions

View File

@ -856,10 +856,9 @@ int Http2Handler::connection_made() {
}
if (config->connection_window_bits != -1) {
r = nghttp2_submit_window_update(
r = nghttp2_session_set_local_window_size(
session_, NGHTTP2_FLAG_NONE, 0,
(1 << config->connection_window_bits) - 1 -
NGHTTP2_INITIAL_CONNECTION_WINDOW_SIZE);
(1 << config->connection_window_bits) - 1);
if (r != 0) {
return r;
}

View File

@ -373,9 +373,8 @@ bool session_impl::setup_session() {
{NGHTTP2_SETTINGS_INITIAL_WINDOW_SIZE, window_size}}};
nghttp2_submit_settings(session_, NGHTTP2_FLAG_NONE, iv.data(), iv.size());
// increase connection window size up to window_size
nghttp2_submit_window_update(session_, NGHTTP2_FLAG_NONE, 0,
window_size -
NGHTTP2_INITIAL_CONNECTION_WINDOW_SIZE);
nghttp2_session_set_local_window_size(session_, NGHTTP2_FLAG_NONE, 0,
window_size);
return true;
}

View File

@ -219,13 +219,10 @@ void Http2Session::on_connect() {
assert(rv == 0);
auto extra_connection_window =
(1 << client_->worker->config->connection_window_bits) - 1 -
NGHTTP2_INITIAL_CONNECTION_WINDOW_SIZE;
if (extra_connection_window != 0) {
nghttp2_submit_window_update(session_, NGHTTP2_FLAG_NONE, 0,
extra_connection_window);
}
auto connection_window =
(1 << client_->worker->config->connection_window_bits) - 1;
nghttp2_session_set_local_window_size(session_, NGHTTP2_FLAG_NONE, 0,
connection_window);
client_->signal_write();
}

View File

@ -1151,9 +1151,9 @@ int HttpClient::connection_made() {
ev_timer_again(loop, &settings_timer);
if (config.connection_window_bits != -1) {
int32_t wininc = (1 << config.connection_window_bits) - 1 -
NGHTTP2_INITIAL_CONNECTION_WINDOW_SIZE;
rv = nghttp2_submit_window_update(session, NGHTTP2_FLAG_NONE, 0, wininc);
int32_t window_size = (1 << config.connection_window_bits) - 1;
rv = nghttp2_session_set_local_window_size(session, NGHTTP2_FLAG_NONE, 0,
window_size);
if (rv != 0) {
return -1;
}

View File

@ -1533,11 +1533,11 @@ int Http2Session::connection_made() {
return -1;
}
auto connection_window_bits = http2conf.downstream.connection_window_bits;
if (connection_window_bits > 16) {
int32_t delta = (1 << connection_window_bits) - 1 -
NGHTTP2_INITIAL_CONNECTION_WINDOW_SIZE;
rv = nghttp2_submit_window_update(session_, NGHTTP2_FLAG_NONE, 0, delta);
if (http2conf.downstream.connection_window_bits != 16) {
int32_t window_size =
(1 << http2conf.downstream.connection_window_bits) - 1;
rv = nghttp2_session_set_local_window_size(session_, NGHTTP2_FLAG_NONE, 0,
window_size);
if (rv != 0) {
return -1;
}

View File

@ -883,10 +883,10 @@ Http2Upstream::Http2Upstream(ClientHandler *handler)
<< nghttp2_strerror(rv);
}
if (http2conf.upstream.connection_window_bits > 16) {
int32_t delta = (1 << http2conf.upstream.connection_window_bits) - 1 -
NGHTTP2_INITIAL_CONNECTION_WINDOW_SIZE;
rv = nghttp2_submit_window_update(session_, NGHTTP2_FLAG_NONE, 0, delta);
if (http2conf.upstream.connection_window_bits != 16) {
int32_t window_size = (1 << http2conf.upstream.connection_window_bits) - 1;
rv = nghttp2_session_set_local_window_size(session_, NGHTTP2_FLAG_NONE, 0,
window_size);
if (rv != 0) {
ULOG(ERROR, this) << "nghttp2_submit_window_update() returned error: "