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

Unified Diff: net/quic/quic_sent_packet_manager.cc

Issue 607803004: Add a convenience method to check for client supplied options in (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@option_to_allow_negotiating_1_connection_76351810
Patch Set: Created 6 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/quic/quic_sent_packet_manager.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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) {
« no previous file with comments | « net/quic/quic_sent_packet_manager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698