| 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 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 405 QuicErrorCode error = | 405 QuicErrorCode error = |
| 406 peer_hello.GetTaglist(tag_, &received_tags, &received_tags_length); | 406 peer_hello.GetTaglist(tag_, &received_tags, &received_tags_length); |
| 407 switch (error) { | 407 switch (error) { |
| 408 case QUIC_CRYPTO_MESSAGE_PARAMETER_NOT_FOUND: | 408 case QUIC_CRYPTO_MESSAGE_PARAMETER_NOT_FOUND: |
| 409 if (presence_ == PRESENCE_OPTIONAL) { | 409 if (presence_ == PRESENCE_OPTIONAL) { |
| 410 return QUIC_NO_ERROR; | 410 return QUIC_NO_ERROR; |
| 411 } | 411 } |
| 412 *error_details = "Missing " + QuicUtils::TagToString(tag_); | 412 *error_details = "Missing " + QuicUtils::TagToString(tag_); |
| 413 break; | 413 break; |
| 414 case QUIC_NO_ERROR: | 414 case QUIC_NO_ERROR: |
| 415 DVLOG(1) << "Received Connection Option tags from receiver."; |
| 415 has_receive_values_ = true; | 416 has_receive_values_ = true; |
| 416 for (size_t i = 0; i < received_tags_length; ++i) { | 417 for (size_t i = 0; i < received_tags_length; ++i) { |
| 417 receive_values_.push_back(received_tags[i]); | 418 receive_values_.push_back(received_tags[i]); |
| 418 } | 419 } |
| 419 break; | 420 break; |
| 420 default: | 421 default: |
| 421 *error_details = "Bad " + QuicUtils::TagToString(tag_); | 422 *error_details = "Bad " + QuicUtils::TagToString(tag_); |
| 422 break; | 423 break; |
| 423 } | 424 } |
| 424 return error; | 425 return error; |
| 425 } | 426 } |
| 426 | 427 |
| 427 QuicConfig::QuicConfig() | 428 QuicConfig::QuicConfig() |
| 428 : congestion_feedback_(kCGST, PRESENCE_REQUIRED), | 429 : congestion_feedback_(kCGST, PRESENCE_REQUIRED), |
| 429 connection_options_(kCOPT, PRESENCE_OPTIONAL), | 430 connection_options_(kCOPT, PRESENCE_OPTIONAL), |
| 430 loss_detection_(kLOSS, PRESENCE_OPTIONAL), | 431 loss_detection_(kLOSS, PRESENCE_OPTIONAL), |
| 431 idle_connection_state_lifetime_seconds_(kICSL, PRESENCE_REQUIRED), | 432 idle_connection_state_lifetime_seconds_(kICSL, PRESENCE_REQUIRED), |
| 432 keepalive_timeout_seconds_(kKATO, PRESENCE_OPTIONAL), | 433 keepalive_timeout_seconds_(kKATO, PRESENCE_OPTIONAL), |
| 433 max_streams_per_connection_(kMSPC, PRESENCE_REQUIRED), | 434 max_streams_per_connection_(kMSPC, PRESENCE_REQUIRED), |
| 434 max_time_before_crypto_handshake_(QuicTime::Delta::Zero()), | 435 max_time_before_crypto_handshake_(QuicTime::Delta::Zero()), |
| 435 initial_congestion_window_(kSWND, PRESENCE_OPTIONAL), | 436 initial_congestion_window_(kSWND, PRESENCE_OPTIONAL), |
| 436 initial_round_trip_time_us_(kIRTT, PRESENCE_OPTIONAL), | 437 initial_round_trip_time_us_(kIRTT, PRESENCE_OPTIONAL), |
| 437 // TODO(rjshade): Make this PRESENCE_REQUIRED when retiring | 438 // TODO(rjshade): Make this PRESENCE_REQUIRED when QUIC_VERSION_16 and |
| 438 // QUIC_VERSION_17. | 439 // QUIC_VERSION_15 are retired. |
| 439 initial_flow_control_window_bytes_(kIFCW, PRESENCE_OPTIONAL), | 440 initial_flow_control_window_bytes_(kIFCW, PRESENCE_OPTIONAL), |
| 440 // TODO(rjshade): Make this PRESENCE_REQUIRED when retiring | 441 // TODO(rjshade): Make this PRESENCE_REQUIRED when retiring |
| 441 // QUIC_VERSION_19. | 442 // QUIC_VERSION_19. |
| 442 initial_stream_flow_control_window_bytes_(kSFCW, PRESENCE_OPTIONAL), | 443 initial_stream_flow_control_window_bytes_(kSFCW, PRESENCE_OPTIONAL), |
| 443 // TODO(rjshade): Make this PRESENCE_REQUIRED when retiring | 444 // TODO(rjshade): Make this PRESENCE_REQUIRED when retiring |
| 444 // QUIC_VERSION_19. | 445 // QUIC_VERSION_19. |
| 445 initial_session_flow_control_window_bytes_(kCFCW, PRESENCE_OPTIONAL) { | 446 initial_session_flow_control_window_bytes_(kCFCW, PRESENCE_OPTIONAL) { |
| 446 } | 447 } |
| 447 | 448 |
| 448 QuicConfig::~QuicConfig() {} | 449 QuicConfig::~QuicConfig() {} |
| (...skipping 14 matching lines...) Expand all Loading... |
| 463 } | 464 } |
| 464 | 465 |
| 465 bool QuicConfig::HasReceivedConnectionOptions() const { | 466 bool QuicConfig::HasReceivedConnectionOptions() const { |
| 466 return connection_options_.HasReceivedValues(); | 467 return connection_options_.HasReceivedValues(); |
| 467 } | 468 } |
| 468 | 469 |
| 469 QuicTagVector QuicConfig::ReceivedConnectionOptions() const { | 470 QuicTagVector QuicConfig::ReceivedConnectionOptions() const { |
| 470 return connection_options_.GetReceivedValues(); | 471 return connection_options_.GetReceivedValues(); |
| 471 } | 472 } |
| 472 | 473 |
| 474 bool QuicConfig::HasSendConnectionOptions() const { |
| 475 return connection_options_.HasSendValues(); |
| 476 } |
| 477 |
| 478 QuicTagVector QuicConfig::SendConnectionOptions() const { |
| 479 return connection_options_.GetSendValues(); |
| 480 } |
| 481 |
| 473 void QuicConfig::SetLossDetectionToSend(QuicTag loss_detection) { | 482 void QuicConfig::SetLossDetectionToSend(QuicTag loss_detection) { |
| 474 loss_detection_.SetSendValue(loss_detection); | 483 loss_detection_.SetSendValue(loss_detection); |
| 475 } | 484 } |
| 476 | 485 |
| 477 bool QuicConfig::HasReceivedLossDetection() const { | 486 bool QuicConfig::HasReceivedLossDetection() const { |
| 478 return loss_detection_.HasReceivedValue(); | 487 return loss_detection_.HasReceivedValue(); |
| 479 } | 488 } |
| 480 | 489 |
| 481 QuicTag QuicConfig::ReceivedLossDetection() const { | 490 QuicTag QuicConfig::ReceivedLossDetection() const { |
| 482 return loss_detection_.GetReceivedValue(); | 491 return loss_detection_.GetReceivedValue(); |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 710 peer_hello, hello_type, error_details); | 719 peer_hello, hello_type, error_details); |
| 711 } | 720 } |
| 712 if (error == QUIC_NO_ERROR) { | 721 if (error == QUIC_NO_ERROR) { |
| 713 error = connection_options_.ProcessPeerHello( | 722 error = connection_options_.ProcessPeerHello( |
| 714 peer_hello, hello_type, error_details); | 723 peer_hello, hello_type, error_details); |
| 715 } | 724 } |
| 716 return error; | 725 return error; |
| 717 } | 726 } |
| 718 | 727 |
| 719 } // namespace net | 728 } // namespace net |
| OLD | NEW |