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

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

Issue 2101353003: Add a new kMIDS (Max Incoming Dynamic Streams) config option, to eventually replace kMSPC. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@Final
Patch Set: Created 4 years, 5 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_server_session_base_test.cc ('k') | net/quic/test_tools/crypto_test_utils.h » ('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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_session.h" 5 #include "net/quic/quic_session.h"
6 6
7 #include "base/stl_util.h" 7 #include "base/stl_util.h"
8 #include "base/strings/string_number_conversions.h" 8 #include "base/strings/string_number_conversions.h"
9 #include "base/strings/stringprintf.h" 9 #include "base/strings/stringprintf.h"
10 #include "net/quic/crypto/proof_verifier.h" 10 #include "net/quic/crypto/proof_verifier.h"
(...skipping 13 matching lines...) Expand all
24 using net::SpdyPriority; 24 using net::SpdyPriority;
25 25
26 namespace net { 26 namespace net {
27 27
28 #define ENDPOINT \ 28 #define ENDPOINT \
29 (perspective() == Perspective::IS_SERVER ? "Server: " : " Client: ") 29 (perspective() == Perspective::IS_SERVER ? "Server: " : " Client: ")
30 30
31 QuicSession::QuicSession(QuicConnection* connection, const QuicConfig& config) 31 QuicSession::QuicSession(QuicConnection* connection, const QuicConfig& config)
32 : connection_(connection), 32 : connection_(connection),
33 config_(config), 33 config_(config),
34 max_open_outgoing_streams_(config_.MaxStreamsPerConnection()), 34 max_open_outgoing_streams_(kDefaultMaxStreamsPerConnection),
35 max_open_incoming_streams_(config_.MaxStreamsPerConnection()), 35 max_open_incoming_streams_(config_.GetMaxIncomingDynamicStreamsToSend()),
36 next_outgoing_stream_id_(perspective() == Perspective::IS_SERVER ? 2 : 3), 36 next_outgoing_stream_id_(perspective() == Perspective::IS_SERVER ? 2 : 3),
37 largest_peer_created_stream_id_( 37 largest_peer_created_stream_id_(
38 perspective() == Perspective::IS_SERVER ? 1 : 0), 38 perspective() == Perspective::IS_SERVER ? 1 : 0),
39 num_dynamic_incoming_streams_(0), 39 num_dynamic_incoming_streams_(0),
40 num_draining_incoming_streams_(0), 40 num_draining_incoming_streams_(0),
41 num_locally_closed_incoming_streams_highest_offset_(0), 41 num_locally_closed_incoming_streams_highest_offset_(0),
42 error_(QUIC_NO_ERROR), 42 error_(QUIC_NO_ERROR),
43 flow_controller_(connection_.get(), 43 flow_controller_(connection_.get(),
44 0, 44 0,
45 perspective(), 45 perspective(),
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after
384 return GetCryptoStream()->encryption_established(); 384 return GetCryptoStream()->encryption_established();
385 } 385 }
386 386
387 bool QuicSession::IsCryptoHandshakeConfirmed() { 387 bool QuicSession::IsCryptoHandshakeConfirmed() {
388 return GetCryptoStream()->handshake_confirmed(); 388 return GetCryptoStream()->handshake_confirmed();
389 } 389 }
390 390
391 void QuicSession::OnConfigNegotiated() { 391 void QuicSession::OnConfigNegotiated() {
392 connection_->SetFromConfig(config_); 392 connection_->SetFromConfig(config_);
393 393
394 uint32_t max_streams = config_.MaxStreamsPerConnection(); 394 const QuicVersion version = connection()->version();
395 uint32_t max_streams = 0;
396 if (version > QUIC_VERSION_34 &&
397 config_.HasReceivedMaxIncomingDynamicStreams()) {
398 max_streams = config_.ReceivedMaxIncomingDynamicStreams();
399 } else {
400 max_streams = config_.MaxStreamsPerConnection();
401 }
402 set_max_open_outgoing_streams(max_streams);
395 if (!FLAGS_quic_enable_autotune_by_default && 403 if (!FLAGS_quic_enable_autotune_by_default &&
396 perspective() == Perspective::IS_SERVER) { 404 perspective() == Perspective::IS_SERVER) {
397 if (config_.HasReceivedConnectionOptions()) { 405 if (config_.HasReceivedConnectionOptions()) {
398 if (ContainsQuicTag(config_.ReceivedConnectionOptions(), kAFCW)) { 406 if (ContainsQuicTag(config_.ReceivedConnectionOptions(), kAFCW)) {
399 // The following variations change the initial receive flow control 407 // The following variations change the initial receive flow control
400 // window sizes. 408 // window sizes.
401 if (ContainsQuicTag(config_.ReceivedConnectionOptions(), kIFW5)) { 409 if (ContainsQuicTag(config_.ReceivedConnectionOptions(), kIFW5)) {
402 AdjustInitialFlowControlWindows(32 * 1024); 410 AdjustInitialFlowControlWindows(32 * 1024);
403 } 411 }
404 if (ContainsQuicTag(config_.ReceivedConnectionOptions(), kIFW6)) { 412 if (ContainsQuicTag(config_.ReceivedConnectionOptions(), kIFW6)) {
405 AdjustInitialFlowControlWindows(64 * 1024); 413 AdjustInitialFlowControlWindows(64 * 1024);
406 } 414 }
407 if (ContainsQuicTag(config_.ReceivedConnectionOptions(), kIFW7)) { 415 if (ContainsQuicTag(config_.ReceivedConnectionOptions(), kIFW7)) {
408 AdjustInitialFlowControlWindows(128 * 1024); 416 AdjustInitialFlowControlWindows(128 * 1024);
409 } 417 }
410 EnableAutoTuneReceiveWindow(); 418 EnableAutoTuneReceiveWindow();
411 } 419 }
412 } 420 }
413 } 421 }
414 422
415 set_max_open_outgoing_streams(max_streams); 423 if (version <= QUIC_VERSION_34) {
416 424 // A small number of additional incoming streams beyond the limit should be
417 // A small number of additional incoming streams beyond the limit should be 425 // allowed. This helps avoid early connection termination when FIN/RSTs for
418 // allowed. This helps avoid early connection termination when FIN/RSTs for 426 // old streams are lost or arrive out of order.
419 // old streams are lost or arrive out of order. 427 // Use a minimum number of additional streams, or a percentage increase,
420 // Use a minimum number of additional streams, or a percentage increase, 428 // whichever is larger.
421 // whichever is larger. 429 uint32_t max_incoming_streams =
422 uint32_t max_incoming_streams = 430 max(max_streams + kMaxStreamsMinimumIncrement,
423 max(max_streams + kMaxStreamsMinimumIncrement, 431 static_cast<uint32_t>(max_streams * kMaxStreamsMultiplier));
424 static_cast<uint32_t>(max_streams * kMaxStreamsMultiplier)); 432 set_max_open_incoming_streams(max_incoming_streams);
425 set_max_open_incoming_streams(max_incoming_streams); 433 } else {
434 uint32_t max_incoming_streams_to_send =
435 config_.GetMaxIncomingDynamicStreamsToSend();
436 uint32_t max_incoming_streams =
437 max(max_incoming_streams_to_send + kMaxStreamsMinimumIncrement,
438 static_cast<uint32_t>(max_incoming_streams_to_send *
439 kMaxStreamsMultiplier));
440 set_max_open_incoming_streams(max_incoming_streams);
441 }
426 442
427 if (config_.HasReceivedInitialStreamFlowControlWindowBytes()) { 443 if (config_.HasReceivedInitialStreamFlowControlWindowBytes()) {
428 // Streams which were created before the SHLO was received (0-RTT 444 // Streams which were created before the SHLO was received (0-RTT
429 // requests) are now informed of the peer's initial flow control window. 445 // requests) are now informed of the peer's initial flow control window.
430 OnNewStreamFlowControlWindow( 446 OnNewStreamFlowControlWindow(
431 config_.ReceivedInitialStreamFlowControlWindowBytes()); 447 config_.ReceivedInitialStreamFlowControlWindowBytes());
432 } 448 }
433 if (config_.HasReceivedInitialSessionFlowControlWindowBytes()) { 449 if (config_.HasReceivedInitialSessionFlowControlWindowBytes()) {
434 OnNewSessionFlowControlWindow( 450 OnNewSessionFlowControlWindow(
435 config_.ReceivedInitialSessionFlowControlWindowBytes()); 451 config_.ReceivedInitialSessionFlowControlWindowBytes());
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after
817 833
818 size_t QuicSession::MaxAvailableStreams() const { 834 size_t QuicSession::MaxAvailableStreams() const {
819 return max_open_incoming_streams_ * kMaxAvailableStreamsMultiplier; 835 return max_open_incoming_streams_ * kMaxAvailableStreamsMultiplier;
820 } 836 }
821 837
822 bool QuicSession::IsIncomingStream(QuicStreamId id) const { 838 bool QuicSession::IsIncomingStream(QuicStreamId id) const {
823 return id % 2 != next_outgoing_stream_id_ % 2; 839 return id % 2 != next_outgoing_stream_id_ % 2;
824 } 840 }
825 841
826 } // namespace net 842 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_server_session_base_test.cc ('k') | net/quic/test_tools/crypto_test_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698