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

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

Issue 1562833003: relnote: Clear the FEC group in QuicPacketCreator when encryption_level is none and close the conne… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@26_CL_111359954
Patch Set: sync quic_error_map with quic_protocol Created 4 years, 11 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 | « net/quic/quic_flags.cc ('k') | net/quic/quic_packet_creator_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_packet_creator.h" 5 #include "net/quic/quic_packet_creator.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 647 matching lines...) Expand 10 before | Expand all | Expand 10 after
658 } 658 }
659 659
660 SerializedPacket QuicPacketCreator::SerializeFec(char* buffer, 660 SerializedPacket QuicPacketCreator::SerializeFec(char* buffer,
661 size_t buffer_len) { 661 size_t buffer_len) {
662 DCHECK_LT(0u, buffer_len); 662 DCHECK_LT(0u, buffer_len);
663 if (fec_group_.get() == nullptr || fec_group_->NumReceivedPackets() <= 0) { 663 if (fec_group_.get() == nullptr || fec_group_->NumReceivedPackets() <= 0) {
664 QUIC_BUG << "SerializeFEC called but no group or zero packets in group."; 664 QUIC_BUG << "SerializeFEC called but no group or zero packets in group.";
665 // TODO(jri): Make this a public method of framer? 665 // TODO(jri): Make this a public method of framer?
666 return NoPacket(); 666 return NoPacket();
667 } 667 }
668 if (FLAGS_quic_no_unencrypted_fec &&
669 encryption_level_ == ENCRYPTION_NONE) {
670 LOG(DFATAL) << "SerializeFEC must be called with encryption.";
671 delegate_->CloseConnection(QUIC_UNENCRYPTED_FEC_DATA, false);
672 return NoPacket();
673 }
668 DCHECK_EQ(0u, queued_frames_.size()); 674 DCHECK_EQ(0u, queued_frames_.size());
669 QuicPacketHeader header; 675 QuicPacketHeader header;
670 FillPacketHeader(fec_group_->FecGroupNumber(), true, &header); 676 FillPacketHeader(fec_group_->FecGroupNumber(), true, &header);
671 scoped_ptr<QuicPacket> packet( 677 scoped_ptr<QuicPacket> packet(
672 framer_->BuildFecPacket(header, fec_group_->PayloadParity())); 678 framer_->BuildFecPacket(header, fec_group_->PayloadParity()));
673 fec_group_.reset(nullptr); 679 fec_group_.reset(nullptr);
674 packet_size_ = 0; 680 packet_size_ = 0;
675 LOG_IF(DFATAL, packet == nullptr) 681 LOG_IF(DFATAL, packet == nullptr)
676 << "Failed to serialize fec packet for group:" 682 << "Failed to serialize fec packet for group:"
677 << fec_group_->FecGroupNumber(); 683 << fec_group_->FecGroupNumber();
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
804 // Flush current open packet. 810 // Flush current open packet.
805 Flush(); 811 Flush();
806 812
807 StartFecProtectingPackets(); 813 StartFecProtectingPackets();
808 DCHECK(fec_protect_); 814 DCHECK(fec_protect_);
809 } 815 }
810 816
811 void QuicPacketCreator::MaybeSendFecPacketAndCloseGroup(bool force_send_fec, 817 void QuicPacketCreator::MaybeSendFecPacketAndCloseGroup(bool force_send_fec,
812 bool is_fec_timeout) { 818 bool is_fec_timeout) {
813 if (ShouldSendFec(force_send_fec)) { 819 if (ShouldSendFec(force_send_fec)) {
814 if (fec_send_policy_ == FEC_ALARM_TRIGGER && !is_fec_timeout) { 820 if ((FLAGS_quic_no_unencrypted_fec &&
821 encryption_level_ == ENCRYPTION_NONE) ||
822 (fec_send_policy_ == FEC_ALARM_TRIGGER && !is_fec_timeout)) {
815 ResetFecGroup(); 823 ResetFecGroup();
816 delegate_->OnResetFecGroup(); 824 delegate_->OnResetFecGroup();
817 } else { 825 } else {
818 // TODO(zhongyi): Change the default 64 alignas value (used the default 826 // TODO(zhongyi): Change the default 64 alignas value (used the default
819 // value from CACHELINE_SIZE). 827 // value from CACHELINE_SIZE).
820 ALIGNAS(64) char seralized_fec_buffer[kMaxPacketSize]; 828 ALIGNAS(64) char seralized_fec_buffer[kMaxPacketSize];
821 SerializedPacket serialized_fec = 829 SerializedPacket serialized_fec =
822 SerializeFec(seralized_fec_buffer, kMaxPacketSize); 830 SerializeFec(seralized_fec_buffer, kMaxPacketSize);
823 OnSerializedPacket(&serialized_fec); 831 OnSerializedPacket(&serialized_fec);
824 } 832 }
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
872 hash_map<QuicPathId, QuicPacketNumber>::iterator it = 880 hash_map<QuicPathId, QuicPacketNumber>::iterator it =
873 multipath_packet_number_.find(path_id); 881 multipath_packet_number_.find(path_id);
874 // If path_id is not in the map, it's a new path. Set packet_number to 0. 882 // If path_id is not in the map, it's a new path. Set packet_number to 0.
875 packet_number_ = it == multipath_packet_number_.end() ? 0 : it->second; 883 packet_number_ = it == multipath_packet_number_.end() ? 0 : it->second;
876 current_path_ = path_id; 884 current_path_ = path_id;
877 // Switching path needs to update packet number length. 885 // Switching path needs to update packet number length.
878 UpdatePacketNumberLength(least_packet_awaited_by_peer, max_packets_in_flight); 886 UpdatePacketNumberLength(least_packet_awaited_by_peer, max_packets_in_flight);
879 } 887 }
880 888
881 } // namespace net 889 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_flags.cc ('k') | net/quic/quic_packet_creator_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698