]>
git.ipfire.org Git - thirdparty/squid.git/blob - src/acl/MaxConnection.cc
2 * Copyright (C) 1996-2017 The Squid Software Foundation and contributors
4 * Squid software is distributed under GPLv2+ license and includes
5 * contributions from numerous individuals and organizations.
6 * Please see the COPYING and CONTRIBUTORS files for details.
9 /* DEBUG: section 28 Access Control */
12 #include "acl/FilledChecklist.h"
13 #include "acl/MaxConnection.h"
14 #include "client_db.h"
16 #include "SquidConfig.h"
19 ACLMaxConnection::clone() const
21 return new ACLMaxConnection(*this);
24 ACLMaxConnection::ACLMaxConnection (char const *theClass
) : class_ (theClass
), limit(-1)
27 ACLMaxConnection::ACLMaxConnection (ACLMaxConnection
const & old
) :class_ (old
.class_
), limit (old
.limit
)
30 ACLMaxConnection::~ACLMaxConnection()
34 ACLMaxConnection::typeString() const
40 ACLMaxConnection::empty () const
46 ACLMaxConnection::valid () const
52 ACLMaxConnection::parse()
54 char *t
= ConfigParser::strtokFile();
61 /* suck out file contents */
64 while ((t
= ConfigParser::strtokFile())) {
65 ignore
|= (*t
!= '#');
70 debugs(89, DBG_CRITICAL
, "WARNING: max_conn only accepts a single limit value.");
76 ACLMaxConnection::match(ACLChecklist
*checklist
)
78 return clientdbEstablished(Filled(checklist
)->src_addr
, 0) > limit
? 1 : 0;
82 ACLMaxConnection::dump() const
89 s
.Printf("%d", limit
);
95 ACLMaxConnection::prepareForUse()
97 if (0 != Config
.onoff
.client_db
)
100 debugs(22, DBG_CRITICAL
, "WARNING: 'maxconn' ACL (" << name
<< ") won't work with client_db disabled");