Makes a few more of the build conditionals match our naming policy.
http://wiki.squid-cache.org/Squid3CodingGuidelines
Updates two code wrapper macros:
* CBDATA_DEBUG becomes USE_CBDATA_DEBUG
* DELAY_POOLS becomes USE_DELAY_POOLS
Updates USE_DELAY_POOLS automake conditional to ENABLE_DELAY_POOLS
TODO: There are more of these wrappers to be updated.
SQUID_YESNO([$enableval],
[unrecognized argument to --enable-debug-cbdata: $enableval])
])
-SQUID_DEFINE_BOOL(CBDATA_DEBUG,${enable_debug_cbdata:=no},
+SQUID_DEFINE_BOOL(USE_CBDATA_DEBUG,${enable_debug_cbdata:=no},
[Enable support for cbdata debug information])
AC_MSG_NOTICE([cbdata debugging enabled: $enable_debug_cbdata])
fi
])
-AM_CONDITIONAL(USE_DELAY_POOLS, false)
+AM_CONDITIONAL(ENABLE_DELAY_POOLS, false)
AC_ARG_ENABLE(delay-pools,
AS_HELP_STRING([--enable-delay-pools],[Enable delay pools to limit bandwidth usage]),
[ if test "x$enableval" = "xyes" ; then
AC_MSG_NOTICE([Delay pools enabled])
- AC_DEFINE([DELAY_POOLS],1,[Traffic management via "delay pools".])
- AM_CONDITIONAL(USE_DELAY_POOLS, true,)
+ AC_DEFINE([USE_DELAY_POOLS],1,[Traffic management via "delay pools".])
+ AM_CONDITIONAL(ENABLE_DELAY_POOLS, true,)
fi
])
PREDEFINED = __cplusplus \
USE_HTTP_VIOLATIONS \
WITH_VALGRIND \
- DELAY_POOLS \
ICAP_CLIENT \
FORW_VIA_DB \
SQUID_SNMP \
USE_ASYNC_IO \
USE_CACHE_DIGESTS \
USE_CLASSFUL \
+ USE_DELAY_POOLS \
USE_DLMALLOC \
USE_DNSSERVERS \
USE_EPOLL \
#include "cbdata.h"
#include <deque>
-#if DELAY_POOLS
+#if USE_DELAY_POOLS
class CommQuotaQueue;
#endif
} cutoff;
int n_established; /* number of current established connections */
time_t last_seen;
-#if DELAY_POOLS
+#if USE_DELAY_POOLS
double writeSpeedLimit;///< Write speed limit in bytes per second, can be less than 1, if too close to zero this could result in timeouts from client
double prevTime; ///< previous time when we checked
double bucketSize; ///< how much can be written now
* \param highWatermark is maximum bucket value
*/
void setWriteLimiter(const int aWriteSpeedLimit, const double anInitialBurst, const double aHighWatermark);
-#endif
+#endif /* USE_DELAY_POOLS */
};
-#if DELAY_POOLS
+#if USE_DELAY_POOLS
// a queue of Comm clients waiting for I/O quota controlled by delay pools
class CommQuotaQueue
{
CBDATA_CLASS2(CommQuotaQueue);
};
-#endif /* DELAY_POOLS */
+#endif /* USE_DELAY_POOLS */
#endif
*/
#ifndef COMMONPOOL_H
#define COMMONPOOL_H
-#if DELAY_POOLS
+
+#if USE_DELAY_POOLS
#include "squid.h"
#include "SquidString.h"
#include "CompositePoolNode.h"
String typeLabel;
};
-#endif
+#endif /* USE_DELAY_POOLS */
#endif /* COMMONPOOL_H */
#ifndef COMPOSITEPOOLNODE_H
#define COMPOSITEPOOLNODE_H
-#if DELAY_POOLS
+#if USE_DELAY_POOLS
#include "squid.h"
#include "auth/UserRequest.h"
#include "DelayPools.h"
DeferredReadManager deferredReads;
};
-#endif /* DELAY_POOLS */
+#endif /* USE_DELAY_POOLS */
#endif /* COMPOSITEPOOLNODE_H */
#include "config.h"
-#if DELAY_POOLS
+#if USE_DELAY_POOLS
#include "squid.h"
#include "DelayBucket.h"
#include "DelaySpec.h"
#include "Store.h"
-#if DEAD_CODE // ?
-#include "DelayPools.h"
-#include "StoreClient.h"
-#include "MemObject.h"
-#include "client_side_request.h"
-#include "acl/Checklist.h"
-#include "acl/Acl.h"
-#include "ConfigParser.h"
-#include "DelayId.h"
-#include "Array.h"
-#include "String.h"
-#include "CommonPool.h"
-#include "CompositePoolNode.h"
-#include "DelayPool.h"
-#include "DelayVector.h"
-#include "NullDelayId.h"
-#endif
-
void
DelayBucket::stats(StoreEntry *entry)const
{
Config.Delay.initial) / 100);
}
-#endif
+#endif /* USE_DELAY_POOLS */
#include "config.h"
-#if DELAY_POOLS
+#if USE_DELAY_POOLS
#include "squid.h"
#include "DelayConfig.h"
#include "ConfigParser.h"
DelayPools::delay_data[i].dump (entry, i);
}
-#endif
+#endif /* USE_DELAY_POOLS */
/* MS Visual Studio Projects are monolithic, so we need the following
* #if to exclude the delay pools code from compile process when not needed.
*/
-#if DELAY_POOLS
+#if USE_DELAY_POOLS
#include "squid.h"
#include "DelayId.h"
}
-#endif /* DELAY_POOLS */
+#endif /* USE_DELAY_POOLS */
#ifndef SQUID_DELAYID_H
#define SQUID_DELAYID_H
-#if DELAY_POOLS
+#if USE_DELAY_POOLS
class ClientHttpRequest;
#include "DelayIdComposite.h"
bool markedAsNoDelay;
};
-#endif /* DELAY_POOLS */
+#endif /* USE_DELAY_POOLS */
#endif /* SQUID_DELAYID_H */
*/
#ifndef DELAYIDCOMPOSITE_H
#define DELAYIDCOMPOSITE_H
-#if DELAY_POOLS
+
+#if USE_DELAY_POOLS
#include "squid.h"
#include "RefCount.h"
virtual void delayRead(DeferredRead const &) {fatal("Not implemented");}
};
-#endif
+#endif /* USE_DELAY_POOLS */
#endif /* DELAYIDCOMPOSITE_H */
#include "config.h"
-#if DELAY_POOLS
+#if USE_DELAY_POOLS
#include "DelayPool.h"
#include "CommonPool.h"
#include "acl/Acl.h"
deferredReads.kickReads(-1);
}
-#endif
+#endif /* USE_DELAY_POOLS */
#ifndef DELAYPOOL_H
#define DELAYPOOL_H
-#if DELAY_POOLS
+#if USE_DELAY_POOLS
#include "squid.h"
#include "CompositePoolNode.h"
CompositePoolNode::Pointer theComposite_;
};
-#endif
+#endif /* USE_DELAY_POOLS */
#endif /* DELAYPOOL_H */
#include "config.h"
-#if DELAY_POOLS
+#if USE_DELAY_POOLS
#include "squid.h"
#include "DelaySpec.h"
#include "Store.h"
#include "config.h"
-#if DELAY_POOLS
+#if USE_DELAY_POOLS
#include "squid.h"
#include "DelayTagged.h"
#include "NullDelayId.h"
#ifndef DELAYTAGGED_H
#define DELAYTAGGED_H
-#if DELAY_POOLS
+#if USE_DELAY_POOLS
#include "squid.h"
#include "auth/Gadgets.h"
Splay<DelayTaggedBucket::Pointer> buckets;
};
-#endif /* DELAY_POOLS */
+#endif /* USE_DELAY_POOLS */
#endif /* DELAYTAGGED_H */
#include "config.h"
-#if DELAY_POOLS
+#if USE_DELAY_POOLS
#include "squid.h"
#include "DelayUser.h"
#include "auth/UserRequest.h"
#ifndef DELAYUSER_H
#define DELAYUSER_H
-#if DELAY_POOLS
+#if USE_DELAY_POOLS
#include "squid.h"
#include "auth/Gadgets.h"
Splay<DelayUserBucket::Pointer> buckets;
};
-#endif /* DELAY_POOLS */
+#endif /* USE_DELAY_POOLS */
#endif /* DELAYUSER_H */
#include "config.h"
-#if DELAY_POOLS
+#if USE_DELAY_POOLS
#include "squid.h"
#include "DelayVector.h"
#include "CommRead.h"
#ifndef SQUID_DELAYVECTOR_H
#define SQUID_DELAYVECTOR_H
-#if DELAY_POOLS
+#if USE_DELAY_POOLS
#include "CompositePoolNode.h"
typedef Vector<CompositePoolNode::Pointer>::const_iterator const_iterator;
};
-#endif /* DELAY_POOLS */
+#endif /* USE_DELAY_POOLS */
#endif /* SQUID_DELAYVECTOR_H */
ClientDelayConfig.cc \
ClientDelayConfig.h
-if USE_DELAY_POOLS
+if ENABLE_DELAY_POOLS
DELAY_POOL_SOURCE = $(DELAY_POOL_ALL_SOURCE)
else
DELAY_POOL_SOURCE =
#include "Store.h"
#include "StoreClient.h"
#include "Generic.h"
-#if DELAY_POOLS
+#if USE_DELAY_POOLS
#include "DelayPools.h"
#endif
#include "MemBuf.h"
int
MemObject::mostBytesWanted(int max) const
{
-#if DELAY_POOLS
+#if USE_DELAY_POOLS
/* identify delay id with largest allowance */
DelayId largestAllowance = mostBytesAllowed ();
return largestAllowance.bytesWanted(0, max);
void
MemObject::setNoDelay(bool const newValue)
{
-#if DELAY_POOLS
+#if USE_DELAY_POOLS
for (dlink_node *node = clients.head; node; node = node->next) {
store_client *sc = (store_client *) node->data;
deferredReads.kickReads(-1);
}
-#if DELAY_POOLS
+#if USE_DELAY_POOLS
DelayId
MemObject::mostBytesAllowed() const
{
typedef void STMCB (void *data, StoreIOBuffer wroteBuffer);
class store_client;
-#if DELAY_POOLS
+#if USE_DELAY_POOLS
#include "DelayId.h"
#endif
bool isContiguous() const;
int mostBytesWanted(int max) const;
void setNoDelay(bool const newValue);
-#if DELAY_POOLS
-
+#if USE_DELAY_POOLS
DelayId mostBytesAllowed() const;
#endif
#include "config.h"
-#if DELAY_POOLS
+#if USE_DELAY_POOLS
#include "squid.h"
#include "NullDelayId.h"
#include "DelayPools.h"
::operator delete (address);
}
-#endif
-
+#endif /* USE_DELAY_POOLS */
*/
#ifndef NULLDELAYID_H
#define NULLDELAYID_H
-#if DELAY_POOLS
+#if USE_DELAY_POOLS
#include "squid.h"
#include "RefCount.h"
#include "DelayIdComposite.h"
virtual void created (StoreEntry *newEntry) = 0;
};
-#if DELAY_POOLS
+#if USE_DELAY_POOLS
#include "DelayId.h"
#endif
unsigned int store_copying:1;
unsigned int copy_event_pending:1;
} flags;
-#if DELAY_POOLS
+#if USE_DELAY_POOLS
DelayId delayId;
void setDelayId(DelayId delay_id);
#endif
}
}
-#if DELAY_POOLS
+#if USE_DELAY_POOLS
#include "DelayPools.h"
#include "DelayConfig.h"
#endif
-#if DELAY_POOLS
+#if USE_DELAY_POOLS
#include "ClientDelayConfig.h"
/* do nothing - free_client_delay_pool_count is the magic free function.
* this is why client_delay_pool_count isn't just marked TYPE: ushort
p->options.sourcehash = 1;
-#if DELAY_POOLS
-
} else if (!strcasecmp(token, "no-delay")) {
+#if USE_DELAY_POOLS
p->options.no_delay = 1;
+#else
+ debugs(0, DBG_CRITICAL, "WARNING: cache_peer option 'no-delay' requires --enable-delay-pools");
#endif
-
} else if (!strncasecmp(token, "login=", 6)) {
p->login = xstrdup(token + 6);
rfc1738_unescape(p->login);
#include "cbdata.h"
#include "mgr/Registration.h"
#include "Store.h"
-#if CBDATA_DEBUG
+#if USE_CBDATA_DEBUG
#include "Stack.h"
#endif
#include "Generic.h"
#endif
static int cbdataCount = 0;
-#if CBDATA_DEBUG
+#if USE_CBDATA_DEBUG
dlink_list cbdataEntries;
#endif
-#if CBDATA_DEBUG
+#if USE_CBDATA_DEBUG
class CBDataCall
{
hash_link hash; // Must be first
#endif
-#if CBDATA_DEBUG
+#if USE_CBDATA_DEBUG
void dump(StoreEntry *)const;
#endif
int valid;
int locks;
cbdata_type type;
-#if CBDATA_DEBUG
+#if USE_CBDATA_DEBUG
void addHistory(char const *label, char const *aFile, int aLine) {
if (calls.size() > 1000)
#endif
static OBJH cbdataDump;
-#if CBDATA_DEBUG
+#if USE_CBDATA_DEBUG
static OBJH cbdataDumpHistory;
#endif
cbdata::~cbdata()
{
-#if CBDATA_DEBUG
+#if USE_CBDATA_DEBUG
CBDataCall *aCall;
while ((aCall = calls.pop()))
Mgr::RegisterAction("cbdata",
"Callback Data Registry Contents",
cbdataDump, 0, 1);
-#if CBDATA_DEBUG
+#if USE_CBDATA_DEBUG
Mgr::RegisterAction("cbdatahistory",
"Detailed call history for all current cbdata contents",
}
void *
-#if CBDATA_DEBUG
+#if USE_CBDATA_DEBUG
cbdataInternalAllocDbg(cbdata_type type, const char *file, int line)
#else
cbdataInternalAlloc(cbdata_type type)
c->locks = 0;
c->cookie = (long) c ^ cbdata::Cookie;
cbdataCount++;
-#if CBDATA_DEBUG
+#if USE_CBDATA_DEBUG
c->file = file;
c->line = line;
}
void *
-#if CBDATA_DEBUG
+#if USE_CBDATA_DEBUG
cbdataInternalFreeDbg(void *p, const char *file, int line)
#else
cbdataInternalFree(void *p)
#else
c = (cbdata *) (((char *) p) - cbdata::Offset);
#endif
-#if CBDATA_DEBUG
+#if USE_CBDATA_DEBUG
debugs(45, 3, "cbdataFree: " << p << " " << file << ":" << line);
#else
c->check(__LINE__);
assert(c->valid);
c->valid = 0;
-#if CBDATA_DEBUG
+#if USE_CBDATA_DEBUG
c->addHistory("Free", file, line);
#endif
cbdataCount--;
debugs(45, 9, "cbdataFree: Freeing " << p);
-#if CBDATA_DEBUG
+#if USE_CBDATA_DEBUG
dlinkDelete(&c->link, &cbdataEntries);
#endif
}
void
-#if CBDATA_DEBUG
+#if USE_CBDATA_DEBUG
cbdataInternalLockDbg(const void *p, const char *file, int line)
#else
cbdataInternalLock(const void *p)
c = (cbdata *) (((char *) p) - cbdata::Offset);
#endif
-#if CBDATA_DEBUG
+#if USE_CBDATA_DEBUG
debugs(45, 3, "cbdataLock: " << p << "=" << (c ? c->locks + 1 : -1) << " " << file << ":" << line);
}
void
-#if CBDATA_DEBUG
+#if USE_CBDATA_DEBUG
cbdataInternalUnlockDbg(const void *p, const char *file, int line)
#else
cbdataInternalUnlock(const void *p)
c = (cbdata *) (((char *) p) - cbdata::Offset);
#endif
-#if CBDATA_DEBUG
+#if USE_CBDATA_DEBUG
debugs(45, 3, "cbdataUnlock: " << p << "=" << (c ? c->locks - 1 : -1) << " " << file << ":" << line);
debugs(45, 9, "cbdataUnlock: Freeing " << p);
-#if CBDATA_DEBUG
+#if USE_CBDATA_DEBUG
dlinkDelete(&c->link, &cbdataEntries);
}
int
-#if CBDATA_DEBUG
+#if USE_CBDATA_DEBUG
cbdataInternalReferenceDoneValidDbg(void **pp, void **tp, const char *file, int line)
#else
cbdataInternalReferenceDoneValid(void **pp, void **tp)
void *p = (void *) *pp;
int valid = cbdataReferenceValid(p);
*pp = NULL;
-#if CBDATA_DEBUG
+#if USE_CBDATA_DEBUG
cbdataInternalUnlockDbg(p, file, line);
#else
}
}
-#if CBDATA_DEBUG
+#if USE_CBDATA_DEBUG
void
cbdata::dump(StoreEntry *sentry) const
{
cbdataDump(StoreEntry * sentry)
{
storeAppendPrintf(sentry, "%d cbdata entries\n", cbdataCount);
-#if CBDATA_DEBUG
+#if USE_CBDATA_DEBUG
storeAppendPrintf(sentry, "Pointer\tType\tLocks\tAllocated by\n");
CBDataDumper dumper(sentry);
}
#else
- storeAppendPrintf(sentry, "detailed allocation information only available when compiled with CBDATA_DEBUG\n");
+ storeAppendPrintf(sentry, "detailed allocation information only available when compiled with --enable-debug-cbdata\n");
#endif
CBDATA_CLASS_INIT(generic_cbdata);
-#if CBDATA_DEBUG
+#if USE_CBDATA_DEBUG
struct CBDataCallDumper : public unary_function<CBDataCall, void> {
CBDataCallDumper (StoreEntry *anEntry):where(anEntry) {}
/// \ingroup CBDATAAPI
extern void cbdataRegisterWithCacheManager(void);
-#if CBDATA_DEBUG
+#if USE_CBDATA_DEBUG
extern void *cbdataInternalAllocDbg(cbdata_type type, const char *, int);
extern void *cbdataInternalFreeDbg(void *p, const char *, int);
extern void cbdataInternalLockDbg(const void *p, const char *, int);
/* cbdata macros */
-#if CBDATA_DEBUG
+#if USE_CBDATA_DEBUG
#define cbdataAlloc(type) ((type *)cbdataInternalAllocDbg(CBDATA_##type,__FILE__,__LINE__))
#define cbdataFree(var) do {if (var) {cbdataInternalFreeDbg(var,__FILE__,__LINE__); var = NULL;}} while(0)
#define cbdataInternalLock(a) cbdataInternalLockDbg(a,__FILE__,__LINE__)
if (address) cbdataInternalFreeDbg(address,__FILE__,__LINE__); \
} \
void *toCbdata() { return this; }
-#else /* CBDATA_DEBUG */
+#else /* USE_CBDATA_DEBUG */
/**
\ingroup CBDATAAPI
NAME: delay_pool_uses_indirect_client
COMMENT: on|off
TYPE: onoff
-IFDEF: FOLLOW_X_FORWARDED_FOR&&DELAY_POOLS
+IFDEF: FOLLOW_X_FORWARDED_FOR&&USE_DELAY_POOLS
DEFAULT: on
LOC: Config.onoff.delay_pool_uses_indirect_client
DOC_START
NAME: delay_pools
TYPE: delay_pool_count
DEFAULT: 0
-IFDEF: DELAY_POOLS
+IFDEF: USE_DELAY_POOLS
LOC: Config.Delay
DOC_START
This represents the number of delay pools to be used. For example,
NAME: delay_class
TYPE: delay_pool_class
DEFAULT: none
-IFDEF: DELAY_POOLS
+IFDEF: USE_DELAY_POOLS
LOC: Config.Delay
DOC_START
This defines the class of each delay pool. There must be exactly one
NAME: delay_access
TYPE: delay_pool_access
DEFAULT: none
-IFDEF: DELAY_POOLS
+IFDEF: USE_DELAY_POOLS
LOC: Config.Delay
DOC_START
This is used to determine which delay pool a request falls into.
NAME: delay_parameters
TYPE: delay_pool_rates
DEFAULT: none
-IFDEF: DELAY_POOLS
+IFDEF: USE_DELAY_POOLS
LOC: Config.Delay
DOC_START
This defines the parameters for a delay pool. Each delay pool has
COMMENT: (percent, 0-100)
TYPE: ushort
DEFAULT: 50
-IFDEF: DELAY_POOLS
+IFDEF: USE_DELAY_POOLS
LOC: Config.Delay.initial
DOC_START
The initial bucket percentage is used to determine how much is put
NAME: client_delay_pools
TYPE: client_delay_pool_count
DEFAULT: 0
-IFDEF: DELAY_POOLS
+IFDEF: USE_DELAY_POOLS
LOC: Config.ClientDelay
DOC_START
This option specifies the number of client delay pools used. It must
COMMENT: (percent, 0-no_limit)
TYPE: ushort
DEFAULT: 50
-IFDEF: DELAY_POOLS
+IFDEF: USE_DELAY_POOLS
LOC: Config.ClientDelay.initial
DOC_START
This option determines the initial bucket size as a percentage of
NAME: client_delay_parameters
TYPE: client_delay_pool_rates
DEFAULT: none
-IFDEF: DELAY_POOLS
+IFDEF: USE_DELAY_POOLS
LOC: Config.ClientDelay
DOC_START
NAME: client_delay_access
TYPE: client_delay_pool_access
DEFAULT: none
-IFDEF: DELAY_POOLS
+IFDEF: USE_DELAY_POOLS
LOC: Config.ClientDelay
DOC_START
print "*/"
print "#include \"config.h\""
print "static struct { const char *name; const char *enable; int defined;} defines[] = {"
- define["DELAY_POOLS"]="--enable-delay-pools"
+ define["USE_DELAY_POOLS"]="--enable-delay-pools"
define["FOLLOW_X_FORWARDED_FOR"]="--enable-follow-x-forwarded-for"
- define["FOLLOW_X_FORWARDED_FOR&&DELAY_POOLS"]="--enable-follow-x-forwarded-for and --enable-delay-pools"
+ define["FOLLOW_X_FORWARDED_FOR&&USE_DELAY_POOLS"]="--enable-follow-x-forwarded-for and --enable-delay-pools"
define["FOLLOW_X_FORWARDED_FOR&&ICAP_CLIENT"]="--enable-follow-x-forwarded-for and --enable-icap-client"
define["FOLLOW_X_FORWARDED_FOR&&LINUX_NETFILTER"]="--enable-follow-x-forwarded-for and --enable-linux-netfilter"
define["USE_HTTP_VIOLATIONS"]="--enable-http-violations"
static void clientdbStartGC(void);
static void clientdbScheduledGC(void *);
-#if DELAY_POOLS
+#if USE_DELAY_POOLS
static int max_clients = 32768;
#else
static int max_clients = 32;
static int cleanup_scheduled = 0;
static int cleanup_removed;
-#if DELAY_POOLS
+#if USE_DELAY_POOLS
#define CLIENT_DB_HASH_SIZE 65357
#else
#define CLIENT_DB_HASH_SIZE 467
c = (ClientInfo *)memAllocate(MEM_CLIENT_INFO);
c->hash.key = addr.NtoA(buf,MAX_IPSTRLEN);
c->addr = addr;
-#if DELAY_POOLS
+#if USE_DELAY_POOLS
/* setup default values for client write limiter */
c->writeLimitingActive=false;
c->writeSpeedLimit=0;
client_table = hash_create((HASHCMP *) strcmp, CLIENT_DB_HASH_SIZE, hash_string);
}
-#if DELAY_POOLS
+#if USE_DELAY_POOLS
/* returns ClientInfo for given IP addr
Returns NULL if no such client (or clientdb turned off)
(it is assumed that clientdbEstablished will be called before and create client record if needed)
ClientInfo *c = (ClientInfo *)data;
safe_free(c->hash.key);
-#if DELAY_POOLS
+#if USE_DELAY_POOLS
if (CommQuotaQueue *q = c->quotaQueue) {
q->clientInfo = NULL;
delete q; // invalidates cbdata, cancelling any pending kicks
#include "SquidTime.h"
#include "Store.h"
-#if DELAY_POOLS
+#if USE_DELAY_POOLS
#include "ClientInfo.h"
#endif
clientdbEstablished(details->peer, 1);
-#if DELAY_POOLS
+#if USE_DELAY_POOLS
fd_table[newfd].clientInfo = NULL;
if (Config.onoff.client_db) {
#include "client_side.h"
#include "client_side_reply.h"
#include "clientStream.h"
-#if DELAY_POOLS
+#if USE_DELAY_POOLS
#include "DelayPools.h"
#endif
#include "errorpage.h"
http->log_uri, http->request->flags, http->request->method);
/* NOTE, don't call StoreEntry->lock(), storeCreateEntry() does it */
sc = storeClientListAdd(entry, this);
-#if DELAY_POOLS
+#if USE_DELAY_POOLS
/* delay_id is already set on original store client */
sc->setDelayId(DelayId::DelayClient(http));
#endif
* plain ol' cache hit
*/
-#if DELAY_POOLS
+#if USE_DELAY_POOLS
if (e->store_status != STORE_OK)
http->logType = LOG_TCP_MISS;
else
}
sc = storeClientListAdd(http->storeEntry(), this);
-#if DELAY_POOLS
-
+#if USE_DELAY_POOLS
sc->setDelayId(DelayId::DelayClient(http));
#endif
sc = storeClientListAdd(e, this);
-#if DELAY_POOLS
-
+#if USE_DELAY_POOLS
sc->setDelayId(DelayId::DelayClient(http));
-
#endif
reqofs = 0;
static void comm_init_opened(int new_socket, Ip::Address &addr, tos_t tos, nfmark_t nfmark, const char *note, struct addrinfo *AI);
static int comm_apply_flags(int new_socket, Ip::Address &addr, int flags, struct addrinfo *AI);
-#if DELAY_POOLS
+#if USE_DELAY_POOLS
CBDATA_CLASS_INIT(CommQuotaQueue);
static void commHandleWriteHelper(void * data);
COMMIO_FD_READCB(fd)->finish(COMM_ERR_CLOSING, errno);
}
-#if DELAY_POOLS
+#if USE_DELAY_POOLS
if (ClientInfo *clientInfo = F->clientInfo) {
if (clientInfo->selectWaiting) {
clientInfo->selectWaiting = false;
Comm::CallbackTableDestruct();
}
-#if DELAY_POOLS
+#if USE_DELAY_POOLS
// called when the queue is done waiting for the client bucket to fill
void
commHandleWriteHelper(void * data)
void
Comm::IoCallback::selectOrQueueWrite()
{
-#if DELAY_POOLS
+#if USE_DELAY_POOLS
// stand in line if there is one
if (ClientInfo *clientInfo = fd_table[fd].clientInfo) {
if (clientInfo->writeLimitingActive) {
}
xerrno = 0;
-#if DELAY_POOLS
+#if USE_DELAY_POOLS
quotaQueueReserv = 0;
#endif
}
int offset;
comm_err_t errcode;
int xerrno;
-#if DELAY_POOLS
+#if USE_DELAY_POOLS
unsigned int quotaQueueReserv; ///< reservation ID from CommQuotaQueue
#endif
#include "config.h"
-#if DELAY_POOLS
+#if USE_DELAY_POOLS
#include "ClientInfo.h"
#endif
#include "comm/IoCallback.h"
nleft = state->size - state->offset;
-#if DELAY_POOLS
+#if USE_DELAY_POOLS
ClientInfo * clientInfo=fd_table[fd].clientInfo;
if (clientInfo && !clientInfo->writeLimitingActive)
}
}
-#endif
+#endif /* USE_DELAY_POOLS */
/* actually WRITE data */
len = FD_WRITE_METHOD(fd, state->buf + state->offset, nleft);
debugs(5, 5, HERE << "write() returns " << len);
-#if DELAY_POOLS
+#if USE_DELAY_POOLS
if (clientInfo) {
if (len > 0) {
/* we wrote data - drain them from bucket */
// even if we wrote nothing, we were served; give others a chance
clientInfo->kickQuotaQueue();
}
-#endif
+#endif /* USE_DELAY_POOLS */
fd_bytes(fd, len, FD_WRITE);
statCounter.syscalls.sock.writes++;
#include "config.h"
-#if DELAY_POOLS
+#if USE_DELAY_POOLS
#include "squid.h"
#include "mgr/Registration.h"
#include "DelaySpec.h"
theClassCHost->buckets.values[theNet].individuals.values[theHost].bytesIn (qty);
}
-#endif
-
+#endif /* USE_DELAY_POOLS */
#include "comm.h"
#include "ip/Address.h"
-#if DELAY_POOLS
+#if USE_DELAY_POOLS
class ClientInfo;
#endif
class PconnPool;
PconnPool *pool;
} pconn;
-#if DELAY_POOLS
+#if USE_DELAY_POOLS
ClientInfo * clientInfo;/* pointer to client info used in client write limiter or NULL if not present */
#endif
unsigned epoll_state;
bytes_written = 0;
pconn.uses = 0;
pconn.pool = NULL;
-#if DELAY_POOLS
+#if USE_DELAY_POOLS
clientInfo = NULL;
#endif
epoll_state = 0;
#include "URLScheme.h"
#include "wordlist.h"
-#if DELAY_POOLS
+#if USE_DELAY_POOLS
#include "DelayPools.h"
#include "MemObject.h"
#endif
if (io.flag == COMM_OK && io.size > 0) {
debugs(9,5,HERE << "appended " << io.size << " bytes to readBuf");
data.readBuf->appended(io.size);
-#if DELAY_POOLS
+#if USE_DELAY_POOLS
DelayId delayId = entry->mem_obj->mostBytesAllowed();
delayId.bytesIn(io.size);
#endif
#include "HttpRequest.h"
#include "HttpReply.h"
#include "comm.h"
-#if DELAY_POOLS
+#if USE_DELAY_POOLS
#include "DelayPools.h"
#include "MemObject.h"
#endif
int bin;
size_t read_sz = BUFSIZ;
int do_next_read = 0;
-#if DELAY_POOLS
-
+#if USE_DELAY_POOLS
DelayId delayId = entry->mem_obj->mostBytesAllowed();
#endif
}
errno = 0;
-#if DELAY_POOLS
-
+#if USE_DELAY_POOLS
read_sz = delayId.bytesWanted(1, read_sz);
#endif
/* leave one space for \0 in gopherToHTML */
if (flag == COMM_OK && len > 0) {
-#if DELAY_POOLS
+#if USE_DELAY_POOLS
delayId.bytesIn(len);
#endif
#include "base/TextException.h"
#include "base64.h"
#include "comm/Write.h"
-#if DELAY_POOLS
+#if USE_DELAY_POOLS
#include "DelayPools.h"
#endif
#include "errorpage.h"
if (_peer->options.proxy_only)
entry->releaseRequest();
-#if DELAY_POOLS
-
+#if USE_DELAY_POOLS
entry->setNoDelay(_peer->options.no_delay);
-
#endif
}
if (len > 0) {
readBuf->appended(len);
reply_bytes_read += len;
-#if DELAY_POOLS
-
+#if USE_DELAY_POOLS
DelayId delayId = entry->mem_obj->mostBytesAllowed();
delayId.bytesIn(len);
#endif
#endif
#include "auth/Gadgets.h"
#include "base/TextException.h"
+#if USE_DELAY_POOLS
+#include "ClientDelayConfig.h"
+#endif
#include "ConfigParser.h"
#include "CpuAffinity.h"
+#if USE_DELAY_POOLS
+#include "DelayPools.h"
+#endif
#include "errorpage.h"
#include "event.h"
#include "EventLoop.h"
#include "icmp/IcmpSquid.h"
#include "icmp/net_db.h"
-#if DELAY_POOLS
-#include "ClientDelayConfig.h"
-#endif
-
#if USE_LOADABLE_MODULES
#include "LoadableModules.h"
#endif
mimeInit(Config.mimeTablePathname);
-#if DELAY_POOLS
+#if USE_DELAY_POOLS
Config.ClientDelay.finalize();
#endif
}
}
-#if DELAY_POOLS
-#include "DelayPools.h"
-#endif
-
static void
mainInitialize(void)
{
do_mallinfo = 1;
mimeInit(Config.mimeTablePathname);
refreshInit();
-#if DELAY_POOLS
-
+#if USE_DELAY_POOLS
DelayPools::Init();
#endif
Esi::Init();
#endif
-#if DELAY_POOLS
+#if USE_DELAY_POOLS
Config.ClientDelay.finalize();
#endif
Esi::Clean();
#endif
-#if DELAY_POOLS
-
+#if USE_DELAY_POOLS
DelayPools::FreePools();
#endif
if (p->options.no_netdb_exchange)
storeAppendPrintf(sentry, " no-netdb-exchange");
-#if DELAY_POOLS
-
+#if USE_DELAY_POOLS
if (p->options.no_delay)
storeAppendPrintf(sentry, " no-delay");
-
#endif
if (p->login)
class HttpRequestMethod;
-#if DELAY_POOLS
+#if USE_DELAY_POOLS
class ClientInfo;
#endif
SQUIDCEXTERN void clientdbFreeMemory(void);
SQUIDCEXTERN int clientdbEstablished(const Ip::Address &, int);
-#if DELAY_POOLS
+#if USE_DELAY_POOLS
SQUIDCEXTERN void clientdbSetWriteLimiter(ClientInfo * info, const int writeSpeedLimit,const double initialBurst,const double highWatermark);
SQUIDCEXTERN ClientInfo * clientdbGetInfo(const Ip::Address &addr);
#endif
#include "MemObject.h"
#include "fde.h"
#include "mem_node.h"
-#if DELAY_POOLS
+#if USE_DELAY_POOLS
#include "DelayId.h"
#endif
#include "client_side_request.h"
storeAppendPrintf(s, "username %s\n", p);
-#if DELAY_POOLS
-
+#if USE_DELAY_POOLS
storeAppendPrintf(s, "delay_pool %d\n", DelayId::DelayClient(http).pool());
-
#endif
storeAppendPrintf(s, "\n");
#include "mem_node.h"
#include "StoreMeta.h"
#include "SwapDir.h"
-#if DELAY_POOLS
+#if USE_DELAY_POOLS
#include "DelayPools.h"
#endif
#include "Stack.h"
assert (mem_obj);
/* read ahead limit */
/* Perhaps these two calls should both live in MemObject */
-#if DELAY_POOLS
-
+#if USE_DELAY_POOLS
if (!mem_obj->readAheadPolicyCanRead()) {
#endif
mem_obj->delayRead(DeferredRead(DeferReader, this, CommRead(fd, buf, len, callback)));
return;
-#if DELAY_POOLS
-
+#if USE_DELAY_POOLS
}
/* delay id limit */
#include "MemObject.h"
#include "StoreMeta.h"
#include "StoreMetaUnpacker.h"
-#if DELAY_POOLS
+#if USE_DELAY_POOLS
#include "DelayPools.h"
#endif
#include "HttpRequest.h"
}
store_client::store_client(StoreEntry *e) : entry (e)
-#if DELAY_POOLS
+#if USE_DELAY_POOLS
, delayId()
#endif
, type (e->storeClientType())
store_client::Callback::Callback(STCB *function, void *data) : callback_handler(function), callback_data (data) {}
-#if DELAY_POOLS
+#if USE_DELAY_POOLS
void
store_client::setDelayId(DelayId delay_id)
{
delayId = delay_id;
}
-
#endif
relist *next;
};
-#if DELAY_POOLS
+#if USE_DELAY_POOLS
#include "DelayConfig.h"
#include "ClientDelayConfig.h"
#endif
struct {
int64_t limit;
} MemPools;
-#if DELAY_POOLS
+#if USE_DELAY_POOLS
DelayConfig Delay;
ClientDelayConfig ClientDelay;
unsigned int htcp_forward_clr:1;
#endif
unsigned int no_netdb_exchange:1;
-#if DELAY_POOLS
+#if USE_DELAY_POOLS
unsigned int no_delay:1;
#endif
unsigned int allow_miss:1;
#include "config.h"
-
-#if DELAY_POOLS
-
+#if USE_DELAY_POOLS
#include "squid.h"
#include "DelayId.h"
DelayId::~DelayId() {}
-#endif
+#endif /* USE_DELAY_POOLS */
#include "squid.h"
#include "MemObject.h"
#include "HttpReply.h"
-#if DELAY_POOLS
+#if USE_DELAY_POOLS
#include "DelayPools.h"
#endif
return -1;
}
-#if DELAY_POOLS
+#if USE_DELAY_POOLS
DelayId
MemObject::mostBytesAllowed() const
{
fatal ("Not implemented");
return result;
}
-
#endif
void
#include "comm/Write.h"
#include "client_side_request.h"
#include "acl/FilledChecklist.h"
-#if DELAY_POOLS
+#if USE_DELAY_POOLS
#include "DelayId.h"
#endif
#include "client_side.h"
void fd(int const newFD);
int bytesWanted(int lower=0, int upper = INT_MAX) const;
void bytesIn(int const &);
-#if DELAY_POOLS
+#if USE_DELAY_POOLS
void setDelayId(DelayId const &);
#endif
private:
int fd_;
-#if DELAY_POOLS
+#if USE_DELAY_POOLS
DelayId delayId;
#endif
int
TunnelStateData::Connection::bytesWanted(int lowerbound, int upperbound) const
{
-#if DELAY_POOLS
+#if USE_DELAY_POOLS
return delayId.bytesWanted(lowerbound, upperbound);
#else
void
TunnelStateData::Connection::bytesIn(int const &count)
{
-#if DELAY_POOLS
+#if USE_DELAY_POOLS
delayId.bytesIn(count);
#endif
request->hier.peer_local_port = comm_local_port(sock); // for %<lp logging
tunnelState = new TunnelStateData;
-#if DELAY_POOLS
+#if USE_DELAY_POOLS
tunnelState->server.setDelayId(DelayId::DelayClient(http));
#endif
tunnelState->request->flags.proxying = 0;
}
-#if DELAY_POOLS
+#if USE_DELAY_POOLS
/* no point using the delayIsNoDelay stuff since tunnel is nice and simple */
if (g && g->options.no_delay)
tunnelState->server.setDelayId(DelayId());
return fd_closed(server.fd()) && fd_closed(client.fd());
}
-#if DELAY_POOLS
+#if USE_DELAY_POOLS
void
TunnelStateData::Connection::setDelayId(DelayId const &newDelay)
{