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

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

Issue 2236973002: Landing Recent QUIC changes until 4AM, Aug 7, 2016 UTC-4 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: flip quic_sequencer_buffer_retire_block_in_time to true Created 4 years, 4 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_printer_bin.cc ('k') | net/tools/quic/quic_server.cc » ('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 e239e58c72d53a250ffb2aa57cca7b125fce6cea..0d0c613bc358aacb38db4a811effcb4be3fb8a0a 100644
--- a/net/tools/quic/quic_packet_reader.cc
+++ b/net/tools/quic/quic_packet_reader.cc
@@ -98,7 +98,6 @@ bool QuicPacketReader::ReadAndDispatchManyPackets(
return false; // recvmmsg failed.
}
- QuicTime fallback_timestamp = QuicTime::Zero();
QuicWallTime fallback_walltimestamp = QuicWallTime::Zero();
for (int i = 0; i < packets_read; ++i) {
if (mmsg_hdr_[i].msg_len == 0) {
@@ -114,12 +113,9 @@ bool QuicPacketReader::ReadAndDispatchManyPackets(
IPEndPoint client_address = IPEndPoint(packets_[i].raw_address);
IPAddress server_ip;
- QuicTime packet_timestamp = QuicTime::Zero();
QuicWallTime packet_walltimestamp = QuicWallTime::Zero();
- bool latched_walltimestamps = FLAGS_quic_socket_walltimestamps;
QuicSocketUtils::GetAddressAndTimestampFromMsghdr(
- &mmsg_hdr_[i].msg_hdr, &server_ip, &packet_timestamp,
- &packet_walltimestamp, latched_walltimestamps);
+ &mmsg_hdr_[i].msg_hdr, &server_ip, &packet_walltimestamp);
if (!IsInitializedAddress(server_ip)) {
QUIC_BUG << "Unable to get server address.";
continue;
@@ -127,24 +123,19 @@ bool QuicPacketReader::ReadAndDispatchManyPackets(
// This isn't particularly desirable, but not all platforms support socket
// timestamping.
- if (latched_walltimestamps) {
- if (packet_walltimestamp.IsZero()) {
- if (fallback_walltimestamp.IsZero()) {
- fallback_walltimestamp = clock.WallNow();
- }
- packet_walltimestamp = fallback_walltimestamp;
- }
- packet_timestamp = clock.ConvertWallTimeToQuicTime(packet_walltimestamp);
- } else {
- if (packet_timestamp == QuicTime::Zero()) {
- if (fallback_timestamp == QuicTime::Zero()) {
- fallback_timestamp = clock.Now();
- }
- packet_timestamp = fallback_timestamp;
+ if (packet_walltimestamp.IsZero()) {
+ if (fallback_walltimestamp.IsZero()) {
+ fallback_walltimestamp = clock.WallNow();
}
+ packet_walltimestamp = fallback_walltimestamp;
}
+ QuicTime timestamp = clock.ConvertWallTimeToQuicTime(packet_walltimestamp);
+ int ttl = 0;
+ bool has_ttl =
+ QuicSocketUtils::GetTtlFromMsghdr(&mmsg_hdr_[i].msg_hdr, &ttl);
QuicReceivedPacket packet(reinterpret_cast<char*>(packets_[i].iov.iov_base),
- mmsg_hdr_[i].msg_len, packet_timestamp, false);
+ mmsg_hdr_[i].msg_len, timestamp, false, ttl,
+ has_ttl);
IPEndPoint server_address(server_ip, port);
processor->ProcessPacket(server_address, client_address, packet);
}
@@ -169,17 +160,14 @@ bool QuicPacketReader::ReadAndDispatchSinglePacket(
const QuicClock& clock,
ProcessPacketInterface* processor,
QuicPacketCount* packets_dropped) {
- bool latched_walltimestamps = FLAGS_quic_socket_walltimestamps;
char buf[kMaxPacketSize];
IPEndPoint client_address;
IPAddress server_ip;
- QuicTime timestamp = QuicTime::Zero();
QuicWallTime walltimestamp = QuicWallTime::Zero();
- int bytes_read = QuicSocketUtils::ReadPacket(
- fd, buf, arraysize(buf), packets_dropped, &server_ip, &timestamp,
- &walltimestamp, latched_walltimestamps, &client_address);
-
+ int bytes_read =
+ QuicSocketUtils::ReadPacket(fd, buf, arraysize(buf), packets_dropped,
+ &server_ip, &walltimestamp, &client_address);
if (bytes_read < 0) {
return false; // ReadPacket failed.
}
@@ -190,16 +178,10 @@ bool QuicPacketReader::ReadAndDispatchSinglePacket(
}
// This isn't particularly desirable, but not all platforms support socket
// timestamping.
- if (latched_walltimestamps) {
- if (walltimestamp.IsZero()) {
- walltimestamp = clock.WallNow();
- }
- timestamp = clock.ConvertWallTimeToQuicTime(walltimestamp);
- } else {
- if (timestamp == QuicTime::Zero()) {
- timestamp = clock.Now();
- }
+ if (walltimestamp.IsZero()) {
+ walltimestamp = clock.WallNow();
}
+ QuicTime timestamp = clock.ConvertWallTimeToQuicTime(walltimestamp);
QuicReceivedPacket packet(buf, bytes_read, timestamp, false);
IPEndPoint server_address(server_ip, port);
« no previous file with comments | « net/tools/quic/quic_packet_printer_bin.cc ('k') | net/tools/quic/quic_server.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698