-
-
Notifications
You must be signed in to change notification settings - Fork 290
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
fix: do not ignore result of ensure_recv_open
#687
Conversation
It may cause hanging, because result isn't checked
There was a problem hiding this 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(()))); | ||
} |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
Signed-off-by: Sven Pfennig <[email protected]>
It may cause hanging, because result isn't checked
Noticed within #600
For example, it's handled here and here with the similar logic