aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2014-01-04 17:11:22 +0100
committerMax Kellermann <max@duempel.org>2014-01-04 17:11:22 +0100
commitf2ad9f6fadb9d070863a8a5c76b85c884943502a (patch)
tree3b8307e14481e18e9abc93991db59d52991b247f /src
parent968c5eb7675a5cf4f3a07820356ac5a0ae55d12f (diff)
downloadmpd-f2ad9f6fadb9d070863a8a5c76b85c884943502a.tar.gz
mpd-f2ad9f6fadb9d070863a8a5c76b85c884943502a.tar.xz
mpd-f2ad9f6fadb9d070863a8a5c76b85c884943502a.zip
output/httpd: merge duplicate code to ClearQueue()
Diffstat (limited to 'src')
-rw-r--r--src/output/HttpdClient.cxx17
-rw-r--r--src/output/HttpdClient.hxx3
2 files changed, 15 insertions, 5 deletions
diff --git a/src/output/HttpdClient.cxx b/src/output/HttpdClient.cxx
index 8fae27855..121f36e41 100644
--- a/src/output/HttpdClient.cxx
+++ b/src/output/HttpdClient.cxx
@@ -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();
diff --git a/src/output/HttpdClient.hxx b/src/output/HttpdClient.hxx
index 12b7af13f..7b83bca33 100644
--- a/src/output/HttpdClient.hxx
+++ b/src/output/HttpdClient.hxx
@@ -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;