output/httpd: move queue size check to HttpdClient::PushPage()

Don't let the server care for client problems.
This commit is contained in:
Max Kellermann 2014-01-04 17:42:03 +01:00
parent 8e4efd071e
commit 68fcc19565
3 changed files with 6 additions and 18 deletions

View File

@ -387,6 +387,12 @@ HttpdClient::PushPage(Page *page)
/* the client is still writing the HTTP request */ /* the client is still writing the HTTP request */
return; return;
if (queue_size > 256 * 1024) {
FormatDebug(httpd_output_domain,
"client is too slow, flushing its queue");
ClearQueue();
}
page->Ref(); page->Ref();
pages.push(page); pages.push(page);
queue_size += page->size; queue_size += page->size;

View File

@ -142,14 +142,6 @@ public:
void LockClose(); void LockClose();
/**
* Returns the total size of this client's page queue.
*/
gcc_pure
size_t GetQueueSize() const {
return queue_size;
}
/** /**
* Clears the page queue. * Clears the page queue.
*/ */

View File

@ -401,16 +401,6 @@ HttpdOutput::BroadcastPage(Page *page)
void void
HttpdOutput::BroadcastFromEncoder() HttpdOutput::BroadcastFromEncoder()
{ {
mutex.lock();
for (auto &client : clients) {
if (client.GetQueueSize() > 256 * 1024) {
FormatDebug(httpd_output_domain,
"client is too slow, flushing its queue");
client.CancelQueue();
}
}
mutex.unlock();
Page *page; Page *page;
while ((page = ReadPage()) != nullptr) { while ((page = ReadPage()) != nullptr) {
BroadcastPage(page); BroadcastPage(page);