summaryrefslogtreecommitdiffstats
path: root/net/spdy
diff options
context:
space:
mode:
Diffstat (limited to 'net/spdy')
-rw-r--r--net/spdy/spdy_session_pool.cc6
-rw-r--r--net/spdy/spdy_session_pool.h8
2 files changed, 12 insertions, 2 deletions
diff --git a/net/spdy/spdy_session_pool.cc b/net/spdy/spdy_session_pool.cc
index 0f012fb..5cfd62c 100644
--- a/net/spdy/spdy_session_pool.cc
+++ b/net/spdy/spdy_session_pool.cc
@@ -12,6 +12,8 @@ namespace net {
// The maximum number of sessions to open to a single domain.
static const size_t kMaxSessionsPerDomain = 1;
+int SpdySessionPool::g_max_sessions_per_domain = kMaxSessionsPerDomain;
+
SpdySessionPool::SpdySessionPool() {}
SpdySessionPool::~SpdySessionPool() {
CloseAllSessions();
@@ -22,7 +24,7 @@ scoped_refptr<SpdySession> SpdySessionPool::Get(
scoped_refptr<SpdySession> spdy_session;
SpdySessionList* list = GetSessionList(host_port_pair);
if (list) {
- if (list->size() >= kMaxSessionsPerDomain) {
+ if (list->size() >= static_cast<unsigned int>(g_max_sessions_per_domain)) {
spdy_session = list->front();
list->pop_front();
}
@@ -36,7 +38,7 @@ scoped_refptr<SpdySession> SpdySessionPool::Get(
DCHECK(spdy_session);
list->push_back(spdy_session);
- DCHECK(list->size() <= kMaxSessionsPerDomain);
+ DCHECK_LE(list->size(), static_cast<unsigned int>(g_max_sessions_per_domain));
return spdy_session;
}
diff --git a/net/spdy/spdy_session_pool.h b/net/spdy/spdy_session_pool.h
index 8cf8c60..8c50577 100644
--- a/net/spdy/spdy_session_pool.h
+++ b/net/spdy/spdy_session_pool.h
@@ -47,6 +47,12 @@ class SpdySessionPool : public base::RefCounted<SpdySessionPool> {
scoped_refptr<SpdySession> Get(
const HostPortPair& host_port_pair, HttpNetworkSession* session);
+ // Set the maximum concurrent sessions per domain.
+ static void set_max_sessions_per_domain(int max) {
+ if (max >= 1)
+ g_max_sessions_per_domain = max;
+ }
+
// Builds a SpdySession from an existing SSL socket. Users should try
// calling Get() first to use an existing SpdySession so we don't get
// multiple SpdySessions per domain. Note that ownership of |connection| is
@@ -86,6 +92,8 @@ class SpdySessionPool : public base::RefCounted<SpdySessionPool> {
// This is our weak session pool - one session per domain.
SpdySessionsMap sessions_;
+ static int g_max_sessions_per_domain;
+
DISALLOW_COPY_AND_ASSIGN(SpdySessionPool);
};