0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-12-25 15:04:10 +01:00

ircd::resource::response: Add flush/push option to chunked::finish().

This commit is contained in:
Jason Volk 2020-12-24 08:08:07 -08:00
parent f30c5f381b
commit 44bee11fc0
2 changed files with 6 additions and 2 deletions

View file

@ -96,7 +96,7 @@ struct ircd::resource::response::chunked
size_t write(const const_buffer &chunk, const bool &ignore_empty = true);
const_buffer flush(const const_buffer &);
bool finish();
bool finish(const bool psh = false);
std::function<const_buffer (const const_buffer &)> flusher();

View file

@ -880,13 +880,17 @@ ircd::resource::response::chunked::flusher()
}
bool
ircd::resource::response::chunked::finish()
ircd::resource::response::chunked::finish(const bool psh)
{
if(!c)
return false;
write(const_buffer{}, false);
assert(finished);
if(psh)
net::flush(*c->sock);
c = nullptr;
return true;
}