/*
- * $Id: cache_cf.cc,v 1.418 2002/10/13 23:48:23 hno Exp $
+ * $Id: cache_cf.cc,v 1.419 2002/10/14 08:43:46 hno Exp $
*
* DEBUG: section 3 Configuration File Parsing
* AUTHOR: Harvest Derived
}
storeAppendPrintf(entry, "%s %d\n", name, cfg.pools);
for (i = 0; i < cfg.pools; i++) {
- storeAppendPrintf(entry, "delay_class %d %d\n", i + 1, cfg.class[i]);
+ storeAppendPrintf(entry, "delay_class %d %d\n", i + 1, cfg.delay_class[i]);
snprintf(nom, 32, "delay_access %d", i + 1);
dump_acl_access(entry, nom, cfg.access[i]);
- if (cfg.class[i] >= 1)
+ if (cfg.delay_class[i] >= 1)
storeAppendPrintf(entry, "delay_parameters %d %d/%d", i + 1,
cfg.rates[i]->aggregate.restore_bps,
cfg.rates[i]->aggregate.max_bytes);
- if (cfg.class[i] >= 3)
+ if (cfg.delay_class[i] >= 3)
storeAppendPrintf(entry, " %d/%d",
cfg.rates[i]->network.restore_bps,
cfg.rates[i]->network.max_bytes);
- if (cfg.class[i] >= 2)
+ if (cfg.delay_class[i] >= 2)
storeAppendPrintf(entry, " %d/%d",
cfg.rates[i]->individual.restore_bps,
cfg.rates[i]->individual.max_bytes);
- if (cfg.class[i] >= 1)
+ if (cfg.delay_class[i] >= 1)
storeAppendPrintf(entry, "\n");
}
}
parse_ushort(&cfg->pools);
if (cfg->pools) {
delayInitDelayData(cfg->pools);
- cfg->delay_class = xcalloc(cfg->pools, sizeof(u_char));
- cfg->rates = xcalloc(cfg->pools, sizeof(delaySpecSet *));
- cfg->access = xcalloc(cfg->pools, sizeof(acl_access *));
+ cfg->delay_class = (unsigned char *)xcalloc(cfg->pools, sizeof(unsigned char));
+ cfg->rates = (delaySpecSet **)xcalloc(cfg->pools, sizeof(delaySpecSet *));
+ cfg->access = (acl_access **)xcalloc(cfg->pools, sizeof(acl_access *));
}
}
static void
parse_delay_pool_class(delayConfig * cfg)
{
- ushort pool, class;
+ ushort pool, delay_class;
parse_ushort(&pool);
if (pool < 1 || pool > cfg->pools) {
debug(3, 0) ("parse_delay_pool_class: Ignoring pool %d not in 1 .. %d\n", pool, cfg->pools);
return;
}
- parse_ushort(&class);
- if (class < 1 || class > 3) {
- debug(3, 0) ("parse_delay_pool_class: Ignoring pool %d class %d not in 1 .. 3\n", pool, class);
+ parse_ushort(&delay_class);
+ if (delay_class < 1 || delay_class > 3) {
+ debug(3, 0) ("parse_delay_pool_class: Ignoring pool %d class %d not in 1 .. 3\n", pool, delay_class);
return;
}
pool--;
delayFreeDelayPool(pool);
safe_free(cfg->rates[pool]);
}
- cfg->rates[pool] = xmalloc(class * sizeof(delaySpec));
- cfg->delay_class[pool] = class;
+ cfg->rates[pool] = (delaySpecSet *)xmalloc(delay_class * sizeof(delaySpecSet));
+ cfg->delay_class[pool] = delay_class;
cfg->rates[pool]->aggregate.restore_bps = cfg->rates[pool]->aggregate.max_bytes = -1;
if (cfg->delay_class[pool] >= 3)
cfg->rates[pool]->network.restore_bps = cfg->rates[pool]->network.max_bytes = -1;
if (cfg->delay_class[pool] >= 2)
cfg->rates[pool]->individual.restore_bps = cfg->rates[pool]->individual.max_bytes = -1;
- delayCreateDelayPool(pool, class);
+ delayCreateDelayPool(pool, delay_class);
}
static void
parse_delay_pool_rates(delayConfig * cfg)
{
- ushort pool, class;
+ ushort pool, delay_class;
int i;
delaySpec *ptr;
char *token;
return;
}
pool--;
- class = cfg->delay_class[pool];
- if (class == 0) {
+ delay_class = cfg->delay_class[pool];
+ if (delay_class == 0) {
debug(3, 0) ("parse_delay_pool_rates: Ignoring pool %d attempt to set rates with class not set\n", pool + 1);
return;
}
ptr = (delaySpec *) cfg->rates[pool];
/* read in "class" sets of restore,max pairs */
- while (class--) {
+ while (delay_class--) {
token = strtok(NULL, "/");
if (token == NULL)
self_destruct();
ptr->max_bytes = i;
ptr++;
}
- class = cfg->delay_class[pool];
+ delay_class = cfg->delay_class[pool];
/* if class is 3, swap around network and individual */
- if (class == 3) {
+ if (delay_class == 3) {
delaySpec tmp;
tmp = cfg->rates[pool]->individual;
cfg->rates[pool]->network = tmp;
}
/* initialize the delay pools */
- delayInitDelayPool(pool, class, cfg->rates[pool]);
+ delayInitDelayPool(pool, delay_class, cfg->rates[pool]);
}
static void
/*
- * $Id: delay_pools.cc,v 1.28 2002/10/14 07:35:45 hno Exp $
+ * $Id: delay_pools.cc,v 1.29 2002/10/14 08:43:46 hno Exp $
*
* DEBUG: section 77 Delay Pools
* AUTHOR: David Luyer <david@luyer.net>
#if DELAY_POOLS
#include "squid.h"
#include "StoreClient.h"
+#include "Store.h"
struct _class1DelayPool {
int delay_class;
{
if (!pools)
return;
- delay_data = xcalloc(pools, sizeof(*delay_data));
+ delay_data = (delayPool *)xcalloc(pools, sizeof(*delay_data));
memory_used += pools * sizeof(*delay_data);
eventAdd("delayPoolsUpdate", delayPoolsUpdate, NULL, 1.0, 1);
delay_id_ptr_hash = hash_create(delayIdPtrHashCmp, 256, delayIdPtrHash);
static void
delayIdZero(void *hlink)
{
- hash_link *h = hlink;
+ hash_link *h = (hash_link *)hlink;
delay_id *id = (delay_id *) h->key;
*id = 0;
xfree(h);
return;
if (*loc == 0)
return;
- lnk = xmalloc(sizeof(hash_link));
+ lnk = (hash_link *)xmalloc(sizeof(hash_link));
memory_used += sizeof(hash_link);
lnk->key = (char *) loc;
hash_join(delay_id_ptr_hash, lnk);
*/
if (*loc == 0)
return;
- lnk = hash_lookup(delay_id_ptr_hash, loc);
+ lnk = (hash_link *)hash_lookup(delay_id_ptr_hash, loc);
assert(lnk);
hash_remove_link(delay_id_ptr_hash, lnk);
xxfree(lnk);
{
switch (delay_class) {
case 1:
- delay_data[pool].class1 = xmalloc(sizeof(class1DelayPool));
+ delay_data[pool].class1 = (class1DelayPool *)xmalloc(sizeof(class1DelayPool));
delay_data[pool].class1->delay_class = 1;
memory_used += sizeof(class1DelayPool);
break;
case 2:
- delay_data[pool].class2 = xmalloc(sizeof(class2DelayPool));
+ delay_data[pool].class2 = (class2DelayPool *)xmalloc(sizeof(class2DelayPool));
delay_data[pool].class1->delay_class = 2;
memory_used += sizeof(class2DelayPool);
break;
case 3:
- delay_data[pool].class3 = xmalloc(sizeof(class3DelayPool));
+ delay_data[pool].class3 = (class3DelayPool *)xmalloc(sizeof(class3DelayPool));
delay_data[pool].class1->delay_class = 3;
memory_used += sizeof(class3DelayPool);
break;
/*
- * $Id: ftp.cc,v 1.331 2002/10/14 08:16:58 robertc Exp $
+ * $Id: ftp.cc,v 1.332 2002/10/14 08:43:46 hno Exp $
*
* DEBUG: section 9 File Transfer Protocol (FTP)
* AUTHOR: Harvest Derived
/* XXX what about Config.Timeout.read? */
read_sz = ftpState->data.size - ftpState->data.offset;
#if DELAY_POOLS
- read_sz = delayBytesWanted(delay_id, 1, read_sz);
+ read_sz = delayBytesWanted(delayId, 1, read_sz);
#endif
comm_read(fd, ftpState->data.buf + ftpState->data.offset, read_sz, ftpDataRead, data);
} else {
/* XXX what about Config.Timeout.read? */
read_sz = ftpState->data.size - ftpState->data.offset;
#if DELAY_POOLS
- read_sz = delayBytesWanted(delay_id, 1, read_sz);
+ read_sz = delayBytesWanted(delayId, 1, read_sz);
#endif
comm_read(fd, ftpState->data.buf + ftpState->data.offset, read_sz, ftpDataRead, data);}
}
/* XXX what about Config.Timeout.read? */
size_t read_sz = ftpState->data.size - ftpState->data.offset;
#if DELAY_POOLS
- read_sz = delayBytesWanted(delay_id, 1, read_sz);
+ read_sz = delayBytesWanted(delayId, 1, read_sz);
#endif
comm_read(ftpState->data.fd, ftpState->data.buf + ftpState->data.offset,
read_sz, ftpDataRead, ftpState);