From 0ba2883940be8bcc42580f1b79afeab39020e49a Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Tue, 12 Nov 2013 11:08:43 +0900 Subject: [PATCH] nghttpx: Use initial window size in config directly --- src/shrpx_http2_session.cc | 7 +------ src/shrpx_http2_session.h | 2 -- src/shrpx_http2_upstream.cc | 8 +------- src/shrpx_http2_upstream.h | 2 -- src/shrpx_spdy_upstream.cc | 5 ----- src/shrpx_spdy_upstream.h | 1 - 6 files changed, 2 insertions(+), 23 deletions(-) diff --git a/src/shrpx_http2_session.cc b/src/shrpx_http2_session.cc index 7a7339e5..22477c6a 100644 --- a/src/shrpx_http2_session.cc +++ b/src/shrpx_http2_session.cc @@ -628,11 +628,6 @@ int Http2Session::submit_window_update(Http2DownstreamConnection *dconn, return 0; } -int32_t Http2Session::get_initial_window_size() const -{ - return (1 << get_config()->http2_downstream_window_bits) - 1; -} - nghttp2_session* Http2Session::get_session() const { return session_; @@ -1169,7 +1164,7 @@ int Http2Session::on_connect() entry[1].value = get_config()->http2_max_concurrent_streams; entry[2].settings_id = NGHTTP2_SETTINGS_INITIAL_WINDOW_SIZE; - entry[2].value = get_initial_window_size(); + entry[2].value = (1 << get_config()->http2_downstream_window_bits) - 1; rv = nghttp2_submit_settings(session_, NGHTTP2_FLAG_NONE, entry, sizeof(entry)/sizeof(nghttp2_settings_entry)); diff --git a/src/shrpx_http2_session.h b/src/shrpx_http2_session.h index 238fcb3d..9bbb73dd 100644 --- a/src/shrpx_http2_session.h +++ b/src/shrpx_http2_session.h @@ -76,8 +76,6 @@ public: int fail_session(nghttp2_error_code error_code); - int32_t get_initial_window_size() const; - nghttp2_session* get_session() const; bool get_flow_control() const; diff --git a/src/shrpx_http2_upstream.cc b/src/shrpx_http2_upstream.cc index 7a90c579..cef83f0d 100644 --- a/src/shrpx_http2_upstream.cc +++ b/src/shrpx_http2_upstream.cc @@ -496,7 +496,6 @@ Http2Upstream::Http2Upstream(ClientHandler *handler) assert(rv == 0); flow_control_ = true; - initial_window_size_ = (1 << get_config()->http2_upstream_window_bits) - 1; // TODO Maybe call from outside? nghttp2_settings_entry entry[2]; @@ -504,7 +503,7 @@ Http2Upstream::Http2Upstream(ClientHandler *handler) entry[0].value = get_config()->http2_max_concurrent_streams; entry[1].settings_id = NGHTTP2_SETTINGS_INITIAL_WINDOW_SIZE; - entry[1].value = initial_window_size_; + entry[1].value = (1 << get_config()->http2_upstream_window_bits) - 1; rv = nghttp2_submit_settings(session_, NGHTTP2_FLAG_NONE, entry, @@ -1026,11 +1025,6 @@ bool Http2Upstream::get_flow_control() const return flow_control_; } -int32_t Http2Upstream::get_initial_window_size() const -{ - return initial_window_size_; -} - void Http2Upstream::pause_read(IOCtrlReason reason) {} diff --git a/src/shrpx_http2_upstream.h b/src/shrpx_http2_upstream.h index 2536f19c..31eb97b0 100644 --- a/src/shrpx_http2_upstream.h +++ b/src/shrpx_http2_upstream.h @@ -73,7 +73,6 @@ public: virtual int on_downstream_body_complete(Downstream *downstream); bool get_flow_control() const; - int32_t get_initial_window_size() const; // Perform HTTP/2.0 upgrade from |upstream|. On success, this object // takes ownership of the |upstream|. This function returns 0 if it // succeeds, or -1. @@ -84,7 +83,6 @@ private: ClientHandler *handler_; nghttp2_session *session_; bool flow_control_; - int32_t initial_window_size_; DownstreamQueue downstream_queue_; std::unique_ptr pre_upstream_; event *settings_timerev_; diff --git a/src/shrpx_spdy_upstream.cc b/src/shrpx_spdy_upstream.cc index 4dfb590a..3e6c9658 100644 --- a/src/shrpx_spdy_upstream.cc +++ b/src/shrpx_spdy_upstream.cc @@ -932,11 +932,6 @@ bool SpdyUpstream::get_flow_control() const return flow_control_; } -int32_t SpdyUpstream::get_initial_window_size() const -{ - return initial_window_size_; -} - void SpdyUpstream::pause_read(IOCtrlReason reason) {} diff --git a/src/shrpx_spdy_upstream.h b/src/shrpx_spdy_upstream.h index 8811a5df..490312f4 100644 --- a/src/shrpx_spdy_upstream.h +++ b/src/shrpx_spdy_upstream.h @@ -67,7 +67,6 @@ public: virtual int on_downstream_body_complete(Downstream *downstream); bool get_flow_control() const; - int32_t get_initial_window_size() const; private: ClientHandler *handler_; spdylay_session *session_;