]> git.ipfire.org Git - thirdparty/squid.git/blame - src/DelayPool.cc
NoNewGlobals for MapLabel (#1746)
[thirdparty/squid.git] / src / DelayPool.cc
CommitLineData
b67e2c8c 1/*
b8ae064d 2 * Copyright (C) 1996-2023 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
aee3523a 20DelayPool::DelayPool() : pool (nullptr), access (nullptr)
b67e2c8c 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{
aee3523a 37 assert(theComposite() != nullptr);
b67e2c8c 38 theComposite()->parse();
39}
40
41void
63be0a78 42DelayPool::dump(StoreEntry *entry, unsigned int i) const
b67e2c8c 43{
aee3523a 44 if (theComposite() == nullptr)
62e76326 45 return;
46
1e9de476 47 storeAppendPrintf(entry, "delay_class %d " SQUIDSBUFPH "\n", i + 1, SQUIDSBUFPRINT(pool->classTypeLabel()));
62e76326 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;
aee3523a 75 pool = nullptr;
b67e2c8c 76}
77
9837567d 78// TODO: create DelayIdComposite.cc
a46d2c0e 79void
a928fdfd 80CompositePoolNode::delayRead(const AsyncCall::Pointer &aRead)
a46d2c0e 81{
a928fdfd 82 deferredReads.delay(aRead);
a46d2c0e 83}
84
85#include "comm.h"
b67e2c8c 86
a46d2c0e 87void
88CompositePoolNode::kickReads()
89{
a928fdfd 90 deferredReads.schedule();
a46d2c0e 91}
92
9a0a18de 93#endif /* USE_DELAY_POOLS */
f53969cc 94