| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "net/quic/quic_config.h" | 5 #include "net/quic/quic_config.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 | 10 |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 negotiated_ = true; | 216 negotiated_ = true; |
| 217 negotiated_tag_ = *received_tags; | 217 negotiated_tag_ = *received_tags; |
| 218 return QUIC_NO_ERROR; | 218 return QUIC_NO_ERROR; |
| 219 } | 219 } |
| 220 | 220 |
| 221 QuicConfig::QuicConfig() : | 221 QuicConfig::QuicConfig() : |
| 222 congestion_control_(kCGST, QuicNegotiableValue::PRESENCE_REQUIRED), | 222 congestion_control_(kCGST, QuicNegotiableValue::PRESENCE_REQUIRED), |
| 223 idle_connection_state_lifetime_seconds_( | 223 idle_connection_state_lifetime_seconds_( |
| 224 kICSL, QuicNegotiableValue::PRESENCE_REQUIRED), | 224 kICSL, QuicNegotiableValue::PRESENCE_REQUIRED), |
| 225 keepalive_timeout_seconds_(kKATO, QuicNegotiableValue::PRESENCE_OPTIONAL), | 225 keepalive_timeout_seconds_(kKATO, QuicNegotiableValue::PRESENCE_OPTIONAL), |
| 226 max_streams_per_connection_(kMSPC, QuicNegotiableValue::PRESENCE_REQUIRED) { | 226 max_streams_per_connection_(kMSPC, QuicNegotiableValue::PRESENCE_REQUIRED), |
| 227 max_time_before_crypto_handshake_(QuicTime::Delta::Zero()) { |
| 227 idle_connection_state_lifetime_seconds_.set(0, 0); | 228 idle_connection_state_lifetime_seconds_.set(0, 0); |
| 228 keepalive_timeout_seconds_.set(0, 0); | 229 keepalive_timeout_seconds_.set(0, 0); |
| 229 } | 230 } |
| 230 | 231 |
| 231 QuicConfig::~QuicConfig() {} | 232 QuicConfig::~QuicConfig() {} |
| 232 | 233 |
| 233 void QuicConfig::set_congestion_control( | 234 void QuicConfig::set_congestion_control( |
| 234 const QuicTagVector& congestion_control, | 235 const QuicTagVector& congestion_control, |
| 235 QuicTag default_congestion_control) { | 236 QuicTag default_congestion_control) { |
| 236 congestion_control_.set(congestion_control, default_congestion_control); | 237 congestion_control_.set(congestion_control, default_congestion_control); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 260 | 261 |
| 261 void QuicConfig::set_max_streams_per_connection(size_t max_streams, | 262 void QuicConfig::set_max_streams_per_connection(size_t max_streams, |
| 262 size_t default_streams) { | 263 size_t default_streams) { |
| 263 max_streams_per_connection_.set(max_streams, default_streams); | 264 max_streams_per_connection_.set(max_streams, default_streams); |
| 264 } | 265 } |
| 265 | 266 |
| 266 uint32 QuicConfig::max_streams_per_connection() const { | 267 uint32 QuicConfig::max_streams_per_connection() const { |
| 267 return max_streams_per_connection_.GetUint32(); | 268 return max_streams_per_connection_.GetUint32(); |
| 268 } | 269 } |
| 269 | 270 |
| 271 void QuicConfig::set_max_time_before_crypto_handshake( |
| 272 QuicTime::Delta max_time_before_crypto_handshake) { |
| 273 max_time_before_crypto_handshake_ = max_time_before_crypto_handshake; |
| 274 } |
| 275 |
| 276 QuicTime::Delta QuicConfig::max_time_before_crypto_handshake() const { |
| 277 return max_time_before_crypto_handshake_; |
| 278 } |
| 279 |
| 270 bool QuicConfig::negotiated() { | 280 bool QuicConfig::negotiated() { |
| 271 return congestion_control_.negotiated() && | 281 return congestion_control_.negotiated() && |
| 272 idle_connection_state_lifetime_seconds_.negotiated() && | 282 idle_connection_state_lifetime_seconds_.negotiated() && |
| 273 keepalive_timeout_seconds_.negotiated() && | 283 keepalive_timeout_seconds_.negotiated() && |
| 274 max_streams_per_connection_.negotiated(); | 284 max_streams_per_connection_.negotiated(); |
| 275 } | 285 } |
| 276 | 286 |
| 277 void QuicConfig::SetDefaults() { | 287 void QuicConfig::SetDefaults() { |
| 278 congestion_control_.set(QuicTagVector(1, kQBIC), kQBIC); | 288 congestion_control_.set(QuicTagVector(1, kQBIC), kQBIC); |
| 279 idle_connection_state_lifetime_seconds_.set(kDefaultTimeoutSecs, | 289 idle_connection_state_lifetime_seconds_.set(kDefaultTimeoutSecs, |
| 280 kDefaultTimeoutSecs); | 290 kDefaultInitialTimeoutSecs); |
| 281 // kKATO is optional. Return 0 if not negotiated. | 291 // kKATO is optional. Return 0 if not negotiated. |
| 282 keepalive_timeout_seconds_.set(0, 0); | 292 keepalive_timeout_seconds_.set(0, 0); |
| 283 max_streams_per_connection_.set(kDefaultMaxStreamsPerConnection, | 293 max_streams_per_connection_.set(kDefaultMaxStreamsPerConnection, |
| 284 kDefaultMaxStreamsPerConnection); | 294 kDefaultMaxStreamsPerConnection); |
| 295 max_time_before_crypto_handshake_ = QuicTime::Delta::FromSeconds( |
| 296 kDefaultMaxTimeForCryptoHandshakeSecs); |
| 285 } | 297 } |
| 286 | 298 |
| 287 void QuicConfig::ToHandshakeMessage(CryptoHandshakeMessage* out) const { | 299 void QuicConfig::ToHandshakeMessage(CryptoHandshakeMessage* out) const { |
| 288 congestion_control_.ToHandshakeMessage(out); | 300 congestion_control_.ToHandshakeMessage(out); |
| 289 idle_connection_state_lifetime_seconds_.ToHandshakeMessage(out); | 301 idle_connection_state_lifetime_seconds_.ToHandshakeMessage(out); |
| 290 keepalive_timeout_seconds_.ToHandshakeMessage(out); | 302 keepalive_timeout_seconds_.ToHandshakeMessage(out); |
| 291 max_streams_per_connection_.ToHandshakeMessage(out); | 303 max_streams_per_connection_.ToHandshakeMessage(out); |
| 292 } | 304 } |
| 293 | 305 |
| 294 QuicErrorCode QuicConfig::ProcessClientHello( | 306 QuicErrorCode QuicConfig::ProcessClientHello( |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 334 } | 346 } |
| 335 if (error == QUIC_NO_ERROR) { | 347 if (error == QUIC_NO_ERROR) { |
| 336 error = max_streams_per_connection_.ProcessServerHello( | 348 error = max_streams_per_connection_.ProcessServerHello( |
| 337 server_hello, error_details); | 349 server_hello, error_details); |
| 338 } | 350 } |
| 339 return error; | 351 return error; |
| 340 } | 352 } |
| 341 | 353 |
| 342 } // namespace net | 354 } // namespace net |
| 343 | 355 |
| OLD | NEW |