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

Simplify UpdateRtt pseudocode #2610

Merged
merged 1 commit into from
Apr 13, 2019
Merged

Simplify UpdateRtt pseudocode #2610

merged 1 commit into from
Apr 13, 2019

Conversation

janaiyengar
Copy link
Contributor

No description provided.

@janaiyengar janaiyengar added editorial An issue that does not affect the design of the protocol; does not require consensus. -recovery labels Apr 12, 2019
adjusted_rtt = latest_rtt
if (latest_rtt - min_rtt > ack_delay):
if (latest_rtt > min_rtt + ack_delay):
adjusted_rtt = latest_rtt - ack_delay
Copy link
Member

Choose a reason for hiding this comment

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

You can simply do latest_rtt -= ack_delay and then use latest_rtt instead of adjusted_rtt below, since latest_rtt is not used anywhere anymore

Copy link
Member

Choose a reason for hiding this comment

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

(But if you want to use the global here, maybe that adjustment to the global is wrong?)

Copy link
Member

Choose a reason for hiding this comment

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

The prose relies on latest_rtt in descriptions. Adjusting that value directly would confuse things.

@@ -1101,22 +1101,24 @@ OnAckReceived(ack, pn_space):


UpdateRtt(latest_rtt, ack_delay):
Copy link
Member

Choose a reason for hiding this comment

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

Why is latest_rtt passed in as a parameter? It's already a global. Does this parameter differ from the global?

Copy link
Member

Choose a reason for hiding this comment

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

latest_rtt probably shouldn't be global.

Copy link
Contributor

Choose a reason for hiding this comment

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

It's used in DetectLostPackets, so it needs to be global.
To avoid confusion with scoping rules, the function parameter should have a different name than the global variable though.

@@ -1101,22 +1101,24 @@ OnAckReceived(ack, pn_space):


UpdateRtt(latest_rtt, ack_delay):
if (smoothed_rtt == 0):
// First RTT sample.
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't you adjust by ack_delay here?

Copy link
Member

Choose a reason for hiding this comment

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

I don't think so. #2607 covers this though.

Copy link
Member

@martinthomson martinthomson left a comment

Choose a reason for hiding this comment

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

This looks good.

@@ -1101,22 +1101,24 @@ OnAckReceived(ack, pn_space):


UpdateRtt(latest_rtt, ack_delay):
Copy link
Member

Choose a reason for hiding this comment

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

latest_rtt probably shouldn't be global.

@@ -1101,22 +1101,24 @@ OnAckReceived(ack, pn_space):


UpdateRtt(latest_rtt, ack_delay):
if (smoothed_rtt == 0):
// First RTT sample.
Copy link
Member

Choose a reason for hiding this comment

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

I don't think so. #2607 covers this though.

adjusted_rtt = latest_rtt
if (latest_rtt - min_rtt > ack_delay):
if (latest_rtt > min_rtt + ack_delay):
adjusted_rtt = latest_rtt - ack_delay
Copy link
Member

Choose a reason for hiding this comment

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

The prose relies on latest_rtt in descriptions. Adjusting that value directly would confuse things.

@janaiyengar janaiyengar merged commit 4b07e21 into master Apr 13, 2019
@martinthomson martinthomson deleted the jri/simplify-rtt branch April 30, 2019 22:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
-recovery editorial An issue that does not affect the design of the protocol; does not require consensus.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants