| 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 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 427 QuicConfig::QuicConfig() | 427 QuicConfig::QuicConfig() |
| 428 : max_time_before_crypto_handshake_(QuicTime::Delta::Zero()), | 428 : max_time_before_crypto_handshake_(QuicTime::Delta::Zero()), |
| 429 max_idle_time_before_crypto_handshake_(QuicTime::Delta::Zero()), | 429 max_idle_time_before_crypto_handshake_(QuicTime::Delta::Zero()), |
| 430 max_undecryptable_packets_(0), | 430 max_undecryptable_packets_(0), |
| 431 congestion_feedback_(kCGST, PRESENCE_REQUIRED), | 431 congestion_feedback_(kCGST, PRESENCE_REQUIRED), |
| 432 connection_options_(kCOPT, PRESENCE_OPTIONAL), | 432 connection_options_(kCOPT, PRESENCE_OPTIONAL), |
| 433 idle_connection_state_lifetime_seconds_(kICSL, PRESENCE_REQUIRED), | 433 idle_connection_state_lifetime_seconds_(kICSL, PRESENCE_REQUIRED), |
| 434 keepalive_timeout_seconds_(kKATO, PRESENCE_OPTIONAL), | 434 keepalive_timeout_seconds_(kKATO, PRESENCE_OPTIONAL), |
| 435 max_streams_per_connection_(kMSPC, PRESENCE_REQUIRED), | 435 max_streams_per_connection_(kMSPC, PRESENCE_REQUIRED), |
| 436 bytes_for_connection_id_(kTCID, PRESENCE_OPTIONAL), | 436 bytes_for_connection_id_(kTCID, PRESENCE_OPTIONAL), |
| 437 initial_congestion_window_(kSWND, PRESENCE_OPTIONAL), | |
| 438 initial_round_trip_time_us_(kIRTT, PRESENCE_OPTIONAL), | 437 initial_round_trip_time_us_(kIRTT, PRESENCE_OPTIONAL), |
| 439 // TODO(rjshade): Remove this when retiring QUIC_VERSION_19. | 438 // TODO(rjshade): Remove this when retiring QUIC_VERSION_19. |
| 440 initial_flow_control_window_bytes_(kIFCW, PRESENCE_OPTIONAL), | 439 initial_flow_control_window_bytes_(kIFCW, PRESENCE_OPTIONAL), |
| 441 // TODO(rjshade): Make this PRESENCE_REQUIRED when retiring | 440 // TODO(rjshade): Make this PRESENCE_REQUIRED when retiring |
| 442 // QUIC_VERSION_19. | 441 // QUIC_VERSION_19. |
| 443 initial_stream_flow_control_window_bytes_(kSFCW, PRESENCE_OPTIONAL), | 442 initial_stream_flow_control_window_bytes_(kSFCW, PRESENCE_OPTIONAL), |
| 444 // TODO(rjshade): Make this PRESENCE_REQUIRED when retiring | 443 // TODO(rjshade): Make this PRESENCE_REQUIRED when retiring |
| 445 // QUIC_VERSION_19. | 444 // QUIC_VERSION_19. |
| 446 initial_session_flow_control_window_bytes_(kCFCW, PRESENCE_OPTIONAL), | 445 initial_session_flow_control_window_bytes_(kCFCW, PRESENCE_OPTIONAL), |
| 447 socket_receive_buffer_(kSRBF, PRESENCE_OPTIONAL) { | 446 socket_receive_buffer_(kSRBF, PRESENCE_OPTIONAL) { |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 517 } | 516 } |
| 518 | 517 |
| 519 bool QuicConfig::HasReceivedBytesForConnectionId() const { | 518 bool QuicConfig::HasReceivedBytesForConnectionId() const { |
| 520 return bytes_for_connection_id_.HasReceivedValue(); | 519 return bytes_for_connection_id_.HasReceivedValue(); |
| 521 } | 520 } |
| 522 | 521 |
| 523 uint32 QuicConfig::ReceivedBytesForConnectionId() const { | 522 uint32 QuicConfig::ReceivedBytesForConnectionId() const { |
| 524 return bytes_for_connection_id_.GetReceivedValue(); | 523 return bytes_for_connection_id_.GetReceivedValue(); |
| 525 } | 524 } |
| 526 | 525 |
| 527 void QuicConfig::SetInitialCongestionWindowToSend(size_t initial_window) { | |
| 528 initial_congestion_window_.SetSendValue(initial_window); | |
| 529 } | |
| 530 | |
| 531 bool QuicConfig::HasReceivedInitialCongestionWindow() const { | |
| 532 return initial_congestion_window_.HasReceivedValue(); | |
| 533 } | |
| 534 | |
| 535 uint32 QuicConfig::ReceivedInitialCongestionWindow() const { | |
| 536 return initial_congestion_window_.GetReceivedValue(); | |
| 537 } | |
| 538 | |
| 539 void QuicConfig::SetInitialRoundTripTimeUsToSend(size_t rtt) { | 526 void QuicConfig::SetInitialRoundTripTimeUsToSend(size_t rtt) { |
| 540 initial_round_trip_time_us_.SetSendValue(rtt); | 527 initial_round_trip_time_us_.SetSendValue(rtt); |
| 541 } | 528 } |
| 542 | 529 |
| 543 bool QuicConfig::HasReceivedInitialRoundTripTimeUs() const { | 530 bool QuicConfig::HasReceivedInitialRoundTripTimeUs() const { |
| 544 return initial_round_trip_time_us_.HasReceivedValue(); | 531 return initial_round_trip_time_us_.HasReceivedValue(); |
| 545 } | 532 } |
| 546 | 533 |
| 547 uint32 QuicConfig::ReceivedInitialRoundTripTimeUs() const { | 534 uint32 QuicConfig::ReceivedInitialRoundTripTimeUs() const { |
| 548 return initial_round_trip_time_us_.GetReceivedValue(); | 535 return initial_round_trip_time_us_.GetReceivedValue(); |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 668 SetInitialStreamFlowControlWindowToSend(kDefaultFlowControlSendWindow); | 655 SetInitialStreamFlowControlWindowToSend(kDefaultFlowControlSendWindow); |
| 669 SetInitialSessionFlowControlWindowToSend(kDefaultFlowControlSendWindow); | 656 SetInitialSessionFlowControlWindowToSend(kDefaultFlowControlSendWindow); |
| 670 } | 657 } |
| 671 | 658 |
| 672 void QuicConfig::ToHandshakeMessage(CryptoHandshakeMessage* out) const { | 659 void QuicConfig::ToHandshakeMessage(CryptoHandshakeMessage* out) const { |
| 673 congestion_feedback_.ToHandshakeMessage(out); | 660 congestion_feedback_.ToHandshakeMessage(out); |
| 674 idle_connection_state_lifetime_seconds_.ToHandshakeMessage(out); | 661 idle_connection_state_lifetime_seconds_.ToHandshakeMessage(out); |
| 675 keepalive_timeout_seconds_.ToHandshakeMessage(out); | 662 keepalive_timeout_seconds_.ToHandshakeMessage(out); |
| 676 max_streams_per_connection_.ToHandshakeMessage(out); | 663 max_streams_per_connection_.ToHandshakeMessage(out); |
| 677 bytes_for_connection_id_.ToHandshakeMessage(out); | 664 bytes_for_connection_id_.ToHandshakeMessage(out); |
| 678 initial_congestion_window_.ToHandshakeMessage(out); | |
| 679 initial_round_trip_time_us_.ToHandshakeMessage(out); | 665 initial_round_trip_time_us_.ToHandshakeMessage(out); |
| 680 initial_flow_control_window_bytes_.ToHandshakeMessage(out); | 666 initial_flow_control_window_bytes_.ToHandshakeMessage(out); |
| 681 initial_stream_flow_control_window_bytes_.ToHandshakeMessage(out); | 667 initial_stream_flow_control_window_bytes_.ToHandshakeMessage(out); |
| 682 initial_session_flow_control_window_bytes_.ToHandshakeMessage(out); | 668 initial_session_flow_control_window_bytes_.ToHandshakeMessage(out); |
| 683 socket_receive_buffer_.ToHandshakeMessage(out); | 669 socket_receive_buffer_.ToHandshakeMessage(out); |
| 684 connection_options_.ToHandshakeMessage(out); | 670 connection_options_.ToHandshakeMessage(out); |
| 685 } | 671 } |
| 686 | 672 |
| 687 QuicErrorCode QuicConfig::ProcessPeerHello( | 673 QuicErrorCode QuicConfig::ProcessPeerHello( |
| 688 const CryptoHandshakeMessage& peer_hello, | 674 const CryptoHandshakeMessage& peer_hello, |
| (...skipping 16 matching lines...) Expand all Loading... |
| 705 } | 691 } |
| 706 if (error == QUIC_NO_ERROR) { | 692 if (error == QUIC_NO_ERROR) { |
| 707 error = max_streams_per_connection_.ProcessPeerHello( | 693 error = max_streams_per_connection_.ProcessPeerHello( |
| 708 peer_hello, hello_type, error_details); | 694 peer_hello, hello_type, error_details); |
| 709 } | 695 } |
| 710 if (error == QUIC_NO_ERROR) { | 696 if (error == QUIC_NO_ERROR) { |
| 711 error = bytes_for_connection_id_.ProcessPeerHello( | 697 error = bytes_for_connection_id_.ProcessPeerHello( |
| 712 peer_hello, hello_type, error_details); | 698 peer_hello, hello_type, error_details); |
| 713 } | 699 } |
| 714 if (error == QUIC_NO_ERROR) { | 700 if (error == QUIC_NO_ERROR) { |
| 715 error = initial_congestion_window_.ProcessPeerHello( | |
| 716 peer_hello, hello_type, error_details); | |
| 717 } | |
| 718 if (error == QUIC_NO_ERROR) { | |
| 719 error = initial_round_trip_time_us_.ProcessPeerHello( | 701 error = initial_round_trip_time_us_.ProcessPeerHello( |
| 720 peer_hello, hello_type, error_details); | 702 peer_hello, hello_type, error_details); |
| 721 } | 703 } |
| 722 if (error == QUIC_NO_ERROR) { | 704 if (error == QUIC_NO_ERROR) { |
| 723 error = initial_flow_control_window_bytes_.ProcessPeerHello( | 705 error = initial_flow_control_window_bytes_.ProcessPeerHello( |
| 724 peer_hello, hello_type, error_details); | 706 peer_hello, hello_type, error_details); |
| 725 } | 707 } |
| 726 if (error == QUIC_NO_ERROR) { | 708 if (error == QUIC_NO_ERROR) { |
| 727 error = initial_stream_flow_control_window_bytes_.ProcessPeerHello( | 709 error = initial_stream_flow_control_window_bytes_.ProcessPeerHello( |
| 728 peer_hello, hello_type, error_details); | 710 peer_hello, hello_type, error_details); |
| 729 } | 711 } |
| 730 if (error == QUIC_NO_ERROR) { | 712 if (error == QUIC_NO_ERROR) { |
| 731 error = initial_session_flow_control_window_bytes_.ProcessPeerHello( | 713 error = initial_session_flow_control_window_bytes_.ProcessPeerHello( |
| 732 peer_hello, hello_type, error_details); | 714 peer_hello, hello_type, error_details); |
| 733 } | 715 } |
| 734 if (error == QUIC_NO_ERROR) { | 716 if (error == QUIC_NO_ERROR) { |
| 735 error = socket_receive_buffer_.ProcessPeerHello( | 717 error = socket_receive_buffer_.ProcessPeerHello( |
| 736 peer_hello, hello_type, error_details); | 718 peer_hello, hello_type, error_details); |
| 737 } | 719 } |
| 738 if (error == QUIC_NO_ERROR) { | 720 if (error == QUIC_NO_ERROR) { |
| 739 error = connection_options_.ProcessPeerHello( | 721 error = connection_options_.ProcessPeerHello( |
| 740 peer_hello, hello_type, error_details); | 722 peer_hello, hello_type, error_details); |
| 741 } | 723 } |
| 742 return error; | 724 return error; |
| 743 } | 725 } |
| 744 | 726 |
| 745 } // namespace net | 727 } // namespace net |
| OLD | NEW |