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_flags.h" |
17 #include "net/tools/quic/quic_dispatcher.h" | 18 #include "net/tools/quic/quic_dispatcher.h" |
18 #include "net/tools/quic/quic_socket_utils.h" | 19 #include "net/tools/quic/quic_socket_utils.h" |
19 | 20 |
20 #define MMSG_MORE 0 | 21 #define MMSG_MORE 0 |
21 | 22 |
22 #ifndef SO_RXQ_OVFL | 23 #ifndef SO_RXQ_OVFL |
23 #define SO_RXQ_OVFL 40 | 24 #define SO_RXQ_OVFL 40 |
24 #endif | 25 #endif |
25 | 26 |
26 namespace net { | 27 namespace net { |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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) { |
102 QuicSocketUtils::GetOverflowFromMsghdr(&mmsg_hdr_[0].msg_hdr, | 103 QuicSocketUtils::GetOverflowFromMsghdr(&mmsg_hdr_[0].msg_hdr, |
103 packets_dropped); | 104 packets_dropped); |
104 } | 105 } |
105 | 106 |
106 return true; | 107 if (FLAGS_quic_read_packets_full_recvmmsg) { |
| 108 // We may not have read all of the packets available on the socket. |
| 109 return packets_read == kNumPacketsPerReadMmsgCall; |
| 110 } else { |
| 111 return true; |
| 112 } |
107 #else | 113 #else |
108 LOG(FATAL) << "Unsupported"; | 114 LOG(FATAL) << "Unsupported"; |
109 return false; | 115 return false; |
110 #endif | 116 #endif |
111 } | 117 } |
112 | 118 |
113 /* static */ | 119 /* static */ |
114 bool QuicPacketReader::ReadAndDispatchSinglePacket( | 120 bool QuicPacketReader::ReadAndDispatchSinglePacket( |
115 int fd, | 121 int fd, |
116 int port, | 122 int port, |
(...skipping 17 matching lines...) Expand all Loading... |
134 processor->ProcessPacket(server_address, client_address, packet); | 140 processor->ProcessPacket(server_address, client_address, packet); |
135 | 141 |
136 // The socket read was successful, so return true even if packet dispatch | 142 // The socket read was successful, so return true even if packet dispatch |
137 // failed. | 143 // failed. |
138 return true; | 144 return true; |
139 } | 145 } |
140 | 146 |
141 } // namespace tools | 147 } // namespace tools |
142 | 148 |
143 } // namespace net | 149 } // namespace net |
OLD | NEW |