output/httpd: wrap the std::list in std::queue
This commit is contained in:
parent
f2ad9f6fad
commit
8e4efd071e
@ -212,10 +212,19 @@ HttpdClient::ClearQueue()
|
|||||||
{
|
{
|
||||||
assert(state == RESPONSE);
|
assert(state == RESPONSE);
|
||||||
|
|
||||||
for (auto page : pages)
|
while (!pages.empty()) {
|
||||||
|
Page *page = pages.front();
|
||||||
|
pages.pop();
|
||||||
|
|
||||||
|
#ifndef NDEBUG
|
||||||
|
assert(queue_size >= page->size);
|
||||||
|
queue_size -= page->size;
|
||||||
|
#endif
|
||||||
|
|
||||||
page->Unref();
|
page->Unref();
|
||||||
pages.clear();
|
}
|
||||||
queue_size = 0;
|
|
||||||
|
assert(queue_size == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -273,7 +282,7 @@ HttpdClient::TryWrite()
|
|||||||
}
|
}
|
||||||
|
|
||||||
current_page = pages.front();
|
current_page = pages.front();
|
||||||
pages.pop_front();
|
pages.pop();
|
||||||
current_position = 0;
|
current_position = 0;
|
||||||
|
|
||||||
assert(queue_size >= current_page->size);
|
assert(queue_size >= current_page->size);
|
||||||
@ -379,7 +388,7 @@ HttpdClient::PushPage(Page *page)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
page->Ref();
|
page->Ref();
|
||||||
pages.push_back(page);
|
pages.push(page);
|
||||||
queue_size += page->size;
|
queue_size += page->size;
|
||||||
|
|
||||||
ScheduleWrite();
|
ScheduleWrite();
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
#include "event/BufferedSocket.hxx"
|
#include "event/BufferedSocket.hxx"
|
||||||
#include "Compiler.h"
|
#include "Compiler.h"
|
||||||
|
|
||||||
|
#include <queue>
|
||||||
#include <list>
|
#include <list>
|
||||||
|
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
@ -53,7 +54,7 @@ class HttpdClient final : BufferedSocket {
|
|||||||
/**
|
/**
|
||||||
* A queue of #Page objects to be sent to the client.
|
* 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.
|
* The sum of all page sizes in #pages.
|
||||||
|
Loading…
Reference in New Issue
Block a user