TS-2872 Can't set "Send Window" for SPDY/3.1 > 64k. Most of this code is Brian Geffon's fault.
Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/90ff1a79 Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/90ff1a79 Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/90ff1a79 Branch: refs/heads/5.0.x Commit: 90ff1a79015a73d7906170f05c3d36fd3127e7d1 Parents: cb2ca53 Author: Leif Hedstrom <[email protected]> Authored: Tue Jun 3 17:21:45 2014 -0600 Committer: Leif Hedstrom <[email protected]> Committed: Tue Jun 3 17:21:45 2014 -0600 ---------------------------------------------------------------------- CHANGES | 3 +++ proxy/spdy/SpdyCallbacks.cc | 6 +++--- proxy/spdy/SpdyClientSession.cc | 21 +++++++++++++-------- proxy/spdy/SpdyClientSession.h | 2 +- proxy/spdy/SpdyCommon.cc | 8 ++++---- proxy/spdy/SpdyCommon.h | 4 ++-- 6 files changed, 26 insertions(+), 18 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/trafficserver/blob/90ff1a79/CHANGES ---------------------------------------------------------------------- diff --git a/CHANGES b/CHANGES index bff65b4..82b3204 100644 --- a/CHANGES +++ b/CHANGES @@ -1,6 +1,9 @@ -*- coding: utf-8 -*- Changes with Apache Traffic Server 5.0.0 + *) [TS-2872] Can't set "Send Window" for SPDY/3.1 > 64k. Code mostly + provided by our SPDY brainiac, Geffon. + *) [TS-2873] Cleanup SPDY metrics and configs, also make it use the common pattern for stats increments/decrements (even though it's ugly, sorry amc). http://git-wip-us.apache.org/repos/asf/trafficserver/blob/90ff1a79/proxy/spdy/SpdyCallbacks.cc ---------------------------------------------------------------------- diff --git a/proxy/spdy/SpdyCallbacks.cc b/proxy/spdy/SpdyCallbacks.cc index d565d09..d9fcd69 100644 --- a/proxy/spdy/SpdyCallbacks.cc +++ b/proxy/spdy/SpdyCallbacks.cc @@ -128,7 +128,7 @@ spdy_show_ctl_frame(const char *head_str, spdylay_session * /*session*/, spdylay break; case SPDYLAY_WINDOW_UPDATE: { spdylay_window_update *f = (spdylay_window_update *)frame; - Debug("spdy", "%s WINDOW_UPDATE (sm_id:%" PRIu64 ", stream_id:%d, flag:%d, delta_window_size:%d)", + Debug("spdy", "%s WINDOW_UPDATE (sm_id:%" PRIu64 ", stream_id:%d, flag:%d, delta_window_size:%u)", head_str, sm->sm_id, f->stream_id, f->hd.flags, f->delta_window_size); } break; @@ -403,11 +403,11 @@ spdy_on_data_recv_callback(spdylay_session *session, uint8_t flags, req->delta_window_size += length; - Debug("spdy", "----sm_id:%" PRId64 ", stream_id:%d, delta_window_size:%d", + Debug("spdy", "----sm_id:%" PRId64 ", stream_id:%d, delta_window_size:%u", sm->sm_id, stream_id, req->delta_window_size); if (req->delta_window_size >= spdy_initial_window_size/2) { - Debug("spdy", "----Reenable write_vio for WINDOW_UPDATE frame, delta_window_size:%d", + Debug("spdy", "----Reenable write_vio for WINDOW_UPDATE frame, delta_window_size:%u", req->delta_window_size); // http://git-wip-us.apache.org/repos/asf/trafficserver/blob/90ff1a79/proxy/spdy/SpdyClientSession.cc ---------------------------------------------------------------------- diff --git a/proxy/spdy/SpdyClientSession.cc b/proxy/spdy/SpdyClientSession.cc index 48477fa..e69f3bc 100644 --- a/proxy/spdy/SpdyClientSession.cc +++ b/proxy/spdy/SpdyClientSession.cc @@ -194,8 +194,11 @@ spdy_sm_create(NetVConnection * netvc, spdy::SessionVersion vers, MIOBuffer * io int SpdyClientSession::state_session_start(int /* event */, void * /* edata */) { - int r; - spdylay_settings_entry entry; + const spdylay_settings_entry entries[] = { + { SPDYLAY_SETTINGS_MAX_CONCURRENT_STREAMS, SPDYLAY_ID_FLAG_SETTINGS_NONE, spdy_max_concurrent_streams }, + { SPDYLAY_SETTINGS_INITIAL_WINDOW_SIZE, SPDYLAY_ID_FLAG_SETTINGS_NONE, spdy_initial_window_size } + }; + int r; if (TSIOBufferReaderAvail(this->req_reader) > 0) { spdy_process_read(TS_EVENT_VCONN_WRITE_READY, this); @@ -206,13 +209,15 @@ SpdyClientSession::state_session_start(int /* event */, void * /* edata */) SET_HANDLER(&SpdyClientSession::state_session_readwrite); - /* send initial settings frame */ - entry.settings_id = SPDYLAY_SETTINGS_MAX_CONCURRENT_STREAMS; - entry.value = spdy_max_concurrent_streams; - entry.flags = SPDYLAY_ID_FLAG_SETTINGS_NONE; + r = spdylay_submit_settings(this->session, SPDYLAY_FLAG_SETTINGS_NONE, entries, countof(entries)); + ink_assert(r == 0); + + if (this->version >= spdy::SESSION_VERSION_3_1 && spdy_initial_window_size > (1 << 16)) { + int32_t delta = (spdy_initial_window_size - SPDYLAY_INITIAL_WINDOW_SIZE); - r = spdylay_submit_settings(this->session, SPDYLAY_FLAG_SETTINGS_NONE, &entry, 1); - TSAssert(r == 0); + r = spdylay_submit_window_update(this->session, 0, delta); + ink_assert(r == 0); + } TSVIOReenable(this->write_vio); return EVENT_CONT; http://git-wip-us.apache.org/repos/asf/trafficserver/blob/90ff1a79/proxy/spdy/SpdyClientSession.h ---------------------------------------------------------------------- diff --git a/proxy/spdy/SpdyClientSession.h b/proxy/spdy/SpdyClientSession.h index 738ff55..81f7107 100644 --- a/proxy/spdy/SpdyClientSession.h +++ b/proxy/spdy/SpdyClientSession.h @@ -77,7 +77,7 @@ public: bool has_submitted_data; bool need_resume_data; int fetch_data_len; - int delta_window_size; + unsigned delta_window_size; bool fetch_body_completed; vector<pair<string, string> > headers; http://git-wip-us.apache.org/repos/asf/trafficserver/blob/90ff1a79/proxy/spdy/SpdyCommon.cc ---------------------------------------------------------------------- diff --git a/proxy/spdy/SpdyCommon.cc b/proxy/spdy/SpdyCommon.cc index 6647671..d14263b 100644 --- a/proxy/spdy/SpdyCommon.cc +++ b/proxy/spdy/SpdyCommon.cc @@ -37,8 +37,8 @@ static char const * const SPDY_STAT_TOTAL_TRANSACTIONS_TIME_NAME = "proxy.proces static char const * const SPDY_STAT_TOTAL_CLIENT_CONNECTION_NAME = "proxy.process.spdy.total_client_connections"; // Configurations -int32_t spdy_max_concurrent_streams = 100; -int32_t spdy_initial_window_size = 65536; +uint32_t spdy_max_concurrent_streams = 100; +uint32_t spdy_initial_window_size = 65536; int32_t spdy_accept_no_activity_timeout = 120; int32_t spdy_no_activity_timeout_in = 115; @@ -54,10 +54,10 @@ http_date(time_t t) int spdy_config_load() { - REC_EstablishStaticConfigInt32(spdy_max_concurrent_streams, "proxy.config.spdy.max_concurrent_streams_in"); + REC_EstablishStaticConfigInt32U(spdy_max_concurrent_streams, "proxy.config.spdy.max_concurrent_streams_in"); + REC_EstablishStaticConfigInt32U(spdy_initial_window_size, "proxy.config.spdy.initial_window_size_in"); REC_EstablishStaticConfigInt32(spdy_no_activity_timeout_in, "proxy.config.spdy.no_activity_timeout_in"); REC_EstablishStaticConfigInt32(spdy_accept_no_activity_timeout, "proxy.config.spdy.accept_no_activity_timeout"); - REC_EstablishStaticConfigInt32(spdy_initial_window_size, "proxy.config.spdy.initial_window_size_in"); spdy_callbacks_init(&spdy_callbacks); http://git-wip-us.apache.org/repos/asf/trafficserver/blob/90ff1a79/proxy/spdy/SpdyCommon.h ---------------------------------------------------------------------- diff --git a/proxy/spdy/SpdyCommon.h b/proxy/spdy/SpdyCommon.h index 02e4a50..6b17c37 100644 --- a/proxy/spdy/SpdyCommon.h +++ b/proxy/spdy/SpdyCommon.h @@ -59,8 +59,8 @@ using namespace std; extern spdylay_session_callbacks spdy_callbacks; // Configurations -extern int32_t spdy_max_concurrent_streams; -extern int32_t spdy_initial_window_size; +extern uint32_t spdy_max_concurrent_streams; +extern uint32_t spdy_initial_window_size; extern int32_t spdy_accept_no_activity_timeout; extern int32_t spdy_no_activity_timeout_in;
