Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(450)

Unified Diff: net/spdy/spdy_session.cc

Issue 2678353003: Close idle H2 sockets when SpdySession is initialized. (Closed)
Patch Set: Self Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: net/spdy/spdy_session.cc
diff --git a/net/spdy/spdy_session.cc b/net/spdy/spdy_session.cc
index 2e3a31a457d7007b28022827c9cf73296ca9202e..8f6d1b8e82ff11a1d8f8b738a22ce1fc00af57f1 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) {
@@ -712,6 +717,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,
@@ -725,6 +731,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),
@@ -890,6 +897,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 HTTP/2 connection.
+ http_network_session_->CloseIdleConnectionsInGroup(
+ connection_->group_name());
+ }
+
// Bootstrap the read loop.
base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE,

Powered by Google App Engine
This is Rietveld 408576698