Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
8e4efd07
Commit
8e4efd07
authored
Jan 04, 2014
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
output/httpd: wrap the std::list in std::queue
parent
f2ad9f6f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
6 deletions
+16
-6
HttpdClient.cxx
src/output/HttpdClient.cxx
+14
-5
HttpdClient.hxx
src/output/HttpdClient.hxx
+2
-1
No files found.
src/output/HttpdClient.cxx
View file @
8e4efd07
...
...
@@ -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
();
...
...
src/output/HttpdClient.hxx
View file @
8e4efd07
...
...
@@ -23,6 +23,7 @@
#include "event/BufferedSocket.hxx"
#include "Compiler.h"
#include <queue>
#include <list>
#include <stddef.h>
...
...
@@ -53,7 +54,7 @@ class HttpdClient final : 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.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment