]> git.ipfire.org Git - thirdparty/squid.git/blob - src/DelayPool.cc
Merge from trunk
[thirdparty/squid.git] / src / DelayPool.cc
1 /*
2 * $Id$
3 *
4 * DEBUG: section 77 Delay Pools
5 * AUTHOR: Robert Collins <robertc@squid-cache.org>
6 * Based upon original delay pools code by
7 * David Luyer <david@luyer.net>
8 *
9 * SQUID Web Proxy Cache http://www.squid-cache.org/
10 * ----------------------------------------------------------
11 *
12 * Squid is the result of efforts by numerous individuals from
13 * the Internet community; see the CONTRIBUTORS file for full
14 * details. Many organizations have provided support for Squid's
15 * development; see the SPONSORS file for full details. Squid is
16 * Copyrighted (C) 2001 by the Regents of the University of
17 * California; see the COPYRIGHT file for full details. Squid
18 * incorporates software developed and/or copyrighted by other
19 * sources; see the CREDITS file for full details.
20 *
21 * This program is free software; you can redistribute it and/or modify
22 * it under the terms of the GNU General Public License as published by
23 * the Free Software Foundation; either version 2 of the License, or
24 * (at your option) any later version.
25 *
26 * This program is distributed in the hope that it will be useful,
27 * but WITHOUT ANY WARRANTY; without even the implied warranty of
28 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
29 * GNU General Public License for more details.
30 *
31 * You should have received a copy of the GNU General Public License
32 * along with this program; if not, write to the Free Software
33 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
34 *
35 *
36 * Copyright (c) 2003, Robert Collins <robertc@squid-cache.org>
37 */
38
39 #include "config.h"
40
41 #if DELAY_POOLS
42 #include "DelayPool.h"
43 #include "CommonPool.h"
44 #include "ACL.h"
45 #include "Store.h"
46
47 DelayPool::DelayPool() : pool (NULL), access (NULL)
48 {
49 pool = CommonPool::Factory(0, theComposite_);
50 }
51
52 DelayPool::~DelayPool()
53 {
54 if (pool)
55 freeData();
56
57 if (access)
58 aclDestroyAccessList(&access);
59 }
60
61 void
62 DelayPool::parse()
63 {
64 assert(theComposite() != NULL);
65 theComposite()->parse();
66 }
67
68 void
69 DelayPool::dump(StoreEntry *entry, unsigned int i) const
70 {
71 if (theComposite() == NULL)
72 return;
73
74 storeAppendPrintf(entry, "delay_class %d %s\n", i + 1, pool->theClassTypeLabel());
75
76 LOCAL_ARRAY(char, nom, 32);
77
78 snprintf(nom, 32, "delay_access %d", i + 1);
79
80 dump_acl_access(entry, nom, access);
81
82 storeAppendPrintf(entry, "delay_parameters %d", i + 1);
83
84 theComposite()->dump (entry);
85
86 storeAppendPrintf(entry, "\n");
87 }
88
89 void
90 DelayPool::createPool(u_char delay_class)
91 {
92 if (pool)
93 freeData();
94
95 pool = CommonPool::Factory(delay_class, theComposite_);
96 }
97
98 void
99 DelayPool::freeData()
100 {
101 delete pool;
102 pool = NULL;
103 }
104
105 /** \todo XXX create DelayIdComposite.cc */
106 void
107 CompositePoolNode::delayRead(DeferredRead const &aRead)
108 {
109 deferredReads.delayRead(aRead);
110 }
111
112 #include "comm.h"
113
114 void
115 CompositePoolNode::kickReads()
116 {
117 deferredReads.kickReads(-1);
118 }
119
120 #endif