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

Unified Diff: net/quic/quic_framer.cc

Issue 47283002: Land Recent QUIC changes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix compilation error Created 7 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/quic/quic_framer.h ('k') | net/quic/quic_framer_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/quic_framer.cc
diff --git a/net/quic/quic_framer.cc b/net/quic/quic_framer.cc
index 2701f391cc3ce86bd29c8f7a58a865ab3166a33a..493cf807b1fde08fbaac1cb0f8a805888c623e37 100644
--- a/net/quic/quic_framer.cc
+++ b/net/quic/quic_framer.cc
@@ -114,7 +114,7 @@ QuicTag GetNullTag(QuicVersion version) {
} // namespace
-QuicFramer::QuicFramer(QuicVersion version,
+QuicFramer::QuicFramer(const QuicVersionVector& supported_versions,
QuicTime creation_time,
bool is_server)
: visitor_(NULL),
@@ -122,13 +122,15 @@ QuicFramer::QuicFramer(QuicVersion version,
error_(QUIC_NO_ERROR),
last_sequence_number_(0),
last_serialized_guid_(0),
- quic_version_(version),
- decrypter_(QuicDecrypter::Create(GetNullTag(version))),
+ supported_versions_(supported_versions),
alternative_decrypter_latch_(false),
is_server_(is_server),
creation_time_(creation_time) {
- DCHECK(IsSupportedVersion(version));
- encrypter_[ENCRYPTION_NONE].reset(QuicEncrypter::Create(GetNullTag(version)));
+ DCHECK(!supported_versions.empty());
+ quic_version_ = supported_versions_[0];
+ decrypter_.reset(QuicDecrypter::Create(GetNullTag(quic_version_)));
+ encrypter_[ENCRYPTION_NONE].reset(
+ QuicEncrypter::Create(GetNullTag(quic_version_)));
}
QuicFramer::~QuicFramer() {}
@@ -229,8 +231,8 @@ bool QuicFramer::CanTruncate(const QuicFrame& frame, size_t free_bytes) {
}
bool QuicFramer::IsSupportedVersion(const QuicVersion version) const {
- for (size_t i = 0; i < arraysize(kSupportedQuicVersions); ++i) {
- if (version == kSupportedQuicVersions[i]) {
+ for (size_t i = 0; i < supported_versions_.size(); ++i) {
+ if (version == supported_versions_[i]) {
return true;
}
}
@@ -1433,7 +1435,8 @@ size_t QuicFramer::GetMaxPlaintextSize(size_t ciphertext_size) {
// level to hand. At the moment, the NullEncrypter has a tag length of 16
// bytes and AES-GCM has a tag length of 12. We take the minimum plaintext
// length just to be safe.
- size_t min_plaintext_size = ciphertext_size;
+ // TODO(rtenneti): remove '- 16' after we delete QUIC_VERSION_10.
+ size_t min_plaintext_size = ciphertext_size - 16;
for (int i = ENCRYPTION_NONE; i < NUM_ENCRYPTION_LEVELS; i++) {
if (encrypter_[i].get() != NULL) {
@@ -1684,6 +1687,9 @@ QuicPacketSequenceNumber QuicFramer::CalculateLargestObserved(
void QuicFramer::set_version(const QuicVersion version) {
DCHECK(IsSupportedVersion(version));
+ // Handle version incompatibility between QUIC_VERSION_10 and QUIC_VERSION_11
+ // because of introduction of a new QUIC null encryption format in
+ // QUIC_VERSION_11.
if ((quic_version_ > QUIC_VERSION_10 && version <= QUIC_VERSION_10) ||
(quic_version_ <= QUIC_VERSION_10 && version > QUIC_VERSION_10)) {
// TODO(rtenneti): remove the following code after we delete
« no previous file with comments | « net/quic/quic_framer.h ('k') | net/quic/quic_framer_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698