| Index: net/quic/quic_connection.cc
|
| diff --git a/net/quic/quic_connection.cc b/net/quic/quic_connection.cc
|
| index af10c61c320a73a53c2559bdafad6db7de81dbd2..4b4431f175fde74e90ddb7c94bdb2d3a42a81cc4 100644
|
| --- a/net/quic/quic_connection.cc
|
| +++ b/net/quic/quic_connection.cc
|
| @@ -31,7 +31,6 @@
|
| #include "net/quic/quic_bandwidth.h"
|
| #include "net/quic/quic_bug_tracker.h"
|
| #include "net/quic/quic_config.h"
|
| -#include "net/quic/quic_fec_group.h"
|
| #include "net/quic/quic_flags.h"
|
| #include "net/quic/quic_packet_generator.h"
|
| #include "net/quic/quic_utils.h"
|
| @@ -60,10 +59,6 @@ namespace {
|
| // This will likely have to be tuned.
|
| const QuicPacketNumber kMaxPacketGap = 5000;
|
|
|
| -// Limit the number of FEC groups to two. If we get enough out of order packets
|
| -// that this becomes limiting, we can revisit.
|
| -const size_t kMaxFecGroups = 2;
|
| -
|
| // Maximum number of acks received before sending an ack in response.
|
| const QuicPacketCount kMaxPacketsReceivedBeforeAckSend = 20;
|
|
|
| @@ -248,7 +243,6 @@ QuicConnection::QuicConnection(QuicConnectionId connection_id,
|
| peer_address_(address),
|
| migrating_peer_port_(0),
|
| last_packet_decrypted_(false),
|
| - last_packet_revived_(false),
|
| last_size_(0),
|
| last_decrypted_packet_level_(ENCRYPTION_NONE),
|
| should_last_packet_instigate_acks_(false),
|
| @@ -339,7 +333,6 @@ QuicConnection::~QuicConnection() {
|
| if (termination_packets_.get() != nullptr) {
|
| STLDeleteElements(termination_packets_.get());
|
| }
|
| - STLDeleteValues(&group_map_);
|
| ClearQueuedPackets();
|
| }
|
|
|
| @@ -449,7 +442,6 @@ void QuicConnection::OnError(QuicFramer* framer) {
|
|
|
| void QuicConnection::OnPacket() {
|
| last_packet_decrypted_ = false;
|
| - last_packet_revived_ = false;
|
| }
|
|
|
| void QuicConnection::OnPublicResetPacket(const QuicPublicResetPacket& packet) {
|
| @@ -567,8 +559,6 @@ void QuicConnection::OnVersionNegotiationPacket(
|
| RetransmitUnackedPackets(ALL_UNACKED_RETRANSMISSION);
|
| }
|
|
|
| -void QuicConnection::OnRevivedPacket() {}
|
| -
|
| bool QuicConnection::OnUnauthenticatedPublicHeader(
|
| const QuicPacketPublicHeader& header) {
|
| if (header.connection_id == connection_id_) {
|
| @@ -655,15 +645,6 @@ bool QuicConnection::OnPacketHeader(const QuicPacketHeader& header) {
|
| return true;
|
| }
|
|
|
| -void QuicConnection::OnFecProtectedPayload(StringPiece payload) {
|
| - DCHECK_EQ(IN_FEC_GROUP, last_header_.is_in_fec_group);
|
| - DCHECK_NE(0u, last_header_.fec_group);
|
| - QuicFecGroup* group = GetFecGroup();
|
| - if (group != nullptr) {
|
| - group->Update(last_decrypted_packet_level_, last_header_, payload);
|
| - }
|
| -}
|
| -
|
| bool QuicConnection::OnStreamFrame(const QuicStreamFrame& frame) {
|
| DCHECK(connected_);
|
| if (debug_visitor_ != nullptr) {
|
| @@ -739,8 +720,6 @@ void QuicConnection::ProcessStopWaitingFrame(
|
| const QuicStopWaitingFrame& stop_waiting) {
|
| largest_seen_packet_with_stop_waiting_ = last_header_.packet_number;
|
| received_packet_manager_.UpdatePacketInformationSentByPeer(stop_waiting);
|
| - // Possibly close any FecGroups which are now irrelevant.
|
| - CloseFecGroupsBefore(stop_waiting.least_unacked + 1);
|
| }
|
|
|
| bool QuicConnection::OnStopWaitingFrame(const QuicStopWaitingFrame& frame) {
|
| @@ -820,14 +799,6 @@ const char* QuicConnection::ValidateAckFrame(const QuicAckFrame& incoming_ack) {
|
| return "Invalid entropy";
|
| }
|
|
|
| - if (incoming_ack.latest_revived_packet != 0 &&
|
| - !incoming_ack.missing_packets.Contains(
|
| - incoming_ack.latest_revived_packet)) {
|
| - LOG(WARNING) << ENDPOINT
|
| - << "Peer specified revived packet which was not missing."
|
| - << " revived_packet:" << incoming_ack.latest_revived_packet;
|
| - return "Invalid revived packet";
|
| - }
|
| return nullptr;
|
| }
|
|
|
| @@ -853,15 +824,6 @@ const char* QuicConnection::ValidateStopWaitingFrame(
|
| return nullptr;
|
| }
|
|
|
| -void QuicConnection::OnFecData(StringPiece redundancy) {
|
| - DCHECK_EQ(IN_FEC_GROUP, last_header_.is_in_fec_group);
|
| - DCHECK_NE(0u, last_header_.fec_group);
|
| - QuicFecGroup* group = GetFecGroup();
|
| - if (group != nullptr) {
|
| - group->UpdateFec(last_decrypted_packet_level_, last_header_, redundancy);
|
| - }
|
| -}
|
| -
|
| bool QuicConnection::OnRstStreamFrame(const QuicRstStreamFrame& frame) {
|
| DCHECK(connected_);
|
| if (debug_visitor_ != nullptr) {
|
| @@ -953,8 +915,7 @@ void QuicConnection::OnPacketComplete() {
|
| return;
|
| }
|
|
|
| - DVLOG(1) << ENDPOINT << (last_packet_revived_ ? "Revived" : "Got")
|
| - << " packet " << last_header_.packet_number << " for "
|
| + DVLOG(1) << ENDPOINT << "Got packet " << last_header_.packet_number << " for "
|
| << last_header_.public_header.connection_id;
|
|
|
| // An ack will be sent if a missing retransmittable packet was received;
|
| @@ -962,15 +923,11 @@ void QuicConnection::OnPacketComplete() {
|
| should_last_packet_instigate_acks_ &&
|
| received_packet_manager_.IsMissing(last_header_.packet_number);
|
|
|
| - // Record received or revived packet to populate ack info correctly before
|
| - // processing stream frames, since the processing may result in a response
|
| - // packet with a bundled ack.
|
| - if (last_packet_revived_) {
|
| - received_packet_manager_.RecordPacketRevived(last_header_.packet_number);
|
| - } else {
|
| - received_packet_manager_.RecordPacketReceived(
|
| - last_size_, last_header_, time_of_last_received_packet_);
|
| - }
|
| + // Record received to populate ack info correctly before processing stream
|
| + // frames, since the processing may result in a response packet with a bundled
|
| + // ack.
|
| + received_packet_manager_.RecordPacketReceived(last_size_, last_header_,
|
| + time_of_last_received_packet_);
|
|
|
| // Process stop waiting frames here, instead of inline, because the packet
|
| // needs to be considered 'received' before the entropy can be updated.
|
| @@ -985,7 +942,6 @@ void QuicConnection::OnPacketComplete() {
|
|
|
| ClearLastFrames();
|
| MaybeCloseIfTooManyOutstandingPackets();
|
| - MaybeProcessRevivedPacket();
|
| }
|
|
|
| void QuicConnection::MaybeQueueAck(bool was_missing) {
|
| @@ -1370,6 +1326,11 @@ void QuicConnection::WriteAndBundleAcksIfNotBlocked() {
|
| }
|
|
|
| bool QuicConnection::ProcessValidatedPacket(const QuicPacketHeader& header) {
|
| + if (header.fec_flag) {
|
| + // Drop any FEC packet.
|
| + return false;
|
| + }
|
| +
|
| if (FLAGS_check_peer_address_change_after_decryption) {
|
| if (perspective_ == Perspective::IS_SERVER &&
|
| IsInitializedIPEndPoint(self_address_) &&
|
| @@ -1939,75 +1900,6 @@ void QuicConnection::MaybeProcessUndecryptablePackets() {
|
| }
|
| }
|
|
|
| -void QuicConnection::MaybeProcessRevivedPacket() {
|
| - QuicFecGroup* group = GetFecGroup();
|
| - if (!connected_ || group == nullptr || !group->CanRevive()) {
|
| - return;
|
| - }
|
| - QuicPacketHeader revived_header;
|
| - char revived_payload[kMaxPacketSize];
|
| - size_t len = group->Revive(&revived_header, revived_payload, kMaxPacketSize);
|
| - if (!received_packet_manager_.IsAwaitingPacket(
|
| - revived_header.packet_number)) {
|
| - // Close this FEC group because all packets in the group has been received.
|
| - group_map_.erase(last_header_.fec_group);
|
| - delete group;
|
| - return;
|
| - }
|
| - revived_header.public_header.connection_id = connection_id_;
|
| - revived_header.public_header.connection_id_length =
|
| - last_header_.public_header.connection_id_length;
|
| - revived_header.public_header.version_flag = false;
|
| - revived_header.public_header.reset_flag = false;
|
| - revived_header.public_header.packet_number_length =
|
| - last_header_.public_header.packet_number_length;
|
| - revived_header.fec_flag = false;
|
| - revived_header.is_in_fec_group = NOT_IN_FEC_GROUP;
|
| - revived_header.fec_group = 0;
|
| - group_map_.erase(last_header_.fec_group);
|
| - last_decrypted_packet_level_ = group->EffectiveEncryptionLevel();
|
| - DCHECK_LT(last_decrypted_packet_level_, NUM_ENCRYPTION_LEVELS);
|
| - delete group;
|
| -
|
| - last_packet_revived_ = true;
|
| - if (debug_visitor_ != nullptr) {
|
| - debug_visitor_->OnRevivedPacket(revived_header,
|
| - StringPiece(revived_payload, len));
|
| - }
|
| -
|
| - ++stats_.packets_revived;
|
| - framer_.ProcessRevivedPacket(&revived_header,
|
| - StringPiece(revived_payload, len));
|
| -}
|
| -
|
| -QuicFecGroup* QuicConnection::GetFecGroup() {
|
| - QuicFecGroupNumber fec_group_num = last_header_.fec_group;
|
| - if (fec_group_num == 0 ||
|
| - (fec_group_num <
|
| - received_packet_manager_.peer_least_packet_awaiting_ack() &&
|
| - !ContainsKey(group_map_, fec_group_num))) {
|
| - // If the group number is below peer_least_packet_awaiting_ack and this
|
| - // group does not exist, which means this group has missing packets below
|
| - // |peer_least_packet_awaiting_ack| which we would never receive, so return
|
| - // nullptr.
|
| - return nullptr;
|
| - }
|
| - if (!ContainsKey(group_map_, fec_group_num)) {
|
| - if (group_map_.size() >= kMaxFecGroups) { // Too many groups
|
| - if (fec_group_num < group_map_.begin()->first) {
|
| - // The group being requested is a group we've seen before and deleted.
|
| - // Don't recreate it.
|
| - return nullptr;
|
| - }
|
| - // Clear the lowest group number.
|
| - delete group_map_.begin()->second;
|
| - group_map_.erase(group_map_.begin());
|
| - }
|
| - group_map_[fec_group_num] = new QuicFecGroup(fec_group_num);
|
| - }
|
| - return group_map_[fec_group_num];
|
| -}
|
| -
|
| void QuicConnection::SendConnectionCloseWithDetails(QuicErrorCode error,
|
| const string& details) {
|
| if (!connected_) {
|
| @@ -2081,24 +1973,6 @@ void QuicConnection::SendGoAway(QuicErrorCode error,
|
| QuicFrame(new QuicGoAwayFrame(error, last_good_stream_id, reason)));
|
| }
|
|
|
| -void QuicConnection::CloseFecGroupsBefore(QuicPacketNumber packet_number) {
|
| - FecGroupMap::iterator it = group_map_.begin();
|
| - while (it != group_map_.end()) {
|
| - // If the group doesn't protect this packet we can ignore it.
|
| - if (!it->second->IsWaitingForPacketBefore(packet_number)) {
|
| - ++it;
|
| - continue;
|
| - }
|
| - QuicFecGroup* fec_group = it->second;
|
| - DCHECK(!fec_group->CanRevive());
|
| - FecGroupMap::iterator next = it;
|
| - ++next;
|
| - group_map_.erase(it);
|
| - delete fec_group;
|
| - it = next;
|
| - }
|
| -}
|
| -
|
| QuicByteCount QuicConnection::max_packet_length() const {
|
| return packet_generator_.GetMaxPacketLength();
|
| }
|
|
|