Change ChunkedInputStream to not block right after chunk is read#2332
Open
tchaloupka wants to merge 1 commit intovibe-d:masterfrom
Open
Change ChunkedInputStream to not block right after chunk is read#2332tchaloupka wants to merge 1 commit intovibe-d:masterfrom
tchaloupka wants to merge 1 commit intovibe-d:masterfrom
Conversation
s-ludwig
reviewed
Dec 6, 2019
http/vibe/http/common.d
Outdated
| @property ulong leastSize() { return bytesInCurrentChunk; } | ||
|
|
||
| @property bool dataAvailableForRead() { return m_bytesInCurrentChunk > 0 && m_in.dataAvailableForRead; } | ||
| @property bool dataAvailableForRead() { return bytesInCurrentChunk > 0 && m_in.dataAvailableForRead; } |
Member
There was a problem hiding this comment.
This must stay as m_bytesInCurrentChunk, so that dataAvailableForRead does not block (its purpose is to be able to tell whether a read will block).
Member
There was a problem hiding this comment.
Suggested change
| @property bool dataAvailableForRead() { return bytesInCurrentChunk > 0 && m_in.dataAvailableForRead; } | |
| @property bool dataAvailableForRead() { return m_bytesInCurrentChunk > 0 && m_in.dataAvailableForRead; } |
s-ludwig
reviewed
Dec 6, 2019
http/vibe/http/common.d
Outdated
| @@ -398,11 +399,17 @@ final class ChunkedInputStream : InputStream | |||
| readChunk(); | |||
Member
There was a problem hiding this comment.
It probably makes sense to take the opportunity and remove this as well, so that the stream is completely lazy.
Contributor
|
@tchaloupka Ping |
0d89cae to
3bf7a84
Compare
Contributor
Author
|
I've made the proposed changes. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is probably not an ideal solution but it at least solves my problem - that I need to process chunked stream data right when it arrives and not when the next chunk is available.