]> git.ipfire.org Git - thirdparty/squid.git/blame - src/DelayPool.cc
SourceFormat Enforcement
[thirdparty/squid.git] / src / DelayPool.cc
CommitLineData
b67e2c8c 1/*
bde978a6 2 * Copyright (C) 1996-2015 The Squid Software Foundation and contributors
b67e2c8c 3 *
bbc27441
AJ
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.
b67e2c8c 7 */
8
bbc27441
AJ
9/* DEBUG: section 77 Delay Pools */
10
f7f3304a 11#include "squid.h"
b67e2c8c 12
9a0a18de 13#if USE_DELAY_POOLS
3ad63615
AR
14#include "acl/Acl.h"
15#include "acl/Gadgets.h"
602d9612
A
16#include "CommonPool.h"
17#include "DelayPool.h"
b67e2c8c 18#include "Store.h"
19
20DelayPool::DelayPool() : pool (NULL), access (NULL)
21{
22 pool = CommonPool::Factory(0, theComposite_);
23}
24
25DelayPool::~DelayPool()
26{
b67e2c8c 27 if (pool)
62e76326 28 freeData();
29
b67e2c8c 30 if (access)
62e76326 31 aclDestroyAccessList(&access);
b67e2c8c 32}
33
34void
35DelayPool::parse()
36{
63be0a78 37 assert(theComposite() != NULL);
b67e2c8c 38 theComposite()->parse();
39}
40
41void
63be0a78 42DelayPool::dump(StoreEntry *entry, unsigned int i) const
b67e2c8c 43{
110f57f4 44 if (theComposite() == NULL)
62e76326 45 return;
46
47 storeAppendPrintf(entry, "delay_class %d %s\n", i + 1, pool->theClassTypeLabel());
48
49 LOCAL_ARRAY(char, nom, 32);
50
51 snprintf(nom, 32, "delay_access %d", i + 1);
52
53 dump_acl_access(entry, nom, access);
54
55 storeAppendPrintf(entry, "delay_parameters %d", i + 1);
56
57 theComposite()->dump (entry);
58
59 storeAppendPrintf(entry, "\n");
b67e2c8c 60}
61
62void
63DelayPool::createPool(u_char delay_class)
64{
65 if (pool)
62e76326 66 freeData();
67
b67e2c8c 68 pool = CommonPool::Factory(delay_class, theComposite_);
69}
70
71void
72DelayPool::freeData()
73{
00d77d6b 74 delete pool;
b67e2c8c 75 pool = NULL;
76}
77
63be0a78 78/** \todo XXX create DelayIdComposite.cc */
a46d2c0e 79void
80CompositePoolNode::delayRead(DeferredRead const &aRead)
81{
82 deferredReads.delayRead(aRead);
83}
84
85#include "comm.h"
b67e2c8c 86
a46d2c0e 87void
88CompositePoolNode::kickReads()
89{
27b24462 90 deferredReads.kickReads(-1);
a46d2c0e 91}
92
9a0a18de 93#endif /* USE_DELAY_POOLS */
f53969cc 94