~chtsanti/squid/icap-max-connections

« back to all changes in this revision

Viewing changes to src/adaptation/Config.cc

  • Committer: Christos Tsantilas
  • Date: 2009-02-18 22:18:35 UTC
  • mfrom: (9294.1.215 trunk)
  • Revision ID: chtsanti@users.sourceforge.net-20090218221835-lfxxe3bs8uhu0b1h
MergeĀ fromĀ trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
68
68
    typedef Services::iterator SCI;
69
69
    for (SCI i = AllServices().begin(); i != AllServices().end(); ++i) {
70
70
        const ServiceConfig &cfg = (*i)->cfg();
71
 
        storeAppendPrintf(entry, "%s %.*s_%s %s %d %.*s\n", name, cfg.key.size(), cfg.key.rawBuf(),
72
 
                          cfg.methodStr(), cfg.vectPointStr(), cfg.bypass, cfg.uri.size(), cfg.uri.rawBuf());
 
71
        storeAppendPrintf(entry, "%s " SQUIDSTRINGPH "_%s %s %d " SQUIDSTRINGPH "\n",
 
72
            name,
 
73
            SQUIDSTRINGPRINT(cfg.key),
 
74
            cfg.methodStr(), cfg.vectPointStr(), cfg.bypass,
 
75
            SQUIDSTRINGPRINT(cfg.uri));
73
76
    }
74
77
}
75
78
 
141
144
{
142
145
    typedef Groups::iterator GI;
143
146
    for (GI i = AllGroups().begin(); i != AllGroups().end(); ++i)
144
 
        storeAppendPrintf(entry, "%s %s\n", name, (*i)->id.unsafeBuf());
 
147
        storeAppendPrintf(entry, "%s " SQUIDSTRINGPH "\n", name, SQUIDSTRINGPRINT((*i)->id));
145
148
}
146
149
 
147
150
void
148
151
Adaptation::Config::ParseAccess(ConfigParser &parser)
149
152
{
150
 
    AccessRule *r = new AccessRule;
 
153
    String groupId;
 
154
    ConfigParser::ParseString(&groupId);
 
155
    AccessRule *r;
 
156
    if (!(r=FindRuleByGroupId(groupId))) {
 
157
        r = new AccessRule(groupId);
 
158
        AllRules().push_back(r);
 
159
    }
151
160
    r->parse(parser);
152
 
    AllRules().push_back(r);
153
161
}
154
162
 
155
163
void
162
170
}
163
171
 
164
172
void
165
 
Adaptation::Config::DestroyConfig()
166
 
{
167
 
    FreeAccess();
168
 
    FreeServiceSet();
169
 
 
170
 
    // invalidate each service so that it can be deleted when refcount=0
171
 
    while (!AllServices().empty()) {
172
 
        AllServices().back()->invalidate();
173
 
        AllServices().pop_back();
174
 
    }
175
 
}
176
 
 
177
 
void
178
173
Adaptation::Config::DumpAccess(StoreEntry *entry, const char *name)
179
174
{
180
175
    LOCAL_ARRAY(char, nom, 64);
181
176
 
182
177
    typedef AccessRules::iterator CI;
183
178
    for (CI i = AllRules().begin(); i != AllRules().end(); ++i) {
184
 
        snprintf(nom, 64, "%s %s", name, (*i)->groupId.unsafeBuf());
 
179
        snprintf(nom, 64, "%s " SQUIDSTRINGPH, name, SQUIDSTRINGPRINT((*i)->groupId));
185
180
        dump_acl_access(entry, nom, (*i)->acl);
186
181
    }
187
182
}
195
190
// with global arrays shared by those individual configs
196
191
Adaptation::Config::~Config()
197
192
{
198
 
    Adaptation::Config::DestroyConfig();
 
193
    FreeAccess();
 
194
    FreeServiceSet();
 
195
 
 
196
    // invalidate each service so that it can be deleted when refcount=0
 
197
    while (!AllServices().empty()) {
 
198
        AllServices().back()->invalidate();
 
199
        AllServices().pop_back();
 
200
    }
 
201
 
199
202
    freeService();
200
203
}