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 4c5307562d3d833847802f061ec295b4675749ff..a142455ecb96173ea14489b5e847ad551befd9a6 100644 |
--- a/net/quic/quic_sent_packet_manager.cc |
+++ b/net/quic/quic_sent_packet_manager.cc |
@@ -117,26 +117,12 @@ void QuicSentPacketManager::SetFromConfig(const QuicConfig& config) { |
send_algorithm_.reset( |
SendAlgorithmInterface::Create(clock_, &rtt_stats_, kReno, stats_)); |
} |
- if (is_server_) { |
- if (config.HasReceivedConnectionOptions() && |
- ContainsQuicTag(config.ReceivedConnectionOptions(), kPACE)) { |
- EnablePacing(); |
- } |
- } else if (config.HasSendConnectionOptions() && |
- ContainsQuicTag(config.SendConnectionOptions(), kPACE)) { |
+ if (HasClientSentConnectionOption(config, kPACE)) { |
EnablePacing(); |
} |
- if (is_server_) { |
- if (config.HasReceivedConnectionOptions() && |
- ContainsQuicTag(config.ReceivedConnectionOptions(), k1CON)) { |
- send_algorithm_->SetNumEmulatedConnections(1); |
- } |
- } else if (config.HasSendConnectionOptions() && |
- ContainsQuicTag(config.SendConnectionOptions(), k1CON)) { |
+ if (HasClientSentConnectionOption(config, k1CON)) { |
send_algorithm_->SetNumEmulatedConnections(1); |
} |
- // TODO(ianswett): Remove the "HasReceivedLossDetection" branch once |
- // the ConnectionOptions code is live everywhere. |
if (config.HasReceivedConnectionOptions() && |
ContainsQuicTag(config.ReceivedConnectionOptions(), kTIME)) { |
loss_algorithm_.reset(LossDetectionInterface::Create(kTime)); |
@@ -148,6 +134,20 @@ void QuicSentPacketManager::SetFromConfig(const QuicConfig& config) { |
} |
} |
+bool QuicSentPacketManager::HasClientSentConnectionOption( |
+ const QuicConfig& config, QuicTag tag) const { |
+ if (is_server_) { |
+ if (config.HasReceivedConnectionOptions() && |
+ ContainsQuicTag(config.ReceivedConnectionOptions(), tag)) { |
+ return true; |
+ } |
+ } else if (config.HasSendConnectionOptions() && |
+ ContainsQuicTag(config.SendConnectionOptions(), tag)) { |
+ return true; |
+ } |
+ return false; |
+} |
+ |
void QuicSentPacketManager::OnRetransmittedPacket( |
QuicPacketSequenceNumber old_sequence_number, |
QuicPacketSequenceNumber new_sequence_number) { |