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: do not ignore result of ensure_recv_open #687

Merged
merged 4 commits into from
Jul 24, 2023

Conversation

DDtKey
Copy link
Contributor

@DDtKey DDtKey commented Jun 5, 2023

It may cause hanging, because result isn't checked
Noticed within #600

For example, it's handled here and here with the similar logic

It may cause hanging, because result isn't checked
Copy link
Member

@seanmonstar seanmonstar left a comment

Choose a reason for hiding this comment

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

(Wow, a function returning a Result<bool> is extremely confusing XD)

stream.state.ensure_recv_open()?;
if !stream.state.ensure_recv_open()? {
return Poll::Ready(Ok(Response::new(())));
}
Copy link
Member

Choose a reason for hiding this comment

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

So, if recv is NOT open, should it be returning a new empty response? Or is that an error in this context? It would be good to include a code comment here to remind us why, in either case.

Copy link
Contributor Author

@DDtKey DDtKey Jun 6, 2023

Choose a reason for hiding this comment

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

I was relying on similar logic here and here, it just forces to mark future as ready without error.

However, it's still not so clear what would be the more correct way, because Result<bool, Error> is confusing and probably should be refactored somehow. What I know for sure: bool shouldn't be ignored.

But for now I wanted to address the issue with simple & partially existed logic: if ensure_recv_open tells us it's not an error but stream is closed, it shouldn't be error. Otherwise we need to think how it can be refactored. Any ideas?

Copy link
Member

Choose a reason for hiding this comment

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

Hm. Is there a way to build a test for this? That might help make it clearer what should actually be done.

src/proto/streams/streams.rs Show resolved Hide resolved
@seanmonstar seanmonstar merged commit 633116e into hyperium:master Jul 24, 2023
6 checks passed
@DDtKey DDtKey deleted the fix-ensure_recv_open-false-result branch July 24, 2023 17:26
0xE282B0 pushed a commit to 0xE282B0/h2 that referenced this pull request Jan 11, 2024
0xE282B0 pushed a commit to 0xE282B0/h2 that referenced this pull request Jan 11, 2024
0xE282B0 pushed a commit to 0xE282B0/h2 that referenced this pull request Jan 16, 2024
Signed-off-by: Sven Pfennig <s.pfennig@reply.de>
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