Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix time loss detection and early retransmit #394

Merged
merged 3 commits into from
Mar 13, 2017
Merged

Conversation

ianswett
Copy link
Contributor

No description provided.

Copy link
Contributor

@janaiyengar janaiyengar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Ian, a few comments

threshold in time, rather than in packet number gaps.
loss_time:
: The time at which the next packet will be considered lost based on early
transmit or exceeding the reordering window in time.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

early transmit --> early retransmit

packet's size.
: An association of packet numbers to information about them, including a number
field indicating the packet number, a time field indicating the time a packet
was sent and a bytes field indicating the packet's size. sent_packets is
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oxford comma nit: "... was sent, and a bytes field ..."

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

field indicating the packet number, a time field indicating the time a packet
was sent and a bytes field indicating the packet's size. sent_packets is
ordered by packet number, and packets remain in sent_packets until
acknowledged or lost.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: "until they are acknowledged or lost"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left it as is, because it's shorter.

else:
reordering_threshold = kReorderingThreshold
time_reordering_fraction = infinite
lost_time = 0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

loss_time = 0

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SGTM, I went with loss_time everywhere.

@@ -406,10 +410,9 @@ Pseudocode for SetLossDetectionAlarm follows:
alarm_duration = 2 * smoothed_rtt
alarm_duration = max(alarm_duration, kMinTLPTimeout)
alarm_duration = alarm_duration << handshake_count
else if (largest sent packet is acked):
// Early retransmit
// with an alarm to reduce spurious retransmits.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this comment can fit in a line

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was removed.

time_delta = acked.time_sent - unacked.time_sent
packet_delta = acked.packet_number - unacked.packet_number
if (time_delta > kTimeReorderThreshold * smoothed_rtt):
time_when_lost = 0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't the time but a wait period... suggestion: reordering_period ? or "short_timeout"? you could just call it short_timeout_period... up to you

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about delay_until_lost?

packet_delta = acked.packet_number - unacked.packet_number
if (time_delta > kTimeReorderThreshold * smoothed_rtt):
time_when_lost = 0;
if (time_reordering_fraction == infinite):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be !=

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks.

foreach (unacked less than largest_acked.packet_number):
time_since_sent = now() - unacked.time_sent
packet_delta = largest_acked.packet_number - unacked.packet_number
if (time_since_sent > time_when_lost):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if time loss detection is disabled, won't time_when_lost be 0?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, I set it to infinite.

lost_packets.insert(unacked)
else if (packet_delta > reordering_threshold)
lost_packets.insert(unacked)
else if (loss_time == 0 && time_when_lost != 0):
loss_time = time_when_lost - time_since_sent
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add a comment here saying something like "loss_time is used for setting the loss detection alarm later."

OnPacketsLost(lost_packets)
MaybeRetransmit(lost_packets)
foreach (packet in lost_packets)
sent_packets.remove(packet.packet_number)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does it make sense, for editorializing, to move these packets to a "lost_packets" structure? doesn't need to be done here, but thinking aloud

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Possibly, though I still need a way to inform the congestion control of newly lost packets. I was thinking of creating a pending_retransmissions data structure in congestion control to store any lost packets that couldn't be sent immediately?

Copy link
Contributor Author

@ianswett ianswett left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Jana, updated.

packet's size.
: An association of packet numbers to information about them, including a number
field indicating the packet number, a time field indicating the time a packet
was sent and a bytes field indicating the packet's size. sent_packets is
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

field indicating the packet number, a time field indicating the time a packet
was sent and a bytes field indicating the packet's size. sent_packets is
ordered by packet number, and packets remain in sent_packets until
acknowledged or lost.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left it as is, because it's shorter.

@@ -406,10 +410,9 @@ Pseudocode for SetLossDetectionAlarm follows:
alarm_duration = 2 * smoothed_rtt
alarm_duration = max(alarm_duration, kMinTLPTimeout)
alarm_duration = alarm_duration << handshake_count
else if (largest sent packet is acked):
// Early retransmit
// with an alarm to reduce spurious retransmits.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was removed.

else:
reordering_threshold = kReorderingThreshold
time_reordering_fraction = infinite
lost_time = 0
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SGTM, I went with loss_time everywhere.

@@ -442,9 +445,9 @@ Pseudocode for OnLossDetectionAlarm follows:
RetransmitAllHandshakePackets();
handshake_count++;
// TODO: Clarify early retransmit and time loss.
else if ():
else if (lost_time != 0):
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@@ -481,19 +484,31 @@ DetectLostPackets takes one parameter, acked, which is the largest acked packet.
Pseudocode for DetectLostPackets follows:

~~~
DetectLostPackets(acked):
DetectLostPackets(largest_acked):
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a packet, not a number, because I use fields of the packet below, such as the time it was sent.

packet_delta = acked.packet_number - unacked.packet_number
if (time_delta > kTimeReorderThreshold * smoothed_rtt):
time_when_lost = 0;
if (time_reordering_fraction == infinite):
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks.

time_delta = acked.time_sent - unacked.time_sent
packet_delta = acked.packet_number - unacked.packet_number
if (time_delta > kTimeReorderThreshold * smoothed_rtt):
time_when_lost = 0;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about delay_until_lost?

foreach (unacked less than largest_acked.packet_number):
time_since_sent = now() - unacked.time_sent
packet_delta = largest_acked.packet_number - unacked.packet_number
if (time_since_sent > time_when_lost):
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, I set it to infinite.

OnPacketsLost(lost_packets)
MaybeRetransmit(lost_packets)
foreach (packet in lost_packets)
sent_packets.remove(packet.packet_number)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Possibly, though I still need a way to inform the congestion control of newly lost packets. I was thinking of creating a pending_retransmissions data structure in congestion control to store any lost packets that couldn't be sent immediately?

@janaiyengar janaiyengar merged commit 07510d1 into master Mar 13, 2017
@martinthomson martinthomson deleted the ianswett-timeloss branch April 21, 2017 05:27
@martinthomson martinthomson added design An issue that affects the design of the protocol; resolution requires consensus. -recovery labels May 22, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
-recovery design An issue that affects the design of the protocol; resolution requires consensus.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants