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

Unified Diff: net/quic/quic_utils.cc

Issue 1660593004: Landing Recent QUIC changes until 01/28/2016 18:41 UTC (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@Final_0202
Patch Set: Created 4 years, 11 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/quic/quic_utils.h ('k') | net/quic/spdy_utils_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/quic_utils.cc
diff --git a/net/quic/quic_utils.cc b/net/quic/quic_utils.cc
index 2c1c24e68114a3d95de02211034f678bffeca352..047cfe2387f87a72f326c9416e5f458b44e872e1 100644
--- a/net/quic/quic_utils.cc
+++ b/net/quic/quic_utils.cc
@@ -455,13 +455,26 @@ void QuicUtils::RemoveFramesForStream(QuicFrames* frames,
// static
void QuicUtils::ClearSerializedPacket(SerializedPacket* serialized_packet) {
- if (serialized_packet->retransmittable_frames != nullptr) {
- DeleteFrames(serialized_packet->retransmittable_frames);
+ if (!serialized_packet->retransmittable_frames.empty()) {
+ DeleteFrames(&serialized_packet->retransmittable_frames);
}
- delete serialized_packet->retransmittable_frames;
delete serialized_packet->packet;
- serialized_packet->retransmittable_frames = nullptr;
serialized_packet->packet = nullptr;
}
+// static
+uint64_t QuicUtils::PackPathIdAndPacketNumber(QuicPathId path_id,
+ QuicPacketNumber packet_number) {
+ // Setting the nonce below relies on QuicPathId and QuicPacketNumber being
+ // specific sizes.
+ static_assert(sizeof(path_id) == 1, "Size of QuicPathId changed.");
+ static_assert(sizeof(packet_number) == 8,
+ "Size of QuicPacketNumber changed.");
+ // Use path_id and lower 7 bytes of packet_number as lower 8 bytes of nonce.
+ uint64_t path_id_packet_number =
+ (static_cast<uint64_t>(path_id) << 56) | packet_number;
+ DCHECK(path_id != kDefaultPathId || path_id_packet_number == packet_number);
+ return path_id_packet_number;
+}
+
} // namespace net
« no previous file with comments | « net/quic/quic_utils.h ('k') | net/quic/spdy_utils_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698