Commit 68fcc195 authored by Max Kellermann's avatar Max Kellermann

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

Don't let the server care for client problems.
parent 8e4efd07
......@@ -387,6 +387,12 @@ HttpdClient::PushPage(Page *page)
/* the client is still writing the HTTP request */
return;
if (queue_size > 256 * 1024) {
FormatDebug(httpd_output_domain,
"client is too slow, flushing its queue");
ClearQueue();
}
page->Ref();
pages.push(page);
queue_size += page->size;
......
......@@ -143,14 +143,6 @@ public:
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.
*/
void CancelQueue();
......
......@@ -401,16 +401,6 @@ HttpdOutput::BroadcastPage(Page *page)
void
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;
while ((page = ReadPage()) != nullptr) {
BroadcastPage(page);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment