output/httpd: move queue size check to HttpdClient::PushPage()
Don't let the server care for client problems.
This commit is contained in:
parent
8e4efd071e
commit
68fcc19565
@ -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;
|
||||
|
@ -142,14 +142,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.
|
||||
*/
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user