Index: net/quic/quic_sent_packet_manager.cc |
diff --git a/net/quic/quic_sent_packet_manager.cc b/net/quic/quic_sent_packet_manager.cc |
index 553e7e2f69a188ed7a7c2bb78c34323ab5741cf7..a6749ec65ba48e1f97d072ece29e50575c32b437 100644 |
--- a/net/quic/quic_sent_packet_manager.cc |
+++ b/net/quic/quic_sent_packet_manager.cc |
@@ -78,6 +78,7 @@ QuicSentPacketManager::QuicSentPacketManager( |
congestion_control_type, |
stats)), |
loss_algorithm_(LossDetectionInterface::Create(loss_type)), |
+ n_connection_simulation_(false), |
receive_buffer_bytes_(kDefaultSocketReceiveBuffer), |
least_packet_awaited_by_peer_(1), |
first_rto_transmission_(0), |
@@ -125,6 +126,9 @@ void QuicSentPacketManager::SetFromConfig(const QuicConfig& config) { |
if (HasClientSentConnectionOption(config, k1CON)) { |
send_algorithm_->SetNumEmulatedConnections(1); |
} |
+ if (HasClientSentConnectionOption(config, kNCON)) { |
+ n_connection_simulation_ = true; |
+ } |
if (HasClientSentConnectionOption(config, kNTLP)) { |
max_tail_loss_probes_ = 0; |
} |
@@ -144,6 +148,14 @@ void QuicSentPacketManager::SetFromConfig(const QuicConfig& config) { |
} |
} |
+void QuicSentPacketManager::SetNumOpenStreams(size_t num_streams) { |
+ if (n_connection_simulation_) { |
+ // Ensure the number of connections is between 1 and 5. |
+ send_algorithm_->SetNumEmulatedConnections( |
+ min<size_t>(5, max<size_t>(1, num_streams))); |
+ } |
+} |
+ |
bool QuicSentPacketManager::HasClientSentConnectionOption( |
const QuicConfig& config, QuicTag tag) const { |
if (is_server_) { |