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

Unified Diff: net/quic/congestion_control/timestamp_receiver.cc

Issue 447093004: Land Recent QUIC Changes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixed indenation in QuicFramer.cc Created 6 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
Index: net/quic/congestion_control/timestamp_receiver.cc
diff --git a/net/quic/congestion_control/timestamp_receiver.cc b/net/quic/congestion_control/timestamp_receiver.cc
new file mode 100644
index 0000000000000000000000000000000000000000..ad4407c1ad2370ecf851daf7a0563f07847f7da3
--- /dev/null
+++ b/net/quic/congestion_control/timestamp_receiver.cc
@@ -0,0 +1,43 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "net/quic/congestion_control/timestamp_receiver.h"
+
+#include <utility>
+
+#include "base/basictypes.h"
+
+namespace net {
+
+TimestampReceiver::TimestampReceiver() {
+}
+
+TimestampReceiver::~TimestampReceiver() {
+}
+
+bool TimestampReceiver::GenerateCongestionFeedback(
+ QuicCongestionFeedbackFrame* feedback) {
+ if (received_packet_times_.size() <= 1) {
+ // Don't waste resources by sending a feedback frame for only one packet.
+ return false;
+ }
+ feedback->type = kTimestamp;
+
+ // Copy our current receive set to our feedback message, we will not resend
+ // this data if it is lost.
+ feedback->timestamp.received_packet_times = received_packet_times_;
+
+ // Prepare for the next set of arriving packets by clearing our current set.
+ received_packet_times_.clear();
+ return true;
+}
+
+void TimestampReceiver::RecordIncomingPacket(
+ QuicByteCount /*bytes*/,
+ QuicPacketSequenceNumber sequence_number,
+ QuicTime timestamp) {
+ received_packet_times_.insert(std::make_pair(sequence_number, timestamp));
+}
+
+} // namespace net
« no previous file with comments | « net/quic/congestion_control/timestamp_receiver.h ('k') | net/quic/congestion_control/timestamp_receiver_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698