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

Unified Diff: net/quic/quic_connection.cc

Issue 1041853002: Land Recent QUIC Changes until 03/25/2015. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@rch_patch_1036023002
Patch Set: Created 5 years, 9 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_connection.h ('k') | net/quic/quic_connection_stats.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/quic_connection.cc
diff --git a/net/quic/quic_connection.cc b/net/quic/quic_connection.cc
index e6a3d8ce71f674fc32951ec444ced242856de482..819bcfe37a4da5e5d8a54297f05b43e201048851 100644
--- a/net/quic/quic_connection.cc
+++ b/net/quic/quic_connection.cc
@@ -391,6 +391,10 @@ void QuicConnection::OnPacket() {
void QuicConnection::OnPublicResetPacket(
const QuicPublicResetPacket& packet) {
+ // Check that any public reset packet with a different connection ID that was
+ // routed to this QuicConnection has been redirected before control reaches
+ // here. (Check for a bug regression.)
+ DCHECK_EQ(connection_id_, packet.public_header.connection_id);
if (debug_visitor_ != nullptr) {
debug_visitor_->OnPublicResetPacket(packet);
}
@@ -460,6 +464,10 @@ bool QuicConnection::OnProtocolVersionMismatch(QuicVersion received_version) {
// Handles version negotiation for client connection.
void QuicConnection::OnVersionNegotiationPacket(
const QuicVersionNegotiationPacket& packet) {
+ // Check that any public reset packet with a different connection ID that was
+ // routed to this QuicConnection has been redirected before control reaches
+ // here. (Check for a bug regression.)
+ DCHECK_EQ(connection_id_, packet.connection_id);
if (perspective_ == Perspective::IS_SERVER) {
LOG(DFATAL) << ENDPOINT << "Framer parsed VersionNegotiationPacket."
<< " Closing connection.";
@@ -503,10 +511,28 @@ void QuicConnection::OnRevivedPacket() {
bool QuicConnection::OnUnauthenticatedPublicHeader(
const QuicPacketPublicHeader& header) {
- return true;
+ if (header.connection_id == connection_id_) {
+ return true;
+ }
+
+ ++stats_.packets_dropped;
+ DVLOG(1) << ENDPOINT << "Ignoring packet from unexpected ConnectionId: "
+ << header.connection_id << " instead of " << connection_id_;
+ if (debug_visitor_ != nullptr) {
+ debug_visitor_->OnIncorrectConnectionId(header.connection_id);
+ }
+ // If this is a server, the dispatcher routes each packet to the
+ // QuicConnection responsible for the packet's connection ID. So if control
+ // arrives here and this is a server, the dispatcher must be malfunctioning.
+ DCHECK_NE(Perspective::IS_SERVER, perspective_);
+ return false;
}
bool QuicConnection::OnUnauthenticatedHeader(const QuicPacketHeader& header) {
+ // Check that any public reset packet with a different connection ID that was
+ // routed to this QuicConnection has been redirected before control reaches
+ // here.
+ DCHECK_EQ(connection_id_, header.public_header.connection_id);
return true;
}
@@ -533,17 +559,6 @@ bool QuicConnection::OnPacketHeader(const QuicPacketHeader& header) {
// Will be decrement below if we fall through to return true;
++stats_.packets_dropped;
- if (header.public_header.connection_id != connection_id_) {
- DVLOG(1) << ENDPOINT << "Ignoring packet from unexpected ConnectionId: "
- << header.public_header.connection_id << " instead of "
- << connection_id_;
- if (debug_visitor_ != nullptr) {
- debug_visitor_->OnIncorrectConnectionId(
- header.public_header.connection_id);
- }
- return false;
- }
-
if (!Near(header.packet_sequence_number,
last_header_.packet_sequence_number)) {
DVLOG(1) << ENDPOINT << "Packet " << header.packet_sequence_number
« no previous file with comments | « net/quic/quic_connection.h ('k') | net/quic/quic_connection_stats.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698