output/httpd: merge duplicate code to ClearQueue()
This commit is contained in:
parent
968c5eb767
commit
f2ad9f6fad
|
@ -37,8 +37,7 @@ HttpdClient::~HttpdClient()
|
||||||
if (current_page != nullptr)
|
if (current_page != nullptr)
|
||||||
current_page->Unref();
|
current_page->Unref();
|
||||||
|
|
||||||
for (auto page : pages)
|
ClearQueue();
|
||||||
page->Unref();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (metadata)
|
if (metadata)
|
||||||
|
@ -209,15 +208,23 @@ HttpdClient::HttpdClient(HttpdOutput &_httpd, int _fd, EventLoop &_loop,
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
HttpdClient::CancelQueue()
|
HttpdClient::ClearQueue()
|
||||||
{
|
{
|
||||||
if (state != RESPONSE)
|
assert(state == RESPONSE);
|
||||||
return;
|
|
||||||
|
|
||||||
for (auto page : pages)
|
for (auto page : pages)
|
||||||
page->Unref();
|
page->Unref();
|
||||||
pages.clear();
|
pages.clear();
|
||||||
queue_size = 0;
|
queue_size = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
HttpdClient::CancelQueue()
|
||||||
|
{
|
||||||
|
if (state != RESPONSE)
|
||||||
|
return;
|
||||||
|
|
||||||
|
ClearQueue();
|
||||||
|
|
||||||
if (current_page == nullptr)
|
if (current_page == nullptr)
|
||||||
CancelWrite();
|
CancelWrite();
|
||||||
|
|
|
@ -187,6 +187,9 @@ public:
|
||||||
*/
|
*/
|
||||||
void PushMetaData(Page *page);
|
void PushMetaData(Page *page);
|
||||||
|
|
||||||
|
private:
|
||||||
|
void ClearQueue();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual bool OnSocketReady(unsigned flags) override;
|
virtual bool OnSocketReady(unsigned flags) override;
|
||||||
virtual InputResult OnSocketInput(void *data, size_t length) override;
|
virtual InputResult OnSocketInput(void *data, size_t length) override;
|
||||||
|
|
Loading…
Reference in New Issue