From 44bee11fc079776307873999e0abf7be123f03a6 Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Thu, 24 Dec 2020 08:08:07 -0800 Subject: [PATCH] ircd::resource::response: Add flush/push option to chunked::finish(). --- include/ircd/resource/response.h | 2 +- ircd/resource.cc | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/include/ircd/resource/response.h b/include/ircd/resource/response.h index 86c0b7fa4..4bb0f3496 100644 --- a/include/ircd/resource/response.h +++ b/include/ircd/resource/response.h @@ -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 flusher(); diff --git a/ircd/resource.cc b/ircd/resource.cc index 82399fc13..f9343f7a0 100644 --- a/ircd/resource.cc +++ b/ircd/resource.cc @@ -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; }