| 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> |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 mmsg_hdr_[i].msg_len, false); | 97 mmsg_hdr_[i].msg_len, false); |
| 98 IPEndPoint server_address(server_ip, port); | 98 IPEndPoint server_address(server_ip, port); |
| 99 processor->ProcessPacket(server_address, client_address, packet); | 99 processor->ProcessPacket(server_address, client_address, packet); |
| 100 } | 100 } |
| 101 | 101 |
| 102 if (packets_dropped != nullptr) { | 102 if (packets_dropped != nullptr) { |
| 103 QuicSocketUtils::GetOverflowFromMsghdr(&mmsg_hdr_[0].msg_hdr, | 103 QuicSocketUtils::GetOverflowFromMsghdr(&mmsg_hdr_[0].msg_hdr, |
| 104 packets_dropped); | 104 packets_dropped); |
| 105 } | 105 } |
| 106 | 106 |
| 107 if (FLAGS_quic_read_packets_full_recvmmsg) { | 107 // We may not have read all of the packets available on the socket. |
| 108 // We may not have read all of the packets available on the socket. | 108 return packets_read == kNumPacketsPerReadMmsgCall; |
| 109 return packets_read == kNumPacketsPerReadMmsgCall; | |
| 110 } else { | |
| 111 return true; | |
| 112 } | |
| 113 #else | 109 #else |
| 114 LOG(FATAL) << "Unsupported"; | 110 LOG(FATAL) << "Unsupported"; |
| 115 return false; | 111 return false; |
| 116 #endif | 112 #endif |
| 117 } | 113 } |
| 118 | 114 |
| 119 /* static */ | 115 /* static */ |
| 120 bool QuicPacketReader::ReadAndDispatchSinglePacket( | 116 bool QuicPacketReader::ReadAndDispatchSinglePacket( |
| 121 int fd, | 117 int fd, |
| 122 int port, | 118 int port, |
| (...skipping 17 matching lines...) Expand all Loading... |
| 140 processor->ProcessPacket(server_address, client_address, packet); | 136 processor->ProcessPacket(server_address, client_address, packet); |
| 141 | 137 |
| 142 // The socket read was successful, so return true even if packet dispatch | 138 // The socket read was successful, so return true even if packet dispatch |
| 143 // failed. | 139 // failed. |
| 144 return true; | 140 return true; |
| 145 } | 141 } |
| 146 | 142 |
| 147 } // namespace tools | 143 } // namespace tools |
| 148 | 144 |
| 149 } // namespace net | 145 } // namespace net |
| OLD | NEW |