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

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

Issue 478153003: Change the wire format of the ack frame to include a compressed version (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase TOT and pass clock to QuicTestPacketMaker and use it in AckPacket Created 6 years, 4 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_config_test.cc ('k') | net/quic/quic_connection_logger.cc » ('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_connection.h" 5 #include "net/quic/quic_connection.h"
6 6
7 #include <string.h> 7 #include <string.h>
8 #include <sys/types.h> 8 #include <sys/types.h>
9 #include <algorithm> 9 #include <algorithm>
10 #include <iterator> 10 #include <iterator>
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 random_generator_(helper->GetRandomGenerator()), 204 random_generator_(helper->GetRandomGenerator()),
205 connection_id_(connection_id), 205 connection_id_(connection_id),
206 peer_address_(address), 206 peer_address_(address),
207 migrating_peer_port_(0), 207 migrating_peer_port_(0),
208 last_packet_revived_(false), 208 last_packet_revived_(false),
209 last_size_(0), 209 last_size_(0),
210 last_decrypted_packet_level_(ENCRYPTION_NONE), 210 last_decrypted_packet_level_(ENCRYPTION_NONE),
211 largest_seen_packet_with_ack_(0), 211 largest_seen_packet_with_ack_(0),
212 largest_seen_packet_with_stop_waiting_(0), 212 largest_seen_packet_with_stop_waiting_(0),
213 pending_version_negotiation_packet_(false), 213 pending_version_negotiation_packet_(false),
214 received_packet_manager_(kTCP, &stats_), 214 received_packet_manager_(&stats_),
215 ack_queued_(false), 215 ack_queued_(false),
216 stop_waiting_count_(0), 216 stop_waiting_count_(0),
217 ack_alarm_(helper->CreateAlarm(new AckAlarm(this))), 217 ack_alarm_(helper->CreateAlarm(new AckAlarm(this))),
218 retransmission_alarm_(helper->CreateAlarm(new RetransmissionAlarm(this))), 218 retransmission_alarm_(helper->CreateAlarm(new RetransmissionAlarm(this))),
219 send_alarm_(helper->CreateAlarm(new SendAlarm(this))), 219 send_alarm_(helper->CreateAlarm(new SendAlarm(this))),
220 resume_writes_alarm_(helper->CreateAlarm(new SendAlarm(this))), 220 resume_writes_alarm_(helper->CreateAlarm(new SendAlarm(this))),
221 timeout_alarm_(helper->CreateAlarm(new TimeoutAlarm(this))), 221 timeout_alarm_(helper->CreateAlarm(new TimeoutAlarm(this))),
222 ping_alarm_(helper->CreateAlarm(new PingAlarm(this))), 222 ping_alarm_(helper->CreateAlarm(new PingAlarm(this))),
223 packet_generator_(connection_id_, &framer_, random_generator_, this), 223 packet_generator_(connection_id_, &framer_, random_generator_, this),
224 idle_network_timeout_( 224 idle_network_timeout_(
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 STLDeleteValues(&group_map_); 262 STLDeleteValues(&group_map_);
263 for (QueuedPacketList::iterator it = queued_packets_.begin(); 263 for (QueuedPacketList::iterator it = queued_packets_.begin();
264 it != queued_packets_.end(); ++it) { 264 it != queued_packets_.end(); ++it) {
265 delete it->packet; 265 delete it->packet;
266 } 266 }
267 } 267 }
268 268
269 void QuicConnection::SetFromConfig(const QuicConfig& config) { 269 void QuicConnection::SetFromConfig(const QuicConfig& config) {
270 SetIdleNetworkTimeout(config.idle_connection_state_lifetime()); 270 SetIdleNetworkTimeout(config.idle_connection_state_lifetime());
271 sent_packet_manager_.SetFromConfig(config); 271 sent_packet_manager_.SetFromConfig(config);
272 // TODO(satyamshekhar): Set congestion control and ICSL also.
273 } 272 }
274 273
275 bool QuicConnection::SelectMutualVersion( 274 bool QuicConnection::SelectMutualVersion(
276 const QuicVersionVector& available_versions) { 275 const QuicVersionVector& available_versions) {
277 // Try to find the highest mutual version by iterating over supported 276 // Try to find the highest mutual version by iterating over supported
278 // versions, starting with the highest, and breaking out of the loop once we 277 // versions, starting with the highest, and breaking out of the loop once we
279 // find a matching version in the provided available_versions vector. 278 // find a matching version in the provided available_versions vector.
280 const QuicVersionVector& supported_versions = framer_.supported_versions(); 279 const QuicVersionVector& supported_versions = framer_.supported_versions();
281 for (size_t i = 0; i < supported_versions.size(); ++i) { 280 for (size_t i = 0; i < supported_versions.size(); ++i) {
282 const QuicVersion& version = supported_versions[i]; 281 const QuicVersion& version = supported_versions[i];
(...skipping 1284 matching lines...) Expand 10 before | Expand all | Expand 10 after
1567 DLOG(ERROR) << "Unable to send ping!?"; 1566 DLOG(ERROR) << "Unable to send ping!?";
1568 } 1567 }
1569 } else { 1568 } else {
1570 packet_generator_.AddControlFrame(QuicFrame(new QuicPingFrame)); 1569 packet_generator_.AddControlFrame(QuicFrame(new QuicPingFrame));
1571 } 1570 }
1572 } 1571 }
1573 1572
1574 void QuicConnection::SendAck() { 1573 void QuicConnection::SendAck() {
1575 ack_alarm_->Cancel(); 1574 ack_alarm_->Cancel();
1576 stop_waiting_count_ = 0; 1575 stop_waiting_count_ = 0;
1577 // TODO(rch): delay this until the CreateFeedbackFrame
1578 // method is invoked. This requires changes SetShouldSendAck
1579 // to be a no-arg method, and re-jiggering its implementation.
1580 bool send_feedback = false; 1576 bool send_feedback = false;
1581 if (received_packet_manager_.GenerateCongestionFeedback( 1577
1582 &outgoing_congestion_feedback_)) { 1578 // Deprecating the Congestion Feedback Frame after QUIC_VERSION_22.
1583 DVLOG(1) << ENDPOINT << "Sending feedback: " 1579 if (version() <= QUIC_VERSION_22) {
1584 << outgoing_congestion_feedback_; 1580 if (received_packet_manager_.GenerateCongestionFeedback(
1585 send_feedback = true; 1581 &outgoing_congestion_feedback_)) {
1582 DVLOG(1) << ENDPOINT << "Sending feedback: "
1583 << outgoing_congestion_feedback_;
1584 send_feedback = true;
1585 }
1586 } 1586 }
1587 1587
1588 packet_generator_.SetShouldSendAck(send_feedback, true); 1588 packet_generator_.SetShouldSendAck(send_feedback, true);
1589 } 1589 }
1590 1590
1591 void QuicConnection::OnRetransmissionTimeout() { 1591 void QuicConnection::OnRetransmissionTimeout() {
1592 if (!sent_packet_manager_.HasUnackedPackets()) { 1592 if (!sent_packet_manager_.HasUnackedPackets()) {
1593 return; 1593 return;
1594 } 1594 }
1595 1595
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after
1985 // If we changed the generator's batch state, restore original batch state. 1985 // If we changed the generator's batch state, restore original batch state.
1986 if (!already_in_batch_mode_) { 1986 if (!already_in_batch_mode_) {
1987 DVLOG(1) << "Leaving Batch Mode."; 1987 DVLOG(1) << "Leaving Batch Mode.";
1988 connection_->packet_generator_.FinishBatchOperations(); 1988 connection_->packet_generator_.FinishBatchOperations();
1989 } 1989 }
1990 DCHECK_EQ(already_in_batch_mode_, 1990 DCHECK_EQ(already_in_batch_mode_,
1991 connection_->packet_generator_.InBatchMode()); 1991 connection_->packet_generator_.InBatchMode());
1992 } 1992 }
1993 1993
1994 } // namespace net 1994 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_config_test.cc ('k') | net/quic/quic_connection_logger.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698