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

Side by Side Diff: net/tools/quic/quic_dispatcher.cc

Issue 1975403002: Deprecate --quic_stateless_version_negotiation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@121437600
Patch Set: Created 4 years, 7 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/tools/quic/quic_dispatcher_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/tools/quic/quic_dispatcher.h" 5 #include "net/tools/quic/quic_dispatcher.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/debug/stack_trace.h" 9 #include "base/debug/stack_trace.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 return HandlePacketForTimeWait(header); 130 return HandlePacketForTimeWait(header);
131 } 131 }
132 132
133 // The packet has an unknown connection ID. 133 // The packet has an unknown connection ID.
134 134
135 // Unless the packet provides a version, assume that we can continue 135 // Unless the packet provides a version, assume that we can continue
136 // processing using our preferred version. 136 // processing using our preferred version.
137 QuicVersion version = supported_versions_.front(); 137 QuicVersion version = supported_versions_.front();
138 if (header.version_flag) { 138 if (header.version_flag) {
139 QuicVersion packet_version = header.versions.front(); 139 QuicVersion packet_version = header.versions.front();
140 if (framer_.IsSupportedVersion(packet_version)) { 140 if (!framer_.IsSupportedVersion(packet_version)) {
141 version = packet_version; 141 if (ShouldCreateSessionForUnknownVersion(framer_.last_version_tag())) {
142 } else { 142 return true;
143 if (FLAGS_quic_stateless_version_negotiation) {
144 if (ShouldCreateSessionForUnknownVersion(framer_.last_version_tag())) {
145 return true;
146 }
147 // Since the version is not supported, send a version negotiation
148 // packet and stop processing the current packet.
149 time_wait_list_manager()->SendVersionNegotiationPacket(
150 connection_id, supported_versions_, current_server_address_,
151 current_client_address_);
152 return false;
153 } else {
154 // Packets set to be processed but having an unsupported version will
155 // cause a connection to be created. The connection will handle
156 // sending a version negotiation packet.
157 // TODO(ianswett): This will malfunction if the full header of the
158 // packet causes a parsing error when parsed using the server's
159 // preferred version.
160 } 143 }
144 // Since the version is not supported, send a version negotiation
145 // packet and stop processing the current packet.
146 time_wait_list_manager()->SendVersionNegotiationPacket(
147 connection_id, supported_versions_, current_server_address_,
148 current_client_address_);
149 return false;
161 } 150 }
151 version = packet_version;
162 } 152 }
163 // Set the framer's version and continue processing. 153 // Set the framer's version and continue processing.
164 framer_.set_version(version); 154 framer_.set_version(version);
165 return true; 155 return true;
166 } 156 }
167 157
168 bool QuicDispatcher::OnUnauthenticatedHeader(const QuicPacketHeader& header) { 158 bool QuicDispatcher::OnUnauthenticatedHeader(const QuicPacketHeader& header) {
169 QuicConnectionId connection_id = header.public_header.connection_id; 159 QuicConnectionId connection_id = header.public_header.connection_id;
170 160
171 if (time_wait_list_manager_->IsConnectionIdInTimeWait( 161 if (time_wait_list_manager_->IsConnectionIdInTimeWait(
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 SetLastError(error); 336 SetLastError(error);
347 DVLOG(1) << QuicUtils::ErrorToString(error); 337 DVLOG(1) << QuicUtils::ErrorToString(error);
348 } 338 }
349 339
350 bool QuicDispatcher::ShouldCreateSessionForUnknownVersion(QuicTag version_tag) { 340 bool QuicDispatcher::ShouldCreateSessionForUnknownVersion(QuicTag version_tag) {
351 return false; 341 return false;
352 } 342 }
353 343
354 bool QuicDispatcher::OnProtocolVersionMismatch( 344 bool QuicDispatcher::OnProtocolVersionMismatch(
355 QuicVersion /*received_version*/) { 345 QuicVersion /*received_version*/) {
356 if (FLAGS_quic_stateless_version_negotiation) { 346 QUIC_BUG_IF(!time_wait_list_manager_->IsConnectionIdInTimeWait(
357 QUIC_BUG_IF( 347 current_connection_id_) &&
358 !time_wait_list_manager_->IsConnectionIdInTimeWait( 348 !ShouldCreateSessionForUnknownVersion(framer_.last_version_tag()))
359 current_connection_id_) && 349 << "Unexpected version mismatch: "
360 !ShouldCreateSessionForUnknownVersion(framer_.last_version_tag())) 350 << QuicUtils::TagToString(framer_.last_version_tag());
361 << "Unexpected version mismatch: "
362 << QuicUtils::TagToString(framer_.last_version_tag());
363 }
364 351
365 // Keep processing after protocol mismatch - this will be dealt with by the 352 // Keep processing after protocol mismatch - this will be dealt with by the
366 // time wait list or connection that we will create. 353 // time wait list or connection that we will create.
367 return true; 354 return true;
368 } 355 }
369 356
370 void QuicDispatcher::OnPublicResetPacket( 357 void QuicDispatcher::OnPublicResetPacket(
371 const QuicPublicResetPacket& /*packet*/) { 358 const QuicPublicResetPacket& /*packet*/) {
372 DCHECK(false); 359 DCHECK(false);
373 } 360 }
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
486 473
487 QuicPacketWriter* QuicDispatcher::CreatePerConnectionWriter() { 474 QuicPacketWriter* QuicDispatcher::CreatePerConnectionWriter() {
488 return new QuicPerConnectionPacketWriter(writer_.get()); 475 return new QuicPerConnectionPacketWriter(writer_.get());
489 } 476 }
490 477
491 void QuicDispatcher::SetLastError(QuicErrorCode error) { 478 void QuicDispatcher::SetLastError(QuicErrorCode error) {
492 last_error_ = error; 479 last_error_ = error;
493 } 480 }
494 481
495 } // namespace net 482 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_flags.cc ('k') | net/tools/quic/quic_dispatcher_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698