summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwtc@chromium.org <wtc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-06 19:42:47 +0000
committerwtc@chromium.org <wtc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-06 19:42:47 +0000
commitf00b9280531031ed5dfd2d4a48d65142497dd1ea (patch)
treedd7f7b9cc7ee46e5199c070421061f994d64be6f
parentafc2d828f6ec40100330b4c8c65be5d96d2c253a (diff)
downloadchromium_src-f00b9280531031ed5dfd2d4a48d65142497dd1ea.zip
chromium_src-f00b9280531031ed5dfd2d4a48d65142497dd1ea.tar.gz
chromium_src-f00b9280531031ed5dfd2d4a48d65142497dd1ea.tar.bz2
Change ProcessPacketHeader to call RaiseError before returning
false. (This is the error reporting strategy of ProcessFrameData.) Change the caller of ProcessPacketHeader to not call RaiseError. This avoids calling RaiseError twice. Merge internal change: 43417565 Remove unused header includes or forward declarations. Merge internal change: 43418564 R=rch@chromium.org BUG=none TEST=none Review URL: https://chromiumcodereview.appspot.com/12464006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@186482 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--net/quic/quic_connection.h2
-rw-r--r--net/quic/quic_framer.cc17
-rw-r--r--net/quic/quic_framer.h3
3 files changed, 11 insertions, 11 deletions
diff --git a/net/quic/quic_connection.h b/net/quic/quic_connection.h
index dd009ae..c277589 100644
--- a/net/quic/quic_connection.h
+++ b/net/quic/quic_connection.h
@@ -27,7 +27,6 @@
#include "net/base/linked_hash_map.h"
#include "net/quic/congestion_control/quic_congestion_manager.h"
#include "net/quic/quic_blocked_writer_interface.h"
-#include "net/quic/quic_fec_group.h"
#include "net/quic/quic_framer.h"
#include "net/quic/quic_packet_creator.h"
#include "net/quic/quic_packet_entropy_manager.h"
@@ -38,7 +37,6 @@ namespace net {
class QuicClock;
class QuicConnection;
-class QuicEncrypter;
class QuicFecGroup;
class QuicRandom;
diff --git a/net/quic/quic_framer.cc b/net/quic/quic_framer.cc
index af8e4f9..2329605 100644
--- a/net/quic/quic_framer.cc
+++ b/net/quic/quic_framer.cc
@@ -278,7 +278,6 @@ bool QuicFramer::ProcessPacket(const QuicEncryptedPacket& packet) {
QuicPacketPublicHeader public_header;
if (!ProcessPublicHeader(&public_header)) {
DLOG(WARNING) << "Unable to process public header.";
- reader_.reset(NULL);
return RaiseError(QUIC_INVALID_PACKET_HEADER);
}
// TODO(satyamshekhar): Handle version negotiation.
@@ -304,11 +303,13 @@ bool QuicFramer::ProcessDataPacket(
QuicPacketHeader header(public_header);
if (!ProcessPacketHeader(&header, packet)) {
+ DCHECK_NE(QUIC_NO_ERROR, error_); // ProcessPacketHeader sets the error.
DLOG(WARNING) << "Unable to process data packet header.";
- return RaiseError(QUIC_INVALID_PACKET_HEADER);
+ return false;
}
if (!visitor_->OnPacketHeader(header)) {
+ // The visitor suppresses further processing of the packet.
return true;
}
@@ -501,30 +502,30 @@ bool QuicFramer::ProcessPacketHeader(
const QuicEncryptedPacket& packet) {
if (!ProcessPacketSequenceNumber(&header->packet_sequence_number)) {
set_detailed_error("Unable to read sequence number.");
- return false;
+ return RaiseError(QUIC_INVALID_PACKET_HEADER);
}
if (header->packet_sequence_number == 0u) {
set_detailed_error("Packet sequence numbers cannot be 0.");
- return false;
+ return RaiseError(QUIC_INVALID_PACKET_HEADER);
}
if (!DecryptPayload(header->packet_sequence_number,
header->public_header.version_flag,
packet)) {
- DLOG(WARNING) << "Unable to decrypt payload.";
+ set_detailed_error("Unable to decrypt payload.");
return RaiseError(QUIC_DECRYPTION_FAILURE);
}
uint8 private_flags;
if (!reader_->ReadBytes(&private_flags, 1)) {
set_detailed_error("Unable to read private flags.");
- return false;
+ return RaiseError(QUIC_INVALID_PACKET_HEADER);
}
if (private_flags > PACKET_PRIVATE_FLAGS_MAX) {
set_detailed_error("Illegal private flags value.");
- return false;
+ return RaiseError(QUIC_INVALID_PACKET_HEADER);
}
header->fec_flag = (private_flags & PACKET_PRIVATE_FLAGS_FEC) != 0;
@@ -535,7 +536,7 @@ bool QuicFramer::ProcessPacketHeader(
uint8 first_fec_protected_packet_offset;
if (!reader_->ReadBytes(&first_fec_protected_packet_offset, 1)) {
set_detailed_error("Unable to read first fec protected packet offset.");
- return false;
+ return RaiseError(QUIC_INVALID_PACKET_HEADER);
}
header->fec_group = first_fec_protected_packet_offset == kNoFecOffset ? 0 :
header->packet_sequence_number - first_fec_protected_packet_offset;
diff --git a/net/quic/quic_framer.h b/net/quic/quic_framer.h
index 008c99d..86b255d 100644
--- a/net/quic/quic_framer.h
+++ b/net/quic/quic_framer.h
@@ -70,7 +70,7 @@ class NET_EXPORT_PRIVATE QuicFramerVisitorInterface {
virtual void OnRevivedPacket() = 0;
// Called when the header of a packet had been parsed.
- // If OnPacketHeader returns false, framing for this packet will cease.
+ // If OnPacketHeader returns false, parsing for this packet will cease.
virtual bool OnPacketHeader(const QuicPacketHeader& header) = 0;
// Called when a data packet is parsed that is part of an FEC group.
@@ -334,6 +334,7 @@ class NET_EXPORT_PRIVATE QuicFramer {
QuicFecBuilderInterface* fec_builder_;
QuicReceivedEntropyHashCalculatorInterface* entropy_calculator_;
QuicErrorCode error_;
+ // Updated by ProcessPacketHeader when it succeeds.
QuicPacketSequenceNumber last_sequence_number_;
// Buffer containing decrypted payload data during parsing.
scoped_ptr<QuicData> decrypted_;