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

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

Issue 1777423002: Remove max_packet_length from QuicPacketGenerator, because it is no longer necessary with FEC gone.… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@116277228
Patch Set: Created 4 years, 9 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 | « no previous file | net/quic/quic_packet_generator.h » ('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 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 1184 matching lines...) Expand 10 before | Expand all | Expand 10 after
1195 stats_.min_rtt_us = min_rtt.ToMicroseconds(); 1195 stats_.min_rtt_us = min_rtt.ToMicroseconds();
1196 1196
1197 QuicTime::Delta srtt = rtt_stats->smoothed_rtt(); 1197 QuicTime::Delta srtt = rtt_stats->smoothed_rtt();
1198 if (srtt.IsZero()) { 1198 if (srtt.IsZero()) {
1199 // If SRTT has not been set, use initial RTT instead. 1199 // If SRTT has not been set, use initial RTT instead.
1200 srtt = QuicTime::Delta::FromMicroseconds(rtt_stats->initial_rtt_us()); 1200 srtt = QuicTime::Delta::FromMicroseconds(rtt_stats->initial_rtt_us());
1201 } 1201 }
1202 stats_.srtt_us = srtt.ToMicroseconds(); 1202 stats_.srtt_us = srtt.ToMicroseconds();
1203 1203
1204 stats_.estimated_bandwidth = sent_packet_manager_.BandwidthEstimate(); 1204 stats_.estimated_bandwidth = sent_packet_manager_.BandwidthEstimate();
1205 stats_.max_packet_size = packet_generator_.GetMaxPacketLength(); 1205 stats_.max_packet_size = packet_generator_.GetCurrentMaxPacketLength();
1206 stats_.max_received_packet_size = largest_received_packet_size_; 1206 stats_.max_received_packet_size = largest_received_packet_size_;
1207 return stats_; 1207 return stats_;
1208 } 1208 }
1209 1209
1210 void QuicConnection::ProcessUdpPacket(const IPEndPoint& self_address, 1210 void QuicConnection::ProcessUdpPacket(const IPEndPoint& self_address,
1211 const IPEndPoint& peer_address, 1211 const IPEndPoint& peer_address,
1212 const QuicEncryptedPacket& packet) { 1212 const QuicEncryptedPacket& packet) {
1213 if (!connected_) { 1213 if (!connected_) {
1214 return; 1214 return;
1215 } 1215 }
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
1406 time_of_last_received_packet_ = clock_->Now(); 1406 time_of_last_received_packet_ = clock_->Now();
1407 DVLOG(1) << ENDPOINT << "time of last received packet: " 1407 DVLOG(1) << ENDPOINT << "time of last received packet: "
1408 << time_of_last_received_packet_.ToDebuggingValue(); 1408 << time_of_last_received_packet_.ToDebuggingValue();
1409 1409
1410 if (last_size_ > largest_received_packet_size_) { 1410 if (last_size_ > largest_received_packet_size_) {
1411 largest_received_packet_size_ = last_size_; 1411 largest_received_packet_size_ = last_size_;
1412 } 1412 }
1413 1413
1414 if (perspective_ == Perspective::IS_SERVER && 1414 if (perspective_ == Perspective::IS_SERVER &&
1415 encryption_level_ == ENCRYPTION_NONE && 1415 encryption_level_ == ENCRYPTION_NONE &&
1416 last_size_ > packet_generator_.GetMaxPacketLength()) { 1416 last_size_ > packet_generator_.GetCurrentMaxPacketLength()) {
1417 SetMaxPacketLength(last_size_); 1417 SetMaxPacketLength(last_size_);
1418 } 1418 }
1419 return true; 1419 return true;
1420 } 1420 }
1421 1421
1422 void QuicConnection::WriteQueuedPackets() { 1422 void QuicConnection::WriteQueuedPackets() {
1423 DCHECK(!writer_->IsWriteBlocked()); 1423 DCHECK(!writer_->IsWriteBlocked());
1424 1424
1425 if (pending_version_negotiation_packet_) { 1425 if (pending_version_negotiation_packet_) {
1426 SendVersionNegotiationPacket(); 1426 SendVersionNegotiationPacket();
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
1561 new QuicEncryptedPacket(buffer_copy, encrypted_length, true)); 1561 new QuicEncryptedPacket(buffer_copy, encrypted_length, true));
1562 // This assures we won't try to write *forced* packets when blocked. 1562 // This assures we won't try to write *forced* packets when blocked.
1563 // Return true to stop processing. 1563 // Return true to stop processing.
1564 if (writer_->IsWriteBlocked()) { 1564 if (writer_->IsWriteBlocked()) {
1565 visitor_->OnWriteBlocked(); 1565 visitor_->OnWriteBlocked();
1566 return true; 1566 return true;
1567 } 1567 }
1568 } 1568 }
1569 1569
1570 DCHECK_LE(encrypted_length, kMaxPacketSize); 1570 DCHECK_LE(encrypted_length, kMaxPacketSize);
1571 DCHECK_LE(encrypted_length, packet_generator_.GetMaxPacketLength()); 1571 DCHECK_LE(encrypted_length, packet_generator_.GetCurrentMaxPacketLength());
1572 DVLOG(1) << ENDPOINT << "Sending packet " << packet_number << " : " 1572 DVLOG(1) << ENDPOINT << "Sending packet " << packet_number << " : "
1573 << (packet->is_fec_packet 1573 << (packet->is_fec_packet
1574 ? "FEC " 1574 ? "FEC "
1575 : (IsRetransmittable(*packet) == HAS_RETRANSMITTABLE_DATA 1575 : (IsRetransmittable(*packet) == HAS_RETRANSMITTABLE_DATA
1576 ? "data bearing " 1576 ? "data bearing "
1577 : " ack only ")) 1577 : " ack only "))
1578 << ", encryption level: " 1578 << ", encryption level: "
1579 << QuicUtils::EncryptionLevelToString(packet->encryption_level) 1579 << QuicUtils::EncryptionLevelToString(packet->encryption_level)
1580 << ", encrypted length:" << encrypted_length; 1580 << ", encrypted length:" << encrypted_length;
1581 DVLOG(2) << ENDPOINT << "packet(" << packet_number << "): " << std::endl 1581 DVLOG(2) << ENDPOINT << "packet(" << packet_number << "): " << std::endl
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after
1975 DVLOG(1) << ENDPOINT << "Going away with error " 1975 DVLOG(1) << ENDPOINT << "Going away with error "
1976 << QuicUtils::ErrorToString(error) << " (" << error << ")"; 1976 << QuicUtils::ErrorToString(error) << " (" << error << ")";
1977 1977
1978 // Opportunistically bundle an ack with this outgoing packet. 1978 // Opportunistically bundle an ack with this outgoing packet.
1979 ScopedPacketBundler ack_bundler(this, BUNDLE_PENDING_ACK); 1979 ScopedPacketBundler ack_bundler(this, BUNDLE_PENDING_ACK);
1980 packet_generator_.AddControlFrame( 1980 packet_generator_.AddControlFrame(
1981 QuicFrame(new QuicGoAwayFrame(error, last_good_stream_id, reason))); 1981 QuicFrame(new QuicGoAwayFrame(error, last_good_stream_id, reason)));
1982 } 1982 }
1983 1983
1984 QuicByteCount QuicConnection::max_packet_length() const { 1984 QuicByteCount QuicConnection::max_packet_length() const {
1985 return packet_generator_.GetMaxPacketLength(); 1985 return packet_generator_.GetCurrentMaxPacketLength();
1986 } 1986 }
1987 1987
1988 void QuicConnection::SetMaxPacketLength(QuicByteCount length) { 1988 void QuicConnection::SetMaxPacketLength(QuicByteCount length) {
1989 return packet_generator_.SetMaxPacketLength(LimitMaxPacketSize(length)); 1989 return packet_generator_.SetMaxPacketLength(LimitMaxPacketSize(length));
1990 } 1990 }
1991 1991
1992 bool QuicConnection::HasQueuedData() const { 1992 bool QuicConnection::HasQueuedData() const {
1993 return pending_version_negotiation_packet_ || !queued_packets_.empty() || 1993 return pending_version_negotiation_packet_ || !queued_packets_.empty() ||
1994 packet_generator_.HasQueuedFrames(); 1994 packet_generator_.HasQueuedFrames();
1995 } 1995 }
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after
2347 } 2347 }
2348 2348
2349 StringPiece QuicConnection::GetCurrentPacket() { 2349 StringPiece QuicConnection::GetCurrentPacket() {
2350 if (current_packet_data_ == nullptr) { 2350 if (current_packet_data_ == nullptr) {
2351 return StringPiece(); 2351 return StringPiece();
2352 } 2352 }
2353 return StringPiece(current_packet_data_, last_size_); 2353 return StringPiece(current_packet_data_, last_size_);
2354 } 2354 }
2355 2355
2356 } // namespace net 2356 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | net/quic/quic_packet_generator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698