| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_packet_reader.h" | 5 #include "net/tools/quic/quic_packet_reader.h" |
| 6 | 6 |
| 7 #include <errno.h> | 7 #include <errno.h> |
| 8 #ifndef __APPLE__ | 8 #ifndef __APPLE__ |
| 9 // This is a GNU header that is not present in /usr/include on MacOS | 9 // This is a GNU header that is not present in /usr/include on MacOS |
| 10 #include <features.h> | 10 #include <features.h> |
| 11 #endif | 11 #endif |
| 12 #include <string.h> | 12 #include <string.h> |
| 13 #include <sys/epoll.h> | 13 #include <sys/epoll.h> |
| 14 | 14 |
| 15 #include "base/logging.h" | 15 #include "base/logging.h" |
| 16 #include "net/base/ip_endpoint.h" | 16 #include "net/base/ip_endpoint.h" |
| 17 #include "net/quic/quic_bug_tracker.h" |
| 17 #include "net/quic/quic_flags.h" | 18 #include "net/quic/quic_flags.h" |
| 18 #include "net/tools/quic/quic_dispatcher.h" | 19 #include "net/tools/quic/quic_dispatcher.h" |
| 19 #include "net/tools/quic/quic_socket_utils.h" | 20 #include "net/tools/quic/quic_socket_utils.h" |
| 20 | 21 |
| 21 #define MMSG_MORE 0 | 22 #define MMSG_MORE 0 |
| 22 | 23 |
| 23 #ifndef SO_RXQ_OVFL | 24 #ifndef SO_RXQ_OVFL |
| 24 #define SO_RXQ_OVFL 40 | 25 #define SO_RXQ_OVFL 40 |
| 25 #endif | 26 #endif |
| 26 | 27 |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 | 82 |
| 82 for (int i = 0; i < packets_read; ++i) { | 83 for (int i = 0; i < packets_read; ++i) { |
| 83 if (mmsg_hdr_[i].msg_len == 0) { | 84 if (mmsg_hdr_[i].msg_len == 0) { |
| 84 continue; | 85 continue; |
| 85 } | 86 } |
| 86 | 87 |
| 87 IPEndPoint client_address = IPEndPoint(raw_address_[i]); | 88 IPEndPoint client_address = IPEndPoint(raw_address_[i]); |
| 88 IPAddressNumber server_ip = | 89 IPAddressNumber server_ip = |
| 89 QuicSocketUtils::GetAddressFromMsghdr(&mmsg_hdr_[i].msg_hdr); | 90 QuicSocketUtils::GetAddressFromMsghdr(&mmsg_hdr_[i].msg_hdr); |
| 90 if (!IsInitializedAddress(server_ip)) { | 91 if (!IsInitializedAddress(server_ip)) { |
| 91 LOG(DFATAL) << "Unable to get server address."; | 92 QUIC_BUG << "Unable to get server address."; |
| 92 continue; | 93 continue; |
| 93 } | 94 } |
| 94 | 95 |
| 95 QuicEncryptedPacket packet(reinterpret_cast<char*>(iov_[i].iov_base), | 96 QuicEncryptedPacket packet(reinterpret_cast<char*>(iov_[i].iov_base), |
| 96 mmsg_hdr_[i].msg_len, false); | 97 mmsg_hdr_[i].msg_len, false); |
| 97 IPEndPoint server_address(server_ip, port); | 98 IPEndPoint server_address(server_ip, port); |
| 98 processor->ProcessPacket(server_address, client_address, packet); | 99 processor->ProcessPacket(server_address, client_address, packet); |
| 99 } | 100 } |
| 100 | 101 |
| 101 if (packets_dropped != nullptr) { | 102 if (packets_dropped != nullptr) { |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 processor->ProcessPacket(server_address, client_address, packet); | 134 processor->ProcessPacket(server_address, client_address, packet); |
| 134 | 135 |
| 135 // The socket read was successful, so return true even if packet dispatch | 136 // The socket read was successful, so return true even if packet dispatch |
| 136 // failed. | 137 // failed. |
| 137 return true; | 138 return true; |
| 138 } | 139 } |
| 139 | 140 |
| 140 } // namespace tools | 141 } // namespace tools |
| 141 | 142 |
| 142 } // namespace net | 143 } // namespace net |
| OLD | NEW |