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

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

Issue 935333002: Update from https://crrev.com/316786 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 10 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_data_writer_test.cc ('k') | net/quic/quic_flags.h » ('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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/quic/quic_dispatcher.h" 5 #include "net/quic/quic_dispatcher.h"
6 6
7 #include <errno.h> 7 #include <errno.h>
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 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 // in OnAuthenticatedHeader. 197 // in OnAuthenticatedHeader.
198 framer_.ProcessPacket(packet); 198 framer_.ProcessPacket(packet);
199 // TODO(rjshade): Return a status describing if/why a packet was dropped, 199 // TODO(rjshade): Return a status describing if/why a packet was dropped,
200 // and log somehow. Maybe expose as a varz. 200 // and log somehow. Maybe expose as a varz.
201 } 201 }
202 202
203 bool QuicDispatcher::OnUnauthenticatedPublicHeader( 203 bool QuicDispatcher::OnUnauthenticatedPublicHeader(
204 const QuicPacketPublicHeader& header) { 204 const QuicPacketPublicHeader& header) {
205 QuicSession* session = nullptr; 205 QuicSession* session = nullptr;
206 206
207 // Port zero is only allowed for unidirectional UDP, so is disallowed by QUIC.
208 // Given that we can't even send a reply rejecting the packet, just black hole
209 // it.
210 if (current_client_address_.port() == 0) {
211 return false;
212 }
213
207 QuicConnectionId connection_id = header.connection_id; 214 QuicConnectionId connection_id = header.connection_id;
208 SessionMap::iterator it = session_map_.find(connection_id); 215 SessionMap::iterator it = session_map_.find(connection_id);
209 if (it == session_map_.end()) { 216 if (it == session_map_.end()) {
210 if (header.reset_flag) { 217 if (header.reset_flag) {
211 return false; 218 return false;
212 } 219 }
213 if (time_wait_list_manager_->IsConnectionIdInTimeWait(connection_id)) { 220 if (time_wait_list_manager_->IsConnectionIdInTimeWait(connection_id)) {
214 return HandlePacketForTimeWait(header); 221 return HandlePacketForTimeWait(header);
215 } 222 }
216 223
(...skipping 18 matching lines...) Expand all
235 242
236 // Use the version in the packet if possible, otherwise assume the latest. 243 // Use the version in the packet if possible, otherwise assume the latest.
237 QuicVersion version = header.version_flag ? header.versions.front() : 244 QuicVersion version = header.version_flag ? header.versions.front() :
238 supported_versions_.front(); 245 supported_versions_.front();
239 time_wait_list_manager_->AddConnectionIdToTimeWait(connection_id, version, 246 time_wait_list_manager_->AddConnectionIdToTimeWait(connection_id, version,
240 nullptr); 247 nullptr);
241 DCHECK(time_wait_list_manager_->IsConnectionIdInTimeWait(connection_id)); 248 DCHECK(time_wait_list_manager_->IsConnectionIdInTimeWait(connection_id));
242 return HandlePacketForTimeWait(header); 249 return HandlePacketForTimeWait(header);
243 } 250 }
244 DVLOG(1) << "Created new session for " << connection_id; 251 DVLOG(1) << "Created new session for " << connection_id;
245 session_map_.insert(make_pair(connection_id, session)); 252 session_map_.insert(std::make_pair(connection_id, session));
246 } else { 253 } else {
247 session = it->second; 254 session = it->second;
248 } 255 }
249 256
250 session->connection()->ProcessUdpPacket( 257 session->connection()->ProcessUdpPacket(
251 current_server_address_, current_client_address_, *current_packet_); 258 current_server_address_, current_client_address_, *current_packet_);
252 259
253 // Do not parse the packet further. The session will process it completely. 260 // Do not parse the packet further. The session will process it completely.
254 return false; 261 return false;
255 } 262 }
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 337
331 void QuicDispatcher::OnWriteBlocked( 338 void QuicDispatcher::OnWriteBlocked(
332 QuicBlockedWriterInterface* blocked_writer) { 339 QuicBlockedWriterInterface* blocked_writer) {
333 if (!writer_->IsWriteBlocked()) { 340 if (!writer_->IsWriteBlocked()) {
334 LOG(DFATAL) << 341 LOG(DFATAL) <<
335 "QuicDispatcher::OnWriteBlocked called when the writer is not blocked."; 342 "QuicDispatcher::OnWriteBlocked called when the writer is not blocked.";
336 // Return without adding the connection to the blocked list, to avoid 343 // Return without adding the connection to the blocked list, to avoid
337 // infinite loops in OnCanWrite. 344 // infinite loops in OnCanWrite.
338 return; 345 return;
339 } 346 }
340 write_blocked_list_.insert(make_pair(blocked_writer, true)); 347 write_blocked_list_.insert(std::make_pair(blocked_writer, true));
341 } 348 }
342 349
343 void QuicDispatcher::OnConnectionAddedToTimeWaitList( 350 void QuicDispatcher::OnConnectionAddedToTimeWaitList(
344 QuicConnectionId connection_id) { 351 QuicConnectionId connection_id) {
345 DVLOG(1) << "Connection " << connection_id << " added to time wait list."; 352 DVLOG(1) << "Connection " << connection_id << " added to time wait list.";
346 } 353 }
347 354
348 void QuicDispatcher::OnConnectionRemovedFromTimeWaitList( 355 void QuicDispatcher::OnConnectionRemovedFromTimeWaitList(
349 QuicConnectionId connection_id) { 356 QuicConnectionId connection_id) {
350 DVLOG(1) << "Connection " << connection_id << " removed from time wait list."; 357 DVLOG(1) << "Connection " << connection_id << " removed from time wait list.";
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
392 // be parsed correctly. 399 // be parsed correctly.
393 framer_.set_version(time_wait_list_manager_->GetQuicVersionFromConnectionId( 400 framer_.set_version(time_wait_list_manager_->GetQuicVersionFromConnectionId(
394 header.connection_id)); 401 header.connection_id));
395 402
396 // Continue parsing the packet to extract the sequence number. Then 403 // Continue parsing the packet to extract the sequence number. Then
397 // send it to the time wait manager in OnUnathenticatedHeader. 404 // send it to the time wait manager in OnUnathenticatedHeader.
398 return true; 405 return true;
399 } 406 }
400 407
401 } // namespace net 408 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_data_writer_test.cc ('k') | net/quic/quic_flags.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698