From 8e4efd071e8eef033d0a68f6cf60f3910599a1a9 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sat, 4 Jan 2014 17:07:24 +0100 Subject: output/httpd: wrap the std::list in std::queue --- src/output/HttpdClient.cxx | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'src/output/HttpdClient.cxx') diff --git a/src/output/HttpdClient.cxx b/src/output/HttpdClient.cxx index 121f36e41..d16f78942 100644 --- a/src/output/HttpdClient.cxx +++ b/src/output/HttpdClient.cxx @@ -212,10 +212,19 @@ HttpdClient::ClearQueue() { 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(); - pages.clear(); - queue_size = 0; + } + + assert(queue_size == 0); } void @@ -273,7 +282,7 @@ HttpdClient::TryWrite() } current_page = pages.front(); - pages.pop_front(); + pages.pop(); current_position = 0; assert(queue_size >= current_page->size); @@ -379,7 +388,7 @@ HttpdClient::PushPage(Page *page) return; page->Ref(); - pages.push_back(page); + pages.push(page); queue_size += page->size; ScheduleWrite(); -- cgit v1.2.3