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

Unified Diff: net/tools/quic/quic_dispatcher.cc

Issue 2318773002: Minor refactoring in QuicDispatcher. No functional change, not flag-protected. (Closed)
Patch Set: Created 4 years, 3 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/tools/quic/quic_dispatcher.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/tools/quic/quic_dispatcher.cc
diff --git a/net/tools/quic/quic_dispatcher.cc b/net/tools/quic/quic_dispatcher.cc
index 486aea70a3eb36947b0af412b27756a54ab86fd7..c65929e6d57b8cc00e53a6102cdd5bb58fec00a8 100644
--- a/net/tools/quic/quic_dispatcher.cc
+++ b/net/tools/quic/quic_dispatcher.cc
@@ -325,12 +325,21 @@ bool QuicDispatcher::OnUnauthenticatedHeader(const QuicPacketHeader& header) {
return false;
}
- // Packet's connection ID is unknown.
- // Apply the validity checks.
+ // Packet's connection ID is unknown. Apply the validity checks.
QuicPacketFate fate = ValidityChecks(header);
if (fate == kFateProcess) {
fate = MaybeRejectStatelessly(connection_id, header);
}
+
+ // Perform whatever actions are needed on the current packet.
+ ProcessUnauthenticatedHeaderFate(fate, connection_id, header.packet_number);
+ return false;
+}
+
+void QuicDispatcher::ProcessUnauthenticatedHeaderFate(
+ QuicPacketFate fate,
+ QuicConnectionId connection_id,
+ QuicPacketNumber packet_number) {
switch (fate) {
case kFateProcess: {
ProcessChlo();
@@ -340,8 +349,7 @@ bool QuicDispatcher::OnUnauthenticatedHeader(const QuicPacketHeader& header) {
// MaybeRejectStatelessly might have already added the connection to
// time wait, in which case it should not be added again.
if (!FLAGS_quic_use_cheap_stateless_rejects ||
- !time_wait_list_manager_->IsConnectionIdInTimeWait(
- header.public_header.connection_id)) {
+ !time_wait_list_manager_->IsConnectionIdInTimeWait(connection_id)) {
// Add this connection_id to the time-wait state, to safely reject
// future packets.
DVLOG(1) << "Adding connection ID " << connection_id
@@ -350,12 +358,10 @@ bool QuicDispatcher::OnUnauthenticatedHeader(const QuicPacketHeader& header) {
connection_id, framer_.version(),
/*connection_rejected_statelessly=*/false, nullptr);
}
- DCHECK(time_wait_list_manager_->IsConnectionIdInTimeWait(
- header.public_header.connection_id));
+ DCHECK(time_wait_list_manager_->IsConnectionIdInTimeWait(connection_id));
time_wait_list_manager_->ProcessPacket(
- current_server_address_, current_client_address_,
- header.public_header.connection_id, header.packet_number,
- *current_packet_);
+ current_server_address_, current_client_address_, connection_id,
+ packet_number, *current_packet_);
break;
case kFateBuffer:
// This packet is a non-CHLO packet which has arrived out of order.
@@ -366,8 +372,6 @@ bool QuicDispatcher::OnUnauthenticatedHeader(const QuicPacketHeader& header) {
// Do nothing with the packet.
break;
}
-
- return false;
}
QuicDispatcher::QuicPacketFate QuicDispatcher::ValidityChecks(
« no previous file with comments | « net/tools/quic/quic_dispatcher.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698