]> git.ipfire.org Git - thirdparty/squid.git/blob - src/DelayPool.cc
Source Format Enforcement (#532)
[thirdparty/squid.git] / src / DelayPool.cc
1 /*
2 * Copyright (C) 1996-2020 The Squid Software Foundation and contributors
3 *
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.
7 */
8
9 /* DEBUG: section 77 Delay Pools */
10
11 #include "squid.h"
12
13 #if USE_DELAY_POOLS
14 #include "acl/Acl.h"
15 #include "acl/Gadgets.h"
16 #include "CommonPool.h"
17 #include "DelayPool.h"
18 #include "Store.h"
19
20 DelayPool::DelayPool() : pool (NULL), access (NULL)
21 {
22 pool = CommonPool::Factory(0, theComposite_);
23 }
24
25 DelayPool::~DelayPool()
26 {
27 if (pool)
28 freeData();
29
30 if (access)
31 aclDestroyAccessList(&access);
32 }
33
34 void
35 DelayPool::parse()
36 {
37 assert(theComposite() != NULL);
38 theComposite()->parse();
39 }
40
41 void
42 DelayPool::dump(StoreEntry *entry, unsigned int i) const
43 {
44 if (theComposite() == NULL)
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");
60 }
61
62 void
63 DelayPool::createPool(u_char delay_class)
64 {
65 if (pool)
66 freeData();
67
68 pool = CommonPool::Factory(delay_class, theComposite_);
69 }
70
71 void
72 DelayPool::freeData()
73 {
74 delete pool;
75 pool = NULL;
76 }
77
78 /** \todo XXX create DelayIdComposite.cc */
79 void
80 CompositePoolNode::delayRead(DeferredRead const &aRead)
81 {
82 deferredReads.delayRead(aRead);
83 }
84
85 #include "comm.h"
86
87 void
88 CompositePoolNode::kickReads()
89 {
90 deferredReads.kickReads(-1);
91 }
92
93 #endif /* USE_DELAY_POOLS */
94