mirror of
https://github.com/matrix-construct/construct
synced 2024-11-17 23:40:57 +01:00
ircd::server: Call the progress callbacks before the completion routines.
This commit is contained in:
parent
9ca019f03e
commit
ee23c98eda
1 changed files with 8 additions and 7 deletions
|
@ -3209,17 +3209,17 @@ ircd::server::tag::read_chunk_content(const const_buffer &buffer,
|
||||||
state.content_read += addl_content_read;
|
state.content_read += addl_content_read;
|
||||||
assert(state.chunk_read <= state.content_read);
|
assert(state.chunk_read <= state.content_read);
|
||||||
|
|
||||||
|
// Invoke the user's optional progress callback; this function
|
||||||
|
// should be marked noexcept for the time being.
|
||||||
|
if(req.in.progress && !done)
|
||||||
|
req.in.progress(buffer, const_buffer{data(content), state.content_read});
|
||||||
|
|
||||||
// This branch is taken at the completion of a chunk. The size
|
// This branch is taken at the completion of a chunk. The size
|
||||||
// all the buffers is rolled back to hide the terminator so it's
|
// all the buffers is rolled back to hide the terminator so it's
|
||||||
// either ignored or overwritten so it doesn't leak to the user.
|
// either ignored or overwritten so it doesn't leak to the user.
|
||||||
if(state.content_read == state.content_length)
|
if(state.content_read == state.content_length)
|
||||||
chunk_content_completed(*this, done);
|
chunk_content_completed(*this, done);
|
||||||
|
|
||||||
// Invoke the user's optional progress callback; this function
|
|
||||||
// should be marked noexcept for the time being.
|
|
||||||
if(req.in.progress && !done)
|
|
||||||
req.in.progress(buffer, const_buffer{data(content), state.content_read});
|
|
||||||
|
|
||||||
// Not finished
|
// Not finished
|
||||||
if(likely(state.content_read != state.content_length))
|
if(likely(state.content_read != state.content_length))
|
||||||
return {};
|
return {};
|
||||||
|
@ -3426,14 +3426,15 @@ ircd::server::tag::read_chunk_dynamic_content(const const_buffer &buffer,
|
||||||
state.content_read += addl_content_read;
|
state.content_read += addl_content_read;
|
||||||
assert(state.chunk_read <= state.content_read);
|
assert(state.chunk_read <= state.content_read);
|
||||||
assert(state.chunk_read <= state.chunk_length);
|
assert(state.chunk_read <= state.chunk_length);
|
||||||
if(state.chunk_read == state.chunk_length)
|
|
||||||
chunk_dynamic_content_completed(*this, done);
|
|
||||||
|
|
||||||
// Invoke the user's optional progress callback; this function
|
// Invoke the user's optional progress callback; this function
|
||||||
// should be marked noexcept for the time being.
|
// should be marked noexcept for the time being.
|
||||||
if(req.in.progress && !done)
|
if(req.in.progress && !done)
|
||||||
req.in.progress(buffer, const_buffer{data(chunk), state.chunk_read});
|
req.in.progress(buffer, const_buffer{data(chunk), state.chunk_read});
|
||||||
|
|
||||||
|
if(state.chunk_read == state.chunk_length)
|
||||||
|
chunk_dynamic_content_completed(*this, done);
|
||||||
|
|
||||||
assert(state.chunk_read <= state.chunk_length);
|
assert(state.chunk_read <= state.chunk_length);
|
||||||
if(likely(state.chunk_read != state.chunk_length))
|
if(likely(state.chunk_read != state.chunk_length))
|
||||||
return {};
|
return {};
|
||||||
|
|
Loading…
Reference in a new issue