| 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 519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 530 | 530 |
| 531 bool QuicConfig::HasReceivedInitialRoundTripTimeUs() const { | 531 bool QuicConfig::HasReceivedInitialRoundTripTimeUs() const { |
| 532 return initial_round_trip_time_us_.HasReceivedValue(); | 532 return initial_round_trip_time_us_.HasReceivedValue(); |
| 533 } | 533 } |
| 534 | 534 |
| 535 uint32 QuicConfig::ReceivedInitialRoundTripTimeUs() const { | 535 uint32 QuicConfig::ReceivedInitialRoundTripTimeUs() const { |
| 536 return initial_round_trip_time_us_.GetReceivedValue(); | 536 return initial_round_trip_time_us_.GetReceivedValue(); |
| 537 } | 537 } |
| 538 | 538 |
| 539 void QuicConfig::SetInitialFlowControlWindowToSend(uint32 window_bytes) { | 539 void QuicConfig::SetInitialFlowControlWindowToSend(uint32 window_bytes) { |
| 540 if (window_bytes < kDefaultFlowControlSendWindow) { |
| 541 LOG(DFATAL) << "Initial flow control receive window (" << window_bytes |
| 542 << ") cannot be set lower than default (" |
| 543 << kDefaultFlowControlSendWindow << ")."; |
| 544 window_bytes = kDefaultFlowControlSendWindow; |
| 545 } |
| 540 initial_flow_control_window_bytes_.SetSendValue(window_bytes); | 546 initial_flow_control_window_bytes_.SetSendValue(window_bytes); |
| 541 } | 547 } |
| 542 | 548 |
| 549 uint32 QuicConfig::GetInitialFlowControlWindowToSend() const { |
| 550 return initial_flow_control_window_bytes_.GetSendValue(); |
| 551 } |
| 552 |
| 543 bool QuicConfig::HasReceivedInitialFlowControlWindowBytes() const { | 553 bool QuicConfig::HasReceivedInitialFlowControlWindowBytes() const { |
| 544 return initial_flow_control_window_bytes_.HasReceivedValue();; | 554 return initial_flow_control_window_bytes_.HasReceivedValue(); |
| 545 } | 555 } |
| 546 | 556 |
| 547 uint32 QuicConfig::ReceivedInitialFlowControlWindowBytes() const { | 557 uint32 QuicConfig::ReceivedInitialFlowControlWindowBytes() const { |
| 548 return initial_flow_control_window_bytes_.GetReceivedValue(); | 558 return initial_flow_control_window_bytes_.GetReceivedValue(); |
| 549 } | 559 } |
| 550 | 560 |
| 551 bool QuicConfig::negotiated() { | 561 bool QuicConfig::negotiated() { |
| 552 // TODO(ianswett): Add the negotiated parameters once and iterate over all | 562 // TODO(ianswett): Add the negotiated parameters once and iterate over all |
| 553 // of them in negotiated, ToHandshakeMessage, ProcessClientHello, and | 563 // of them in negotiated, ToHandshakeMessage, ProcessClientHello, and |
| 554 // ProcessServerHello. | 564 // ProcessServerHello. |
| (...skipping 11 matching lines...) Expand all Loading... |
| 566 congestion_feedback.push_back(kQBIC); | 576 congestion_feedback.push_back(kQBIC); |
| 567 congestion_feedback_.set(congestion_feedback, kQBIC); | 577 congestion_feedback_.set(congestion_feedback, kQBIC); |
| 568 idle_connection_state_lifetime_seconds_.set(kDefaultTimeoutSecs, | 578 idle_connection_state_lifetime_seconds_.set(kDefaultTimeoutSecs, |
| 569 kDefaultInitialTimeoutSecs); | 579 kDefaultInitialTimeoutSecs); |
| 570 // kKATO is optional. Return 0 if not negotiated. | 580 // kKATO is optional. Return 0 if not negotiated. |
| 571 keepalive_timeout_seconds_.set(0, 0); | 581 keepalive_timeout_seconds_.set(0, 0); |
| 572 max_streams_per_connection_.set(kDefaultMaxStreamsPerConnection, | 582 max_streams_per_connection_.set(kDefaultMaxStreamsPerConnection, |
| 573 kDefaultMaxStreamsPerConnection); | 583 kDefaultMaxStreamsPerConnection); |
| 574 max_time_before_crypto_handshake_ = QuicTime::Delta::FromSeconds( | 584 max_time_before_crypto_handshake_ = QuicTime::Delta::FromSeconds( |
| 575 kDefaultMaxTimeForCryptoHandshakeSecs); | 585 kDefaultMaxTimeForCryptoHandshakeSecs); |
| 586 |
| 587 SetInitialFlowControlWindowToSend(kDefaultFlowControlSendWindow); |
| 576 } | 588 } |
| 577 | 589 |
| 578 void QuicConfig::EnablePacing(bool enable_pacing) { | 590 void QuicConfig::EnablePacing(bool enable_pacing) { |
| 579 QuicTagVector congestion_feedback; | 591 QuicTagVector congestion_feedback; |
| 580 if (enable_pacing) { | 592 if (enable_pacing) { |
| 581 congestion_feedback.push_back(kPACE); | 593 congestion_feedback.push_back(kPACE); |
| 582 } | 594 } |
| 583 congestion_feedback.push_back(kQBIC); | 595 congestion_feedback.push_back(kQBIC); |
| 584 congestion_feedback_.set(congestion_feedback, kQBIC); | 596 congestion_feedback_.set(congestion_feedback, kQBIC); |
| 585 } | 597 } |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 636 peer_hello, hello_type, error_details); | 648 peer_hello, hello_type, error_details); |
| 637 } | 649 } |
| 638 if (error == QUIC_NO_ERROR) { | 650 if (error == QUIC_NO_ERROR) { |
| 639 error = congestion_options_.ProcessPeerHello( | 651 error = congestion_options_.ProcessPeerHello( |
| 640 peer_hello, hello_type, error_details); | 652 peer_hello, hello_type, error_details); |
| 641 } | 653 } |
| 642 return error; | 654 return error; |
| 643 } | 655 } |
| 644 | 656 |
| 645 } // namespace net | 657 } // namespace net |
| OLD | NEW |