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/core/quic_config.h" | 5 #include "net/quic/core/quic_config.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "net/quic/core/crypto/crypto_handshake_message.h" | 9 #include "net/quic/core/crypto/crypto_handshake_message.h" |
10 #include "net/quic/core/crypto/crypto_protocol.h" | 10 #include "net/quic/core/crypto/crypto_protocol.h" |
11 #include "net/quic/core/quic_flags.h" | 11 #include "net/quic/core/quic_flags.h" |
12 #include "net/quic/core/quic_socket_address_coder.h" | 12 #include "net/quic/core/quic_socket_address_coder.h" |
13 #include "net/quic/core/quic_utils.h" | 13 #include "net/quic/core/quic_utils.h" |
14 #include "net/quic/platform/api/quic_bug_tracker.h" | 14 #include "net/quic/platform/api/quic_bug_tracker.h" |
15 #include "net/quic/platform/api/quic_flag_utils.h" | |
15 #include "net/quic/platform/api/quic_logging.h" | 16 #include "net/quic/platform/api/quic_logging.h" |
16 #include "net/quic/platform/api/quic_string_piece.h" | 17 #include "net/quic/platform/api/quic_string_piece.h" |
17 | 18 |
18 using std::string; | 19 using std::string; |
19 | 20 |
20 namespace net { | 21 namespace net { |
21 | 22 |
22 // Reads the value corresponding to |name_| from |msg| into |out|. If the | 23 // Reads the value corresponding to |name_| from |msg| into |out|. If the |
23 // |name_| is absent in |msg| and |presence| is set to OPTIONAL |out| is set | 24 // |name_| is absent in |msg| and |presence| is set to OPTIONAL |out| is set |
24 // to |default_value|. | 25 // to |default_value|. |
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
333 max_streams_per_connection_(kMSPC, PRESENCE_OPTIONAL), | 334 max_streams_per_connection_(kMSPC, PRESENCE_OPTIONAL), |
334 max_incoming_dynamic_streams_(kMIDS, PRESENCE_OPTIONAL), | 335 max_incoming_dynamic_streams_(kMIDS, PRESENCE_OPTIONAL), |
335 bytes_for_connection_id_(kTCID, PRESENCE_OPTIONAL), | 336 bytes_for_connection_id_(kTCID, PRESENCE_OPTIONAL), |
336 initial_round_trip_time_us_(kIRTT, PRESENCE_OPTIONAL), | 337 initial_round_trip_time_us_(kIRTT, PRESENCE_OPTIONAL), |
337 initial_stream_flow_control_window_bytes_(kSFCW, PRESENCE_OPTIONAL), | 338 initial_stream_flow_control_window_bytes_(kSFCW, PRESENCE_OPTIONAL), |
338 initial_session_flow_control_window_bytes_(kCFCW, PRESENCE_OPTIONAL), | 339 initial_session_flow_control_window_bytes_(kCFCW, PRESENCE_OPTIONAL), |
339 socket_receive_buffer_(kSRBF, PRESENCE_OPTIONAL), | 340 socket_receive_buffer_(kSRBF, PRESENCE_OPTIONAL), |
340 connection_migration_disabled_(kNCMR, PRESENCE_OPTIONAL), | 341 connection_migration_disabled_(kNCMR, PRESENCE_OPTIONAL), |
341 alternate_server_address_(kASAD, PRESENCE_OPTIONAL), | 342 alternate_server_address_(kASAD, PRESENCE_OPTIONAL), |
342 force_hol_blocking_(kFHL2, PRESENCE_OPTIONAL), | 343 force_hol_blocking_(kFHL2, PRESENCE_OPTIONAL), |
343 support_max_header_list_size_(kSMHL, PRESENCE_OPTIONAL) { | 344 support_max_header_list_size_(kSMHL, PRESENCE_OPTIONAL), |
345 latched_no_socket_receive_buffer_( | |
346 FLAGS_quic_reloadable_flag_quic_no_socket_receive_buffer) { | |
344 SetDefaults(); | 347 SetDefaults(); |
345 } | 348 } |
346 | 349 |
347 QuicConfig::QuicConfig(const QuicConfig& other) = default; | 350 QuicConfig::QuicConfig(const QuicConfig& other) = default; |
348 | 351 |
349 QuicConfig::~QuicConfig() {} | 352 QuicConfig::~QuicConfig() {} |
350 | 353 |
351 bool QuicConfig::SetInitialReceivedConnectionOptions( | 354 bool QuicConfig::SetInitialReceivedConnectionOptions( |
352 const QuicTagVector& tags) { | 355 const QuicTagVector& tags) { |
353 if (HasReceivedConnectionOptions()) { | 356 if (HasReceivedConnectionOptions()) { |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
535 | 538 |
536 bool QuicConfig::HasReceivedInitialSessionFlowControlWindowBytes() const { | 539 bool QuicConfig::HasReceivedInitialSessionFlowControlWindowBytes() const { |
537 return initial_session_flow_control_window_bytes_.HasReceivedValue(); | 540 return initial_session_flow_control_window_bytes_.HasReceivedValue(); |
538 } | 541 } |
539 | 542 |
540 uint32_t QuicConfig::ReceivedInitialSessionFlowControlWindowBytes() const { | 543 uint32_t QuicConfig::ReceivedInitialSessionFlowControlWindowBytes() const { |
541 return initial_session_flow_control_window_bytes_.GetReceivedValue(); | 544 return initial_session_flow_control_window_bytes_.GetReceivedValue(); |
542 } | 545 } |
543 | 546 |
544 void QuicConfig::SetSocketReceiveBufferToSend(uint32_t tcp_receive_window) { | 547 void QuicConfig::SetSocketReceiveBufferToSend(uint32_t tcp_receive_window) { |
545 socket_receive_buffer_.SetSendValue(tcp_receive_window); | 548 if (latched_no_socket_receive_buffer_) { |
549 QUIC_FLAG_COUNT_N(gfe2_reloadable_flag_quic_no_socket_receive_buffer, 1, 3); | |
Ryan Hamilton
2017/03/10 05:37:44
ditto. I'm perplexed by why the script missed this
| |
550 } else { | |
551 socket_receive_buffer_.SetSendValue(tcp_receive_window); | |
552 } | |
546 } | 553 } |
547 | 554 |
548 bool QuicConfig::HasReceivedSocketReceiveBuffer() const { | 555 bool QuicConfig::HasReceivedSocketReceiveBuffer() const { |
549 return socket_receive_buffer_.HasReceivedValue(); | 556 return socket_receive_buffer_.HasReceivedValue(); |
550 } | 557 } |
551 | 558 |
552 uint32_t QuicConfig::ReceivedSocketReceiveBuffer() const { | 559 uint32_t QuicConfig::ReceivedSocketReceiveBuffer() const { |
553 return socket_receive_buffer_.GetReceivedValue(); | 560 return socket_receive_buffer_.GetReceivedValue(); |
554 } | 561 } |
555 | 562 |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
624 | 631 |
625 void QuicConfig::ToHandshakeMessage(CryptoHandshakeMessage* out) const { | 632 void QuicConfig::ToHandshakeMessage(CryptoHandshakeMessage* out) const { |
626 idle_network_timeout_seconds_.ToHandshakeMessage(out); | 633 idle_network_timeout_seconds_.ToHandshakeMessage(out); |
627 silent_close_.ToHandshakeMessage(out); | 634 silent_close_.ToHandshakeMessage(out); |
628 max_streams_per_connection_.ToHandshakeMessage(out); | 635 max_streams_per_connection_.ToHandshakeMessage(out); |
629 max_incoming_dynamic_streams_.ToHandshakeMessage(out); | 636 max_incoming_dynamic_streams_.ToHandshakeMessage(out); |
630 bytes_for_connection_id_.ToHandshakeMessage(out); | 637 bytes_for_connection_id_.ToHandshakeMessage(out); |
631 initial_round_trip_time_us_.ToHandshakeMessage(out); | 638 initial_round_trip_time_us_.ToHandshakeMessage(out); |
632 initial_stream_flow_control_window_bytes_.ToHandshakeMessage(out); | 639 initial_stream_flow_control_window_bytes_.ToHandshakeMessage(out); |
633 initial_session_flow_control_window_bytes_.ToHandshakeMessage(out); | 640 initial_session_flow_control_window_bytes_.ToHandshakeMessage(out); |
634 socket_receive_buffer_.ToHandshakeMessage(out); | 641 if (latched_no_socket_receive_buffer_) { |
642 QUIC_FLAG_COUNT_N(gfe2_reloadable_flag_quic_no_socket_receive_buffer, 2, 3); | |
643 } else { | |
644 socket_receive_buffer_.ToHandshakeMessage(out); | |
645 } | |
635 connection_migration_disabled_.ToHandshakeMessage(out); | 646 connection_migration_disabled_.ToHandshakeMessage(out); |
636 connection_options_.ToHandshakeMessage(out); | 647 connection_options_.ToHandshakeMessage(out); |
637 alternate_server_address_.ToHandshakeMessage(out); | 648 alternate_server_address_.ToHandshakeMessage(out); |
638 force_hol_blocking_.ToHandshakeMessage(out); | 649 force_hol_blocking_.ToHandshakeMessage(out); |
639 support_max_header_list_size_.ToHandshakeMessage(out); | 650 support_max_header_list_size_.ToHandshakeMessage(out); |
640 } | 651 } |
641 | 652 |
642 QuicErrorCode QuicConfig::ProcessPeerHello( | 653 QuicErrorCode QuicConfig::ProcessPeerHello( |
643 const CryptoHandshakeMessage& peer_hello, | 654 const CryptoHandshakeMessage& peer_hello, |
644 HelloType hello_type, | 655 HelloType hello_type, |
(...skipping 26 matching lines...) Expand all Loading... | |
671 error_details); | 682 error_details); |
672 } | 683 } |
673 if (error == QUIC_NO_ERROR) { | 684 if (error == QUIC_NO_ERROR) { |
674 error = initial_stream_flow_control_window_bytes_.ProcessPeerHello( | 685 error = initial_stream_flow_control_window_bytes_.ProcessPeerHello( |
675 peer_hello, hello_type, error_details); | 686 peer_hello, hello_type, error_details); |
676 } | 687 } |
677 if (error == QUIC_NO_ERROR) { | 688 if (error == QUIC_NO_ERROR) { |
678 error = initial_session_flow_control_window_bytes_.ProcessPeerHello( | 689 error = initial_session_flow_control_window_bytes_.ProcessPeerHello( |
679 peer_hello, hello_type, error_details); | 690 peer_hello, hello_type, error_details); |
680 } | 691 } |
681 if (error == QUIC_NO_ERROR) { | 692 if (latched_no_socket_receive_buffer_) { |
693 QUIC_FLAG_COUNT_N(gfe2_reloadable_flag_quic_no_socket_receive_buffer, 3, 3); | |
694 } else if (error == QUIC_NO_ERROR) { | |
682 error = socket_receive_buffer_.ProcessPeerHello(peer_hello, hello_type, | 695 error = socket_receive_buffer_.ProcessPeerHello(peer_hello, hello_type, |
683 error_details); | 696 error_details); |
684 } | 697 } |
685 if (error == QUIC_NO_ERROR) { | 698 if (error == QUIC_NO_ERROR) { |
686 error = connection_migration_disabled_.ProcessPeerHello( | 699 error = connection_migration_disabled_.ProcessPeerHello( |
687 peer_hello, hello_type, error_details); | 700 peer_hello, hello_type, error_details); |
688 } | 701 } |
689 if (error == QUIC_NO_ERROR) { | 702 if (error == QUIC_NO_ERROR) { |
690 error = connection_options_.ProcessPeerHello(peer_hello, hello_type, | 703 error = connection_options_.ProcessPeerHello(peer_hello, hello_type, |
691 error_details); | 704 error_details); |
692 } | 705 } |
693 if (error == QUIC_NO_ERROR) { | 706 if (error == QUIC_NO_ERROR) { |
694 error = alternate_server_address_.ProcessPeerHello(peer_hello, hello_type, | 707 error = alternate_server_address_.ProcessPeerHello(peer_hello, hello_type, |
695 error_details); | 708 error_details); |
696 } | 709 } |
697 if (error == QUIC_NO_ERROR) { | 710 if (error == QUIC_NO_ERROR) { |
698 error = force_hol_blocking_.ProcessPeerHello(peer_hello, hello_type, | 711 error = force_hol_blocking_.ProcessPeerHello(peer_hello, hello_type, |
699 error_details); | 712 error_details); |
700 } | 713 } |
701 if (error == QUIC_NO_ERROR) { | 714 if (error == QUIC_NO_ERROR) { |
702 error = support_max_header_list_size_.ProcessPeerHello( | 715 error = support_max_header_list_size_.ProcessPeerHello( |
703 peer_hello, hello_type, error_details); | 716 peer_hello, hello_type, error_details); |
704 } | 717 } |
705 return error; | 718 return error; |
706 } | 719 } |
707 | 720 |
708 } // namespace net | 721 } // namespace net |
OLD | NEW |