]> git.ipfire.org Git - thirdparty/squid.git/blame - src/comm/AcceptLimiter.h
Language Updates: manuals - more polish.
[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
6namespace Comm {
7
8class ListenStateData;
9
10/**
11 * FIFO Queue holding listener socket handlers which have been activated
12 * ready to dupe their FD and accept() a new client connection.
13 * But when doing so there were not enough FD available to handle the
14 * new connection. These handlers are awaiting some FD to become free.
15 *
16 * defer - used only by Comm layer ListenStateData adding themselves when FD are limited.
17 * kick - used by Comm layer when FD are closed.
18 */
19class AcceptLimiter
20{
21
22public:
23 /** retrieve the global instance of the queue. */
24 static AcceptLimiter &Instance();
25
26 /** delay accepting a new client connection. */
27 void defer(Comm::ListenStateData *afd);
28
29 /** try to accept and begin processing any delayed client connections. */
30 void kick();
31
32private:
33 static AcceptLimiter Instance_;
34
35 /** FIFO queue */
36 Vector<Comm::ListenStateData*> deferred;
37};
38
39}; // namepace Comm
40
41#endif /* _SQUID_SRC_COMM_ACCEPT_LIMITER_H */