Commit f2ad9f6f authored by Max Kellermann's avatar Max Kellermann

output/httpd: merge duplicate code to ClearQueue()

parent 968c5eb7
......@@ -37,8 +37,7 @@ HttpdClient::~HttpdClient()
if (current_page != nullptr)
current_page->Unref();
for (auto page : pages)
page->Unref();
ClearQueue();
}
if (metadata)
......@@ -209,15 +208,23 @@ HttpdClient::HttpdClient(HttpdOutput &_httpd, int _fd, EventLoop &_loop,
}
void
HttpdClient::CancelQueue()
HttpdClient::ClearQueue()
{
if (state != RESPONSE)
return;
assert(state == RESPONSE);
for (auto page : pages)
page->Unref();
pages.clear();
queue_size = 0;
}
void
HttpdClient::CancelQueue()
{
if (state != RESPONSE)
return;
ClearQueue();
if (current_page == nullptr)
CancelWrite();
......
......@@ -187,6 +187,9 @@ public:
*/
void PushMetaData(Page *page);
private:
void ClearQueue();
protected:
virtual bool OnSocketReady(unsigned flags) override;
virtual InputResult OnSocketInput(void *data, size_t length) override;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment