]>
git.ipfire.org Git - thirdparty/squid.git/blob - src/acl/MaxConnection.cc
2 * Copyright (C) 1996-2015 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"
15 #include "client_db.h"
17 #include "SquidConfig.h"
20 ACLMaxConnection::clone() const
22 return new ACLMaxConnection(*this);
25 ACLMaxConnection::ACLMaxConnection (char const *theClass
) : class_ (theClass
), limit(-1)
28 ACLMaxConnection::ACLMaxConnection (ACLMaxConnection
const & old
) :class_ (old
.class_
), limit (old
.limit
)
31 ACLMaxConnection::~ACLMaxConnection()
35 ACLMaxConnection::typeString() const
41 ACLMaxConnection::empty () const
47 ACLMaxConnection::valid () const
53 ACLMaxConnection::parse()
55 char *t
= strtokFile();
62 /* suck out file contents */
65 while ((t
= strtokFile())) {
66 ignore
|= (*t
!= '#');
71 debugs(89, DBG_CRITICAL
, "WARNING: max_conn only accepts a single limit value.");
77 ACLMaxConnection::match(ACLChecklist
*checklist
)
79 return clientdbEstablished(Filled(checklist
)->src_addr
, 0) > limit
? 1 : 0;
83 ACLMaxConnection::dump() const
90 s
.Printf("%d", limit
);
96 ACLMaxConnection::prepareForUse()
98 if (0 != Config
.onoff
.client_db
)
101 debugs(22, DBG_CRITICAL
, "WARNING: 'maxconn' ACL (" << name
<< ") won't work with client_db disabled");