summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorwillchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-13 05:16:00 +0000
committerwillchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-13 05:16:00 +0000
commit160df77f063adb9c9149e43e90d8a9c2e1b1523e (patch)
treee160d8a6dbeb87a441fc90f8745d3776d1b852df /net
parent1aa303dd453468928bf1945b7583156f4c798a90 (diff)
downloadchromium_src-160df77f063adb9c9149e43e90d8a9c2e1b1523e.zip
chromium_src-160df77f063adb9c9149e43e90d8a9c2e1b1523e.tar.gz
chromium_src-160df77f063adb9c9149e43e90d8a9c2e1b1523e.tar.bz2
Add --use-spdy option to control initial max concurrent streams.
e.g.: out/Debug/chrome --use-spdy=init-max-streams=100 BUG=none TEST=none Review URL: http://codereview.chromium.org/8258005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@105266 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net')
-rw-r--r--net/http/http_network_layer.cc6
-rw-r--r--net/spdy/spdy_session.cc5
-rw-r--r--net/spdy/spdy_session.h15
3 files changed, 21 insertions, 5 deletions
diff --git a/net/http/http_network_layer.cc b/net/http/http_network_layer.cc
index e8ee62c..759ea13 100644
--- a/net/http/http_network_layer.cc
+++ b/net/http/http_network_layer.cc
@@ -77,6 +77,8 @@ void HttpNetworkLayer::EnableSpdy(const std::string& mode) {
// No spdy specified.
static const char kNpnProtosHttpOnly[] = "\x08http/1.1\x07http1.1";
+ static const char kInitialMaxConcurrentStreams[] = "init-max-streams";
+
std::vector<std::string> spdy_options;
base::SplitString(mode, ',', &spdy_options);
@@ -127,6 +129,10 @@ void HttpNetworkLayer::EnableSpdy(const std::string& mode) {
} else if (option == kSingleDomain) {
SpdySessionPool::ForceSingleDomain();
LOG(ERROR) << "FORCING SINGLE DOMAIN";
+ } else if (option == kInitialMaxConcurrentStreams) {
+ int streams;
+ if (base::StringToInt(value, &streams) && streams > 0)
+ SpdySession::set_init_max_concurrent_streams(streams);
} else if (option.empty() && it == spdy_options.begin()) {
continue;
} else {
diff --git a/net/spdy/spdy_session.cc b/net/spdy/spdy_session.cc
index fd19edc..cd7d10b 100644
--- a/net/spdy/spdy_session.cc
+++ b/net/spdy/spdy_session.cc
@@ -208,6 +208,9 @@ bool SpdySession::use_ssl_ = true;
bool SpdySession::use_flow_control_ = false;
// static
+size_t SpdySession::init_max_concurrent_streams_ = 10;
+
+// static
size_t SpdySession::max_concurrent_stream_limit_ = 256;
SpdySession::SpdySession(const HostPortProxyPair& host_port_proxy_pair,
@@ -233,7 +236,7 @@ SpdySession::SpdySession(const HostPortProxyPair& host_port_proxy_pair,
certificate_error_code_(OK),
error_(OK),
state_(IDLE),
- max_concurrent_streams_(kDefaultMaxConcurrentStreams),
+ max_concurrent_streams_(init_max_concurrent_streams_),
streams_initiated_count_(0),
streams_pushed_count_(0),
streams_pushed_and_claimed_count_(0),
diff --git a/net/spdy/spdy_session.h b/net/spdy/spdy_session.h
index c3711a1..96b67f9 100644
--- a/net/spdy/spdy_session.h
+++ b/net/spdy/spdy_session.h
@@ -147,12 +147,20 @@ class NET_EXPORT SpdySession : public base::RefCounted<SpdySession>,
static void set_flow_control(bool enable) { use_flow_control_ = enable; }
static bool flow_control() { return use_flow_control_; }
- // Sets the max concurrent streams per session.
+ // Sets the max concurrent streams per session, as a ceiling on any server
+ // specific SETTINGS value.
static void set_max_concurrent_streams(size_t value) {
max_concurrent_stream_limit_ = value;
}
static size_t max_concurrent_streams() {
- return max_concurrent_stream_limit_;
+ return max_concurrent_stream_limit_;
+ }
+
+ // The initial max concurrent streams per session, can be overridden by the
+ // server via SETTINGS.
+ static void set_init_max_concurrent_streams(size_t value) {
+ init_max_concurrent_streams_ =
+ std::min(value, max_concurrent_stream_limit_);
}
// Send WINDOW_UPDATE frame, called by a stream whenever receive window
@@ -251,8 +259,6 @@ class NET_EXPORT SpdySession : public base::RefCounted<SpdySession>,
CLOSED
};
- enum { kDefaultMaxConcurrentStreams = 10 };
-
virtual ~SpdySession();
void ProcessPendingCreateStreams();
@@ -449,6 +455,7 @@ class NET_EXPORT SpdySession : public base::RefCounted<SpdySession>,
static bool use_ssl_;
static bool use_flow_control_;
+ static size_t init_max_concurrent_streams_;
static size_t max_concurrent_stream_limit_;
};