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

Unified Diff: net/tools/quic/quic_packet_reader.cc

Issue 1810103002: Always use recvmmsg or recvmsg if it's available, and consolidate ReadAndDispatchPackets and ReadAn… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@116987771
Patch Set: Created 4 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/tools/quic/quic_packet_reader.h ('k') | net/tools/quic/quic_server.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/tools/quic/quic_packet_reader.cc
diff --git a/net/tools/quic/quic_packet_reader.cc b/net/tools/quic/quic_packet_reader.cc
index a4ba1be4c544113ad9483a6bae20990466f1f485..3f5f8c8c64c72ff5c49c33007bfee46884b8bd92 100644
--- a/net/tools/quic/quic_packet_reader.cc
+++ b/net/tools/quic/quic_packet_reader.cc
@@ -60,14 +60,24 @@ void QuicPacketReader::Initialize() {
QuicPacketReader::~QuicPacketReader() {}
-// TODO(danzh): write a public method to wrap ReadAndDispatchPackets() and
-// ReadAndDispatchSinglePacket() based on MMSG_MORE.
bool QuicPacketReader::ReadAndDispatchPackets(
int fd,
int port,
ProcessPacketInterface* processor,
QuicPacketCount* packets_dropped) {
#if MMSG_MORE
+ return ReadAndDispatchManyPackets(fd, port, processor, packets_dropped);
+#else
+ return ReadAndDispatchSinglePacket(fd, port, processor, packets_dropped);
+#endif
+}
+
+bool QuicPacketReader::ReadAndDispatchManyPackets(
+ int fd,
+ int port,
+ ProcessPacketInterface* processor,
+ QuicPacketCount* packets_dropped) {
+#if MMSG_MORE
// Re-set the length fields in case recvmmsg has changed them.
for (int i = 0; i < kNumPacketsPerReadMmsgCall; ++i) {
DCHECK_EQ(kMaxPacketSize, packets_[i].iov.iov_len);
« no previous file with comments | « net/tools/quic/quic_packet_reader.h ('k') | net/tools/quic/quic_server.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698