diff options
author | rch@chromium.org <rch@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-06-11 04:26:14 +0000 |
---|---|---|
committer | rch@chromium.org <rch@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-06-11 04:26:14 +0000 |
commit | fd276a28d54d41d8aa735ba30dd8ee0726e10929 (patch) | |
tree | 7f84b9da1af1387bd9e492119697adebeedf5c26 /net | |
parent | 2f6361cfc097e6fbf9c5c68c38f5a1dd2e5c290c (diff) | |
download | chromium_src-fd276a28d54d41d8aa735ba30dd8ee0726e10929.zip chromium_src-fd276a28d54d41d8aa735ba30dd8ee0726e10929.tar.gz chromium_src-fd276a28d54d41d8aa735ba30dd8ee0726e10929.tar.bz2 |
Make the config_ member of QuicStreamFactory const to prevent bugs
resulting from mutating config_ instead of config.
Review URL: https://codereview.chromium.org/328483002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@276250 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net')
-rw-r--r-- | net/quic/quic_stream_factory.cc | 27 | ||||
-rw-r--r-- | net/quic/quic_stream_factory.h | 7 |
2 files changed, 19 insertions, 15 deletions
diff --git a/net/quic/quic_stream_factory.cc b/net/quic/quic_stream_factory.cc index acd689e..9acedcb 100644 --- a/net/quic/quic_stream_factory.cc +++ b/net/quic/quic_stream_factory.cc @@ -53,6 +53,9 @@ enum CreateSessionFailure { CREATION_ERROR_MAX }; +// When a connection is idle for 30 seconds it will be closed. +const int kIdleConnectionTimeoutSeconds = 30; + // The initial receive window size for both streams and sessions. const int32 kInitialReceiveWindowSize = 10 * 1024 * 1024; // 10MB @@ -81,6 +84,19 @@ bool IsEcdsaSupported() { return true; } +QuicConfig InitializeQuicConfig(bool enable_pacing, + bool enable_time_based_loss_detection) { + QuicConfig config; + config.SetDefaults(); + config.EnablePacing(enable_pacing); + if (enable_time_based_loss_detection) + config.SetLossDetectionToSend(kTIME); + config.set_idle_connection_state_lifetime( + QuicTime::Delta::FromSeconds(kIdleConnectionTimeoutSeconds), + QuicTime::Delta::FromSeconds(kIdleConnectionTimeoutSeconds)); + return config; +} + } // namespace QuicStreamFactory::IpAliasKey::IpAliasKey() {} @@ -453,19 +469,12 @@ QuicStreamFactory::QuicStreamFactory( random_generator_(random_generator), clock_(clock), max_packet_length_(max_packet_length), + config_(InitializeQuicConfig(enable_pacing, + enable_time_based_loss_detection)), supported_versions_(supported_versions), enable_port_selection_(enable_port_selection), - enable_pacing_(enable_pacing), port_seed_(random_generator_->RandUint64()), weak_factory_(this) { - config_.SetDefaults(); - config_.EnablePacing(enable_pacing_); - if (enable_time_based_loss_detection) - config_.SetLossDetectionToSend(kTIME); - config_.set_idle_connection_state_lifetime( - QuicTime::Delta::FromSeconds(30), - QuicTime::Delta::FromSeconds(30)); - crypto_config_.SetDefaults(); crypto_config_.set_user_agent_id(user_agent_id); crypto_config_.AddCanonicalSuffix(".c.youtube.com"); diff --git a/net/quic/quic_stream_factory.h b/net/quic/quic_stream_factory.h index cc79285..eb82659 100644 --- a/net/quic/quic_stream_factory.h +++ b/net/quic/quic_stream_factory.h @@ -172,8 +172,6 @@ class NET_EXPORT_PRIVATE QuicStreamFactory quic_server_info_factory_ = quic_server_info_factory; } - bool enable_pacing() const { return enable_pacing_; } - private: class Job; friend class test::QuicStreamFactoryPeer; @@ -260,7 +258,7 @@ class NET_EXPORT_PRIVATE QuicStreamFactory // Origins which have gone away recently. AliasSet gone_away_aliases_; - QuicConfig config_; + const QuicConfig config_; QuicCryptoClientConfig crypto_config_; JobMap active_jobs_; @@ -274,9 +272,6 @@ class NET_EXPORT_PRIVATE QuicStreamFactory // connection. bool enable_port_selection_; - // True if packet pacing should be advertised during the crypto handshake. - bool enable_pacing_; - // Each profile will (probably) have a unique port_seed_ value. This value is // used to help seed a pseudo-random number generator (PortSuggester) so that // we consistently (within this profile) suggest the same ephemeral port when |