OLD | NEW |
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 1421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1432 } | 1432 } |
1433 } else { | 1433 } else { |
1434 encrypted_deleter.reset(encrypted); | 1434 encrypted_deleter.reset(encrypted); |
1435 } | 1435 } |
1436 | 1436 |
1437 if (!FLAGS_quic_allow_oversized_packets_for_test) { | 1437 if (!FLAGS_quic_allow_oversized_packets_for_test) { |
1438 DCHECK_LE(encrypted->length(), kMaxPacketSize); | 1438 DCHECK_LE(encrypted->length(), kMaxPacketSize); |
1439 } | 1439 } |
1440 DCHECK_LE(encrypted->length(), packet_generator_.max_packet_length()); | 1440 DCHECK_LE(encrypted->length(), packet_generator_.max_packet_length()); |
1441 DVLOG(1) << ENDPOINT << "Sending packet " << sequence_number << " : " | 1441 DVLOG(1) << ENDPOINT << "Sending packet " << sequence_number << " : " |
1442 << (packet->serialized_packet.packet->is_fec_packet() ? "FEC " : | 1442 << (packet->serialized_packet.is_fec_packet |
1443 (IsRetransmittable(*packet) == HAS_RETRANSMITTABLE_DATA | 1443 ? "FEC " |
1444 ? "data bearing " : " ack only ")) | 1444 : (IsRetransmittable(*packet) == HAS_RETRANSMITTABLE_DATA |
1445 << ", encryption level: " | 1445 ? "data bearing " |
| 1446 : " ack only ")) << ", encryption level: " |
1446 << QuicUtils::EncryptionLevelToString(packet->encryption_level) | 1447 << QuicUtils::EncryptionLevelToString(packet->encryption_level) |
1447 << ", length:" | 1448 << ", length:" << packet->serialized_packet.packet->length() |
1448 << packet->serialized_packet.packet->length() | 1449 << ", encrypted length:" << encrypted->length(); |
1449 << ", encrypted length:" | |
1450 << encrypted->length(); | |
1451 DVLOG(2) << ENDPOINT << "packet(" << sequence_number << "): " << std::endl | 1450 DVLOG(2) << ENDPOINT << "packet(" << sequence_number << "): " << std::endl |
1452 << QuicUtils::StringToHexASCIIDump( | 1451 << QuicUtils::StringToHexASCIIDump( |
1453 packet->serialized_packet.packet->AsStringPiece()); | 1452 packet->serialized_packet.packet->AsStringPiece()); |
1454 | 1453 |
1455 QuicTime packet_send_time = QuicTime::Zero(); | 1454 QuicTime packet_send_time = QuicTime::Zero(); |
1456 if (FLAGS_quic_record_send_time_before_write) { | 1455 if (FLAGS_quic_record_send_time_before_write) { |
1457 // Measure the RTT from before the write begins to avoid underestimating the | 1456 // Measure the RTT from before the write begins to avoid underestimating the |
1458 // min_rtt_, especially in cases where the thread blocks or gets swapped out | 1457 // min_rtt_, especially in cases where the thread blocks or gets swapped out |
1459 // during the WritePacket below. | 1458 // during the WritePacket below. |
1460 packet_send_time = clock_->Now(); | 1459 packet_send_time = clock_->Now(); |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1597 SetDefaultEncryptionLevel(ENCRYPTION_FORWARD_SECURE); | 1596 SetDefaultEncryptionLevel(ENCRYPTION_FORWARD_SECURE); |
1598 } | 1597 } |
1599 if (serialized_packet.retransmittable_frames) { | 1598 if (serialized_packet.retransmittable_frames) { |
1600 serialized_packet.retransmittable_frames-> | 1599 serialized_packet.retransmittable_frames-> |
1601 set_encryption_level(encryption_level_); | 1600 set_encryption_level(encryption_level_); |
1602 | 1601 |
1603 if (FLAGS_quic_ack_notifier_informed_on_serialized) { | 1602 if (FLAGS_quic_ack_notifier_informed_on_serialized) { |
1604 sent_packet_manager_.OnSerializedPacket(serialized_packet); | 1603 sent_packet_manager_.OnSerializedPacket(serialized_packet); |
1605 } | 1604 } |
1606 } | 1605 } |
1607 if (serialized_packet.packet->is_fec_packet() && fec_alarm_->IsSet()) { | 1606 if (serialized_packet.is_fec_packet && fec_alarm_->IsSet()) { |
1608 // If an FEC packet is serialized with the FEC alarm set, cancel the alarm. | 1607 // If an FEC packet is serialized with the FEC alarm set, cancel the alarm. |
1609 fec_alarm_->Cancel(); | 1608 fec_alarm_->Cancel(); |
1610 } | 1609 } |
1611 SendOrQueuePacket(QueuedPacket(serialized_packet, encryption_level_)); | 1610 SendOrQueuePacket(QueuedPacket(serialized_packet, encryption_level_)); |
1612 } | 1611 } |
1613 | 1612 |
1614 void QuicConnection::OnCongestionWindowChange() { | 1613 void QuicConnection::OnCongestionWindowChange() { |
1615 packet_generator_.OnCongestionWindowChange( | 1614 packet_generator_.OnCongestionWindowChange( |
1616 sent_packet_manager_.EstimateMaxPacketsInFlight(max_packet_length())); | 1615 sent_packet_manager_.EstimateMaxPacketsInFlight(max_packet_length())); |
1617 visitor_->OnCongestionWindowChange(clock_->ApproximateNow()); | 1616 visitor_->OnCongestionWindowChange(clock_->ApproximateNow()); |
(...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2110 } | 2109 } |
2111 for (const QuicFrame& frame : retransmittable_frames->frames()) { | 2110 for (const QuicFrame& frame : retransmittable_frames->frames()) { |
2112 if (frame.type == CONNECTION_CLOSE_FRAME) { | 2111 if (frame.type == CONNECTION_CLOSE_FRAME) { |
2113 return true; | 2112 return true; |
2114 } | 2113 } |
2115 } | 2114 } |
2116 return false; | 2115 return false; |
2117 } | 2116 } |
2118 | 2117 |
2119 } // namespace net | 2118 } // namespace net |
OLD | NEW |