Skip to content

Defer processing of saved datagrams - #1024

Merged
martinthomson merged 2 commits into
mozilla:mainfrom
martinthomson:defer-saved
Oct 30, 2020
Merged

martinthomson merged 2 commits into
mozilla:mainfrom
martinthomson:defer-saved

Conversation

@martinthomson

Copy link
Copy Markdown
Member

This ensures that we don't jump into handling Handshake packets before
we have finished processing the current datagram.

This doesn't do much, but the moved assertion in start_handshake()
should highlight why this was not great. Without the changes, that
assertion fails.

This ensures that we don't jump into handling Handshake packets before
we have finished processing the current datagram.

This doesn't do much, but the moved assertion in start_handshake()
should highlight why this was not great.  Without the changes, that
assertion fails.
Comment thread neqo-transport/src/connection/mod.rs Outdated
fn process_saved(&mut self, now: Instant) {
while let Some(cspace) = self.saved_datagrams.available() {
qdebug!([self], "process saved for space {:?}", cspace);
if self.crypto.states.rx_hp(cspace).is_some() {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I do not like that this is theory could loop if we have mismatch between making a space available and self.crypto.states.rx_hp(cspace).is_some() returning false. Can we do it a bit different?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Hmm. I think that we have a guarantee that we won't ever mark something as available if the crypto space isn't available. I think that what we really need here is an assertion rather than an if statement, like:

debug_assert!(self.crypto.states.rx_hp(cspace).is_some());

Would that make you more comfortable?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

let's do that.

Please add the assertion and land the PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants