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 #include "net/quic/crypto/crypto_handshake_message.h" | 10 #include "net/quic/crypto/crypto_handshake_message.h" |
(...skipping 29 matching lines...) Expand all Loading... |
40 break; | 40 break; |
41 case QUIC_NO_ERROR: | 41 case QUIC_NO_ERROR: |
42 break; | 42 break; |
43 default: | 43 default: |
44 *error_details = "Bad " + QuicUtils::TagToString(tag); | 44 *error_details = "Bad " + QuicUtils::TagToString(tag); |
45 break; | 45 break; |
46 } | 46 } |
47 return error; | 47 return error; |
48 } | 48 } |
49 | 49 |
50 | 50 QuicConfigValue::QuicConfigValue(QuicTag tag, QuicConfigPresence presence) |
51 QuicConfigValue::QuicConfigValue(QuicTag tag, | 51 : tag_(tag), presence_(presence) { |
52 QuicConfigPresence presence) | |
53 : tag_(tag), | |
54 presence_(presence) { | |
55 } | 52 } |
56 QuicConfigValue::~QuicConfigValue() {} | 53 QuicConfigValue::~QuicConfigValue() { |
| 54 } |
57 | 55 |
58 QuicNegotiableValue::QuicNegotiableValue(QuicTag tag, | 56 QuicNegotiableValue::QuicNegotiableValue(QuicTag tag, |
59 QuicConfigPresence presence) | 57 QuicConfigPresence presence) |
60 : QuicConfigValue(tag, presence), | 58 : QuicConfigValue(tag, presence), negotiated_(false) { |
61 negotiated_(false) { | |
62 } | 59 } |
63 QuicNegotiableValue::~QuicNegotiableValue() {} | 60 QuicNegotiableValue::~QuicNegotiableValue() { |
| 61 } |
64 | 62 |
65 QuicNegotiableUint32::QuicNegotiableUint32(QuicTag tag, | 63 QuicNegotiableUint32::QuicNegotiableUint32(QuicTag tag, |
66 QuicConfigPresence presence) | 64 QuicConfigPresence presence) |
67 : QuicNegotiableValue(tag, presence), | 65 : QuicNegotiableValue(tag, presence), max_value_(0), default_value_(0) { |
68 max_value_(0), | |
69 default_value_(0) { | |
70 } | 66 } |
71 QuicNegotiableUint32::~QuicNegotiableUint32() {} | 67 QuicNegotiableUint32::~QuicNegotiableUint32() { |
| 68 } |
72 | 69 |
73 void QuicNegotiableUint32::set(uint32 max, uint32 default_value) { | 70 void QuicNegotiableUint32::set(uint32 max, uint32 default_value) { |
74 DCHECK_LE(default_value, max); | 71 DCHECK_LE(default_value, max); |
75 max_value_ = max; | 72 max_value_ = max; |
76 default_value_ = default_value; | 73 default_value_ = default_value; |
77 } | 74 } |
78 | 75 |
79 uint32 QuicNegotiableUint32::GetUint32() const { | 76 uint32 QuicNegotiableUint32::GetUint32() const { |
80 if (negotiated_) { | 77 if (negotiated_) { |
81 return negotiated_value_; | 78 return negotiated_value_; |
(...skipping 10 matching lines...) Expand all Loading... |
92 } | 89 } |
93 } | 90 } |
94 | 91 |
95 QuicErrorCode QuicNegotiableUint32::ProcessPeerHello( | 92 QuicErrorCode QuicNegotiableUint32::ProcessPeerHello( |
96 const CryptoHandshakeMessage& peer_hello, | 93 const CryptoHandshakeMessage& peer_hello, |
97 HelloType hello_type, | 94 HelloType hello_type, |
98 string* error_details) { | 95 string* error_details) { |
99 DCHECK(!negotiated_); | 96 DCHECK(!negotiated_); |
100 DCHECK(error_details != NULL); | 97 DCHECK(error_details != NULL); |
101 uint32 value; | 98 uint32 value; |
102 QuicErrorCode error = ReadUint32(peer_hello, | 99 QuicErrorCode error = ReadUint32( |
103 tag_, | 100 peer_hello, tag_, presence_, default_value_, &value, error_details); |
104 presence_, | |
105 default_value_, | |
106 &value, | |
107 error_details); | |
108 if (error != QUIC_NO_ERROR) { | 101 if (error != QUIC_NO_ERROR) { |
109 return error; | 102 return error; |
110 } | 103 } |
111 if (hello_type == SERVER && value > max_value_) { | 104 if (hello_type == SERVER && value > max_value_) { |
112 *error_details = "Invalid value received for " + | 105 *error_details = |
113 QuicUtils::TagToString(tag_); | 106 "Invalid value received for " + QuicUtils::TagToString(tag_); |
114 return QUIC_INVALID_NEGOTIATED_VALUE; | 107 return QUIC_INVALID_NEGOTIATED_VALUE; |
115 } | 108 } |
116 | 109 |
117 negotiated_ = true; | 110 negotiated_ = true; |
118 negotiated_value_ = min(value, max_value_); | 111 negotiated_value_ = min(value, max_value_); |
119 return QUIC_NO_ERROR; | 112 return QUIC_NO_ERROR; |
120 } | 113 } |
121 | 114 |
122 QuicNegotiableTag::QuicNegotiableTag(QuicTag tag, QuicConfigPresence presence) | 115 QuicNegotiableTag::QuicNegotiableTag(QuicTag tag, QuicConfigPresence presence) |
123 : QuicNegotiableValue(tag, presence), | 116 : QuicNegotiableValue(tag, presence), |
124 negotiated_tag_(0), | 117 negotiated_tag_(0), |
125 default_value_(0) { | 118 default_value_(0) { |
126 } | 119 } |
127 | 120 |
128 QuicNegotiableTag::~QuicNegotiableTag() {} | 121 QuicNegotiableTag::~QuicNegotiableTag() { |
| 122 } |
129 | 123 |
130 void QuicNegotiableTag::set(const QuicTagVector& possible, | 124 void QuicNegotiableTag::set(const QuicTagVector& possible, |
131 QuicTag default_value) { | 125 QuicTag default_value) { |
132 DCHECK(std::find(possible.begin(), possible.end(), default_value) != | 126 DCHECK(std::find(possible.begin(), possible.end(), default_value) != |
133 possible.end()); | 127 possible.end()); |
134 possible_values_ = possible; | 128 possible_values_ = possible; |
135 default_value_ = default_value; | 129 default_value_ = default_value; |
136 } | 130 } |
137 | 131 |
138 QuicTag QuicNegotiableTag::GetTag() const { | 132 QuicTag QuicNegotiableTag::GetTag() const { |
139 if (negotiated_) { | 133 if (negotiated_) { |
140 return negotiated_tag_; | 134 return negotiated_tag_; |
141 } | 135 } |
142 return default_value_; | 136 return default_value_; |
143 } | 137 } |
144 | 138 |
145 void QuicNegotiableTag::ToHandshakeMessage(CryptoHandshakeMessage* out) const { | 139 void QuicNegotiableTag::ToHandshakeMessage(CryptoHandshakeMessage* out) const { |
146 if (negotiated_) { | 140 if (negotiated_) { |
147 // Because of the way we serialize and parse handshake messages we can | 141 // Because of the way we serialize and parse handshake messages we can |
148 // serialize this as value and still parse it as a vector. | 142 // serialize this as value and still parse it as a vector. |
149 out->SetValue(tag_, negotiated_tag_); | 143 out->SetValue(tag_, negotiated_tag_); |
150 } else { | 144 } else { |
151 out->SetVector(tag_, possible_values_); | 145 out->SetVector(tag_, possible_values_); |
152 } | 146 } |
153 } | 147 } |
154 | 148 |
155 QuicErrorCode QuicNegotiableTag::ReadVector( | 149 QuicErrorCode QuicNegotiableTag::ReadVector(const CryptoHandshakeMessage& msg, |
156 const CryptoHandshakeMessage& msg, | 150 const QuicTag** out, |
157 const QuicTag** out, | 151 size_t* out_length, |
158 size_t* out_length, | 152 string* error_details) const { |
159 string* error_details) const { | |
160 DCHECK(error_details != NULL); | 153 DCHECK(error_details != NULL); |
161 QuicErrorCode error = msg.GetTaglist(tag_, out, out_length); | 154 QuicErrorCode error = msg.GetTaglist(tag_, out, out_length); |
162 switch (error) { | 155 switch (error) { |
163 case QUIC_CRYPTO_MESSAGE_PARAMETER_NOT_FOUND: | 156 case QUIC_CRYPTO_MESSAGE_PARAMETER_NOT_FOUND: |
164 if (presence_ == PRESENCE_REQUIRED) { | 157 if (presence_ == PRESENCE_REQUIRED) { |
165 *error_details = "Missing " + QuicUtils::TagToString(tag_); | 158 *error_details = "Missing " + QuicUtils::TagToString(tag_); |
166 break; | 159 break; |
167 } | 160 } |
168 error = QUIC_NO_ERROR; | 161 error = QUIC_NO_ERROR; |
169 *out_length = 1; | 162 *out_length = 1; |
170 *out = &default_value_; | 163 *out = &default_value_; |
171 | 164 |
172 case QUIC_NO_ERROR: | 165 case QUIC_NO_ERROR: |
173 break; | 166 break; |
174 default: | 167 default: |
175 *error_details = "Bad " + QuicUtils::TagToString(tag_); | 168 *error_details = "Bad " + QuicUtils::TagToString(tag_); |
176 break; | 169 break; |
177 } | 170 } |
178 return error; | 171 return error; |
179 } | 172 } |
180 | 173 |
181 QuicErrorCode QuicNegotiableTag::ProcessPeerHello( | 174 QuicErrorCode QuicNegotiableTag::ProcessPeerHello( |
182 const CryptoHandshakeMessage& peer_hello, | 175 const CryptoHandshakeMessage& peer_hello, |
183 HelloType hello_type, | 176 HelloType hello_type, |
184 string* error_details) { | 177 string* error_details) { |
185 DCHECK(!negotiated_); | 178 DCHECK(!negotiated_); |
186 DCHECK(error_details != NULL); | 179 DCHECK(error_details != NULL); |
187 const QuicTag* received_tags; | 180 const QuicTag* received_tags; |
188 size_t received_tags_length; | 181 size_t received_tags_length; |
189 QuicErrorCode error = ReadVector(peer_hello, &received_tags, | 182 QuicErrorCode error = ReadVector( |
190 &received_tags_length, error_details); | 183 peer_hello, &received_tags, &received_tags_length, error_details); |
191 if (error != QUIC_NO_ERROR) { | 184 if (error != QUIC_NO_ERROR) { |
192 return error; | 185 return error; |
193 } | 186 } |
194 | 187 |
195 if (hello_type == SERVER) { | 188 if (hello_type == SERVER) { |
196 if (received_tags_length != 1 || | 189 if (received_tags_length != 1 || |
197 std::find(possible_values_.begin(), possible_values_.end(), | 190 std::find(possible_values_.begin(), |
| 191 possible_values_.end(), |
198 *received_tags) == possible_values_.end()) { | 192 *received_tags) == possible_values_.end()) { |
199 *error_details = "Invalid " + QuicUtils::TagToString(tag_); | 193 *error_details = "Invalid " + QuicUtils::TagToString(tag_); |
200 return QUIC_INVALID_NEGOTIATED_VALUE; | 194 return QUIC_INVALID_NEGOTIATED_VALUE; |
201 } | 195 } |
202 negotiated_tag_ = *received_tags; | 196 negotiated_tag_ = *received_tags; |
203 } else { | 197 } else { |
204 QuicTag negotiated_tag; | 198 QuicTag negotiated_tag; |
205 if (!QuicUtils::FindMutualTag(possible_values_, | 199 if (!QuicUtils::FindMutualTag(possible_values_, |
206 received_tags, | 200 received_tags, |
207 received_tags_length, | 201 received_tags_length, |
208 QuicUtils::LOCAL_PRIORITY, | 202 QuicUtils::LOCAL_PRIORITY, |
209 &negotiated_tag, | 203 &negotiated_tag, |
210 NULL)) { | 204 NULL)) { |
211 *error_details = "Unsupported " + QuicUtils::TagToString(tag_); | 205 *error_details = "Unsupported " + QuicUtils::TagToString(tag_); |
212 return QUIC_CRYPTO_MESSAGE_PARAMETER_NO_OVERLAP; | 206 return QUIC_CRYPTO_MESSAGE_PARAMETER_NO_OVERLAP; |
213 } | 207 } |
214 negotiated_tag_ = negotiated_tag; | 208 negotiated_tag_ = negotiated_tag; |
215 } | 209 } |
216 | 210 |
217 negotiated_ = true; | 211 negotiated_ = true; |
218 return QUIC_NO_ERROR; | 212 return QUIC_NO_ERROR; |
219 } | 213 } |
220 | 214 |
221 QuicFixedUint32::QuicFixedUint32(QuicTag tag, QuicConfigPresence presence) | 215 QuicFixedUint32::QuicFixedUint32(QuicTag tag, QuicConfigPresence presence) |
222 : QuicConfigValue(tag, presence), | 216 : QuicConfigValue(tag, presence), |
223 has_send_value_(false), | 217 has_send_value_(false), |
224 has_receive_value_(false) { | 218 has_receive_value_(false) { |
225 } | 219 } |
226 QuicFixedUint32::~QuicFixedUint32() {} | 220 QuicFixedUint32::~QuicFixedUint32() { |
| 221 } |
227 | 222 |
228 bool QuicFixedUint32::HasSendValue() const { | 223 bool QuicFixedUint32::HasSendValue() const { |
229 return has_send_value_; | 224 return has_send_value_; |
230 } | 225 } |
231 | 226 |
232 uint32 QuicFixedUint32::GetSendValue() const { | 227 uint32 QuicFixedUint32::GetSendValue() const { |
233 LOG_IF(DFATAL, !has_send_value_) << "No send value to get for tag:" << tag_; | 228 LOG_IF(DFATAL, !has_send_value_) << "No send value to get for tag:" << tag_; |
234 return send_value_; | 229 return send_value_; |
235 } | 230 } |
236 | 231 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 case QUIC_NO_ERROR: | 272 case QUIC_NO_ERROR: |
278 has_receive_value_ = true; | 273 has_receive_value_ = true; |
279 break; | 274 break; |
280 default: | 275 default: |
281 *error_details = "Bad " + QuicUtils::TagToString(tag_); | 276 *error_details = "Bad " + QuicUtils::TagToString(tag_); |
282 break; | 277 break; |
283 } | 278 } |
284 return error; | 279 return error; |
285 } | 280 } |
286 | 281 |
287 QuicFixedTag::QuicFixedTag(QuicTag name, | 282 QuicFixedTag::QuicFixedTag(QuicTag name, QuicConfigPresence presence) |
288 QuicConfigPresence presence) | |
289 : QuicConfigValue(name, presence), | 283 : QuicConfigValue(name, presence), |
290 has_send_value_(false), | 284 has_send_value_(false), |
291 has_receive_value_(false) { | 285 has_receive_value_(false) { |
292 } | 286 } |
293 | 287 |
294 QuicFixedTag::~QuicFixedTag() {} | 288 QuicFixedTag::~QuicFixedTag() { |
| 289 } |
295 | 290 |
296 bool QuicFixedTag::HasSendValue() const { | 291 bool QuicFixedTag::HasSendValue() const { |
297 return has_send_value_; | 292 return has_send_value_; |
298 } | 293 } |
299 | 294 |
300 uint32 QuicFixedTag::GetSendValue() const { | 295 uint32 QuicFixedTag::GetSendValue() const { |
301 LOG_IF(DFATAL, !has_send_value_) << "No send value to get for tag:" << tag_; | 296 LOG_IF(DFATAL, !has_send_value_) << "No send value to get for tag:" << tag_; |
302 return send_value_; | 297 return send_value_; |
303 } | 298 } |
304 | 299 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
359 keepalive_timeout_seconds_(kKATO, PRESENCE_OPTIONAL), | 354 keepalive_timeout_seconds_(kKATO, PRESENCE_OPTIONAL), |
360 max_streams_per_connection_(kMSPC, PRESENCE_REQUIRED), | 355 max_streams_per_connection_(kMSPC, PRESENCE_REQUIRED), |
361 max_time_before_crypto_handshake_(QuicTime::Delta::Zero()), | 356 max_time_before_crypto_handshake_(QuicTime::Delta::Zero()), |
362 initial_congestion_window_(kSWND, PRESENCE_OPTIONAL), | 357 initial_congestion_window_(kSWND, PRESENCE_OPTIONAL), |
363 initial_round_trip_time_us_(kIRTT, PRESENCE_OPTIONAL), | 358 initial_round_trip_time_us_(kIRTT, PRESENCE_OPTIONAL), |
364 // TODO(rjshade): Make this PRESENCE_REQUIRED when retiring | 359 // TODO(rjshade): Make this PRESENCE_REQUIRED when retiring |
365 // QUIC_VERSION_17. | 360 // QUIC_VERSION_17. |
366 initial_flow_control_window_bytes_(kIFCW, PRESENCE_OPTIONAL) { | 361 initial_flow_control_window_bytes_(kIFCW, PRESENCE_OPTIONAL) { |
367 } | 362 } |
368 | 363 |
369 QuicConfig::~QuicConfig() {} | 364 QuicConfig::~QuicConfig() { |
| 365 } |
370 | 366 |
371 void QuicConfig::set_congestion_control( | 367 void QuicConfig::set_congestion_control(const QuicTagVector& congestion_control, |
372 const QuicTagVector& congestion_control, | 368 QuicTag default_congestion_control) { |
373 QuicTag default_congestion_control) { | |
374 congestion_control_.set(congestion_control, default_congestion_control); | 369 congestion_control_.set(congestion_control, default_congestion_control); |
375 } | 370 } |
376 | 371 |
377 QuicTag QuicConfig::congestion_control() const { | 372 QuicTag QuicConfig::congestion_control() const { |
378 return congestion_control_.GetTag(); | 373 return congestion_control_.GetTag(); |
379 } | 374 } |
380 | 375 |
381 void QuicConfig::SetLossDetectionToSend(QuicTag loss_detection) { | 376 void QuicConfig::SetLossDetectionToSend(QuicTag loss_detection) { |
382 loss_detection_.SetSendValue(loss_detection); | 377 loss_detection_.SetSendValue(loss_detection); |
383 } | 378 } |
(...skipping 13 matching lines...) Expand all Loading... |
397 max_idle_connection_state_lifetime.ToSeconds(), | 392 max_idle_connection_state_lifetime.ToSeconds(), |
398 default_idle_conection_state_lifetime.ToSeconds()); | 393 default_idle_conection_state_lifetime.ToSeconds()); |
399 } | 394 } |
400 | 395 |
401 QuicTime::Delta QuicConfig::idle_connection_state_lifetime() const { | 396 QuicTime::Delta QuicConfig::idle_connection_state_lifetime() const { |
402 return QuicTime::Delta::FromSeconds( | 397 return QuicTime::Delta::FromSeconds( |
403 idle_connection_state_lifetime_seconds_.GetUint32()); | 398 idle_connection_state_lifetime_seconds_.GetUint32()); |
404 } | 399 } |
405 | 400 |
406 QuicTime::Delta QuicConfig::keepalive_timeout() const { | 401 QuicTime::Delta QuicConfig::keepalive_timeout() const { |
407 return QuicTime::Delta::FromSeconds( | 402 return QuicTime::Delta::FromSeconds(keepalive_timeout_seconds_.GetUint32()); |
408 keepalive_timeout_seconds_.GetUint32()); | |
409 } | 403 } |
410 | 404 |
411 void QuicConfig::set_max_streams_per_connection(size_t max_streams, | 405 void QuicConfig::set_max_streams_per_connection(size_t max_streams, |
412 size_t default_streams) { | 406 size_t default_streams) { |
413 max_streams_per_connection_.set(max_streams, default_streams); | 407 max_streams_per_connection_.set(max_streams, default_streams); |
414 } | 408 } |
415 | 409 |
416 uint32 QuicConfig::max_streams_per_connection() const { | 410 uint32 QuicConfig::max_streams_per_connection() const { |
417 return max_streams_per_connection_.GetUint32(); | 411 return max_streams_per_connection_.GetUint32(); |
418 } | 412 } |
(...skipping 29 matching lines...) Expand all Loading... |
448 | 442 |
449 uint32 QuicConfig::ReceivedInitialRoundTripTimeUs() const { | 443 uint32 QuicConfig::ReceivedInitialRoundTripTimeUs() const { |
450 return initial_round_trip_time_us_.GetReceivedValue(); | 444 return initial_round_trip_time_us_.GetReceivedValue(); |
451 } | 445 } |
452 | 446 |
453 void QuicConfig::SetInitialFlowControlWindowToSend(uint32 window_bytes) { | 447 void QuicConfig::SetInitialFlowControlWindowToSend(uint32 window_bytes) { |
454 initial_flow_control_window_bytes_.SetSendValue(window_bytes); | 448 initial_flow_control_window_bytes_.SetSendValue(window_bytes); |
455 } | 449 } |
456 | 450 |
457 bool QuicConfig::HasReceivedInitialFlowControlWindowBytes() const { | 451 bool QuicConfig::HasReceivedInitialFlowControlWindowBytes() const { |
458 return initial_flow_control_window_bytes_.HasReceivedValue();; | 452 return initial_flow_control_window_bytes_.HasReceivedValue(); |
| 453 ; |
459 } | 454 } |
460 | 455 |
461 uint32 QuicConfig::ReceivedInitialFlowControlWindowBytes() const { | 456 uint32 QuicConfig::ReceivedInitialFlowControlWindowBytes() const { |
462 return initial_flow_control_window_bytes_.GetReceivedValue(); | 457 return initial_flow_control_window_bytes_.GetReceivedValue(); |
463 } | 458 } |
464 | 459 |
465 bool QuicConfig::negotiated() { | 460 bool QuicConfig::negotiated() { |
466 // TODO(ianswett): Add the negotiated parameters once and iterate over all | 461 // TODO(ianswett): Add the negotiated parameters once and iterate over all |
467 // of them in negotiated, ToHandshakeMessage, ProcessClientHello, and | 462 // of them in negotiated, ToHandshakeMessage, ProcessClientHello, and |
468 // ProcessServerHello. | 463 // ProcessServerHello. |
469 return congestion_control_.negotiated() && | 464 return congestion_control_.negotiated() && |
470 idle_connection_state_lifetime_seconds_.negotiated() && | 465 idle_connection_state_lifetime_seconds_.negotiated() && |
471 keepalive_timeout_seconds_.negotiated() && | 466 keepalive_timeout_seconds_.negotiated() && |
472 max_streams_per_connection_.negotiated(); | 467 max_streams_per_connection_.negotiated(); |
473 } | 468 } |
474 | 469 |
475 void QuicConfig::SetDefaults() { | 470 void QuicConfig::SetDefaults() { |
476 QuicTagVector congestion_control; | 471 QuicTagVector congestion_control; |
477 if (FLAGS_enable_quic_pacing) { | 472 if (FLAGS_enable_quic_pacing) { |
478 congestion_control.push_back(kPACE); | 473 congestion_control.push_back(kPACE); |
479 } | 474 } |
480 congestion_control.push_back(kQBIC); | 475 congestion_control.push_back(kQBIC); |
481 congestion_control_.set(congestion_control, kQBIC); | 476 congestion_control_.set(congestion_control, kQBIC); |
482 idle_connection_state_lifetime_seconds_.set(kDefaultTimeoutSecs, | 477 idle_connection_state_lifetime_seconds_.set(kDefaultTimeoutSecs, |
483 kDefaultInitialTimeoutSecs); | 478 kDefaultInitialTimeoutSecs); |
484 // kKATO is optional. Return 0 if not negotiated. | 479 // kKATO is optional. Return 0 if not negotiated. |
485 keepalive_timeout_seconds_.set(0, 0); | 480 keepalive_timeout_seconds_.set(0, 0); |
486 max_streams_per_connection_.set(kDefaultMaxStreamsPerConnection, | 481 max_streams_per_connection_.set(kDefaultMaxStreamsPerConnection, |
487 kDefaultMaxStreamsPerConnection); | 482 kDefaultMaxStreamsPerConnection); |
488 max_time_before_crypto_handshake_ = QuicTime::Delta::FromSeconds( | 483 max_time_before_crypto_handshake_ = |
489 kDefaultMaxTimeForCryptoHandshakeSecs); | 484 QuicTime::Delta::FromSeconds(kDefaultMaxTimeForCryptoHandshakeSecs); |
490 } | 485 } |
491 | 486 |
492 void QuicConfig::EnablePacing(bool enable_pacing) { | 487 void QuicConfig::EnablePacing(bool enable_pacing) { |
493 QuicTagVector congestion_control; | 488 QuicTagVector congestion_control; |
494 if (enable_pacing) { | 489 if (enable_pacing) { |
495 congestion_control.push_back(kPACE); | 490 congestion_control.push_back(kPACE); |
496 } | 491 } |
497 congestion_control.push_back(kQBIC); | 492 congestion_control.push_back(kQBIC); |
498 congestion_control_.set(congestion_control, kQBIC); | 493 congestion_control_.set(congestion_control, kQBIC); |
499 } | 494 } |
(...skipping 11 matching lines...) Expand all Loading... |
511 | 506 |
512 QuicErrorCode QuicConfig::ProcessPeerHello( | 507 QuicErrorCode QuicConfig::ProcessPeerHello( |
513 const CryptoHandshakeMessage& peer_hello, | 508 const CryptoHandshakeMessage& peer_hello, |
514 HelloType hello_type, | 509 HelloType hello_type, |
515 string* error_details) { | 510 string* error_details) { |
516 DCHECK(error_details != NULL); | 511 DCHECK(error_details != NULL); |
517 | 512 |
518 QuicErrorCode error = QUIC_NO_ERROR; | 513 QuicErrorCode error = QUIC_NO_ERROR; |
519 if (error == QUIC_NO_ERROR) { | 514 if (error == QUIC_NO_ERROR) { |
520 error = congestion_control_.ProcessPeerHello( | 515 error = congestion_control_.ProcessPeerHello( |
521 peer_hello, hello_type, error_details); | 516 peer_hello, hello_type, error_details); |
522 } | 517 } |
523 if (error == QUIC_NO_ERROR) { | 518 if (error == QUIC_NO_ERROR) { |
524 error = idle_connection_state_lifetime_seconds_.ProcessPeerHello( | 519 error = idle_connection_state_lifetime_seconds_.ProcessPeerHello( |
525 peer_hello, hello_type, error_details); | 520 peer_hello, hello_type, error_details); |
526 } | 521 } |
527 if (error == QUIC_NO_ERROR) { | 522 if (error == QUIC_NO_ERROR) { |
528 error = keepalive_timeout_seconds_.ProcessPeerHello( | 523 error = keepalive_timeout_seconds_.ProcessPeerHello( |
529 peer_hello, hello_type, error_details); | 524 peer_hello, hello_type, error_details); |
530 } | 525 } |
531 if (error == QUIC_NO_ERROR) { | 526 if (error == QUIC_NO_ERROR) { |
532 error = max_streams_per_connection_.ProcessPeerHello( | 527 error = max_streams_per_connection_.ProcessPeerHello( |
533 peer_hello, hello_type, error_details); | 528 peer_hello, hello_type, error_details); |
534 } | 529 } |
535 if (error == QUIC_NO_ERROR) { | 530 if (error == QUIC_NO_ERROR) { |
536 error = initial_congestion_window_.ProcessPeerHello( | 531 error = initial_congestion_window_.ProcessPeerHello( |
537 peer_hello, hello_type, error_details); | 532 peer_hello, hello_type, error_details); |
538 } | 533 } |
539 if (error == QUIC_NO_ERROR) { | 534 if (error == QUIC_NO_ERROR) { |
540 error = initial_round_trip_time_us_.ProcessPeerHello( | 535 error = initial_round_trip_time_us_.ProcessPeerHello( |
541 peer_hello, hello_type, error_details); | 536 peer_hello, hello_type, error_details); |
542 } | 537 } |
543 if (error == QUIC_NO_ERROR) { | 538 if (error == QUIC_NO_ERROR) { |
544 error = initial_flow_control_window_bytes_.ProcessPeerHello( | 539 error = initial_flow_control_window_bytes_.ProcessPeerHello( |
545 peer_hello, hello_type, error_details); | 540 peer_hello, hello_type, error_details); |
546 } | 541 } |
547 if (error == QUIC_NO_ERROR) { | 542 if (error == QUIC_NO_ERROR) { |
548 error = loss_detection_.ProcessPeerHello( | 543 error = |
549 peer_hello, hello_type, error_details); | 544 loss_detection_.ProcessPeerHello(peer_hello, hello_type, error_details); |
550 } | 545 } |
551 return error; | 546 return error; |
552 } | 547 } |
553 | 548 |
554 } // namespace net | 549 } // namespace net |
OLD | NEW |