| 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 529 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 540 | 540 |
| 541 bool QuicConfig::HasInitialRoundTripTimeUsToSend() const { | 541 bool QuicConfig::HasInitialRoundTripTimeUsToSend() const { |
| 542 return initial_round_trip_time_us_.HasSendValue(); | 542 return initial_round_trip_time_us_.HasSendValue(); |
| 543 } | 543 } |
| 544 | 544 |
| 545 uint32 QuicConfig::GetInitialRoundTripTimeUsToSend() const { | 545 uint32 QuicConfig::GetInitialRoundTripTimeUsToSend() const { |
| 546 return initial_round_trip_time_us_.GetSendValue(); | 546 return initial_round_trip_time_us_.GetSendValue(); |
| 547 } | 547 } |
| 548 | 548 |
| 549 void QuicConfig::SetInitialFlowControlWindowToSend(uint32 window_bytes) { | 549 void QuicConfig::SetInitialFlowControlWindowToSend(uint32 window_bytes) { |
| 550 if (window_bytes < kDefaultFlowControlSendWindow) { | 550 if (window_bytes < kMinimumFlowControlSendWindow) { |
| 551 LOG(DFATAL) << "Initial flow control receive window (" << window_bytes | 551 LOG(DFATAL) << "Initial flow control receive window (" << window_bytes |
| 552 << ") cannot be set lower than default (" | 552 << ") cannot be set lower than default (" |
| 553 << kDefaultFlowControlSendWindow << ")."; | 553 << kMinimumFlowControlSendWindow << ")."; |
| 554 window_bytes = kDefaultFlowControlSendWindow; | 554 window_bytes = kMinimumFlowControlSendWindow; |
| 555 } | 555 } |
| 556 initial_flow_control_window_bytes_.SetSendValue(window_bytes); | 556 initial_flow_control_window_bytes_.SetSendValue(window_bytes); |
| 557 } | 557 } |
| 558 | 558 |
| 559 uint32 QuicConfig::GetInitialFlowControlWindowToSend() const { | 559 uint32 QuicConfig::GetInitialFlowControlWindowToSend() const { |
| 560 return initial_flow_control_window_bytes_.GetSendValue(); | 560 return initial_flow_control_window_bytes_.GetSendValue(); |
| 561 } | 561 } |
| 562 | 562 |
| 563 bool QuicConfig::HasReceivedInitialFlowControlWindowBytes() const { | 563 bool QuicConfig::HasReceivedInitialFlowControlWindowBytes() const { |
| 564 return initial_flow_control_window_bytes_.HasReceivedValue(); | 564 return initial_flow_control_window_bytes_.HasReceivedValue(); |
| 565 } | 565 } |
| 566 | 566 |
| 567 uint32 QuicConfig::ReceivedInitialFlowControlWindowBytes() const { | 567 uint32 QuicConfig::ReceivedInitialFlowControlWindowBytes() const { |
| 568 return initial_flow_control_window_bytes_.GetReceivedValue(); | 568 return initial_flow_control_window_bytes_.GetReceivedValue(); |
| 569 } | 569 } |
| 570 | 570 |
| 571 void QuicConfig::SetInitialStreamFlowControlWindowToSend(uint32 window_bytes) { | 571 void QuicConfig::SetInitialStreamFlowControlWindowToSend(uint32 window_bytes) { |
| 572 if (window_bytes < kDefaultFlowControlSendWindow) { | 572 if (window_bytes < kMinimumFlowControlSendWindow) { |
| 573 LOG(DFATAL) << "Initial stream flow control receive window (" | 573 LOG(DFATAL) << "Initial stream flow control receive window (" |
| 574 << window_bytes << ") cannot be set lower than default (" | 574 << window_bytes << ") cannot be set lower than default (" |
| 575 << kDefaultFlowControlSendWindow << ")."; | 575 << kMinimumFlowControlSendWindow << ")."; |
| 576 window_bytes = kDefaultFlowControlSendWindow; | 576 window_bytes = kMinimumFlowControlSendWindow; |
| 577 } | 577 } |
| 578 initial_stream_flow_control_window_bytes_.SetSendValue(window_bytes); | 578 initial_stream_flow_control_window_bytes_.SetSendValue(window_bytes); |
| 579 } | 579 } |
| 580 | 580 |
| 581 uint32 QuicConfig::GetInitialStreamFlowControlWindowToSend() const { | 581 uint32 QuicConfig::GetInitialStreamFlowControlWindowToSend() const { |
| 582 return initial_stream_flow_control_window_bytes_.GetSendValue(); | 582 return initial_stream_flow_control_window_bytes_.GetSendValue(); |
| 583 } | 583 } |
| 584 | 584 |
| 585 bool QuicConfig::HasReceivedInitialStreamFlowControlWindowBytes() const { | 585 bool QuicConfig::HasReceivedInitialStreamFlowControlWindowBytes() const { |
| 586 return initial_stream_flow_control_window_bytes_.HasReceivedValue(); | 586 return initial_stream_flow_control_window_bytes_.HasReceivedValue(); |
| 587 } | 587 } |
| 588 | 588 |
| 589 uint32 QuicConfig::ReceivedInitialStreamFlowControlWindowBytes() const { | 589 uint32 QuicConfig::ReceivedInitialStreamFlowControlWindowBytes() const { |
| 590 return initial_stream_flow_control_window_bytes_.GetReceivedValue(); | 590 return initial_stream_flow_control_window_bytes_.GetReceivedValue(); |
| 591 } | 591 } |
| 592 | 592 |
| 593 void QuicConfig::SetInitialSessionFlowControlWindowToSend(uint32 window_bytes) { | 593 void QuicConfig::SetInitialSessionFlowControlWindowToSend(uint32 window_bytes) { |
| 594 if (window_bytes < kDefaultFlowControlSendWindow) { | 594 if (window_bytes < kMinimumFlowControlSendWindow) { |
| 595 LOG(DFATAL) << "Initial session flow control receive window (" | 595 LOG(DFATAL) << "Initial session flow control receive window (" |
| 596 << window_bytes << ") cannot be set lower than default (" | 596 << window_bytes << ") cannot be set lower than default (" |
| 597 << kDefaultFlowControlSendWindow << ")."; | 597 << kMinimumFlowControlSendWindow << ")."; |
| 598 window_bytes = kDefaultFlowControlSendWindow; | 598 window_bytes = kMinimumFlowControlSendWindow; |
| 599 } | 599 } |
| 600 initial_session_flow_control_window_bytes_.SetSendValue(window_bytes); | 600 initial_session_flow_control_window_bytes_.SetSendValue(window_bytes); |
| 601 } | 601 } |
| 602 | 602 |
| 603 uint32 QuicConfig::GetInitialSessionFlowControlWindowToSend() const { | 603 uint32 QuicConfig::GetInitialSessionFlowControlWindowToSend() const { |
| 604 return initial_session_flow_control_window_bytes_.GetSendValue(); | 604 return initial_session_flow_control_window_bytes_.GetSendValue(); |
| 605 } | 605 } |
| 606 | 606 |
| 607 bool QuicConfig::HasReceivedInitialSessionFlowControlWindowBytes() const { | 607 bool QuicConfig::HasReceivedInitialSessionFlowControlWindowBytes() const { |
| 608 return initial_session_flow_control_window_bytes_.HasReceivedValue(); | 608 return initial_session_flow_control_window_bytes_.HasReceivedValue(); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 649 silent_close_.set(0, 0); | 649 silent_close_.set(0, 0); |
| 650 } | 650 } |
| 651 SetMaxStreamsPerConnection(kDefaultMaxStreamsPerConnection, | 651 SetMaxStreamsPerConnection(kDefaultMaxStreamsPerConnection, |
| 652 kDefaultMaxStreamsPerConnection); | 652 kDefaultMaxStreamsPerConnection); |
| 653 max_time_before_crypto_handshake_ = | 653 max_time_before_crypto_handshake_ = |
| 654 QuicTime::Delta::FromSeconds(kMaxTimeForCryptoHandshakeSecs); | 654 QuicTime::Delta::FromSeconds(kMaxTimeForCryptoHandshakeSecs); |
| 655 max_idle_time_before_crypto_handshake_ = | 655 max_idle_time_before_crypto_handshake_ = |
| 656 QuicTime::Delta::FromSeconds(kInitialIdleTimeoutSecs); | 656 QuicTime::Delta::FromSeconds(kInitialIdleTimeoutSecs); |
| 657 max_undecryptable_packets_ = kDefaultMaxUndecryptablePackets; | 657 max_undecryptable_packets_ = kDefaultMaxUndecryptablePackets; |
| 658 | 658 |
| 659 SetInitialFlowControlWindowToSend(kDefaultFlowControlSendWindow); | 659 SetInitialFlowControlWindowToSend(kMinimumFlowControlSendWindow); |
| 660 SetInitialStreamFlowControlWindowToSend(kDefaultFlowControlSendWindow); | 660 SetInitialStreamFlowControlWindowToSend(kMinimumFlowControlSendWindow); |
| 661 SetInitialSessionFlowControlWindowToSend(kDefaultFlowControlSendWindow); | 661 SetInitialSessionFlowControlWindowToSend(kMinimumFlowControlSendWindow); |
| 662 } | 662 } |
| 663 | 663 |
| 664 void QuicConfig::ToHandshakeMessage(CryptoHandshakeMessage* out) const { | 664 void QuicConfig::ToHandshakeMessage(CryptoHandshakeMessage* out) const { |
| 665 congestion_feedback_.ToHandshakeMessage(out); | 665 congestion_feedback_.ToHandshakeMessage(out); |
| 666 idle_connection_state_lifetime_seconds_.ToHandshakeMessage(out); | 666 idle_connection_state_lifetime_seconds_.ToHandshakeMessage(out); |
| 667 silent_close_.ToHandshakeMessage(out); | 667 silent_close_.ToHandshakeMessage(out); |
| 668 max_streams_per_connection_.ToHandshakeMessage(out); | 668 max_streams_per_connection_.ToHandshakeMessage(out); |
| 669 bytes_for_connection_id_.ToHandshakeMessage(out); | 669 bytes_for_connection_id_.ToHandshakeMessage(out); |
| 670 initial_round_trip_time_us_.ToHandshakeMessage(out); | 670 initial_round_trip_time_us_.ToHandshakeMessage(out); |
| 671 initial_flow_control_window_bytes_.ToHandshakeMessage(out); | 671 initial_flow_control_window_bytes_.ToHandshakeMessage(out); |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 723 peer_hello, hello_type, error_details); | 723 peer_hello, hello_type, error_details); |
| 724 } | 724 } |
| 725 if (error == QUIC_NO_ERROR) { | 725 if (error == QUIC_NO_ERROR) { |
| 726 error = connection_options_.ProcessPeerHello( | 726 error = connection_options_.ProcessPeerHello( |
| 727 peer_hello, hello_type, error_details); | 727 peer_hello, hello_type, error_details); |
| 728 } | 728 } |
| 729 return error; | 729 return error; |
| 730 } | 730 } |
| 731 | 731 |
| 732 } // namespace net | 732 } // namespace net |
| OLD | NEW |