diff options
Diffstat (limited to '')
-rw-r--r-- | src/output/HttpdClient.hxx | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/src/output/HttpdClient.hxx b/src/output/HttpdClient.hxx index 66a819232..f94f05769 100644 --- a/src/output/HttpdClient.hxx +++ b/src/output/HttpdClient.hxx @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2013 The Music Player Daemon Project + * Copyright (C) 2003-2014 The Music Player Daemon Project * http://www.musicpd.org * * This program is free software; you can redistribute it and/or modify @@ -23,18 +23,19 @@ #include "event/BufferedSocket.hxx" #include "Compiler.h" +#include <queue> #include <list> #include <stddef.h> -struct HttpdOutput; +class HttpdOutput; class Page; -class HttpdClient final : public BufferedSocket { +class HttpdClient final : BufferedSocket { /** * The httpd output object this client is connected to. */ - HttpdOutput *const httpd; + HttpdOutput &httpd; /** * The current state of the client. @@ -53,7 +54,12 @@ class HttpdClient final : public BufferedSocket { /** * A queue of #Page objects to be sent to the client. */ - std::list<Page *> pages; + std::queue<Page *, std::list<Page *>> pages; + + /** + * The sum of all page sizes in #pages. + */ + size_t queue_size; /** * The #page which is currently being sent to the client. @@ -120,7 +126,7 @@ public: * @param httpd the HTTP output device * @param fd the socket file descriptor */ - HttpdClient(HttpdOutput *httpd, int _fd, EventLoop &_loop, + HttpdClient(HttpdOutput &httpd, int _fd, EventLoop &_loop, bool _metadata_supported); /** @@ -137,12 +143,6 @@ public: void LockClose(); /** - * Returns the total size of this client's page queue. - */ - gcc_pure - size_t GetQueueSize() const; - - /** * Clears the page queue. */ void CancelQueue(); @@ -180,6 +180,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; |