From 36a9cbf41f4d1769d4cfdf16359b7282df2c0774 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Sat, 7 Mar 2015 00:26:19 +0900 Subject: [PATCH] asio: Use large window size for client --- src/asio_client_session_impl.cc | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/asio_client_session_impl.cc b/src/asio_client_session_impl.cc index f7796c74..cb576d3c 100644 --- a/src/asio_client_session_impl.cc +++ b/src/asio_client_session_impl.cc @@ -315,9 +315,18 @@ bool session_impl::setup_session() { return false; } - nghttp2_settings_entry iv = {NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS, 100}; - nghttp2_submit_settings(session_, NGHTTP2_FLAG_NONE, &iv, 1); + const uint32_t window_size = 256 * 1024 * 1024; + std::array iv{ + {{NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS, 100}, + // typically client is just a *sink* and just process data as + // much as possible. Use large window size by default. + {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); return true; }