Index: net/spdy/spdy_session.cc |
diff --git a/net/spdy/spdy_session.cc b/net/spdy/spdy_session.cc |
index edb1ae9b44877b08c4088e3f34ce45052d7e5cbf..db89ac2c43e4dbc2b86083215a35fb2012245ec0 100644 |
--- a/net/spdy/spdy_session.cc |
+++ b/net/spdy/spdy_session.cc |
@@ -11,6 +11,7 @@ |
#include "base/bind.h" |
#include "base/compiler_specific.h" |
+#include "base/feature_list.h" |
#include "base/location.h" |
#include "base/logging.h" |
#include "base/memory/ptr_util.h" |
@@ -73,6 +74,10 @@ const uint32_t kDefaultInitialEnablePush = 1; |
const uint32_t kDefaultInitialInitialWindowSize = 65535; |
const uint32_t kDefaultInitialMaxFrameSize = 16384; |
+// Experiment to close idle H2 sockets when SpdySession is initialized. |
+const base::Feature kCloseIdleH2SocketsEarlyExperiment{ |
+ "CloseIdleH2SocketsEarly", base::FEATURE_DISABLED_BY_DEFAULT}; |
+ |
bool IsSpdySettingAtDefaultInitialValue(SpdySettingsIds setting_id, |
uint32_t value) { |
switch (setting_id) { |
@@ -702,6 +707,7 @@ bool SpdySession::CanPool(TransportSecurityState* transport_security_state, |
SpdySession::SpdySession(const SpdySessionKey& spdy_session_key, |
HttpServerProperties* http_server_properties, |
TransportSecurityState* transport_security_state, |
+ HttpNetworkSession* http_network_session, |
bool enable_sending_initial_data, |
bool enable_ping_based_connection_checking, |
size_t session_max_recv_window_size, |
@@ -715,6 +721,7 @@ SpdySession::SpdySession(const SpdySessionKey& spdy_session_key, |
pool_(NULL), |
http_server_properties_(http_server_properties), |
transport_security_state_(transport_security_state), |
+ http_network_session_(http_network_session), |
read_buffer_(new IOBuffer(kReadBufferSize)), |
stream_hi_water_mark_(kFirstStreamId), |
last_accepted_push_stream_id_(0), |
@@ -826,6 +833,13 @@ void SpdySession::InitializeWithSocket( |
SendInitialData(); |
pool_ = pool; |
+ if (base::FeatureList::IsEnabled(kCloseIdleH2SocketsEarlyExperiment)) { |
+ // Close idle sockets in this group, since subsequent requests will go over |
+ // this Http2 connection. |
Bence
2017/02/08 00:18:52
s/'Http2'/'HTTP/2'/
xunjieli
2017/02/08 14:15:40
Done.
|
+ http_network_session_->CloseIdleConnectionsInGroup( |
+ connection_->group_name()); |
+ } |
+ |
// Bootstrap the read loop. |
base::ThreadTaskRunnerHandle::Get()->PostTask( |
FROM_HERE, |