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

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

Issue 123303003: Move all the packet parsing logic into QuicDispatcher from the (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « net/quic/test_tools/simple_quic_framer.cc ('k') | net/tools/quic/quic_dispatcher.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 (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_client.h" 5 #include "net/tools/quic/quic_client.h"
6 6
7 #include <errno.h> 7 #include <errno.h>
8 #include <netinet/in.h> 8 #include <netinet/in.h>
9 #include <string.h> 9 #include <string.h>
10 #include <sys/epoll.h> 10 #include <sys/epoll.h>
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 297
298 int bytes_read = QuicSocketUtils::ReadPacket( 298 int bytes_read = QuicSocketUtils::ReadPacket(
299 fd_, buf, arraysize(buf), overflow_supported_ ? &packets_dropped_ : NULL, 299 fd_, buf, arraysize(buf), overflow_supported_ ? &packets_dropped_ : NULL,
300 &client_ip, &server_address); 300 &client_ip, &server_address);
301 301
302 if (bytes_read < 0) { 302 if (bytes_read < 0) {
303 return false; 303 return false;
304 } 304 }
305 305
306 QuicEncryptedPacket packet(buf, bytes_read, false); 306 QuicEncryptedPacket packet(buf, bytes_read, false);
307 QuicGuid our_guid = session_->connection()->guid();
308 QuicGuid packet_guid;
309
310 if (!QuicFramer::ReadGuidFromPacket(packet, &packet_guid)) {
311 DLOG(INFO) << "Could not read GUID from packet";
312 return true;
313 }
314 if (packet_guid != our_guid) {
315 DLOG(INFO) << "Ignoring packet from unexpected GUID: "
316 << packet_guid << " instead of " << our_guid;
317 return true;
318 }
319 307
320 IPEndPoint client_address(client_ip, client_address_.port()); 308 IPEndPoint client_address(client_ip, client_address_.port());
321 session_->connection()->ProcessUdpPacket( 309 session_->connection()->ProcessUdpPacket(
322 client_address, server_address, packet); 310 client_address, server_address, packet);
323 return true; 311 return true;
324 } 312 }
325 313
326 } // namespace tools 314 } // namespace tools
327 } // namespace net 315 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/test_tools/simple_quic_framer.cc ('k') | net/tools/quic/quic_dispatcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698