-
Notifications
You must be signed in to change notification settings - Fork 284
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
Change ChunkedInputStream to not block right after chunk is read #2332
base: master
Are you sure you want to change the base?
Conversation
http/vibe/http/common.d
Outdated
|
||
@property bool dataAvailableForRead() { return m_bytesInCurrentChunk > 0 && m_in.dataAvailableForRead; } | ||
@property bool dataAvailableForRead() { return bytesInCurrentChunk > 0 && m_in.dataAvailableForRead; } |
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.
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).
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.
@property bool dataAvailableForRead() { return bytesInCurrentChunk > 0 && m_in.dataAvailableForRead; } | |
@property bool dataAvailableForRead() { return m_bytesInCurrentChunk > 0 && m_in.dataAvailableForRead; } |
http/vibe/http/common.d
Outdated
@@ -398,11 +399,17 @@ final class ChunkedInputStream : InputStream | |||
readChunk(); |
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.
It probably makes sense to take the opportunity and remove this as well, so that the stream is completely lazy.
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.
readChunk(); |
@tchaloupka Ping |
0d89cae
to
3bf7a84
Compare
I've made the proposed changes. |
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.