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

Side by Side 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, 2 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_sent_packet_manager.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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_sent_packet_manager.h" 5 #include "net/quic/quic_sent_packet_manager.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/stl_util.h" 10 #include "base/stl_util.h"
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 QuicTime::Delta::FromSeconds(FLAGS_quic_recent_min_rtt_window_s)); 110 QuicTime::Delta::FromSeconds(FLAGS_quic_recent_min_rtt_window_s));
111 } 111 }
112 send_algorithm_.reset( 112 send_algorithm_.reset(
113 SendAlgorithmInterface::Create(clock_, &rtt_stats_, kBBR, stats_)); 113 SendAlgorithmInterface::Create(clock_, &rtt_stats_, kBBR, stats_));
114 } 114 }
115 if (config.HasReceivedConnectionOptions() && 115 if (config.HasReceivedConnectionOptions() &&
116 ContainsQuicTag(config.ReceivedConnectionOptions(), kRENO)) { 116 ContainsQuicTag(config.ReceivedConnectionOptions(), kRENO)) {
117 send_algorithm_.reset( 117 send_algorithm_.reset(
118 SendAlgorithmInterface::Create(clock_, &rtt_stats_, kReno, stats_)); 118 SendAlgorithmInterface::Create(clock_, &rtt_stats_, kReno, stats_));
119 } 119 }
120 if (is_server_) { 120 if (HasClientSentConnectionOption(config, kPACE)) {
121 if (config.HasReceivedConnectionOptions() &&
122 ContainsQuicTag(config.ReceivedConnectionOptions(), kPACE)) {
123 EnablePacing();
124 }
125 } else if (config.HasSendConnectionOptions() &&
126 ContainsQuicTag(config.SendConnectionOptions(), kPACE)) {
127 EnablePacing(); 121 EnablePacing();
128 } 122 }
129 if (is_server_) { 123 if (HasClientSentConnectionOption(config, k1CON)) {
130 if (config.HasReceivedConnectionOptions() &&
131 ContainsQuicTag(config.ReceivedConnectionOptions(), k1CON)) {
132 send_algorithm_->SetNumEmulatedConnections(1);
133 }
134 } else if (config.HasSendConnectionOptions() &&
135 ContainsQuicTag(config.SendConnectionOptions(), k1CON)) {
136 send_algorithm_->SetNumEmulatedConnections(1); 124 send_algorithm_->SetNumEmulatedConnections(1);
137 } 125 }
138 // TODO(ianswett): Remove the "HasReceivedLossDetection" branch once
139 // the ConnectionOptions code is live everywhere.
140 if (config.HasReceivedConnectionOptions() && 126 if (config.HasReceivedConnectionOptions() &&
141 ContainsQuicTag(config.ReceivedConnectionOptions(), kTIME)) { 127 ContainsQuicTag(config.ReceivedConnectionOptions(), kTIME)) {
142 loss_algorithm_.reset(LossDetectionInterface::Create(kTime)); 128 loss_algorithm_.reset(LossDetectionInterface::Create(kTime));
143 } 129 }
144 send_algorithm_->SetFromConfig(config, is_server_); 130 send_algorithm_->SetFromConfig(config, is_server_);
145 131
146 if (network_change_visitor_ != NULL) { 132 if (network_change_visitor_ != NULL) {
147 network_change_visitor_->OnCongestionWindowChange(GetCongestionWindow()); 133 network_change_visitor_->OnCongestionWindowChange(GetCongestionWindow());
148 } 134 }
149 } 135 }
150 136
137 bool QuicSentPacketManager::HasClientSentConnectionOption(
138 const QuicConfig& config, QuicTag tag) const {
139 if (is_server_) {
140 if (config.HasReceivedConnectionOptions() &&
141 ContainsQuicTag(config.ReceivedConnectionOptions(), tag)) {
142 return true;
143 }
144 } else if (config.HasSendConnectionOptions() &&
145 ContainsQuicTag(config.SendConnectionOptions(), tag)) {
146 return true;
147 }
148 return false;
149 }
150
151 void QuicSentPacketManager::OnRetransmittedPacket( 151 void QuicSentPacketManager::OnRetransmittedPacket(
152 QuicPacketSequenceNumber old_sequence_number, 152 QuicPacketSequenceNumber old_sequence_number,
153 QuicPacketSequenceNumber new_sequence_number) { 153 QuicPacketSequenceNumber new_sequence_number) {
154 TransmissionType transmission_type; 154 TransmissionType transmission_type;
155 PendingRetransmissionMap::iterator it = 155 PendingRetransmissionMap::iterator it =
156 pending_retransmissions_.find(old_sequence_number); 156 pending_retransmissions_.find(old_sequence_number);
157 if (it != pending_retransmissions_.end()) { 157 if (it != pending_retransmissions_.end()) {
158 transmission_type = it->second; 158 transmission_type = it->second;
159 pending_retransmissions_.erase(it); 159 pending_retransmissions_.erase(it);
160 } else { 160 } else {
(...skipping 717 matching lines...) Expand 10 before | Expand all | Expand 10 after
878 878
879 // Set up a pacing sender with a 5 millisecond alarm granularity. 879 // Set up a pacing sender with a 5 millisecond alarm granularity.
880 using_pacing_ = true; 880 using_pacing_ = true;
881 send_algorithm_.reset( 881 send_algorithm_.reset(
882 new PacingSender(send_algorithm_.release(), 882 new PacingSender(send_algorithm_.release(),
883 QuicTime::Delta::FromMilliseconds(5), 883 QuicTime::Delta::FromMilliseconds(5),
884 kInitialUnpacedBurst)); 884 kInitialUnpacedBurst));
885 } 885 }
886 886
887 } // namespace net 887 } // namespace net
OLDNEW
« 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