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

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

Issue 329933003: Refactor the Connection and Generator so the Creator is completely (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 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 received_packet_manager_(kTCP, &stats_), 212 received_packet_manager_(kTCP, &stats_),
213 ack_queued_(false), 213 ack_queued_(false),
214 stop_waiting_count_(0), 214 stop_waiting_count_(0),
215 ack_alarm_(helper->CreateAlarm(new AckAlarm(this))), 215 ack_alarm_(helper->CreateAlarm(new AckAlarm(this))),
216 retransmission_alarm_(helper->CreateAlarm(new RetransmissionAlarm(this))), 216 retransmission_alarm_(helper->CreateAlarm(new RetransmissionAlarm(this))),
217 send_alarm_(helper->CreateAlarm(new SendAlarm(this))), 217 send_alarm_(helper->CreateAlarm(new SendAlarm(this))),
218 resume_writes_alarm_(helper->CreateAlarm(new SendAlarm(this))), 218 resume_writes_alarm_(helper->CreateAlarm(new SendAlarm(this))),
219 timeout_alarm_(helper->CreateAlarm(new TimeoutAlarm(this))), 219 timeout_alarm_(helper->CreateAlarm(new TimeoutAlarm(this))),
220 ping_alarm_(helper->CreateAlarm(new PingAlarm(this))), 220 ping_alarm_(helper->CreateAlarm(new PingAlarm(this))),
221 debug_visitor_(NULL), 221 debug_visitor_(NULL),
222 packet_creator_(connection_id_, &framer_, random_generator_, is_server), 222 packet_generator_(connection_id_, &framer_, random_generator_, this),
223 packet_generator_(this, NULL, &packet_creator_),
224 idle_network_timeout_( 223 idle_network_timeout_(
225 QuicTime::Delta::FromSeconds(kDefaultInitialTimeoutSecs)), 224 QuicTime::Delta::FromSeconds(kDefaultInitialTimeoutSecs)),
226 overall_connection_timeout_(QuicTime::Delta::Infinite()), 225 overall_connection_timeout_(QuicTime::Delta::Infinite()),
227 time_of_last_received_packet_(clock_->ApproximateNow()), 226 time_of_last_received_packet_(clock_->ApproximateNow()),
228 time_of_last_sent_new_packet_(clock_->ApproximateNow()), 227 time_of_last_sent_new_packet_(clock_->ApproximateNow()),
229 sequence_number_of_last_sent_packet_(0), 228 sequence_number_of_last_sent_packet_(0),
230 sent_packet_manager_( 229 sent_packet_manager_(
231 is_server, clock_, &stats_, kTCP, 230 is_server, clock_, &stats_, kTCP,
232 FLAGS_quic_use_time_loss_detection ? kTime : kNack), 231 FLAGS_quic_use_time_loss_detection ? kTime : kNack),
233 version_negotiation_state_(START_NEGOTIATION), 232 version_negotiation_state_(START_NEGOTIATION),
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
471 } else { 470 } else {
472 DCHECK_EQ(1u, header.public_header.versions.size()); 471 DCHECK_EQ(1u, header.public_header.versions.size());
473 DCHECK_EQ(header.public_header.versions[0], version()); 472 DCHECK_EQ(header.public_header.versions[0], version());
474 version_negotiation_state_ = NEGOTIATED_VERSION; 473 version_negotiation_state_ = NEGOTIATED_VERSION;
475 visitor_->OnSuccessfulVersionNegotiation(version()); 474 visitor_->OnSuccessfulVersionNegotiation(version());
476 } 475 }
477 } else { 476 } else {
478 DCHECK(!header.public_header.version_flag); 477 DCHECK(!header.public_header.version_flag);
479 // If the client gets a packet without the version flag from the server 478 // If the client gets a packet without the version flag from the server
480 // it should stop sending version since the version negotiation is done. 479 // it should stop sending version since the version negotiation is done.
481 packet_creator_.StopSendingVersion(); 480 packet_generator_.StopSendingVersion();
482 version_negotiation_state_ = NEGOTIATED_VERSION; 481 version_negotiation_state_ = NEGOTIATED_VERSION;
483 visitor_->OnSuccessfulVersionNegotiation(version()); 482 visitor_->OnSuccessfulVersionNegotiation(version());
484 } 483 }
485 } 484 }
486 485
487 DCHECK_EQ(NEGOTIATED_VERSION, version_negotiation_state_); 486 DCHECK_EQ(NEGOTIATED_VERSION, version_negotiation_state_);
488 487
489 --stats_.packets_dropped; 488 --stats_.packets_dropped;
490 DVLOG(1) << ENDPOINT << "Received packet header: " << header; 489 DVLOG(1) << ENDPOINT << "Received packet header: " << header;
491 last_header_ = header; 490 last_header_ = header;
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
609 bool QuicConnection::OnPingFrame(const QuicPingFrame& frame) { 608 bool QuicConnection::OnPingFrame(const QuicPingFrame& frame) {
610 DCHECK(connected_); 609 DCHECK(connected_);
611 if (debug_visitor_) { 610 if (debug_visitor_) {
612 debug_visitor_->OnPingFrame(frame); 611 debug_visitor_->OnPingFrame(frame);
613 } 612 }
614 return true; 613 return true;
615 } 614 }
616 615
617 bool QuicConnection::ValidateAckFrame(const QuicAckFrame& incoming_ack) { 616 bool QuicConnection::ValidateAckFrame(const QuicAckFrame& incoming_ack) {
618 if (incoming_ack.received_info.largest_observed > 617 if (incoming_ack.received_info.largest_observed >
619 packet_creator_.sequence_number()) { 618 packet_generator_.sequence_number()) {
620 DLOG(ERROR) << ENDPOINT << "Peer's observed unsent packet:" 619 DLOG(ERROR) << ENDPOINT << "Peer's observed unsent packet:"
621 << incoming_ack.received_info.largest_observed << " vs " 620 << incoming_ack.received_info.largest_observed << " vs "
622 << packet_creator_.sequence_number(); 621 << packet_generator_.sequence_number();
623 // We got an error for data we have not sent. Error out. 622 // We got an error for data we have not sent. Error out.
624 return false; 623 return false;
625 } 624 }
626 625
627 if (incoming_ack.received_info.largest_observed < 626 if (incoming_ack.received_info.largest_observed <
628 received_packet_manager_.peer_largest_observed_packet()) { 627 received_packet_manager_.peer_largest_observed_packet()) {
629 DLOG(ERROR) << ENDPOINT << "Peer's largest_observed packet decreased:" 628 DLOG(ERROR) << ENDPOINT << "Peer's largest_observed packet decreased:"
630 << incoming_ack.received_info.largest_observed << " vs " 629 << incoming_ack.received_info.largest_observed << " vs "
631 << received_packet_manager_.peer_largest_observed_packet(); 630 << received_packet_manager_.peer_largest_observed_packet();
632 // A new ack has a diminished largest_observed value. Error out. 631 // A new ack has a diminished largest_observed value. Error out.
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
931 *last_ack_frames_.back().received_info.missing_packets.begin()) { 930 *last_ack_frames_.back().received_info.missing_packets.begin()) {
932 ++stop_waiting_count_; 931 ++stop_waiting_count_;
933 } else { 932 } else {
934 stop_waiting_count_ = 0; 933 stop_waiting_count_ = 0;
935 } 934 }
936 } 935 }
937 936
938 QuicPacketSequenceNumber QuicConnection::GetLeastUnacked() const { 937 QuicPacketSequenceNumber QuicConnection::GetLeastUnacked() const {
939 return sent_packet_manager_.HasUnackedPackets() ? 938 return sent_packet_manager_.HasUnackedPackets() ?
940 sent_packet_manager_.GetLeastUnackedSentPacket() : 939 sent_packet_manager_.GetLeastUnackedSentPacket() :
941 packet_creator_.sequence_number() + 1; 940 packet_generator_.sequence_number() + 1;
942 } 941 }
943 942
944 void QuicConnection::MaybeSendInResponseToPacket() { 943 void QuicConnection::MaybeSendInResponseToPacket() {
945 if (!connected_) { 944 if (!connected_) {
946 return; 945 return;
947 } 946 }
948 ScopedPacketBundler bundler(this, ack_queued_ ? SEND_ACK : NO_ACK); 947 ScopedPacketBundler bundler(this, ack_queued_ ? SEND_ACK : NO_ACK);
949 948
950 // Now that we have received an ack, we might be able to send packets which 949 // Now that we have received an ack, we might be able to send packets which
951 // are queued locally, or drain streams which are blocked. 950 // are queued locally, or drain streams which are blocked.
952 if (CanWrite(HAS_RETRANSMITTABLE_DATA)) { 951 if (CanWrite(HAS_RETRANSMITTABLE_DATA)) {
953 OnCanWrite(); 952 OnCanWrite();
954 } 953 }
955 } 954 }
956 955
957 void QuicConnection::SendVersionNegotiationPacket() { 956 void QuicConnection::SendVersionNegotiationPacket() {
958 // TODO(alyssar): implement zero server state negotiation. 957 // TODO(alyssar): implement zero server state negotiation.
959 pending_version_negotiation_packet_ = true; 958 pending_version_negotiation_packet_ = true;
960 if (writer_->IsWriteBlocked()) { 959 if (writer_->IsWriteBlocked()) {
961 visitor_->OnWriteBlocked(); 960 visitor_->OnWriteBlocked();
962 return; 961 return;
963 } 962 }
964 scoped_ptr<QuicEncryptedPacket> version_packet( 963 scoped_ptr<QuicEncryptedPacket> version_packet(
965 packet_creator_.SerializeVersionNegotiationPacket( 964 packet_generator_.SerializeVersionNegotiationPacket(
966 framer_.supported_versions())); 965 framer_.supported_versions()));
967 WriteResult result = writer_->WritePacket( 966 WriteResult result = writer_->WritePacket(
968 version_packet->data(), version_packet->length(), 967 version_packet->data(), version_packet->length(),
969 self_address().address(), peer_address()); 968 self_address().address(), peer_address());
970 969
971 if (result.status == WRITE_STATUS_ERROR) { 970 if (result.status == WRITE_STATUS_ERROR) {
972 // We can't send an error as the socket is presumably borked. 971 // We can't send an error as the socket is presumably borked.
973 CloseConnection(QUIC_PACKET_WRITE_ERROR, false); 972 CloseConnection(QUIC_PACKET_WRITE_ERROR, false);
974 return; 973 return;
975 } 974 }
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
1054 1053
1055 const QuicConnectionStats& QuicConnection::GetStats() { 1054 const QuicConnectionStats& QuicConnection::GetStats() {
1056 // Update rtt and estimated bandwidth. 1055 // Update rtt and estimated bandwidth.
1057 stats_.min_rtt_us = 1056 stats_.min_rtt_us =
1058 sent_packet_manager_.GetRttStats()->min_rtt().ToMicroseconds(); 1057 sent_packet_manager_.GetRttStats()->min_rtt().ToMicroseconds();
1059 stats_.srtt_us = 1058 stats_.srtt_us =
1060 sent_packet_manager_.GetRttStats()->SmoothedRtt().ToMicroseconds(); 1059 sent_packet_manager_.GetRttStats()->SmoothedRtt().ToMicroseconds();
1061 stats_.estimated_bandwidth = 1060 stats_.estimated_bandwidth =
1062 sent_packet_manager_.BandwidthEstimate().ToBytesPerSecond(); 1061 sent_packet_manager_.BandwidthEstimate().ToBytesPerSecond();
1063 stats_.congestion_window = sent_packet_manager_.GetCongestionWindow(); 1062 stats_.congestion_window = sent_packet_manager_.GetCongestionWindow();
1064 stats_.max_packet_size = packet_creator_.max_packet_length(); 1063 stats_.max_packet_size = packet_generator_.max_packet_length();
1065 return stats_; 1064 return stats_;
1066 } 1065 }
1067 1066
1068 void QuicConnection::ProcessUdpPacket(const IPEndPoint& self_address, 1067 void QuicConnection::ProcessUdpPacket(const IPEndPoint& self_address,
1069 const IPEndPoint& peer_address, 1068 const IPEndPoint& peer_address,
1070 const QuicEncryptedPacket& packet) { 1069 const QuicEncryptedPacket& packet) {
1071 if (!connected_) { 1070 if (!connected_) {
1072 return; 1071 return;
1073 } 1072 }
1074 if (debug_visitor_) { 1073 if (debug_visitor_) {
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
1184 << peer_address_.port() << " to " << migrating_peer_port_ 1183 << peer_address_.port() << " to " << migrating_peer_port_
1185 << ", migrating connection."; 1184 << ", migrating connection.";
1186 peer_address_ = IPEndPoint(peer_address_.address(), migrating_peer_port_); 1185 peer_address_ = IPEndPoint(peer_address_.address(), migrating_peer_port_);
1187 } 1186 }
1188 1187
1189 time_of_last_received_packet_ = clock_->Now(); 1188 time_of_last_received_packet_ = clock_->Now();
1190 DVLOG(1) << ENDPOINT << "time of last received packet: " 1189 DVLOG(1) << ENDPOINT << "time of last received packet: "
1191 << time_of_last_received_packet_.ToDebuggingValue(); 1190 << time_of_last_received_packet_.ToDebuggingValue();
1192 1191
1193 if (is_server_ && encryption_level_ == ENCRYPTION_NONE && 1192 if (is_server_ && encryption_level_ == ENCRYPTION_NONE &&
1194 last_size_ > packet_creator_.max_packet_length()) { 1193 last_size_ > packet_generator_.max_packet_length()) {
1195 packet_creator_.set_max_packet_length(last_size_); 1194 packet_generator_.set_max_packet_length(last_size_);
1196 } 1195 }
1197 return true; 1196 return true;
1198 } 1197 }
1199 1198
1200 void QuicConnection::WriteQueuedPackets() { 1199 void QuicConnection::WriteQueuedPackets() {
1201 DCHECK(!writer_->IsWriteBlocked()); 1200 DCHECK(!writer_->IsWriteBlocked());
1202 1201
1203 if (pending_version_negotiation_packet_) { 1202 if (pending_version_negotiation_packet_) {
1204 SendVersionNegotiationPacket(); 1203 SendVersionNegotiationPacket();
1205 } 1204 }
(...skipping 24 matching lines...) Expand all
1230 } 1229 }
1231 1230
1232 // Re-packetize the frames with a new sequence number for retransmission. 1231 // Re-packetize the frames with a new sequence number for retransmission.
1233 // Retransmitted data packets do not use FEC, even when it's enabled. 1232 // Retransmitted data packets do not use FEC, even when it's enabled.
1234 // Retransmitted packets use the same sequence number length as the 1233 // Retransmitted packets use the same sequence number length as the
1235 // original. 1234 // original.
1236 // Flush the packet creator before making a new packet. 1235 // Flush the packet creator before making a new packet.
1237 // TODO(ianswett): Implement ReserializeAllFrames as a separate path that 1236 // TODO(ianswett): Implement ReserializeAllFrames as a separate path that
1238 // does not require the creator to be flushed. 1237 // does not require the creator to be flushed.
1239 Flush(); 1238 Flush();
1240 SerializedPacket serialized_packet = packet_creator_.ReserializeAllFrames( 1239 SerializedPacket serialized_packet = packet_generator_.ReserializeAllFrames(
1241 pending.retransmittable_frames.frames(), 1240 pending.retransmittable_frames.frames(),
1242 pending.sequence_number_length); 1241 pending.sequence_number_length);
1243 1242
1244 DVLOG(1) << ENDPOINT << "Retransmitting " << pending.sequence_number 1243 DVLOG(1) << ENDPOINT << "Retransmitting " << pending.sequence_number
1245 << " as " << serialized_packet.sequence_number; 1244 << " as " << serialized_packet.sequence_number;
1246 if (debug_visitor_) { 1245 if (debug_visitor_) {
1247 debug_visitor_->OnPacketRetransmitted( 1246 debug_visitor_->OnPacketRetransmitted(
1248 pending.sequence_number, serialized_packet.sequence_number); 1247 pending.sequence_number, serialized_packet.sequence_number);
1249 } 1248 }
1250 sent_packet_manager_.OnRetransmittedPacket( 1249 sent_packet_manager_.OnRetransmittedPacket(
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
1354 // Return true to stop processing. 1353 // Return true to stop processing.
1355 if (writer_->IsWriteBlocked()) { 1354 if (writer_->IsWriteBlocked()) {
1356 visitor_->OnWriteBlocked(); 1355 visitor_->OnWriteBlocked();
1357 return true; 1356 return true;
1358 } 1357 }
1359 } else { 1358 } else {
1360 encrypted_deleter.reset(encrypted); 1359 encrypted_deleter.reset(encrypted);
1361 } 1360 }
1362 1361
1363 LOG_IF(DFATAL, encrypted->length() > 1362 LOG_IF(DFATAL, encrypted->length() >
1364 packet_creator_.max_packet_length()) 1363 packet_generator_.max_packet_length())
1365 << "Writing an encrypted packet larger than max_packet_length:" 1364 << "Writing an encrypted packet larger than max_packet_length:"
1366 << packet_creator_.max_packet_length() << " encrypted length: " 1365 << packet_generator_.max_packet_length() << " encrypted length: "
1367 << encrypted->length(); 1366 << encrypted->length();
1368 DVLOG(1) << ENDPOINT << "Sending packet " << sequence_number 1367 DVLOG(1) << ENDPOINT << "Sending packet " << sequence_number
1369 << " : " << (packet.packet->is_fec_packet() ? "FEC " : 1368 << " : " << (packet.packet->is_fec_packet() ? "FEC " :
1370 (packet.retransmittable == HAS_RETRANSMITTABLE_DATA 1369 (packet.retransmittable == HAS_RETRANSMITTABLE_DATA
1371 ? "data bearing " : " ack only ")) 1370 ? "data bearing " : " ack only "))
1372 << ", encryption level: " 1371 << ", encryption level: "
1373 << QuicUtils::EncryptionLevelToString(packet.encryption_level) 1372 << QuicUtils::EncryptionLevelToString(packet.encryption_level)
1374 << ", length:" << packet.packet->length() << ", encrypted length:" 1373 << ", length:" << packet.packet->length() << ", encrypted length:"
1375 << encrypted->length(); 1374 << encrypted->length();
1376 DVLOG(2) << ENDPOINT << "packet(" << sequence_number << "): " << std::endl 1375 DVLOG(2) << ENDPOINT << "packet(" << sequence_number << "): " << std::endl
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
1484 QuicTime now = clock_->Now(); 1483 QuicTime now = clock_->Now();
1485 if (transmission_type == NOT_RETRANSMISSION) { 1484 if (transmission_type == NOT_RETRANSMISSION) {
1486 time_of_last_sent_new_packet_ = now; 1485 time_of_last_sent_new_packet_ = now;
1487 } 1486 }
1488 SetPingAlarm(); 1487 SetPingAlarm();
1489 DVLOG(1) << ENDPOINT << "time of last sent packet: " 1488 DVLOG(1) << ENDPOINT << "time of last sent packet: "
1490 << now.ToDebuggingValue(); 1489 << now.ToDebuggingValue();
1491 1490
1492 // TODO(ianswett): Change the sequence number length and other packet creator 1491 // TODO(ianswett): Change the sequence number length and other packet creator
1493 // options by a more explicit API than setting a struct value directly. 1492 // options by a more explicit API than setting a struct value directly.
1494 packet_creator_.UpdateSequenceNumberLength( 1493 packet_generator_.UpdateSequenceNumberLength(
1495 received_packet_manager_.least_packet_awaited_by_peer(), 1494 received_packet_manager_.least_packet_awaited_by_peer(),
1496 sent_packet_manager_.GetCongestionWindow()); 1495 sent_packet_manager_.GetCongestionWindow());
1497 1496
1498 bool reset_retransmission_alarm = 1497 bool reset_retransmission_alarm =
1499 sent_packet_manager_.OnPacketSent(sequence_number, now, length, 1498 sent_packet_manager_.OnPacketSent(sequence_number, now, length,
1500 transmission_type, retransmittable); 1499 transmission_type, retransmittable);
1501 1500
1502 if (reset_retransmission_alarm || !retransmission_alarm_->IsSet()) { 1501 if (reset_retransmission_alarm || !retransmission_alarm_->IsSet()) {
1503 retransmission_alarm_->Cancel(); 1502 retransmission_alarm_->Cancel();
1504 QuicTime retransmission_time = sent_packet_manager_.GetRetransmissionTime(); 1503 QuicTime retransmission_time = sent_packet_manager_.GetRetransmissionTime();
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
1628 QuicEncrypter* encrypter) { 1627 QuicEncrypter* encrypter) {
1629 framer_.SetEncrypter(level, encrypter); 1628 framer_.SetEncrypter(level, encrypter);
1630 } 1629 }
1631 1630
1632 const QuicEncrypter* QuicConnection::encrypter(EncryptionLevel level) const { 1631 const QuicEncrypter* QuicConnection::encrypter(EncryptionLevel level) const {
1633 return framer_.encrypter(level); 1632 return framer_.encrypter(level);
1634 } 1633 }
1635 1634
1636 void QuicConnection::SetDefaultEncryptionLevel(EncryptionLevel level) { 1635 void QuicConnection::SetDefaultEncryptionLevel(EncryptionLevel level) {
1637 encryption_level_ = level; 1636 encryption_level_ = level;
1638 packet_creator_.set_encryption_level(level); 1637 packet_generator_.set_encryption_level(level);
1639 } 1638 }
1640 1639
1641 void QuicConnection::SetDecrypter(QuicDecrypter* decrypter, 1640 void QuicConnection::SetDecrypter(QuicDecrypter* decrypter,
1642 EncryptionLevel level) { 1641 EncryptionLevel level) {
1643 framer_.SetDecrypter(decrypter, level); 1642 framer_.SetDecrypter(decrypter, level);
1644 } 1643 }
1645 1644
1646 void QuicConnection::SetAlternativeDecrypter(QuicDecrypter* decrypter, 1645 void QuicConnection::SetAlternativeDecrypter(QuicDecrypter* decrypter,
1647 EncryptionLevel level, 1646 EncryptionLevel level,
1648 bool latch_once_used) { 1647 bool latch_once_used) {
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
1819 QuicFecGroup* fec_group = it->second; 1818 QuicFecGroup* fec_group = it->second;
1820 DCHECK(!fec_group->CanRevive()); 1819 DCHECK(!fec_group->CanRevive());
1821 FecGroupMap::iterator next = it; 1820 FecGroupMap::iterator next = it;
1822 ++next; 1821 ++next;
1823 group_map_.erase(it); 1822 group_map_.erase(it);
1824 delete fec_group; 1823 delete fec_group;
1825 it = next; 1824 it = next;
1826 } 1825 }
1827 } 1826 }
1828 1827
1828 size_t QuicConnection::max_packet_length() const {
1829 return packet_generator_.max_packet_length();
1830 }
1831
1832 void QuicConnection::set_max_packet_length(size_t length) {
1833 return packet_generator_.set_max_packet_length(length);
1834 }
1835
1829 void QuicConnection::Flush() { 1836 void QuicConnection::Flush() {
1830 packet_generator_.FlushAllQueuedFrames(); 1837 packet_generator_.FlushAllQueuedFrames();
1831 } 1838 }
1832 1839
1833 bool QuicConnection::HasQueuedData() const { 1840 bool QuicConnection::HasQueuedData() const {
1834 return pending_version_negotiation_packet_ || 1841 return pending_version_negotiation_packet_ ||
1835 !queued_packets_.empty() || packet_generator_.HasQueuedFrames(); 1842 !queued_packets_.empty() || packet_generator_.HasQueuedFrames();
1836 } 1843 }
1837 1844
1838 bool QuicConnection::CanWriteStreamData() { 1845 bool QuicConnection::CanWriteStreamData() {
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
1965 // If we changed the generator's batch state, restore original batch state. 1972 // If we changed the generator's batch state, restore original batch state.
1966 if (!already_in_batch_mode_) { 1973 if (!already_in_batch_mode_) {
1967 DVLOG(1) << "Leaving Batch Mode."; 1974 DVLOG(1) << "Leaving Batch Mode.";
1968 connection_->packet_generator_.FinishBatchOperations(); 1975 connection_->packet_generator_.FinishBatchOperations();
1969 } 1976 }
1970 DCHECK_EQ(already_in_batch_mode_, 1977 DCHECK_EQ(already_in_batch_mode_,
1971 connection_->packet_generator_.InBatchMode()); 1978 connection_->packet_generator_.InBatchMode());
1972 } 1979 }
1973 1980
1974 } // namespace net 1981 } // 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