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

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

Issue 490263003: When talking >=QUIC_VERSION_22, regularly send updated bandwidth (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
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 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 // Pacing will be enabled if the client negotiates it. 244 // Pacing will be enabled if the client negotiates it.
245 sent_packet_manager_.MaybeEnablePacing(); 245 sent_packet_manager_.MaybeEnablePacing();
246 } 246 }
247 #endif 247 #endif
248 DVLOG(1) << ENDPOINT << "Created connection with connection_id: " 248 DVLOG(1) << ENDPOINT << "Created connection with connection_id: "
249 << connection_id; 249 << connection_id;
250 timeout_alarm_->Set(clock_->ApproximateNow().Add(idle_network_timeout_)); 250 timeout_alarm_->Set(clock_->ApproximateNow().Add(idle_network_timeout_));
251 framer_.set_visitor(this); 251 framer_.set_visitor(this);
252 framer_.set_received_entropy_calculator(&received_packet_manager_); 252 framer_.set_received_entropy_calculator(&received_packet_manager_);
253 stats_.connection_creation_time = clock_->ApproximateNow(); 253 stats_.connection_creation_time = clock_->ApproximateNow();
254 sent_packet_manager_.set_network_change_visitor(&packet_generator_); 254 sent_packet_manager_.set_network_change_visitor(this);
255 } 255 }
256 256
257 QuicConnection::~QuicConnection() { 257 QuicConnection::~QuicConnection() {
258 if (owns_writer_) { 258 if (owns_writer_) {
259 delete writer_; 259 delete writer_;
260 } 260 }
261 STLDeleteElements(&undecryptable_packets_); 261 STLDeleteElements(&undecryptable_packets_);
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) {
(...skipping 1270 matching lines...) Expand 10 before | Expand all | Expand 10 after
1535 set_encryption_level(encryption_level_); 1535 set_encryption_level(encryption_level_);
1536 } 1536 }
1537 sent_packet_manager_.OnSerializedPacket(serialized_packet); 1537 sent_packet_manager_.OnSerializedPacket(serialized_packet);
1538 // The TransmissionType is NOT_RETRANSMISSION because all retransmissions 1538 // The TransmissionType is NOT_RETRANSMISSION because all retransmissions
1539 // serialize packets and invoke SendOrQueuePacket directly. 1539 // serialize packets and invoke SendOrQueuePacket directly.
1540 return SendOrQueuePacket(encryption_level_, 1540 return SendOrQueuePacket(encryption_level_,
1541 serialized_packet, 1541 serialized_packet,
1542 NOT_RETRANSMISSION); 1542 NOT_RETRANSMISSION);
1543 } 1543 }
1544 1544
1545 void QuicConnection::OnCongestionWindowChange(QuicByteCount congestion_window) {
1546 packet_generator_.OnCongestionWindowChange(congestion_window);
1547 visitor_->OnCongestionWindowChange(clock_->ApproximateNow());
1548 }
1549
1545 void QuicConnection::OnHandshakeComplete() { 1550 void QuicConnection::OnHandshakeComplete() {
1546 sent_packet_manager_.SetHandshakeConfirmed(); 1551 sent_packet_manager_.SetHandshakeConfirmed();
1547 } 1552 }
1548 1553
1549 bool QuicConnection::SendOrQueuePacket(EncryptionLevel level, 1554 bool QuicConnection::SendOrQueuePacket(EncryptionLevel level,
1550 const SerializedPacket& packet, 1555 const SerializedPacket& packet,
1551 TransmissionType transmission_type) { 1556 TransmissionType transmission_type) {
1552 if (packet.packet == NULL) { 1557 if (packet.packet == NULL) {
1553 LOG(DFATAL) << "NULL packet passed in to SendOrQueuePacket"; 1558 LOG(DFATAL) << "NULL packet passed in to SendOrQueuePacket";
1554 return true; 1559 return true;
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after
2009 // If we changed the generator's batch state, restore original batch state. 2014 // If we changed the generator's batch state, restore original batch state.
2010 if (!already_in_batch_mode_) { 2015 if (!already_in_batch_mode_) {
2011 DVLOG(1) << "Leaving Batch Mode."; 2016 DVLOG(1) << "Leaving Batch Mode.";
2012 connection_->packet_generator_.FinishBatchOperations(); 2017 connection_->packet_generator_.FinishBatchOperations();
2013 } 2018 }
2014 DCHECK_EQ(already_in_batch_mode_, 2019 DCHECK_EQ(already_in_batch_mode_,
2015 connection_->packet_generator_.InBatchMode()); 2020 connection_->packet_generator_.InBatchMode());
2016 } 2021 }
2017 2022
2018 } // namespace net 2023 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698