0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-12-26 07:23:53 +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); size_t write(const const_buffer &chunk, const bool &ignore_empty = true);
const_buffer flush(const const_buffer &); const_buffer flush(const const_buffer &);
bool finish(); bool finish(const bool psh = false);
std::function<const_buffer (const const_buffer &)> flusher(); std::function<const_buffer (const const_buffer &)> flusher();

View file

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