/*
- * $Id: cache_cf.cc,v 1.240 1998/01/02 19:55:28 wessels Exp $
+ * $Id: cache_cf.cc,v 1.241 1998/01/05 00:45:43 wessels Exp $
*
* DEBUG: section 3 Configuration File Parsing
* AUTHOR: Harvest Derived
p->http_port = CACHE_HTTP_PORT;
p->icp_port = CACHE_ICP_PORT;
p->weight = 1;
+ p->stats.logged_state = PEER_ALIVE;
if ((token = strtok(NULL, w_space)) == NULL)
self_destruct();
p->host = xstrdup(token);
neighbor_timeout 2 seconds
DOC_END
+NAME: dead_peer_timeout
+COMMENT: (seconds)
+DEFAULT: 10 seconds
+TYPE: time_t
+LOC: Config.Timeout.deadPeer
+DOC_START
+ This controls how long Squid waits to declare a peer cache
+ as "dead." If there are no ICP replies received in this
+ amount of time, Squid will declare the peer dead and not
+ expect to receive any further ICP replies. However, it
+ continues to send ICP queries, and will mark the peer as
+ alive upon receipt of the first subsequent ICP reply.
+
+dead_peer_timeout 10 seconds
+DOC_END
+
NAME: hierarchy_stoplist
TYPE: wordlist
/*
- * $Id: comm.cc,v 1.218 1998/01/02 16:30:14 wessels Exp $
+ * $Id: comm.cc,v 1.219 1998/01/05 00:45:45 wessels Exp $
*
* DEBUG: section 5 Socket Functions
* AUTHOR: Harvest Derived
}
if (!nfds)
return;
+#if !ALARM_UPDATES_TIME
+ getCurrentTime();
+#endif
polledinc = poll(pfds, nfds, 0);
if (polledinc < 1) {
polledinc = 0;
}
if (maxfd++ == 0)
return;
+#if !ALARM_UPDATES_TIME
+ getCurrentTime();
+#endif
polledinc = select(maxfd, &read_mask, &write_mask, NULL, &zero_tv);
if (polledinc < 1) {
polledinc = 0;
#define PEER_COUNTING 2
#define ICP_AUTH_SIZE (2) /* size of authenticator field */
+#define PEER_DEAD 0
+#define PEER_ALIVE 1
+
#define ICON_MENU "anthony-dir.gif"
#define ICON_DIRUP "anthony-dirup.gif"
#define ICON_LINK "anthony-link.gif"
/*
- * $Id: main.cc,v 1.200 1998/01/02 06:56:52 wessels Exp $
+ * $Id: main.cc,v 1.201 1998/01/05 00:45:46 wessels Exp $
*
* DEBUG: section 1 Startup and Main Loop
* AUTHOR: Harvest Derived
void
serverConnectionsClose(void)
{
- /* NOTE, this function will be called repeatedly while shutdown
- * is pending */
+ /*
+ * NOTE, this function will be called repeatedly while shutdown
+ * is pending
+ */
int i;
for (i = 0; i < NHttpSockets; i++) {
if (HttpSockets[i] >= 0) {
}
NHttpSockets = 0;
if (theInIcpConnection > -1) {
- /* NOTE, don't close outgoing ICP connection, we need to write to
- * it during shutdown */
+ /*
+ * NOTE, don't close outgoing ICP connection, we need to write
+ * to it during shutdown.
+ */
debug(1, 1) ("FD %d Closing ICP connection\n",
theInIcpConnection);
- if (theInIcpConnection != theOutIcpConnection)
+ if (theInIcpConnection != theOutIcpConnection) {
comm_close(theInIcpConnection);
- else
+ assert(theOutIcpConnection > -1);
+ /*
+ * Normally we only write to the outgoing ICP socket, but
+ * we also have a read handler there to catch messages sent
+ * to that specific interface. During shutdown, we must
+ * disable reading on the outgoing socket.
+ */
+ commSetSelect(theOutIcpConnection,
+ COMM_SELECT_READ,
+ NULL,
+ NULL,
+ 0);
+ } else {
commSetSelect(theInIcpConnection,
COMM_SELECT_READ,
NULL,
NULL,
0);
+ }
theInIcpConnection = -1;
}
- /*
- * Normally we only write to the outgoing ICP socket, but we
- * also have a read handler there to catch messages sent to that
- * specific interface. During shutdown, we must disable reading
- * on the outgoing socket.
- */
- if (theOutIcpConnection > -1)
- commSetSelect(theOutIcpConnection, COMM_SELECT_READ, NULL, NULL, 0);
if (icmp_sock > -1)
icmpClose();
#ifdef SQUID_SNMP
/*
- * $Id: neighbors.cc,v 1.170 1998/01/02 21:59:47 wessels Exp $
+ * $Id: neighbors.cc,v 1.171 1998/01/05 00:45:47 wessels Exp $
*
* DEBUG: section 15 Neighbor Routines
* AUTHOR: Harvest Derived
}
queries_sent++;
- p->stats.ack_deficit++;
p->stats.pings_sent++;
- debug(15, 3) ("neighborsUdpPing: %s: ack_deficit = %d\n",
- p->host, p->stats.ack_deficit);
if (p->type == PEER_MULTICAST) {
- p->stats.ack_deficit = 0;
+ /*
+ * set a bogus last_reply time so neighborUp() never
+ * says a multicast peer is dead.
+ */
+ p->stats.last_reply = squid_curtime;
(*exprep) += p->mcast.n_replies_expected;
} else if (neighborUp(p)) {
/* its alive, expect a reply from it */
} else {
/* Neighbor is dead; ping it anyway, but don't expect a reply */
/* log it once at the threshold */
- if ((p->stats.ack_deficit == HIER_MAX_DEFICIT)) {
+ if (p->stats.logged_state == PEER_ALIVE) {
debug(15, 0) ("Detected DEAD %s: %s/%d/%d\n",
neighborTypeStr(p),
p->host, p->http_port, p->icp_port);
+ p->stats.logged_state = PEER_DEAD;
}
}
+ p->stats.last_query = squid_curtime;
}
if ((first_ping = first_ping->next) == NULL)
first_ping = Config.peers;
{
int rtt;
int n;
- /* Neighbor is alive, reset the ack deficit */
- if (p->stats.ack_deficit >= HIER_MAX_DEFICIT) {
+ if (p->stats.logged_state == PEER_DEAD) {
debug(15, 0) ("Detected REVIVED %s: %s/%d/%d\n",
neighborTypeStr(p),
p->host, p->http_port, p->icp_port);
+ p->stats.logged_state = PEER_ALIVE;
}
- p->stats.ack_deficit = 0;
+ p->stats.last_reply = squid_curtime;
n = ++p->stats.pings_acked;
if ((icp_opcode) header->opcode <= ICP_END)
p->stats.counts[header->opcode]++;
{
if (!p->tcp_up)
return 0;
- if (p->stats.ack_deficit >= HIER_MAX_DEFICIT)
+ if (squid_curtime - p->stats.last_query > Config.Timeout.deadPeer)
+ return 1;
+ if (p->stats.last_query - p->stats.last_reply >= Config.Timeout.deadPeer)
return 0;
return 1;
}
/*
- * $Id: stat.cc,v 1.179 1997/12/03 01:31:40 wessels Exp $
+ * $Id: stat.cc,v 1.180 1998/01/05 00:45:48 wessels Exp $
*
* DEBUG: section 18 Cache Manager Statistics
* AUTHOR: Harvest Derived
storeAppendPrintf(sentry, "{Status : %s}\n",
neighborUp(e) ? "Up" : "Down");
storeAppendPrintf(sentry, "{AVG RTT : %d msec}\n", e->stats.rtt);
- storeAppendPrintf(sentry, "{ACK DEFICIT: %8d}\n", e->stats.ack_deficit);
+ storeAppendPrintf(sentry, "{LAST QUERY : %8d seconds ago}\n",
+ (int) (squid_curtime - e->stats.last_query));
+ storeAppendPrintf(sentry, "{LAST REPLY : %8d seconds ago}\n",
+ (int) (squid_curtime - e->stats.last_reply));
storeAppendPrintf(sentry, "{PINGS SENT : %8d}\n", e->stats.pings_sent);
storeAppendPrintf(sentry, "{PINGS ACKED: %8d %3d%%}\n",
e->stats.pings_acked,
time_t request;
time_t pconn;
time_t siteSelect;
+ time_t deadPeer;
} Timeout;
size_t maxRequestSize;
struct {
struct {
int pings_sent;
int pings_acked;
- int ack_deficit;
int fetches;
int rtt;
int counts[ICP_END];
int ignored_replies;
int n_keepalives_sent;
int n_keepalives_recv;
+ time_t last_query;
+ time_t last_reply;
+ int logged_state; /* so we can print dead/revived msgs */
} stats;
u_short icp_port;
u_short http_port;