/*
- * $Id: authenticate.cc,v 1.3 1998/09/04 23:04:38 wessels Exp $
+ * $Id: authenticate.cc,v 1.4 1998/09/14 21:58:45 wessels Exp $
*
* DEBUG: section 29 Authenticator
* AUTHOR: Duane Wessels
typedef struct _authenticator {
int index;
- int flags;
+ helper_flags flags;
int fd;
char *inbuf;
unsigned int size;
if (len <= 0) {
if (len < 0)
debug(50, 1) ("authenticateHandleRead: FD %d read: %s\n", fd, xstrerror());
- debug(29, EBIT_TEST(authenticator->flags, HELPER_CLOSING) ? 5 : 1)
+ debug(29, authenticator->flags.closing ? 5 : 1)
("FD %d: Connection from Authenticator #%d is closed, disabling\n",
fd, authenticator->index + 1);
- authenticator->flags = 0;
+ authenticator->flags.alive = 0;
+ authenticator->flags.busy = 0;
+ authenticator->flags.closing = 0;
+ authenticator->flags.shutdown = 0;
memFree(MEM_8K_BUF, authenticator->inbuf);
authenticator->inbuf = NULL;
comm_close(fd);
}
authenticateStateFree(r);
authenticator->authenticateState = NULL;
- EBIT_CLR(authenticator->flags, HELPER_BUSY);
+ authenticator->flags.busy = 0;
authenticator->offset = 0;
n = ++AuthenticateStats.replies;
AuthenticateStats.avg_svc_time =
authenticator_t *authenticate = NULL;
for (k = 0; k < NAuthenticators; k++) {
authenticate = *(authenticate_child_table + k);
- if (EBIT_TEST(authenticate->flags, HELPER_BUSY))
+ if (authenticate->flags.busy)
continue;
- if (!EBIT_TEST(authenticate->flags, HELPER_ALIVE))
+ if (!authenticate->flags.alive)
continue;
return authenticate;
}
authenticateStateFree(r);
return;
}
- EBIT_SET(authenticate->flags, HELPER_BUSY);
+ authenticate->flags.busy = 1;
authenticate->authenticateState = r;
authenticate->dispatch_time = current_time;
buf = memAllocate(MEM_8K_BUF);
&authenticatesocket);
if (x < 0) {
debug(29, 1) ("WARNING: Cannot run '%s' process.\n", prg);
- EBIT_CLR(authenticate_child_table[k]->flags, HELPER_ALIVE);
+ authenticate_child_table[k]->flags.alive = 0;
} else {
- EBIT_SET(authenticate_child_table[k]->flags, HELPER_ALIVE);
+ authenticate_child_table[k]->flags.alive = 1;
authenticate_child_table[k]->index = k;
authenticate_child_table[k]->fd = authenticatesocket;
authenticate_child_table[k]->inbuf = memAllocate(MEM_8K_BUF);
}
for (k = 0; k < NAuthenticators; k++) {
authenticate = *(authenticate_child_table + k);
- if (!EBIT_TEST(authenticate->flags, HELPER_ALIVE))
+ if (!authenticate->flags.alive)
continue;
- if (EBIT_TEST(authenticate->flags, HELPER_CLOSING))
+ if (authenticate->flags.closing)
continue;
- if (EBIT_TEST(authenticate->flags, HELPER_BUSY)) {
+ if (authenticate->flags.busy) {
na++;
continue;
}
debug(29, 3) ("authenticateShutdownServers: closing authenticator #%d, FD %d\n",
authenticate->index + 1, authenticate->fd);
comm_close(authenticate->fd);
- EBIT_SET(authenticate->flags, HELPER_CLOSING);
- EBIT_SET(authenticate->flags, HELPER_BUSY);
+ authenticate->flags.closing = 1;
+ authenticate->flags.busy = 1;
}
if (na)
eventAdd("authenticateShutdownServers", authenticateShutdownServers, NULL, 1.0, 1);
/*
- * $Id: cache_cf.cc,v 1.304 1998/09/01 22:12:06 wessels Exp $
+ * $Id: cache_cf.cc,v 1.305 1998/09/14 21:58:46 wessels Exp $
*
* DEBUG: section 3 Configuration File Parsing
* AUTHOR: Harvest Derived
}
while ((token = strtok(NULL, w_space))) {
if (!strcasecmp(token, "proxy-only")) {
- EBIT_SET(p->options, NEIGHBOR_PROXY_ONLY);
+ p->options.proxy_only = 1;
} else if (!strcasecmp(token, "no-query")) {
- EBIT_SET(p->options, NEIGHBOR_NO_QUERY);
+ p->options.no_query = 1;
} else if (!strcasecmp(token, "no-digest")) {
- EBIT_SET(p->options, NEIGHBOR_NO_DIGEST);
+ p->options.no_digest = 1;
} else if (!strcasecmp(token, "multicast-responder")) {
- EBIT_SET(p->options, NEIGHBOR_MCAST_RESPONDER);
+ p->options.mcast_responder = 1;
} else if (!strncasecmp(token, "weight=", 7)) {
p->weight = atoi(token + 7);
} else if (!strcasecmp(token, "closest-only")) {
- EBIT_SET(p->options, NEIGHBOR_CLOSEST_ONLY);
+ p->options.closest_only = 1;
} else if (!strncasecmp(token, "ttl=", 4)) {
p->mcast.ttl = atoi(token + 4);
if (p->mcast.ttl < 0)
if (p->mcast.ttl > 128)
p->mcast.ttl = 128;
} else if (!strcasecmp(token, "default")) {
- EBIT_SET(p->options, NEIGHBOR_DEFAULT_PARENT);
+ p->options.default_parent = 1;
} else if (!strcasecmp(token, "round-robin")) {
- EBIT_SET(p->options, NEIGHBOR_ROUNDROBIN);
+ p->options.roundrobin = 1;
#if USE_HTCP
} else if (!strcasecmp(token, "htcp")) {
- EBIT_SET(p->options, NEIGHBOR_HTCP);
+ p->options.htcp = 1;
#endif
} else if (!strcasecmp(token, "no-netdb-exchange")) {
- EBIT_SET(p->options, NEIGHBOR_NO_NETDB_EXCHANGE);
+ p->options.no_netdb_exchange = 1;
#if USE_CARP
} else if (!strncasecmp(token, "carp-load-factor=", 17)) {
if (p->type != PEER_PARENT)
#endif
#if DELAY_POOLS
} else if (!strcasecmp(token, "no-delay")) {
- EBIT_SET(p->options, NEIGHBOR_NO_DELAY);
+ p->options.no_delay = 1;
#endif
} else {
debug(3, 0) ("parse_peer: token='%s'\n", token);
/*
- * $Id: dns.cc,v 1.63 1998/07/29 03:57:37 wessels Exp $
+ * $Id: dns.cc,v 1.64 1998/09/14 21:58:47 wessels Exp $
*
* DEBUG: section 34 Dnsserver interface
* AUTHOR: Harvest Derived
dnsserver_t *dns = NULL;
for (k = 0; k < NDnsServersAlloc; k++) {
dns = *(dns_child_table + k);
- if (EBIT_TEST(dns->flags, HELPER_BUSY))
+ if (dns->flags.busy)
continue;
- if (EBIT_TEST(dns->flags, HELPER_CLOSING))
+ if (dns->flags.closing)
continue;
- if (!EBIT_TEST(dns->flags, HELPER_ALIVE))
+ if (!dns->flags.alive)
continue;
return dns;
}
&wfd);
if (x < 0) {
debug(34, 1) ("dnsOpenServers: WARNING: Failed to start 'dnsserver' #%d.\n", k + 1);
- EBIT_CLR(dns_child_table[k]->flags, HELPER_ALIVE);
+ dns_child_table[k]->flags.alive = 0;
dns_child_table[k]->id = k + 1;
dns_child_table[k]->inpipe = -1;
dns_child_table[k]->outpipe = -1;
} else {
debug(34, 4) ("dnsOpenServers: FD %d connected to %s #%d.\n",
wfd, prg, k + 1);
- EBIT_SET(dns_child_table[k]->flags, HELPER_ALIVE);
+ dns_child_table[k]->flags.alive = 1;
dns_child_table[k]->id = k + 1;
dns_child_table[k]->inpipe = rfd;
dns_child_table[k]->outpipe = wfd;
k + 1,
dns->inpipe,
DnsStats.hist[k],
- EBIT_TEST(dns->flags, HELPER_ALIVE) ? 'A' : ' ',
- EBIT_TEST(dns->flags, HELPER_BUSY) ? 'B' : ' ',
- EBIT_TEST(dns->flags, HELPER_CLOSING) ? 'C' : ' ',
- EBIT_TEST(dns->flags, HELPER_SHUTDOWN) ? 'S' : ' ',
+ dns->flags.alive ? 'A' : ' ',
+ dns->flags.busy ? 'B' : ' ',
+ dns->flags.closing ? 'C' : ' ',
+ dns->flags.shutdown ? 'S' : ' ',
0.001 * tvSubMsec(dns->dispatch_time, current_time),
(int) dns->offset);
}
debug(34, 3) ("dnsShutdownServers:\n");
for (k = 0; k < NDnsServersAlloc; k++) {
dns = *(dns_child_table + k);
- if (!EBIT_TEST(dns->flags, HELPER_ALIVE)) {
+ if (!dns->flags.alive) {
debug(34, 3) ("dnsShutdownServers: #%d is NOT ALIVE.\n", dns->id);
continue;
}
- if (EBIT_TEST(dns->flags, HELPER_BUSY)) {
+ if (dns->flags.busy) {
debug(34, 3) ("dnsShutdownServers: #%d is BUSY.\n", dns->id);
- EBIT_SET(dns->flags, HELPER_SHUTDOWN);
+ dns->flags.shutdown = 1;
na++;
continue;
}
- if (EBIT_TEST(dns->flags, HELPER_CLOSING)) {
+ if (dns->flags.closing) {
debug(34, 3) ("dnsShutdownServers: #%d is CLOSING.\n", dns->id);
continue;
}
dnsShutdownRead,
dns,
0);
- EBIT_SET(dns->flags, HELPER_CLOSING);
+ dns->flags.closing = 1;
}
static void
dnsShutdownRead(int fd, void *data)
{
dnsserver_t *dns = data;
- debug(14, EBIT_TEST(dns->flags, HELPER_CLOSING) ? 5 : 1)
+ debug(14, dns->flags.closing ? 5 : 1)
("FD %d: Connection from DNSSERVER #%d is closed, disabling\n",
fd,
dns->id);
- dns->flags = 0;
+ dns->flags.alive = 0;
+ dns->flags.busy = 0;
+ dns->flags.closing = 0;
+ dns->flags.shutdown = 0;
commSetSelect(fd, COMM_SELECT_WRITE, NULL, NULL, 0);
cbdataUnlock(dns);
comm_close(fd);
/*
- * $Id: enums.h,v 1.127 1998/09/14 21:28:01 wessels Exp $
+ * $Id: enums.h,v 1.128 1998/09/14 21:58:47 wessels Exp $
*
*
* SQUID Internet Object Cache http://squid.nlanr.net/Squid/
ERR_FLAG_CBDATA
};
-enum {
- HELPER_ALIVE,
- HELPER_BUSY,
- HELPER_CLOSING,
- HELPER_SHUTDOWN
-};
-
-enum {
- NEIGHBOR_PROXY_ONLY,
- NEIGHBOR_NO_QUERY,
- NEIGHBOR_NO_DIGEST,
- NEIGHBOR_DEFAULT_PARENT,
- NEIGHBOR_ROUNDROBIN,
- NEIGHBOR_MCAST_RESPONDER,
- NEIGHBOR_CLOSEST_ONLY,
-#if USE_HTCP
- NEIGHBOR_HTCP,
-#endif
- NEIGHBOR_NO_NETDB_EXCHANGE,
-#if DELAY_POOLS
- NEIGHBOR_NO_DELAY,
-#endif
- NEIGHBOR_END
-};
-
typedef enum {
ACCESS_DENIED,
ACCESS_ALLOWED,
/*
- * $Id: fqdncache.cc,v 1.114 1998/09/04 23:04:44 wessels Exp $
+ * $Id: fqdncache.cc,v 1.115 1998/09/14 21:58:48 wessels Exp $
*
* DEBUG: section 35 FQDN Cache
* AUTHOR: Harvest Derived
dnsData, 0);
return;
}
- debug(35, EBIT_TEST(dnsData->flags, HELPER_CLOSING) ? 5 : 1)
+ debug(35, dnsData->flags.closing ? 5 : 1)
("FD %d: Connection from DNSSERVER #%d is closed, disabling\n",
fd, dnsData->id);
- dnsData->flags = 0;
+ dnsData->flags.alive = 0;
+ dnsData->flags.busy = 0;
+ dnsData->flags.closing = 0;
+ dnsData->flags.shutdown = 0;
commSetSelect(fd,
COMM_SELECT_WRITE,
NULL,
}
if (dnsData->offset == 0) {
dnsData->data = NULL;
- EBIT_CLR(dnsData->flags, HELPER_BUSY);
- if (EBIT_TEST(dnsData->flags, HELPER_SHUTDOWN))
+ dnsData->flags.busy = 0;
+ if (dnsData->flags.shutdown)
dnsShutdownServer(dnsData);
cbdataUnlock(dnsData);
}
fqdncache_dnsDispatch(dnsserver_t * dns, fqdncache_entry * f)
{
char *buf = NULL;
- assert(EBIT_TEST(dns->flags, HELPER_ALIVE));
+ assert(dns->flags.alive);
if (!fqdncacheHasPending(f)) {
debug(35, 0) ("fqdncache_dnsDispatch: skipping '%s' because no handler.\n",
f->name);
debug_trap("fqdncache_dnsDispatch: status != FQDN_PENDING");
buf = xcalloc(1, 256);
snprintf(buf, 256, "%s\n", f->name);
- EBIT_SET(dns->flags, HELPER_BUSY);
+ dns->flags.busy = 1;
dns->data = f;
f->status = FQDN_DISPATCHED;
comm_write(dns->outpipe,
/*
- * $Id: http.cc,v 1.317 1998/09/14 21:28:05 wessels Exp $
+ * $Id: http.cc,v 1.318 1998/09/14 21:58:49 wessels Exp $
*
* DEBUG: section 11 Hypertext Transfer Protocol (HTTP)
* AUTHOR: Harvest Derived
* We might end up getting the object from somewhere else if,
* for example, the request to this neighbor fails.
*/
- if (EBIT_TEST(httpState->peer->options, NEIGHBOR_PROXY_ONLY))
+ if (httpState->peer->options.proxy_only)
storeReleaseRequest(httpState->entry);
#if DELAY_POOLS
- if (EBIT_TEST(httpState->peer->options, NEIGHBOR_NO_DELAY)) {
+ if (httpState->peer->options.no_delay) {
proxy_req->delay_id = 0;
} else {
proxy_req->delay_id = orig_req->delay_id;
/*
- * $Id: ipcache.cc,v 1.200 1998/09/04 23:04:54 wessels Exp $
+ * $Id: ipcache.cc,v 1.201 1998/09/14 21:58:50 wessels Exp $
*
* DEBUG: section 14 IP Cache
* AUTHOR: Harvest Derived
0);
return;
}
- debug(14, EBIT_TEST(dnsData->flags, HELPER_CLOSING) ? 5 : 1)
+ debug(14, dnsData->flags.closing ? 5 : 1)
("FD %d: Connection from DNSSERVER #%d is closed, disabling\n",
fd, dnsData->id);
- dnsData->flags = 0;
+ dnsData->flags.alive = 0;
+ dnsData->flags.busy = 0;
+ dnsData->flags.closing = 0;
+ dnsData->flags.shutdown = 0;
commSetSelect(fd, COMM_SELECT_WRITE, NULL, NULL, 0);
comm_close(fd);
return;
}
if (dnsData->offset == 0) {
dnsData->data = NULL;
- EBIT_CLR(dnsData->flags, HELPER_BUSY);
- if (EBIT_TEST(dnsData->flags, HELPER_SHUTDOWN))
+ dnsData->flags.busy = 0;
+ if (dnsData->flags.shutdown)
dnsShutdownServer(dnsData);
cbdataUnlock(dnsData);
}
ipcache_dnsDispatch(dnsserver_t * dns, ipcache_entry * i)
{
char *buf = NULL;
- assert(EBIT_TEST(dns->flags, HELPER_ALIVE));
+ assert(dns->flags.alive);
if (!ipcacheHasPending(i)) {
debug(14, 3) ("Skipping lookup of '%s' because client(s) disappeared.\n",
i->name);
assert(i->status == IP_PENDING);
buf = xcalloc(1, 256);
snprintf(buf, 256, "%s\n", i->name);
- EBIT_SET(dns->flags, HELPER_BUSY);
+ dns->flags.busy = 1;
dns->data = i;
i->status = IP_DISPATCHED;
cbdataLock(dns);
/*
- * $Id: neighbors.cc,v 1.246 1998/09/14 21:28:06 wessels Exp $
+ * $Id: neighbors.cc,v 1.247 1998/09/14 21:58:51 wessels Exp $
*
* DEBUG: section 15 Neighbor Routines
* AUTHOR: Harvest Derived
{
if (!peerAllowedToUse(p, request))
return 0;
- if (EBIT_TEST(p->options, NEIGHBOR_NO_QUERY))
+ if (p->options.no_query)
return 0;
- if (EBIT_TEST(p->options, NEIGHBOR_MCAST_RESPONDER))
+ if (p->options.mcast_responder)
return 0;
/* the case below seems strange, but can happen if the
* URL host is on the other side of a firewall */
return NULL; /* oops, found second parent */
p = q;
}
- if (p != NULL && !EBIT_TEST(p->options, NEIGHBOR_NO_QUERY))
+ if (p != NULL && !p->options.no_query)
return NULL;
debug(15, 3) ("getSingleParent: returning %s\n", p ? p->host : "NULL");
return p;
peer *p;
peer *q = NULL;
for (p = Config.peers; p; p = p->next) {
- if (!EBIT_TEST(p->options, NEIGHBOR_ROUNDROBIN))
+ if (!p->options.roundrobin)
continue;
if (neighborType(p, request) != PEER_PARENT)
continue;
for (p = Config.peers; p; p = p->next) {
if (neighborType(p, request) != PEER_PARENT)
continue;
- if (!EBIT_TEST(p->options, NEIGHBOR_DEFAULT_PARENT))
+ if (!p->options.default_parent)
continue;
if (!peerHTTPOkay(p, request))
continue;
debug(15, 3) ("neighborsUdpPing: reqnum = %d\n", reqnum);
#if USE_HTCP
- if (EBIT_TEST(p->options, NEIGHBOR_HTCP)) {
+ if (p->options.htcp) {
debug(15, 3) ("neighborsUdpPing: sending HTCP query\n");
htcpQuery(entry, request, p);
} else
{
if (p == NULL)
return 0;
- if (!EBIT_TEST(p->options, NEIGHBOR_MCAST_RESPONDER))
+ if (!p->options.mcast_responder)
return 0;
if (peerHTTPOkay(p, mem->request))
return 0;
if (p->type == PEER_MULTICAST)
peerCountMcastPeersSchedule(p, 10);
if (p->type != PEER_MULTICAST)
- if (!EBIT_TEST(p->options, NEIGHBOR_NO_NETDB_EXCHANGE))
+ if (!p->options.no_netdb_exchange)
eventAddIsh("netdbExchangeStart", netdbExchangeStart, p, 30.0, 1);
}
void
dump_peer_options(StoreEntry * sentry, peer * p)
{
- if (EBIT_TEST(p->options, NEIGHBOR_PROXY_ONLY))
+ if (p->options.proxy_only)
storeAppendPrintf(sentry, " proxy-only");
- if (EBIT_TEST(p->options, NEIGHBOR_NO_QUERY))
+ if (p->options.no_query)
storeAppendPrintf(sentry, " no-query");
- if (EBIT_TEST(p->options, NEIGHBOR_NO_DIGEST))
+ if (p->options.no_digest)
storeAppendPrintf(sentry, " no-digest");
- if (EBIT_TEST(p->options, NEIGHBOR_DEFAULT_PARENT))
+ if (p->options.default_parent)
storeAppendPrintf(sentry, " default");
- if (EBIT_TEST(p->options, NEIGHBOR_ROUNDROBIN))
+ if (p->options.roundrobin)
storeAppendPrintf(sentry, " round-robin");
- if (EBIT_TEST(p->options, NEIGHBOR_MCAST_RESPONDER))
+ if (p->options.mcast_responder)
storeAppendPrintf(sentry, " multicast-responder");
- if (EBIT_TEST(p->options, NEIGHBOR_CLOSEST_ONLY))
+ if (p->options.closest_only)
storeAppendPrintf(sentry, " closest-only");
#if USE_HTCP
- if (EBIT_TEST(p->options, NEIGHBOR_HTCP))
+ if (p->options.htcp)
storeAppendPrintf(sentry, " htcp");
#endif
- if (EBIT_TEST(p->options, NEIGHBOR_NO_NETDB_EXCHANGE))
+ if (p->options.no_netdb_exchange)
storeAppendPrintf(sentry, " no-netdb-exchange");
#if DELAY_POOLS
- if (EBIT_TEST(p->options, NEIGHBOR_NO_DELAY))
+ if (p->options.no_delay)
storeAppendPrintf(sentry, " no-delay");
#endif
if (p->mcast.ttl > 0)
percent(e->stats.ignored_replies, e->stats.pings_acked));
storeAppendPrintf(sentry, "Histogram of PINGS ACKED:\n");
#if USE_HTCP
- if (EBIT_TEST(e->options, NEIGHBOR_HTCP)) {
+ if (e->options.htcp) {
storeAppendPrintf(sentry, "\tMisses\t%8d %3d%%\n",
e->htcp.counts[0],
percent(e->htcp.counts[0], e->stats.pings_acked));
/*
- * $Id: peer_digest.cc,v 1.48 1998/09/14 21:28:07 wessels Exp $
+ * $Id: peer_digest.cc,v 1.49 1998/09/14 21:58:52 wessels Exp $
*
* DEBUG: section 72 Peer Digest Routines
* AUTHOR: Alex Rousskov
assert(p->digest.flags == (1 << PD_INIT_PENDING));
assert(!p->digest.cd);
assert(SM_PAGE_SIZE == 4096); /* we use MEM_4K_BUF */
- if (EBIT_TEST(p->options, NEIGHBOR_NO_DIGEST)) {
+ if (p->options.no_digest) {
peerDigestDisable(p);
} else {
cbdataLock(p);
/*
- * $Id: peer_select.cc,v 1.80 1998/09/14 21:28:08 wessels Exp $
+ * $Id: peer_select.cc,v 1.81 1998/09/14 21:58:52 wessels Exp $
*
* DEBUG: section 44 Peer Selection Algorithm
* AUTHOR: Duane Wessels
}
}
/* if closest-only is set, then don't allow FIRST_PARENT_MISS */
- if (EBIT_TEST(p->options, NEIGHBOR_CLOSEST_ONLY))
+ if (p->options.closest_only)
return;
/* set FIRST_MISS if there is no CLOSEST parent */
if (ps->closest_parent_miss.sin_addr.s_addr != any_addr.s_addr)
}
}
/* if closest-only is set, then don't allow FIRST_PARENT_MISS */
- if (EBIT_TEST(p->options, NEIGHBOR_CLOSEST_ONLY))
+ if (p->options.closest_only)
return;
/* set FIRST_MISS if there is no CLOSEST parent */
if (ps->closest_parent_miss.sin_addr.s_addr != any_addr.s_addr)
/*
- * $Id: redirect.cc,v 1.65 1998/09/04 23:04:58 wessels Exp $
+ * $Id: redirect.cc,v 1.66 1998/09/14 21:58:53 wessels Exp $
*
* DEBUG: section 29 Redirector
* AUTHOR: Duane Wessels
typedef struct _redirector {
int index;
- int flags;
+ helper_flags flags;
int fd;
char *inbuf;
unsigned int size;
if (len <= 0) {
if (len < 0)
debug(50, 1) ("redirectHandleRead: FD %d read: %s\n", fd, xstrerror());
- debug(29, EBIT_TEST(redirector->flags, HELPER_CLOSING) ? 5 : 1)
+ debug(29, redirector->flags.closing ? 5 : 1)
("FD %d: Connection from Redirector #%d is closed, disabling\n",
fd, redirector->index + 1);
- redirector->flags = 0;
+ redirector->flags.alive = 0;
+ redirector->flags.busy = 0;
+ redirector->flags.closing = 0;
+ redirector->flags.shutdown = 0;
memFree(MEM_8K_BUF, redirector->inbuf);
redirector->inbuf = NULL;
comm_close(fd);
}
redirectStateFree(r);
redirector->redirectState = NULL;
- EBIT_CLR(redirector->flags, HELPER_BUSY);
+ redirector->flags.busy = 0;
redirector->offset = 0;
n = ++RedirectStats.replies;
RedirectStats.avg_svc_time =
redirector_t *redirect = NULL;
for (k = 0; k < NRedirectors; k++) {
redirect = *(redirect_child_table + k);
- if (EBIT_TEST(redirect->flags, HELPER_BUSY))
+ if (redirect->flags.busy)
continue;
- if (!EBIT_TEST(redirect->flags, HELPER_ALIVE))
+ if (!redirect->flags.alive)
continue;
return redirect;
}
redirectStateFree(r);
return;
}
- EBIT_SET(redirect->flags, HELPER_BUSY);
+ redirect->flags.busy = 1;
redirect->redirectState = r;
redirect->dispatch_time = current_time;
if ((fqdn = fqdncache_gethostbyaddr(r->client_addr, 0)) == NULL)
&redirectsocket);
if (x < 0) {
debug(29, 1) ("WARNING: Cannot run '%s' process.\n", prg);
- EBIT_CLR(redirect_child_table[k]->flags, HELPER_ALIVE);
+ redirect_child_table[k]->flags.alive = 0;
} else {
- EBIT_SET(redirect_child_table[k]->flags, HELPER_ALIVE);
+ redirect_child_table[k]->flags.alive = 1;
redirect_child_table[k]->index = k;
redirect_child_table[k]->fd = redirectsocket;
redirect_child_table[k]->inbuf = memAllocate(MEM_8K_BUF);
}
for (k = 0; k < NRedirectors; k++) {
redirect = *(redirect_child_table + k);
- if (!EBIT_TEST(redirect->flags, HELPER_ALIVE))
+ if (!redirect->flags.alive)
continue;
- if (EBIT_TEST(redirect->flags, HELPER_CLOSING))
+ if (redirect->flags.closing)
continue;
- if (EBIT_TEST(redirect->flags, HELPER_BUSY)) {
+ if (redirect->flags.busy) {
na++;
continue;
}
debug(29, 3) ("redirectShutdownServers: closing redirector #%d, FD %d\n",
redirect->index + 1, redirect->fd);
comm_close(redirect->fd);
- EBIT_SET(redirect->flags, HELPER_CLOSING);
- EBIT_SET(redirect->flags, HELPER_BUSY);
+ redirect->flags.closing = 1;
+ redirect->flags.busy = 1;
}
if (na)
eventAdd("redirectShutdownServers", redirectShutdownServers, NULL, 1.0, 1);
/*
- * $Id: structs.h,v 1.221 1998/09/14 21:28:17 wessels Exp $
+ * $Id: structs.h,v 1.222 1998/09/14 21:58:54 wessels Exp $
*
*
* SQUID Internet Object Cache http://squid.nlanr.net/Squid/
void *client_data;
};
+struct _helper_flags {
+ int alive:1;
+ int busy:1;
+ int closing:1;
+ int shutdown:1;
+};
+
struct _dnsserver_t {
int id;
- int flags;
+ helper_flags flags;
int inpipe;
int outpipe;
time_t answer;
domain_ping *pinglist;
domain_type *typelist;
acl_access *access;
- int options;
+ struct {
+ int proxy_only:1;
+ int no_query:1;
+ int no_digest:1;
+ int default_parent:1;
+ int roundrobin:1;
+ int mcast_responder:1;
+ int closest_only:1;
+#if USE_HTCP
+ int htcp:1;
+#endif
+ int no_netdb_exchange:1;
+#if DELAY_POOLS
+ int no_delay:1;
+#endif
+ } options;
int weight;
struct {
double avg_n_members;
/*
- * $Id: typedefs.h,v 1.74 1998/09/14 21:28:18 wessels Exp $
+ * $Id: typedefs.h,v 1.75 1998/09/14 21:58:55 wessels Exp $
*
*
* SQUID Internet Object Cache http://squid.nlanr.net/Squid/
typedef struct _SwapDir SwapDir;
typedef struct _request_flags request_flags;
typedef struct _store_flags store_flags;
+typedef struct _helper_flags helper_flags;
typedef struct _request_t request_t;
typedef struct _AccessLogEntry AccessLogEntry;
typedef struct _cachemgr_passwd cachemgr_passwd;