| 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" |
| (...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 334 max_streams_per_connection_(kMSPC, PRESENCE_OPTIONAL), | 334 max_streams_per_connection_(kMSPC, PRESENCE_OPTIONAL), |
| 335 max_incoming_dynamic_streams_(kMIDS, PRESENCE_OPTIONAL), | 335 max_incoming_dynamic_streams_(kMIDS, PRESENCE_OPTIONAL), |
| 336 bytes_for_connection_id_(kTCID, PRESENCE_OPTIONAL), | 336 bytes_for_connection_id_(kTCID, PRESENCE_OPTIONAL), |
| 337 initial_round_trip_time_us_(kIRTT, PRESENCE_OPTIONAL), | 337 initial_round_trip_time_us_(kIRTT, PRESENCE_OPTIONAL), |
| 338 initial_stream_flow_control_window_bytes_(kSFCW, PRESENCE_OPTIONAL), | 338 initial_stream_flow_control_window_bytes_(kSFCW, PRESENCE_OPTIONAL), |
| 339 initial_session_flow_control_window_bytes_(kCFCW, PRESENCE_OPTIONAL), | 339 initial_session_flow_control_window_bytes_(kCFCW, PRESENCE_OPTIONAL), |
| 340 socket_receive_buffer_(kSRBF, PRESENCE_OPTIONAL), | 340 socket_receive_buffer_(kSRBF, PRESENCE_OPTIONAL), |
| 341 connection_migration_disabled_(kNCMR, PRESENCE_OPTIONAL), | 341 connection_migration_disabled_(kNCMR, PRESENCE_OPTIONAL), |
| 342 alternate_server_address_(kASAD, PRESENCE_OPTIONAL), | 342 alternate_server_address_(kASAD, PRESENCE_OPTIONAL), |
| 343 force_hol_blocking_(kFHL2, PRESENCE_OPTIONAL), | 343 force_hol_blocking_(kFHL2, PRESENCE_OPTIONAL), |
| 344 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) { | |
| 347 SetDefaults(); | 345 SetDefaults(); |
| 348 } | 346 } |
| 349 | 347 |
| 350 QuicConfig::QuicConfig(const QuicConfig& other) = default; | 348 QuicConfig::QuicConfig(const QuicConfig& other) = default; |
| 351 | 349 |
| 352 QuicConfig::~QuicConfig() {} | 350 QuicConfig::~QuicConfig() {} |
| 353 | 351 |
| 354 bool QuicConfig::SetInitialReceivedConnectionOptions( | 352 bool QuicConfig::SetInitialReceivedConnectionOptions( |
| 355 const QuicTagVector& tags) { | 353 const QuicTagVector& tags) { |
| 356 if (HasReceivedConnectionOptions()) { | 354 if (HasReceivedConnectionOptions()) { |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 537 } | 535 } |
| 538 | 536 |
| 539 bool QuicConfig::HasReceivedInitialSessionFlowControlWindowBytes() const { | 537 bool QuicConfig::HasReceivedInitialSessionFlowControlWindowBytes() const { |
| 540 return initial_session_flow_control_window_bytes_.HasReceivedValue(); | 538 return initial_session_flow_control_window_bytes_.HasReceivedValue(); |
| 541 } | 539 } |
| 542 | 540 |
| 543 uint32_t QuicConfig::ReceivedInitialSessionFlowControlWindowBytes() const { | 541 uint32_t QuicConfig::ReceivedInitialSessionFlowControlWindowBytes() const { |
| 544 return initial_session_flow_control_window_bytes_.GetReceivedValue(); | 542 return initial_session_flow_control_window_bytes_.GetReceivedValue(); |
| 545 } | 543 } |
| 546 | 544 |
| 547 void QuicConfig::SetSocketReceiveBufferToSend(uint32_t tcp_receive_window) { | |
| 548 if (latched_no_socket_receive_buffer_) { | |
| 549 QUIC_FLAG_COUNT_N(quic_reloadable_flag_quic_no_socket_receive_buffer, 1, 3); | |
| 550 } else { | |
| 551 socket_receive_buffer_.SetSendValue(tcp_receive_window); | |
| 552 } | |
| 553 } | |
| 554 | |
| 555 bool QuicConfig::HasReceivedSocketReceiveBuffer() const { | |
| 556 return socket_receive_buffer_.HasReceivedValue(); | |
| 557 } | |
| 558 | |
| 559 uint32_t QuicConfig::ReceivedSocketReceiveBuffer() const { | |
| 560 return socket_receive_buffer_.GetReceivedValue(); | |
| 561 } | |
| 562 | |
| 563 void QuicConfig::SetDisableConnectionMigration() { | 545 void QuicConfig::SetDisableConnectionMigration() { |
| 564 connection_migration_disabled_.SetSendValue(1); | 546 connection_migration_disabled_.SetSendValue(1); |
| 565 } | 547 } |
| 566 | 548 |
| 567 bool QuicConfig::DisableConnectionMigration() const { | 549 bool QuicConfig::DisableConnectionMigration() const { |
| 568 return connection_migration_disabled_.HasReceivedValue(); | 550 return connection_migration_disabled_.HasReceivedValue(); |
| 569 } | 551 } |
| 570 | 552 |
| 571 void QuicConfig::SetAlternateServerAddressToSend( | 553 void QuicConfig::SetAlternateServerAddressToSend( |
| 572 const QuicSocketAddress& alternate_server_address) { | 554 const QuicSocketAddress& alternate_server_address) { |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 631 | 613 |
| 632 void QuicConfig::ToHandshakeMessage(CryptoHandshakeMessage* out) const { | 614 void QuicConfig::ToHandshakeMessage(CryptoHandshakeMessage* out) const { |
| 633 idle_network_timeout_seconds_.ToHandshakeMessage(out); | 615 idle_network_timeout_seconds_.ToHandshakeMessage(out); |
| 634 silent_close_.ToHandshakeMessage(out); | 616 silent_close_.ToHandshakeMessage(out); |
| 635 max_streams_per_connection_.ToHandshakeMessage(out); | 617 max_streams_per_connection_.ToHandshakeMessage(out); |
| 636 max_incoming_dynamic_streams_.ToHandshakeMessage(out); | 618 max_incoming_dynamic_streams_.ToHandshakeMessage(out); |
| 637 bytes_for_connection_id_.ToHandshakeMessage(out); | 619 bytes_for_connection_id_.ToHandshakeMessage(out); |
| 638 initial_round_trip_time_us_.ToHandshakeMessage(out); | 620 initial_round_trip_time_us_.ToHandshakeMessage(out); |
| 639 initial_stream_flow_control_window_bytes_.ToHandshakeMessage(out); | 621 initial_stream_flow_control_window_bytes_.ToHandshakeMessage(out); |
| 640 initial_session_flow_control_window_bytes_.ToHandshakeMessage(out); | 622 initial_session_flow_control_window_bytes_.ToHandshakeMessage(out); |
| 641 if (latched_no_socket_receive_buffer_) { | |
| 642 QUIC_FLAG_COUNT_N(quic_reloadable_flag_quic_no_socket_receive_buffer, 2, 3); | |
| 643 } else { | |
| 644 socket_receive_buffer_.ToHandshakeMessage(out); | |
| 645 } | |
| 646 connection_migration_disabled_.ToHandshakeMessage(out); | 623 connection_migration_disabled_.ToHandshakeMessage(out); |
| 647 connection_options_.ToHandshakeMessage(out); | 624 connection_options_.ToHandshakeMessage(out); |
| 648 alternate_server_address_.ToHandshakeMessage(out); | 625 alternate_server_address_.ToHandshakeMessage(out); |
| 649 force_hol_blocking_.ToHandshakeMessage(out); | 626 force_hol_blocking_.ToHandshakeMessage(out); |
| 650 support_max_header_list_size_.ToHandshakeMessage(out); | 627 support_max_header_list_size_.ToHandshakeMessage(out); |
| 651 } | 628 } |
| 652 | 629 |
| 653 QuicErrorCode QuicConfig::ProcessPeerHello( | 630 QuicErrorCode QuicConfig::ProcessPeerHello( |
| 654 const CryptoHandshakeMessage& peer_hello, | 631 const CryptoHandshakeMessage& peer_hello, |
| 655 HelloType hello_type, | 632 HelloType hello_type, |
| (...skipping 26 matching lines...) Expand all Loading... |
| 682 error_details); | 659 error_details); |
| 683 } | 660 } |
| 684 if (error == QUIC_NO_ERROR) { | 661 if (error == QUIC_NO_ERROR) { |
| 685 error = initial_stream_flow_control_window_bytes_.ProcessPeerHello( | 662 error = initial_stream_flow_control_window_bytes_.ProcessPeerHello( |
| 686 peer_hello, hello_type, error_details); | 663 peer_hello, hello_type, error_details); |
| 687 } | 664 } |
| 688 if (error == QUIC_NO_ERROR) { | 665 if (error == QUIC_NO_ERROR) { |
| 689 error = initial_session_flow_control_window_bytes_.ProcessPeerHello( | 666 error = initial_session_flow_control_window_bytes_.ProcessPeerHello( |
| 690 peer_hello, hello_type, error_details); | 667 peer_hello, hello_type, error_details); |
| 691 } | 668 } |
| 692 if (latched_no_socket_receive_buffer_) { | |
| 693 QUIC_FLAG_COUNT_N(quic_reloadable_flag_quic_no_socket_receive_buffer, 3, 3); | |
| 694 } else if (error == QUIC_NO_ERROR) { | |
| 695 error = socket_receive_buffer_.ProcessPeerHello(peer_hello, hello_type, | |
| 696 error_details); | |
| 697 } | |
| 698 if (error == QUIC_NO_ERROR) { | 669 if (error == QUIC_NO_ERROR) { |
| 699 error = connection_migration_disabled_.ProcessPeerHello( | 670 error = connection_migration_disabled_.ProcessPeerHello( |
| 700 peer_hello, hello_type, error_details); | 671 peer_hello, hello_type, error_details); |
| 701 } | 672 } |
| 702 if (error == QUIC_NO_ERROR) { | 673 if (error == QUIC_NO_ERROR) { |
| 703 error = connection_options_.ProcessPeerHello(peer_hello, hello_type, | 674 error = connection_options_.ProcessPeerHello(peer_hello, hello_type, |
| 704 error_details); | 675 error_details); |
| 705 } | 676 } |
| 706 if (error == QUIC_NO_ERROR) { | 677 if (error == QUIC_NO_ERROR) { |
| 707 error = alternate_server_address_.ProcessPeerHello(peer_hello, hello_type, | 678 error = alternate_server_address_.ProcessPeerHello(peer_hello, hello_type, |
| 708 error_details); | 679 error_details); |
| 709 } | 680 } |
| 710 if (error == QUIC_NO_ERROR) { | 681 if (error == QUIC_NO_ERROR) { |
| 711 error = force_hol_blocking_.ProcessPeerHello(peer_hello, hello_type, | 682 error = force_hol_blocking_.ProcessPeerHello(peer_hello, hello_type, |
| 712 error_details); | 683 error_details); |
| 713 } | 684 } |
| 714 if (error == QUIC_NO_ERROR) { | 685 if (error == QUIC_NO_ERROR) { |
| 715 error = support_max_header_list_size_.ProcessPeerHello( | 686 error = support_max_header_list_size_.ProcessPeerHello( |
| 716 peer_hello, hello_type, error_details); | 687 peer_hello, hello_type, error_details); |
| 717 } | 688 } |
| 718 return error; | 689 return error; |
| 719 } | 690 } |
| 720 | 691 |
| 721 } // namespace net | 692 } // namespace net |
| OLD | NEW |