| 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 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 436 initial_congestion_window_(kSWND, PRESENCE_OPTIONAL), | 436 initial_congestion_window_(kSWND, PRESENCE_OPTIONAL), |
| 437 initial_round_trip_time_us_(kIRTT, PRESENCE_OPTIONAL), | 437 initial_round_trip_time_us_(kIRTT, PRESENCE_OPTIONAL), |
| 438 // TODO(rjshade): Make this PRESENCE_REQUIRED when QUIC_VERSION_16 is | 438 // TODO(rjshade): Make this PRESENCE_REQUIRED when QUIC_VERSION_16 is |
| 439 // retired. | 439 // retired. |
| 440 initial_flow_control_window_bytes_(kIFCW, PRESENCE_OPTIONAL), | 440 initial_flow_control_window_bytes_(kIFCW, PRESENCE_OPTIONAL), |
| 441 // TODO(rjshade): Make this PRESENCE_REQUIRED when retiring | 441 // TODO(rjshade): Make this PRESENCE_REQUIRED when retiring |
| 442 // QUIC_VERSION_19. | 442 // QUIC_VERSION_19. |
| 443 initial_stream_flow_control_window_bytes_(kSFCW, PRESENCE_OPTIONAL), | 443 initial_stream_flow_control_window_bytes_(kSFCW, PRESENCE_OPTIONAL), |
| 444 // TODO(rjshade): Make this PRESENCE_REQUIRED when retiring | 444 // TODO(rjshade): Make this PRESENCE_REQUIRED when retiring |
| 445 // QUIC_VERSION_19. | 445 // QUIC_VERSION_19. |
| 446 initial_session_flow_control_window_bytes_(kCFCW, PRESENCE_OPTIONAL) { | 446 initial_session_flow_control_window_bytes_(kCFCW, PRESENCE_OPTIONAL), |
| 447 socket_receive_buffer_(kSRBF, PRESENCE_OPTIONAL) { |
| 447 } | 448 } |
| 448 | 449 |
| 449 QuicConfig::~QuicConfig() {} | 450 QuicConfig::~QuicConfig() {} |
| 450 | 451 |
| 451 void QuicConfig::set_congestion_feedback( | 452 void QuicConfig::set_congestion_feedback( |
| 452 const QuicTagVector& congestion_feedback, | 453 const QuicTagVector& congestion_feedback, |
| 453 QuicTag default_congestion_feedback) { | 454 QuicTag default_congestion_feedback) { |
| 454 congestion_feedback_.set(congestion_feedback, default_congestion_feedback); | 455 congestion_feedback_.set(congestion_feedback, default_congestion_feedback); |
| 455 } | 456 } |
| 456 | 457 |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 610 } | 611 } |
| 611 | 612 |
| 612 bool QuicConfig::HasReceivedInitialSessionFlowControlWindowBytes() const { | 613 bool QuicConfig::HasReceivedInitialSessionFlowControlWindowBytes() const { |
| 613 return initial_session_flow_control_window_bytes_.HasReceivedValue(); | 614 return initial_session_flow_control_window_bytes_.HasReceivedValue(); |
| 614 } | 615 } |
| 615 | 616 |
| 616 uint32 QuicConfig::ReceivedInitialSessionFlowControlWindowBytes() const { | 617 uint32 QuicConfig::ReceivedInitialSessionFlowControlWindowBytes() const { |
| 617 return initial_session_flow_control_window_bytes_.GetReceivedValue(); | 618 return initial_session_flow_control_window_bytes_.GetReceivedValue(); |
| 618 } | 619 } |
| 619 | 620 |
| 621 void QuicConfig::SetSocketReceiveBufferToSend(uint32 tcp_receive_window) { |
| 622 socket_receive_buffer_.SetSendValue(tcp_receive_window); |
| 623 } |
| 624 |
| 625 uint32 QuicConfig::GetSocketReceiveBufferToSend() const { |
| 626 return socket_receive_buffer_.GetSendValue(); |
| 627 } |
| 628 |
| 629 bool QuicConfig::HasReceivedSocketReceiveBuffer() const { |
| 630 return socket_receive_buffer_.HasReceivedValue(); |
| 631 } |
| 632 |
| 633 uint32 QuicConfig::ReceivedSocketReceiveBuffer() const { |
| 634 return socket_receive_buffer_.GetReceivedValue(); |
| 635 } |
| 636 |
| 620 bool QuicConfig::negotiated() { | 637 bool QuicConfig::negotiated() { |
| 621 // TODO(ianswett): Add the negotiated parameters once and iterate over all | 638 // TODO(ianswett): Add the negotiated parameters once and iterate over all |
| 622 // of them in negotiated, ToHandshakeMessage, ProcessClientHello, and | 639 // of them in negotiated, ToHandshakeMessage, ProcessClientHello, and |
| 623 // ProcessServerHello. | 640 // ProcessServerHello. |
| 624 return congestion_feedback_.negotiated() && | 641 return congestion_feedback_.negotiated() && |
| 625 idle_connection_state_lifetime_seconds_.negotiated() && | 642 idle_connection_state_lifetime_seconds_.negotiated() && |
| 626 keepalive_timeout_seconds_.negotiated() && | 643 keepalive_timeout_seconds_.negotiated() && |
| 627 max_streams_per_connection_.negotiated(); | 644 max_streams_per_connection_.negotiated(); |
| 628 } | 645 } |
| 629 | 646 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 661 congestion_feedback_.ToHandshakeMessage(out); | 678 congestion_feedback_.ToHandshakeMessage(out); |
| 662 idle_connection_state_lifetime_seconds_.ToHandshakeMessage(out); | 679 idle_connection_state_lifetime_seconds_.ToHandshakeMessage(out); |
| 663 keepalive_timeout_seconds_.ToHandshakeMessage(out); | 680 keepalive_timeout_seconds_.ToHandshakeMessage(out); |
| 664 max_streams_per_connection_.ToHandshakeMessage(out); | 681 max_streams_per_connection_.ToHandshakeMessage(out); |
| 665 initial_congestion_window_.ToHandshakeMessage(out); | 682 initial_congestion_window_.ToHandshakeMessage(out); |
| 666 initial_round_trip_time_us_.ToHandshakeMessage(out); | 683 initial_round_trip_time_us_.ToHandshakeMessage(out); |
| 667 loss_detection_.ToHandshakeMessage(out); | 684 loss_detection_.ToHandshakeMessage(out); |
| 668 initial_flow_control_window_bytes_.ToHandshakeMessage(out); | 685 initial_flow_control_window_bytes_.ToHandshakeMessage(out); |
| 669 initial_stream_flow_control_window_bytes_.ToHandshakeMessage(out); | 686 initial_stream_flow_control_window_bytes_.ToHandshakeMessage(out); |
| 670 initial_session_flow_control_window_bytes_.ToHandshakeMessage(out); | 687 initial_session_flow_control_window_bytes_.ToHandshakeMessage(out); |
| 688 socket_receive_buffer_.ToHandshakeMessage(out); |
| 671 connection_options_.ToHandshakeMessage(out); | 689 connection_options_.ToHandshakeMessage(out); |
| 672 } | 690 } |
| 673 | 691 |
| 674 QuicErrorCode QuicConfig::ProcessPeerHello( | 692 QuicErrorCode QuicConfig::ProcessPeerHello( |
| 675 const CryptoHandshakeMessage& peer_hello, | 693 const CryptoHandshakeMessage& peer_hello, |
| 676 HelloType hello_type, | 694 HelloType hello_type, |
| 677 string* error_details) { | 695 string* error_details) { |
| 678 DCHECK(error_details != NULL); | 696 DCHECK(error_details != NULL); |
| 679 | 697 |
| 680 QuicErrorCode error = QUIC_NO_ERROR; | 698 QuicErrorCode error = QUIC_NO_ERROR; |
| (...skipping 27 matching lines...) Expand all Loading... |
| 708 } | 726 } |
| 709 if (error == QUIC_NO_ERROR) { | 727 if (error == QUIC_NO_ERROR) { |
| 710 error = initial_stream_flow_control_window_bytes_.ProcessPeerHello( | 728 error = initial_stream_flow_control_window_bytes_.ProcessPeerHello( |
| 711 peer_hello, hello_type, error_details); | 729 peer_hello, hello_type, error_details); |
| 712 } | 730 } |
| 713 if (error == QUIC_NO_ERROR) { | 731 if (error == QUIC_NO_ERROR) { |
| 714 error = initial_session_flow_control_window_bytes_.ProcessPeerHello( | 732 error = initial_session_flow_control_window_bytes_.ProcessPeerHello( |
| 715 peer_hello, hello_type, error_details); | 733 peer_hello, hello_type, error_details); |
| 716 } | 734 } |
| 717 if (error == QUIC_NO_ERROR) { | 735 if (error == QUIC_NO_ERROR) { |
| 736 error = socket_receive_buffer_.ProcessPeerHello( |
| 737 peer_hello, hello_type, error_details); |
| 738 } |
| 739 if (error == QUIC_NO_ERROR) { |
| 718 error = loss_detection_.ProcessPeerHello( | 740 error = loss_detection_.ProcessPeerHello( |
| 719 peer_hello, hello_type, error_details); | 741 peer_hello, hello_type, error_details); |
| 720 } | 742 } |
| 721 if (error == QUIC_NO_ERROR) { | 743 if (error == QUIC_NO_ERROR) { |
| 722 error = connection_options_.ProcessPeerHello( | 744 error = connection_options_.ProcessPeerHello( |
| 723 peer_hello, hello_type, error_details); | 745 peer_hello, hello_type, error_details); |
| 724 } | 746 } |
| 725 return error; | 747 return error; |
| 726 } | 748 } |
| 727 | 749 |
| 728 } // namespace net | 750 } // namespace net |
| OLD | NEW |