OLD | NEW |
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 Loading... |
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 |
OLD | NEW |