]> git.ipfire.org Git - thirdparty/squid.git/blame - src/comm/AcceptLimiter.h
HTTP/1.1: partial support for no-cache and private= controls with parameters
[thirdparty/squid.git] / src / comm / AcceptLimiter.h
CommitLineData
04f55905
AJ
1#ifndef _SQUID_SRC_COMM_ACCEPT_LIMITER_H
2#define _SQUID_SRC_COMM_ACCEPT_LIMITER_H
3
4#include "Array.h"
5
97b8ac39
A
6namespace Comm
7{
04f55905 8
cbff89ba 9class TcpAcceptor;
04f55905
AJ
10
11/**
12 * FIFO Queue holding listener socket handlers which have been activated
13 * ready to dupe their FD and accept() a new client connection.
14 * But when doing so there were not enough FD available to handle the
15 * new connection. These handlers are awaiting some FD to become free.
16 *
a9870624 17 * defer - used only by Comm layer ConnAcceptor adding themselves when FD are limited.
166ba587 18 * removeDead - used only by Comm layer ConnAcceptor to remove themselves when dying.
04f55905
AJ
19 * kick - used by Comm layer when FD are closed.
20 */
21class AcceptLimiter
22{
23
24public:
25 /** retrieve the global instance of the queue. */
26 static AcceptLimiter &Instance();
27
28 /** delay accepting a new client connection. */
cbff89ba 29 void defer(Comm::TcpAcceptor *afd);
04f55905 30
166ba587 31 /** remove all records of an acceptor. Only to be called by the ConnAcceptor::swanSong() */
cbff89ba 32 void removeDead(const Comm::TcpAcceptor *afd);
166ba587 33
04f55905
AJ
34 /** try to accept and begin processing any delayed client connections. */
35 void kick();
36
37private:
38 static AcceptLimiter Instance_;
39
40 /** FIFO queue */
cbff89ba 41 Vector<Comm::TcpAcceptor*> deferred;
04f55905
AJ
42};
43
44}; // namepace Comm
45
46#endif /* _SQUID_SRC_COMM_ACCEPT_LIMITER_H */