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 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
420 default: | 420 default: |
421 *error_details = "Bad " + QuicUtils::TagToString(tag_); | 421 *error_details = "Bad " + QuicUtils::TagToString(tag_); |
422 break; | 422 break; |
423 } | 423 } |
424 return error; | 424 return error; |
425 } | 425 } |
426 | 426 |
427 QuicConfig::QuicConfig() | 427 QuicConfig::QuicConfig() |
428 : congestion_feedback_(kCGST, PRESENCE_REQUIRED), | 428 : congestion_feedback_(kCGST, PRESENCE_REQUIRED), |
429 connection_options_(kCOPT, PRESENCE_OPTIONAL), | 429 connection_options_(kCOPT, PRESENCE_OPTIONAL), |
430 loss_detection_(kLOSS, PRESENCE_OPTIONAL), | |
431 idle_connection_state_lifetime_seconds_(kICSL, PRESENCE_REQUIRED), | 430 idle_connection_state_lifetime_seconds_(kICSL, PRESENCE_REQUIRED), |
432 keepalive_timeout_seconds_(kKATO, PRESENCE_OPTIONAL), | 431 keepalive_timeout_seconds_(kKATO, PRESENCE_OPTIONAL), |
433 max_streams_per_connection_(kMSPC, PRESENCE_REQUIRED), | 432 max_streams_per_connection_(kMSPC, PRESENCE_REQUIRED), |
434 max_time_before_crypto_handshake_(QuicTime::Delta::Zero()), | 433 max_time_before_crypto_handshake_(QuicTime::Delta::Zero()), |
435 initial_congestion_window_(kSWND, PRESENCE_OPTIONAL), | 434 initial_congestion_window_(kSWND, PRESENCE_OPTIONAL), |
436 initial_round_trip_time_us_(kIRTT, PRESENCE_OPTIONAL), | 435 initial_round_trip_time_us_(kIRTT, PRESENCE_OPTIONAL), |
437 // TODO(rjshade): Make this PRESENCE_REQUIRED when QUIC_VERSION_16 is | 436 // TODO(rjshade): Make this PRESENCE_REQUIRED when QUIC_VERSION_16 is |
438 // retired. | 437 // retired. |
439 initial_flow_control_window_bytes_(kIFCW, PRESENCE_OPTIONAL), | 438 initial_flow_control_window_bytes_(kIFCW, PRESENCE_OPTIONAL), |
440 // TODO(rjshade): Make this PRESENCE_REQUIRED when retiring | 439 // TODO(rjshade): Make this PRESENCE_REQUIRED when retiring |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
472 } | 471 } |
473 | 472 |
474 bool QuicConfig::HasSendConnectionOptions() const { | 473 bool QuicConfig::HasSendConnectionOptions() const { |
475 return connection_options_.HasSendValues(); | 474 return connection_options_.HasSendValues(); |
476 } | 475 } |
477 | 476 |
478 QuicTagVector QuicConfig::SendConnectionOptions() const { | 477 QuicTagVector QuicConfig::SendConnectionOptions() const { |
479 return connection_options_.GetSendValues(); | 478 return connection_options_.GetSendValues(); |
480 } | 479 } |
481 | 480 |
482 void QuicConfig::SetLossDetectionToSend(QuicTag loss_detection) { | |
483 loss_detection_.SetSendValue(loss_detection); | |
484 } | |
485 | |
486 bool QuicConfig::HasReceivedLossDetection() const { | |
487 return loss_detection_.HasReceivedValue(); | |
488 } | |
489 | |
490 QuicTag QuicConfig::ReceivedLossDetection() const { | |
491 return loss_detection_.GetReceivedValue(); | |
492 } | |
493 | |
494 void QuicConfig::set_idle_connection_state_lifetime( | 481 void QuicConfig::set_idle_connection_state_lifetime( |
495 QuicTime::Delta max_idle_connection_state_lifetime, | 482 QuicTime::Delta max_idle_connection_state_lifetime, |
496 QuicTime::Delta default_idle_conection_state_lifetime) { | 483 QuicTime::Delta default_idle_conection_state_lifetime) { |
497 idle_connection_state_lifetime_seconds_.set( | 484 idle_connection_state_lifetime_seconds_.set( |
498 max_idle_connection_state_lifetime.ToSeconds(), | 485 max_idle_connection_state_lifetime.ToSeconds(), |
499 default_idle_conection_state_lifetime.ToSeconds()); | 486 default_idle_conection_state_lifetime.ToSeconds()); |
500 } | 487 } |
501 | 488 |
502 QuicTime::Delta QuicConfig::idle_connection_state_lifetime() const { | 489 QuicTime::Delta QuicConfig::idle_connection_state_lifetime() const { |
503 return QuicTime::Delta::FromSeconds( | 490 return QuicTime::Delta::FromSeconds( |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
669 SetInitialSessionFlowControlWindowToSend(kDefaultFlowControlSendWindow); | 656 SetInitialSessionFlowControlWindowToSend(kDefaultFlowControlSendWindow); |
670 } | 657 } |
671 | 658 |
672 void QuicConfig::ToHandshakeMessage(CryptoHandshakeMessage* out) const { | 659 void QuicConfig::ToHandshakeMessage(CryptoHandshakeMessage* out) const { |
673 congestion_feedback_.ToHandshakeMessage(out); | 660 congestion_feedback_.ToHandshakeMessage(out); |
674 idle_connection_state_lifetime_seconds_.ToHandshakeMessage(out); | 661 idle_connection_state_lifetime_seconds_.ToHandshakeMessage(out); |
675 keepalive_timeout_seconds_.ToHandshakeMessage(out); | 662 keepalive_timeout_seconds_.ToHandshakeMessage(out); |
676 max_streams_per_connection_.ToHandshakeMessage(out); | 663 max_streams_per_connection_.ToHandshakeMessage(out); |
677 initial_congestion_window_.ToHandshakeMessage(out); | 664 initial_congestion_window_.ToHandshakeMessage(out); |
678 initial_round_trip_time_us_.ToHandshakeMessage(out); | 665 initial_round_trip_time_us_.ToHandshakeMessage(out); |
679 loss_detection_.ToHandshakeMessage(out); | |
680 initial_flow_control_window_bytes_.ToHandshakeMessage(out); | 666 initial_flow_control_window_bytes_.ToHandshakeMessage(out); |
681 initial_stream_flow_control_window_bytes_.ToHandshakeMessage(out); | 667 initial_stream_flow_control_window_bytes_.ToHandshakeMessage(out); |
682 initial_session_flow_control_window_bytes_.ToHandshakeMessage(out); | 668 initial_session_flow_control_window_bytes_.ToHandshakeMessage(out); |
683 socket_receive_buffer_.ToHandshakeMessage(out); | 669 socket_receive_buffer_.ToHandshakeMessage(out); |
684 connection_options_.ToHandshakeMessage(out); | 670 connection_options_.ToHandshakeMessage(out); |
685 } | 671 } |
686 | 672 |
687 QuicErrorCode QuicConfig::ProcessPeerHello( | 673 QuicErrorCode QuicConfig::ProcessPeerHello( |
688 const CryptoHandshakeMessage& peer_hello, | 674 const CryptoHandshakeMessage& peer_hello, |
689 HelloType hello_type, | 675 HelloType hello_type, |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
725 } | 711 } |
726 if (error == QUIC_NO_ERROR) { | 712 if (error == QUIC_NO_ERROR) { |
727 error = initial_session_flow_control_window_bytes_.ProcessPeerHello( | 713 error = initial_session_flow_control_window_bytes_.ProcessPeerHello( |
728 peer_hello, hello_type, error_details); | 714 peer_hello, hello_type, error_details); |
729 } | 715 } |
730 if (error == QUIC_NO_ERROR) { | 716 if (error == QUIC_NO_ERROR) { |
731 error = socket_receive_buffer_.ProcessPeerHello( | 717 error = socket_receive_buffer_.ProcessPeerHello( |
732 peer_hello, hello_type, error_details); | 718 peer_hello, hello_type, error_details); |
733 } | 719 } |
734 if (error == QUIC_NO_ERROR) { | 720 if (error == QUIC_NO_ERROR) { |
735 error = loss_detection_.ProcessPeerHello( | |
736 peer_hello, hello_type, error_details); | |
737 } | |
738 if (error == QUIC_NO_ERROR) { | |
739 error = connection_options_.ProcessPeerHello( | 721 error = connection_options_.ProcessPeerHello( |
740 peer_hello, hello_type, error_details); | 722 peer_hello, hello_type, error_details); |
741 } | 723 } |
742 return error; | 724 return error; |
743 } | 725 } |
744 | 726 |
745 } // namespace net | 727 } // namespace net |
OLD | NEW |