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

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

Issue 301173007: Replaced options from QuicPacketCreator with members and explicit (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « net/quic/quic_connection.h ('k') | net/quic/quic_connection_test.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 1048 matching lines...) Expand 10 before | Expand all | Expand 10 after
1059 1059
1060 const QuicConnectionStats& QuicConnection::GetStats() { 1060 const QuicConnectionStats& QuicConnection::GetStats() {
1061 // Update rtt and estimated bandwidth. 1061 // Update rtt and estimated bandwidth.
1062 stats_.min_rtt_us = 1062 stats_.min_rtt_us =
1063 sent_packet_manager_.GetRttStats()->min_rtt().ToMicroseconds(); 1063 sent_packet_manager_.GetRttStats()->min_rtt().ToMicroseconds();
1064 stats_.srtt_us = 1064 stats_.srtt_us =
1065 sent_packet_manager_.GetRttStats()->SmoothedRtt().ToMicroseconds(); 1065 sent_packet_manager_.GetRttStats()->SmoothedRtt().ToMicroseconds();
1066 stats_.estimated_bandwidth = 1066 stats_.estimated_bandwidth =
1067 sent_packet_manager_.BandwidthEstimate().ToBytesPerSecond(); 1067 sent_packet_manager_.BandwidthEstimate().ToBytesPerSecond();
1068 stats_.congestion_window = sent_packet_manager_.GetCongestionWindow(); 1068 stats_.congestion_window = sent_packet_manager_.GetCongestionWindow();
1069 stats_.max_packet_size = options()->max_packet_length; 1069 stats_.max_packet_size = packet_creator_.max_packet_length();
1070 return stats_; 1070 return stats_;
1071 } 1071 }
1072 1072
1073 void QuicConnection::ProcessUdpPacket(const IPEndPoint& self_address, 1073 void QuicConnection::ProcessUdpPacket(const IPEndPoint& self_address,
1074 const IPEndPoint& peer_address, 1074 const IPEndPoint& peer_address,
1075 const QuicEncryptedPacket& packet) { 1075 const QuicEncryptedPacket& packet) {
1076 if (!connected_) { 1076 if (!connected_) {
1077 return; 1077 return;
1078 } 1078 }
1079 if (debug_visitor_) { 1079 if (debug_visitor_) {
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
1189 << peer_address_.port() << " to " << migrating_peer_port_ 1189 << peer_address_.port() << " to " << migrating_peer_port_
1190 << ", migrating connection."; 1190 << ", migrating connection.";
1191 peer_address_ = IPEndPoint(peer_address_.address(), migrating_peer_port_); 1191 peer_address_ = IPEndPoint(peer_address_.address(), migrating_peer_port_);
1192 } 1192 }
1193 1193
1194 time_of_last_received_packet_ = clock_->Now(); 1194 time_of_last_received_packet_ = clock_->Now();
1195 DVLOG(1) << ENDPOINT << "time of last received packet: " 1195 DVLOG(1) << ENDPOINT << "time of last received packet: "
1196 << time_of_last_received_packet_.ToDebuggingValue(); 1196 << time_of_last_received_packet_.ToDebuggingValue();
1197 1197
1198 if (is_server_ && encryption_level_ == ENCRYPTION_NONE && 1198 if (is_server_ && encryption_level_ == ENCRYPTION_NONE &&
1199 last_size_ > options()->max_packet_length) { 1199 last_size_ > packet_creator_.max_packet_length()) {
1200 options()->max_packet_length = last_size_; 1200 packet_creator_.set_max_packet_length(last_size_);
1201 } 1201 }
1202 return true; 1202 return true;
1203 } 1203 }
1204 1204
1205 void QuicConnection::WriteQueuedPackets() { 1205 void QuicConnection::WriteQueuedPackets() {
1206 DCHECK(!writer_->IsWriteBlocked()); 1206 DCHECK(!writer_->IsWriteBlocked());
1207 1207
1208 if (pending_version_negotiation_packet_) { 1208 if (pending_version_negotiation_packet_) {
1209 SendVersionNegotiationPacket(); 1209 SendVersionNegotiationPacket();
1210 } 1210 }
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
1368 // This assures we won't try to write *forced* packets when blocked. 1368 // This assures we won't try to write *forced* packets when blocked.
1369 // Return true to stop processing. 1369 // Return true to stop processing.
1370 if (writer_->IsWriteBlocked()) { 1370 if (writer_->IsWriteBlocked()) {
1371 visitor_->OnWriteBlocked(); 1371 visitor_->OnWriteBlocked();
1372 return true; 1372 return true;
1373 } 1373 }
1374 } else { 1374 } else {
1375 encrypted_deleter.reset(encrypted); 1375 encrypted_deleter.reset(encrypted);
1376 } 1376 }
1377 1377
1378 LOG_IF(DFATAL, encrypted->length() > options()->max_packet_length) 1378 LOG_IF(DFATAL, encrypted->length() >
1379 packet_creator_.max_packet_length())
1379 << "Writing an encrypted packet larger than max_packet_length:" 1380 << "Writing an encrypted packet larger than max_packet_length:"
1380 << options()->max_packet_length << " encrypted length: " 1381 << packet_creator_.max_packet_length() << " encrypted length: "
1381 << encrypted->length(); 1382 << encrypted->length();
1382 DVLOG(1) << ENDPOINT << "Sending packet " << sequence_number 1383 DVLOG(1) << ENDPOINT << "Sending packet " << sequence_number
1383 << " : " << (packet.packet->is_fec_packet() ? "FEC " : 1384 << " : " << (packet.packet->is_fec_packet() ? "FEC " :
1384 (packet.retransmittable == HAS_RETRANSMITTABLE_DATA 1385 (packet.retransmittable == HAS_RETRANSMITTABLE_DATA
1385 ? "data bearing " : " ack only ")) 1386 ? "data bearing " : " ack only "))
1386 << ", encryption level: " 1387 << ", encryption level: "
1387 << QuicUtils::EncryptionLevelToString(packet.encryption_level) 1388 << QuicUtils::EncryptionLevelToString(packet.encryption_level)
1388 << ", length:" << packet.packet->length() << ", encrypted length:" 1389 << ", length:" << packet.packet->length() << ", encrypted length:"
1389 << encrypted->length(); 1390 << encrypted->length();
1390 DVLOG(2) << ENDPOINT << "packet(" << sequence_number << "): " << std::endl 1391 DVLOG(2) << ENDPOINT << "packet(" << sequence_number << "): " << std::endl
(...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after
1972 // If we changed the generator's batch state, restore original batch state. 1973 // If we changed the generator's batch state, restore original batch state.
1973 if (!already_in_batch_mode_) { 1974 if (!already_in_batch_mode_) {
1974 DVLOG(1) << "Leaving Batch Mode."; 1975 DVLOG(1) << "Leaving Batch Mode.";
1975 connection_->packet_generator_.FinishBatchOperations(); 1976 connection_->packet_generator_.FinishBatchOperations();
1976 } 1977 }
1977 DCHECK_EQ(already_in_batch_mode_, 1978 DCHECK_EQ(already_in_batch_mode_,
1978 connection_->packet_generator_.InBatchMode()); 1979 connection_->packet_generator_.InBatchMode());
1979 } 1980 }
1980 1981
1981 } // namespace net 1982 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_connection.h ('k') | net/quic/quic_connection_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698