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

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

Issue 182523002: Land Recent QUIC Changes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixed rch's comments in Patch set 1 of CL 181463007 Created 6 years, 10 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/tcp_loss_algorithm.cc
diff --git a/net/quic/congestion_control/tcp_loss_algorithm.cc b/net/quic/congestion_control/tcp_loss_algorithm.cc
index 72df0702b26f6bdf286c4caee6663fda950ef4f3..eeca19dfe99af6697267e8d7b4459847daeaf669 100644
--- a/net/quic/congestion_control/tcp_loss_algorithm.cc
+++ b/net/quic/congestion_control/tcp_loss_algorithm.cc
@@ -9,43 +9,67 @@
namespace net {
namespace {
+
// TCP retransmits after 3 nacks.
static const size_t kNumberOfNacksBeforeRetransmission = 3;
+
+// How many RTTs the algorithm waits before determining a packet is lost due
+// to early retransmission.
+static const double kEarlyRetransmitLossDelayMultiplier = 1.25;
+
}
-TCPLossAlgorithm::TCPLossAlgorithm() { }
+TCPLossAlgorithm::TCPLossAlgorithm()
+ : loss_detection_timeout_(QuicTime::Zero()) { }
// Uses nack counts to decide when packets are lost.
SequenceNumberSet TCPLossAlgorithm::DetectLostPackets(
const QuicUnackedPacketMap& unacked_packets,
const QuicTime& time,
QuicPacketSequenceNumber largest_observed,
- QuicTime::Delta srtt) {
+ QuicTime::Delta srtt,
+ QuicTime::Delta latest_rtt) {
SequenceNumberSet lost_packets;
+ loss_detection_timeout_ = QuicTime::Zero();
+ QuicTime::Delta loss_delay =
+ srtt.Multiply(kEarlyRetransmitLossDelayMultiplier);
for (QuicUnackedPacketMap::const_iterator it = unacked_packets.begin();
it != unacked_packets.end() && it->first <= largest_observed; ++it) {
if (!it->second.pending) {
continue;
}
- size_t num_nacks_needed = kNumberOfNacksBeforeRetransmission;
- // Check for early retransmit(RFC5827) when the last packet gets acked and
- // the there are fewer than 4 pending packets.
- // TODO(ianswett): Set a retransmission timer instead of losing the packet
- // and retransmitting immediately.
- if (it->second.retransmittable_frames &&
- unacked_packets.largest_sent_packet() == largest_observed) {
- num_nacks_needed = largest_observed - it->first;
- }
- if (it->second.nack_count < num_nacks_needed) {
+ LOG_IF(DFATAL, it->second.nack_count == 0)
+ << "All packets less than largest observed should have been nacked.";
+ if (it->second.nack_count >= kNumberOfNacksBeforeRetransmission) {
+ lost_packets.insert(it->first);
continue;
}
- lost_packets.insert(it->first);
+ // Only early retransmit(RFC5827) when the last packet gets acked and
+ // there are pending retransmittable packets.
+ // This also implements a timer-protected variant of FACK.
+ if (it->second.retransmittable_frames &&
+ unacked_packets.largest_sent_packet() == largest_observed) {
+ // Early retransmit marks the packet as lost once 1.25RTTs have passed
+ // since the packet was sent and otherwise sets an alarm.
+ if (time >= it->second.sent_time.Add(loss_delay)) {
+ lost_packets.insert(it->first);
+ } else {
+ // Set the timeout for the earliest retransmittable packet where early
+ // retransmit applies.
+ loss_detection_timeout_ = it->second.sent_time.Add(loss_delay);
+ break;
+ }
+ }
}
return lost_packets;
}
+QuicTime TCPLossAlgorithm::GetLossTimeout() const {
+ return loss_detection_timeout_;
+}
+
} // namespace net
« no previous file with comments | « net/quic/congestion_control/tcp_loss_algorithm.h ('k') | net/quic/congestion_control/tcp_loss_algorithm_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698