aboutsummaryrefslogtreecommitdiffstats
path: root/src/output/HttpdClient.hxx
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/output/HttpdClient.hxx25
1 files changed, 14 insertions, 11 deletions
diff --git a/src/output/HttpdClient.hxx b/src/output/HttpdClient.hxx
index 66a819232..94fe2ae62 100644
--- a/src/output/HttpdClient.hxx
+++ b/src/output/HttpdClient.hxx
@@ -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;