diff options
Diffstat (limited to 'net/tools/quic/quic_packet_reader.h')
-rw-r--r-- | net/tools/quic/quic_packet_reader.h | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/net/tools/quic/quic_packet_reader.h b/net/tools/quic/quic_packet_reader.h index 6ffe26b..b388406 100644 --- a/net/tools/quic/quic_packet_reader.h +++ b/net/tools/quic/quic_packet_reader.h @@ -11,8 +11,10 @@ #include <sys/socket.h> #include "base/macros.h" +#include "net/quic/quic_clock.h" #include "net/quic/quic_protocol.h" #include "net/tools/quic/quic_process_packet_interface.h" +#include "net/tools/quic/quic_socket_utils.h" #define MMSG_MORE 0 @@ -21,9 +23,6 @@ namespace net { #if MMSG_MORE // Read in larger batches to minimize recvmmsg overhead. const int kNumPacketsPerReadMmsgCall = 16; -// Allocate space for in6_pktinfo as it's larger than in_pktinfo -const int kSpaceForOverflowAndIp = - CMSG_SPACE(sizeof(int)) + CMSG_SPACE(sizeof(in6_pktinfo)); #endif namespace test { @@ -43,8 +42,11 @@ class QuicPacketReader { // packets available on the socket. // Populates |packets_dropped| if it is non-null and the socket is configured // to track dropped packets and some packets are read. + // If the socket has timestamping enabled, the per packet timestamps will be + // passed to the processor. Otherwise, |clock| will be used. virtual bool ReadAndDispatchPackets(int fd, int port, + const QuicClock& clock, ProcessPacketInterface* processor, QuicPacketCount* packets_dropped); @@ -55,12 +57,14 @@ class QuicPacketReader { // Reads and dispatches many packets using recvmmsg. bool ReadAndDispatchManyPackets(int fd, int port, + const QuicClock& clock, ProcessPacketInterface* processor, QuicPacketCount* packets_dropped); // Reads and dispatches a single packet using recvmsg. static bool ReadAndDispatchSinglePacket(int fd, int port, + const QuicClock& clock, ProcessPacketInterface* processor, QuicPacketCount* packets_dropped); @@ -78,7 +82,7 @@ class QuicPacketReader { // call on the packets. struct sockaddr_storage raw_address; // cbuf is used for ancillary data from the kernel on recvmmsg. - char cbuf[kSpaceForOverflowAndIp]; + char cbuf[QuicSocketUtils::kSpaceForCmsg]; // buf is used for the data read from the kernel on recvmmsg. char buf[kMaxPacketSize]; }; |