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 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
419 break; | 419 break; |
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 congestion_options_(kCOPT, PRESENCE_OPTIONAL), | 429 connection_options_(kCOPT, PRESENCE_OPTIONAL), |
430 loss_detection_(kLOSS, PRESENCE_OPTIONAL), | 430 loss_detection_(kLOSS, PRESENCE_OPTIONAL), |
431 idle_connection_state_lifetime_seconds_(kICSL, PRESENCE_REQUIRED), | 431 idle_connection_state_lifetime_seconds_(kICSL, PRESENCE_REQUIRED), |
432 keepalive_timeout_seconds_(kKATO, PRESENCE_OPTIONAL), | 432 keepalive_timeout_seconds_(kKATO, PRESENCE_OPTIONAL), |
433 max_streams_per_connection_(kMSPC, PRESENCE_REQUIRED), | 433 max_streams_per_connection_(kMSPC, PRESENCE_REQUIRED), |
434 max_time_before_crypto_handshake_(QuicTime::Delta::Zero()), | 434 max_time_before_crypto_handshake_(QuicTime::Delta::Zero()), |
435 initial_congestion_window_(kSWND, PRESENCE_OPTIONAL), | 435 initial_congestion_window_(kSWND, PRESENCE_OPTIONAL), |
436 initial_round_trip_time_us_(kIRTT, PRESENCE_OPTIONAL), | 436 initial_round_trip_time_us_(kIRTT, PRESENCE_OPTIONAL), |
437 // TODO(rjshade): Make this PRESENCE_REQUIRED when retiring | 437 // TODO(rjshade): Make this PRESENCE_REQUIRED when retiring |
438 // QUIC_VERSION_17. | 438 // QUIC_VERSION_17. |
439 initial_flow_control_window_bytes_(kIFCW, PRESENCE_OPTIONAL), | 439 initial_flow_control_window_bytes_(kIFCW, PRESENCE_OPTIONAL), |
(...skipping 10 matching lines...) Expand all Loading... |
450 void QuicConfig::set_congestion_feedback( | 450 void QuicConfig::set_congestion_feedback( |
451 const QuicTagVector& congestion_feedback, | 451 const QuicTagVector& congestion_feedback, |
452 QuicTag default_congestion_feedback) { | 452 QuicTag default_congestion_feedback) { |
453 congestion_feedback_.set(congestion_feedback, default_congestion_feedback); | 453 congestion_feedback_.set(congestion_feedback, default_congestion_feedback); |
454 } | 454 } |
455 | 455 |
456 QuicTag QuicConfig::congestion_feedback() const { | 456 QuicTag QuicConfig::congestion_feedback() const { |
457 return congestion_feedback_.GetTag(); | 457 return congestion_feedback_.GetTag(); |
458 } | 458 } |
459 | 459 |
460 void QuicConfig::SetCongestionOptionsToSend( | 460 void QuicConfig::SetConnectionOptionsToSend( |
461 const QuicTagVector& congestion_options) { | 461 const QuicTagVector& connection_options) { |
462 congestion_options_.SetSendValues(congestion_options); | 462 connection_options_.SetSendValues(connection_options); |
463 } | 463 } |
464 | 464 |
465 bool QuicConfig::HasReceivedCongestionOptions() const { | 465 bool QuicConfig::HasReceivedConnectionOptions() const { |
466 return congestion_options_.HasReceivedValues(); | 466 return connection_options_.HasReceivedValues(); |
467 } | 467 } |
468 | 468 |
469 QuicTagVector QuicConfig::ReceivedCongestionOptions() const { | 469 QuicTagVector QuicConfig::ReceivedConnectionOptions() const { |
470 return congestion_options_.GetReceivedValues(); | 470 return connection_options_.GetReceivedValues(); |
471 } | 471 } |
472 | 472 |
473 void QuicConfig::SetLossDetectionToSend(QuicTag loss_detection) { | 473 void QuicConfig::SetLossDetectionToSend(QuicTag loss_detection) { |
474 loss_detection_.SetSendValue(loss_detection); | 474 loss_detection_.SetSendValue(loss_detection); |
475 } | 475 } |
476 | 476 |
477 bool QuicConfig::HasReceivedLossDetection() const { | 477 bool QuicConfig::HasReceivedLossDetection() const { |
478 return loss_detection_.HasReceivedValue(); | 478 return loss_detection_.HasReceivedValue(); |
479 } | 479 } |
480 | 480 |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
652 congestion_feedback_.ToHandshakeMessage(out); | 652 congestion_feedback_.ToHandshakeMessage(out); |
653 idle_connection_state_lifetime_seconds_.ToHandshakeMessage(out); | 653 idle_connection_state_lifetime_seconds_.ToHandshakeMessage(out); |
654 keepalive_timeout_seconds_.ToHandshakeMessage(out); | 654 keepalive_timeout_seconds_.ToHandshakeMessage(out); |
655 max_streams_per_connection_.ToHandshakeMessage(out); | 655 max_streams_per_connection_.ToHandshakeMessage(out); |
656 initial_congestion_window_.ToHandshakeMessage(out); | 656 initial_congestion_window_.ToHandshakeMessage(out); |
657 initial_round_trip_time_us_.ToHandshakeMessage(out); | 657 initial_round_trip_time_us_.ToHandshakeMessage(out); |
658 loss_detection_.ToHandshakeMessage(out); | 658 loss_detection_.ToHandshakeMessage(out); |
659 initial_flow_control_window_bytes_.ToHandshakeMessage(out); | 659 initial_flow_control_window_bytes_.ToHandshakeMessage(out); |
660 initial_stream_flow_control_window_bytes_.ToHandshakeMessage(out); | 660 initial_stream_flow_control_window_bytes_.ToHandshakeMessage(out); |
661 initial_session_flow_control_window_bytes_.ToHandshakeMessage(out); | 661 initial_session_flow_control_window_bytes_.ToHandshakeMessage(out); |
662 congestion_options_.ToHandshakeMessage(out); | 662 connection_options_.ToHandshakeMessage(out); |
663 } | 663 } |
664 | 664 |
665 QuicErrorCode QuicConfig::ProcessPeerHello( | 665 QuicErrorCode QuicConfig::ProcessPeerHello( |
666 const CryptoHandshakeMessage& peer_hello, | 666 const CryptoHandshakeMessage& peer_hello, |
667 HelloType hello_type, | 667 HelloType hello_type, |
668 string* error_details) { | 668 string* error_details) { |
669 DCHECK(error_details != NULL); | 669 DCHECK(error_details != NULL); |
670 | 670 |
671 QuicErrorCode error = QUIC_NO_ERROR; | 671 QuicErrorCode error = QUIC_NO_ERROR; |
672 if (error == QUIC_NO_ERROR) { | 672 if (error == QUIC_NO_ERROR) { |
(...skipping 30 matching lines...) Expand all Loading... |
703 } | 703 } |
704 if (error == QUIC_NO_ERROR) { | 704 if (error == QUIC_NO_ERROR) { |
705 error = initial_session_flow_control_window_bytes_.ProcessPeerHello( | 705 error = initial_session_flow_control_window_bytes_.ProcessPeerHello( |
706 peer_hello, hello_type, error_details); | 706 peer_hello, hello_type, error_details); |
707 } | 707 } |
708 if (error == QUIC_NO_ERROR) { | 708 if (error == QUIC_NO_ERROR) { |
709 error = loss_detection_.ProcessPeerHello( | 709 error = loss_detection_.ProcessPeerHello( |
710 peer_hello, hello_type, error_details); | 710 peer_hello, hello_type, error_details); |
711 } | 711 } |
712 if (error == QUIC_NO_ERROR) { | 712 if (error == QUIC_NO_ERROR) { |
713 error = congestion_options_.ProcessPeerHello( | 713 error = connection_options_.ProcessPeerHello( |
714 peer_hello, hello_type, error_details); | 714 peer_hello, hello_type, error_details); |
715 } | 715 } |
716 return error; | 716 return error; |
717 } | 717 } |
718 | 718 |
719 } // namespace net | 719 } // namespace net |
OLD | NEW |