| OLD | NEW |
| (Empty) |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "net/quic/congestion_control/timestamp_receiver.h" | |
| 6 | |
| 7 #include <utility> | |
| 8 | |
| 9 #include "base/basictypes.h" | |
| 10 | |
| 11 namespace net { | |
| 12 | |
| 13 TimestampReceiver::TimestampReceiver() { | |
| 14 } | |
| 15 | |
| 16 TimestampReceiver::~TimestampReceiver() { | |
| 17 } | |
| 18 | |
| 19 bool TimestampReceiver::GenerateCongestionFeedback( | |
| 20 QuicCongestionFeedbackFrame* feedback) { | |
| 21 if (received_packet_times_.size() <= 1) { | |
| 22 // Don't waste resources by sending a feedback frame for only one packet. | |
| 23 return false; | |
| 24 } | |
| 25 feedback->type = kTimestamp; | |
| 26 | |
| 27 // Copy our current receive set to our feedback message, we will not resend | |
| 28 // this data if it is lost. | |
| 29 feedback->timestamp.received_packet_times = received_packet_times_; | |
| 30 | |
| 31 // Prepare for the next set of arriving packets by clearing our current set. | |
| 32 received_packet_times_.clear(); | |
| 33 return true; | |
| 34 } | |
| 35 | |
| 36 void TimestampReceiver::RecordIncomingPacket( | |
| 37 QuicByteCount /*bytes*/, | |
| 38 QuicPacketSequenceNumber sequence_number, | |
| 39 QuicTime timestamp) { | |
| 40 received_packet_times_.insert(std::make_pair(sequence_number, timestamp)); | |
| 41 } | |
| 42 | |
| 43 } // namespace net | |
| OLD | NEW |