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

Side by Side Diff: net/tools/quic/quic_packet_reader.cc

Issue 2229703003: Introduce TTL in QuicReceivedPacket. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@129359661
Patch Set: git pull from upper stream 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 unified diff | Download patch
« no previous file with comments | « net/quic/core/quic_protocol.cc ('k') | net/tools/quic/quic_socket_utils.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 123
124 // This isn't particularly desirable, but not all platforms support socket 124 // This isn't particularly desirable, but not all platforms support socket
125 // timestamping. 125 // timestamping.
126 if (packet_walltimestamp.IsZero()) { 126 if (packet_walltimestamp.IsZero()) {
127 if (fallback_walltimestamp.IsZero()) { 127 if (fallback_walltimestamp.IsZero()) {
128 fallback_walltimestamp = clock.WallNow(); 128 fallback_walltimestamp = clock.WallNow();
129 } 129 }
130 packet_walltimestamp = fallback_walltimestamp; 130 packet_walltimestamp = fallback_walltimestamp;
131 } 131 }
132 QuicTime timestamp = clock.ConvertWallTimeToQuicTime(packet_walltimestamp); 132 QuicTime timestamp = clock.ConvertWallTimeToQuicTime(packet_walltimestamp);
133 int ttl = 0;
134 bool has_ttl =
135 QuicSocketUtils::GetTtlFromMsghdr(&mmsg_hdr_[i].msg_hdr, &ttl);
133 QuicReceivedPacket packet(reinterpret_cast<char*>(packets_[i].iov.iov_base), 136 QuicReceivedPacket packet(reinterpret_cast<char*>(packets_[i].iov.iov_base),
134 mmsg_hdr_[i].msg_len, timestamp, false); 137 mmsg_hdr_[i].msg_len, timestamp, false, ttl,
138 has_ttl);
135 IPEndPoint server_address(server_ip, port); 139 IPEndPoint server_address(server_ip, port);
136 processor->ProcessPacket(server_address, client_address, packet); 140 processor->ProcessPacket(server_address, client_address, packet);
137 } 141 }
138 142
139 if (packets_dropped != nullptr) { 143 if (packets_dropped != nullptr) {
140 QuicSocketUtils::GetOverflowFromMsghdr(&mmsg_hdr_[0].msg_hdr, 144 QuicSocketUtils::GetOverflowFromMsghdr(&mmsg_hdr_[0].msg_hdr,
141 packets_dropped); 145 packets_dropped);
142 } 146 }
143 147
144 // We may not have read all of the packets available on the socket. 148 // We may not have read all of the packets available on the socket.
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 IPEndPoint server_address(server_ip, port); 187 IPEndPoint server_address(server_ip, port);
184 processor->ProcessPacket(server_address, client_address, packet); 188 processor->ProcessPacket(server_address, client_address, packet);
185 189
186 // The socket read was successful, so return true even if packet dispatch 190 // The socket read was successful, so return true even if packet dispatch
187 // failed. 191 // failed.
188 return true; 192 return true;
189 } 193 }
190 194
191 195
192 } // namespace net 196 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/core/quic_protocol.cc ('k') | net/tools/quic/quic_socket_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698