Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(248)

Side by Side Diff: net/quic/quic_config.cc

Issue 851503003: Update from https://crrev.com/311076 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/quic/quic_config.h ('k') | net/quic/quic_config_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 417 matching lines...) Expand 10 before | Expand all | Expand 10 after
428 : max_time_before_crypto_handshake_(QuicTime::Delta::Zero()), 428 : max_time_before_crypto_handshake_(QuicTime::Delta::Zero()),
429 max_idle_time_before_crypto_handshake_(QuicTime::Delta::Zero()), 429 max_idle_time_before_crypto_handshake_(QuicTime::Delta::Zero()),
430 max_undecryptable_packets_(0), 430 max_undecryptable_packets_(0),
431 congestion_feedback_(kCGST, PRESENCE_REQUIRED), 431 congestion_feedback_(kCGST, PRESENCE_REQUIRED),
432 connection_options_(kCOPT, PRESENCE_OPTIONAL), 432 connection_options_(kCOPT, PRESENCE_OPTIONAL),
433 idle_connection_state_lifetime_seconds_(kICSL, PRESENCE_REQUIRED), 433 idle_connection_state_lifetime_seconds_(kICSL, PRESENCE_REQUIRED),
434 silent_close_(kSCLS, PRESENCE_OPTIONAL), 434 silent_close_(kSCLS, PRESENCE_OPTIONAL),
435 max_streams_per_connection_(kMSPC, PRESENCE_REQUIRED), 435 max_streams_per_connection_(kMSPC, PRESENCE_REQUIRED),
436 bytes_for_connection_id_(kTCID, PRESENCE_OPTIONAL), 436 bytes_for_connection_id_(kTCID, PRESENCE_OPTIONAL),
437 initial_round_trip_time_us_(kIRTT, PRESENCE_OPTIONAL), 437 initial_round_trip_time_us_(kIRTT, PRESENCE_OPTIONAL),
438 // TODO(rjshade): Remove this when retiring QUIC_VERSION_19.
439 initial_flow_control_window_bytes_(kIFCW, PRESENCE_OPTIONAL),
440 // TODO(rjshade): Make this PRESENCE_REQUIRED when retiring
441 // QUIC_VERSION_19.
442 initial_stream_flow_control_window_bytes_(kSFCW, PRESENCE_OPTIONAL), 438 initial_stream_flow_control_window_bytes_(kSFCW, PRESENCE_OPTIONAL),
443 // TODO(rjshade): Make this PRESENCE_REQUIRED when retiring
444 // QUIC_VERSION_19.
445 initial_session_flow_control_window_bytes_(kCFCW, PRESENCE_OPTIONAL), 439 initial_session_flow_control_window_bytes_(kCFCW, PRESENCE_OPTIONAL),
446 socket_receive_buffer_(kSRBF, PRESENCE_OPTIONAL) { 440 socket_receive_buffer_(kSRBF, PRESENCE_OPTIONAL) {
447 SetDefaults(); 441 SetDefaults();
448 } 442 }
449 443
450 QuicConfig::~QuicConfig() {} 444 QuicConfig::~QuicConfig() {}
451 445
452 void QuicConfig::SetCongestionFeedback( 446 void QuicConfig::SetCongestionFeedback(
453 const QuicTagVector& congestion_feedback, 447 const QuicTagVector& congestion_feedback,
454 QuicTag default_congestion_feedback) { 448 QuicTag default_congestion_feedback) {
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
539 } 533 }
540 534
541 bool QuicConfig::HasInitialRoundTripTimeUsToSend() const { 535 bool QuicConfig::HasInitialRoundTripTimeUsToSend() const {
542 return initial_round_trip_time_us_.HasSendValue(); 536 return initial_round_trip_time_us_.HasSendValue();
543 } 537 }
544 538
545 uint32 QuicConfig::GetInitialRoundTripTimeUsToSend() const { 539 uint32 QuicConfig::GetInitialRoundTripTimeUsToSend() const {
546 return initial_round_trip_time_us_.GetSendValue(); 540 return initial_round_trip_time_us_.GetSendValue();
547 } 541 }
548 542
549 void QuicConfig::SetInitialFlowControlWindowToSend(uint32 window_bytes) {
550 if (window_bytes < kMinimumFlowControlSendWindow) {
551 LOG(DFATAL) << "Initial flow control receive window (" << window_bytes
552 << ") cannot be set lower than default ("
553 << kMinimumFlowControlSendWindow << ").";
554 window_bytes = kMinimumFlowControlSendWindow;
555 }
556 initial_flow_control_window_bytes_.SetSendValue(window_bytes);
557 }
558
559 uint32 QuicConfig::GetInitialFlowControlWindowToSend() const {
560 return initial_flow_control_window_bytes_.GetSendValue();
561 }
562
563 bool QuicConfig::HasReceivedInitialFlowControlWindowBytes() const {
564 return initial_flow_control_window_bytes_.HasReceivedValue();
565 }
566
567 uint32 QuicConfig::ReceivedInitialFlowControlWindowBytes() const {
568 return initial_flow_control_window_bytes_.GetReceivedValue();
569 }
570
571 void QuicConfig::SetInitialStreamFlowControlWindowToSend(uint32 window_bytes) { 543 void QuicConfig::SetInitialStreamFlowControlWindowToSend(uint32 window_bytes) {
572 if (window_bytes < kMinimumFlowControlSendWindow) { 544 if (window_bytes < kMinimumFlowControlSendWindow) {
573 LOG(DFATAL) << "Initial stream flow control receive window (" 545 LOG(DFATAL) << "Initial stream flow control receive window ("
574 << window_bytes << ") cannot be set lower than default (" 546 << window_bytes << ") cannot be set lower than default ("
575 << kMinimumFlowControlSendWindow << ")."; 547 << kMinimumFlowControlSendWindow << ").";
576 window_bytes = kMinimumFlowControlSendWindow; 548 window_bytes = kMinimumFlowControlSendWindow;
577 } 549 }
578 initial_stream_flow_control_window_bytes_.SetSendValue(window_bytes); 550 initial_stream_flow_control_window_bytes_.SetSendValue(window_bytes);
579 } 551 }
580 552
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
649 silent_close_.set(0, 0); 621 silent_close_.set(0, 0);
650 } 622 }
651 SetMaxStreamsPerConnection(kDefaultMaxStreamsPerConnection, 623 SetMaxStreamsPerConnection(kDefaultMaxStreamsPerConnection,
652 kDefaultMaxStreamsPerConnection); 624 kDefaultMaxStreamsPerConnection);
653 max_time_before_crypto_handshake_ = 625 max_time_before_crypto_handshake_ =
654 QuicTime::Delta::FromSeconds(kMaxTimeForCryptoHandshakeSecs); 626 QuicTime::Delta::FromSeconds(kMaxTimeForCryptoHandshakeSecs);
655 max_idle_time_before_crypto_handshake_ = 627 max_idle_time_before_crypto_handshake_ =
656 QuicTime::Delta::FromSeconds(kInitialIdleTimeoutSecs); 628 QuicTime::Delta::FromSeconds(kInitialIdleTimeoutSecs);
657 max_undecryptable_packets_ = kDefaultMaxUndecryptablePackets; 629 max_undecryptable_packets_ = kDefaultMaxUndecryptablePackets;
658 630
659 SetInitialFlowControlWindowToSend(kMinimumFlowControlSendWindow);
660 SetInitialStreamFlowControlWindowToSend(kMinimumFlowControlSendWindow); 631 SetInitialStreamFlowControlWindowToSend(kMinimumFlowControlSendWindow);
661 SetInitialSessionFlowControlWindowToSend(kMinimumFlowControlSendWindow); 632 SetInitialSessionFlowControlWindowToSend(kMinimumFlowControlSendWindow);
662 } 633 }
663 634
664 void QuicConfig::ToHandshakeMessage(CryptoHandshakeMessage* out) const { 635 void QuicConfig::ToHandshakeMessage(CryptoHandshakeMessage* out) const {
665 congestion_feedback_.ToHandshakeMessage(out); 636 congestion_feedback_.ToHandshakeMessage(out);
666 idle_connection_state_lifetime_seconds_.ToHandshakeMessage(out); 637 idle_connection_state_lifetime_seconds_.ToHandshakeMessage(out);
667 silent_close_.ToHandshakeMessage(out); 638 silent_close_.ToHandshakeMessage(out);
668 max_streams_per_connection_.ToHandshakeMessage(out); 639 max_streams_per_connection_.ToHandshakeMessage(out);
669 bytes_for_connection_id_.ToHandshakeMessage(out); 640 bytes_for_connection_id_.ToHandshakeMessage(out);
670 initial_round_trip_time_us_.ToHandshakeMessage(out); 641 initial_round_trip_time_us_.ToHandshakeMessage(out);
671 initial_flow_control_window_bytes_.ToHandshakeMessage(out);
672 initial_stream_flow_control_window_bytes_.ToHandshakeMessage(out); 642 initial_stream_flow_control_window_bytes_.ToHandshakeMessage(out);
673 initial_session_flow_control_window_bytes_.ToHandshakeMessage(out); 643 initial_session_flow_control_window_bytes_.ToHandshakeMessage(out);
674 socket_receive_buffer_.ToHandshakeMessage(out); 644 socket_receive_buffer_.ToHandshakeMessage(out);
675 connection_options_.ToHandshakeMessage(out); 645 connection_options_.ToHandshakeMessage(out);
676 } 646 }
677 647
678 QuicErrorCode QuicConfig::ProcessPeerHello( 648 QuicErrorCode QuicConfig::ProcessPeerHello(
679 const CryptoHandshakeMessage& peer_hello, 649 const CryptoHandshakeMessage& peer_hello,
680 HelloType hello_type, 650 HelloType hello_type,
681 string* error_details) { 651 string* error_details) {
(...skipping 18 matching lines...) Expand all
700 } 670 }
701 if (error == QUIC_NO_ERROR) { 671 if (error == QUIC_NO_ERROR) {
702 error = bytes_for_connection_id_.ProcessPeerHello( 672 error = bytes_for_connection_id_.ProcessPeerHello(
703 peer_hello, hello_type, error_details); 673 peer_hello, hello_type, error_details);
704 } 674 }
705 if (error == QUIC_NO_ERROR) { 675 if (error == QUIC_NO_ERROR) {
706 error = initial_round_trip_time_us_.ProcessPeerHello( 676 error = initial_round_trip_time_us_.ProcessPeerHello(
707 peer_hello, hello_type, error_details); 677 peer_hello, hello_type, error_details);
708 } 678 }
709 if (error == QUIC_NO_ERROR) { 679 if (error == QUIC_NO_ERROR) {
710 error = initial_flow_control_window_bytes_.ProcessPeerHello(
711 peer_hello, hello_type, error_details);
712 }
713 if (error == QUIC_NO_ERROR) {
714 error = initial_stream_flow_control_window_bytes_.ProcessPeerHello( 680 error = initial_stream_flow_control_window_bytes_.ProcessPeerHello(
715 peer_hello, hello_type, error_details); 681 peer_hello, hello_type, error_details);
716 } 682 }
717 if (error == QUIC_NO_ERROR) { 683 if (error == QUIC_NO_ERROR) {
718 error = initial_session_flow_control_window_bytes_.ProcessPeerHello( 684 error = initial_session_flow_control_window_bytes_.ProcessPeerHello(
719 peer_hello, hello_type, error_details); 685 peer_hello, hello_type, error_details);
720 } 686 }
721 if (error == QUIC_NO_ERROR) { 687 if (error == QUIC_NO_ERROR) {
722 error = socket_receive_buffer_.ProcessPeerHello( 688 error = socket_receive_buffer_.ProcessPeerHello(
723 peer_hello, hello_type, error_details); 689 peer_hello, hello_type, error_details);
724 } 690 }
725 if (error == QUIC_NO_ERROR) { 691 if (error == QUIC_NO_ERROR) {
726 error = connection_options_.ProcessPeerHello( 692 error = connection_options_.ProcessPeerHello(
727 peer_hello, hello_type, error_details); 693 peer_hello, hello_type, error_details);
728 } 694 }
729 return error; 695 return error;
730 } 696 }
731 697
732 } // namespace net 698 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_config.h ('k') | net/quic/quic_config_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698