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

Make the Content.Chunk.isTerminal() contract stricter #8994

Merged
merged 1 commit into from
Dec 6, 2022

Conversation

lorban
Copy link
Contributor

@lorban lorban commented Dec 1, 2022

Make the Content.Chunk.isTerminal() contract stricter by explicitly disallowing the creation of new last chunks with an empty ByteBuffer.

Also replace non-last empty chunks with EMPTY where it makes sense.

Closes #8993

@lorban lorban added the jetty 12 label Dec 1, 2022
@lorban lorban self-assigned this Dec 1, 2022
@lorban lorban changed the title Disallow creating new chunks with an empty ByteBuffer Make the Content.Chunk.isTerminal() contract stricter Dec 1, 2022
Copy link
Contributor

@gregw gregw left a comment

Choose a reason for hiding this comment

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

I like the change. But it raises a question about calling succeeded twice?

@lorban lorban marked this pull request as ready for review December 2, 2022 11:58
@lorban lorban requested a review from sbordet December 2, 2022 11:58
@lorban lorban requested a review from gregw December 2, 2022 13:13
@lorban
Copy link
Contributor Author

lorban commented Dec 2, 2022

@gregw I answered your question w.r.t succeeding twice the callback in your code comment. In a nutshell, it's never succeeded twice and my original change introduced a bug which made it never be succeeded in certain cases. This is now fixed with some comments explaining the somewhat baroque logic.

@lorban lorban requested a review from sbordet December 5, 2022 15:36
Copy link
Contributor

@gregw gregw left a comment

Choose a reason for hiding this comment

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

I think we should rely on Chunk.from to correctly choose from EOF, EMPTY or a new chunk, rather than have that same logic scatter around the code base.

@lorban lorban requested a review from gregw December 6, 2022 14:28
@lorban lorban requested a review from sbordet December 6, 2022 17:54
@lorban lorban force-pushed the jetty-12.0.x-8993-isTerminal-eof branch from 84eddd6 to cc5dedc Compare December 6, 2022 18:43
… Chunk.isTerminal() contract stricter

Signed-off-by: Ludovic Orban <lorban@bitronix.be>
@lorban lorban force-pushed the jetty-12.0.x-8993-isTerminal-eof branch from cc5dedc to f510986 Compare December 6, 2022 18:46
@lorban lorban merged commit 42186bf into jetty-12.0.x Dec 6, 2022
@lorban lorban deleted the jetty-12.0.x-8993-isTerminal-eof branch December 6, 2022 18:48
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.

Content.Chunk.isTerminal() cannot discriminate EOF from chunks containing a pooled empty buffer
3 participants