From: wessels <> Date: Sat, 31 Aug 1996 04:44:09 +0000 (+0000) Subject: - Fixed ENTRY_DISPATCHED bug. ENTRY_DISPATCHED was not always getting X-Git-Tag: SQUID_3_0_PRE1~5870 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=457bedbdd246399c95a68855928b3a559723c701;p=thirdparty%2Fsquid.git - Fixed ENTRY_DISPATCHED bug. ENTRY_DISPATCHED was not always getting set (e.g. for requests matching hierarchy_stoplist). This caused multiple calls to storeAbort() for the same entry. - misc filedescriptor management cleanup - renamed getFromCache() to protoStart(). - Added delays when forking dnsservers, redirectors, and ftpget. --- diff --git a/src/neighbors.cc b/src/neighbors.cc index e45d91712d..1d46a89181 100644 --- a/src/neighbors.cc +++ b/src/neighbors.cc @@ -1,5 +1,5 @@ /* - * $Id: neighbors.cc,v 1.45 1996/08/29 16:55:00 wessels Exp $ + * $Id: neighbors.cc,v 1.46 1996/08/30 22:44:09 wessels Exp $ * * DEBUG: section 15 Neighbor Routines * AUTHOR: Harvest Derived @@ -480,8 +480,8 @@ int neighborsUdpPing(proto) e->stats.ack_deficit++; e->stats.pings_sent++; - debug(15,3,"neighborsUdpPing: %s: ack_deficit = %d\n", - e->host, e->stats.ack_deficit); + debug(15, 3, "neighborsUdpPing: %s: ack_deficit = %d\n", + e->host, e->stats.ack_deficit); if (e->stats.ack_deficit < HIER_MAX_DEFICIT) { /* its alive, expect a reply from it */ @@ -598,9 +598,8 @@ void neighborsUdpAck(fd, url, header, from, entry, data, data_sz) HIER_SOURCE_FASTEST, 0, fqdnFromAddr(from->sin_addr)); - BIT_SET(entry->flag, ENTRY_DISPATCHED); entry->ping_status = PING_DONE; - getFromCache(0, entry, NULL, entry->mem_obj->request); + protoStart(0, entry, NULL, entry->mem_obj->request); return; } } else if (header->opcode == ICP_OP_HIT_OBJ) { @@ -635,9 +634,8 @@ void neighborsUdpAck(fd, url, header, from, entry, data, data_sz) e->type == EDGE_SIBLING ? HIER_SIBLING_HIT : HIER_PARENT_HIT, 0, e->host); - BIT_SET(entry->flag, ENTRY_DISPATCHED); entry->ping_status = PING_DONE; - getFromCache(0, entry, e, entry->mem_obj->request); + protoStart(0, entry, e, entry->mem_obj->request); return; } } else if (header->opcode == ICP_OP_DECHO) { @@ -683,10 +681,9 @@ void neighborsUdpAck(fd, url, header, from, entry, data, data_sz) IcpOpcodeStr[header->opcode]); } if (mem->e_pings_n_acks == mem->e_pings_n_pings) { - BIT_SET(entry->flag, ENTRY_DISPATCHED); entry->ping_status = PING_DONE; debug(15, 6, "neighborsUdpAck: All replies received.\n"); - /* pass in fd=0 here so getFromCache() looks up the real FD + /* pass in fd=0 here so protoStart() looks up the real FD * and resets the timeout handler */ getFromDefaultSource(0, entry); return; diff --git a/src/redirect.cc b/src/redirect.cc index f700cb6fc8..2f8639b418 100644 --- a/src/redirect.cc +++ b/src/redirect.cc @@ -1,5 +1,5 @@ /* - * $Id: redirect.cc,v 1.12 1996/08/26 22:47:55 wessels Exp $ + * $Id: redirect.cc,v 1.13 1996/08/30 22:44:11 wessels Exp $ * * DEBUG: section 29 Redirector * AUTHOR: Duane Wessels @@ -95,6 +95,7 @@ static int redirectCreateRedirector(command) int sfd; int len; int fd; + struct timeval slp; cfd = comm_open(COMM_NOCLOEXEC, local_addr, 0, @@ -130,6 +131,9 @@ static int redirectCreateRedirector(command) comm_set_fd_lifetime(sfd, -1); debug(29, 4, "redirect_create_redirector: FD %d connected to %s #%d.\n", sfd, command, n_redirector++); + slp.tv_sec = 0; + slp.tv_usec = 250000; + select(0, NULL, NULL, NULL, &slp); return sfd; } /* child */ @@ -141,8 +145,10 @@ static int redirectCreateRedirector(command) } dup2(fd, 0); dup2(fd, 1); - for (fd = 3; fd < FD_SETSIZE; fd++) - close(fd); + dup2(fileno(debug_log), 2); + fclose(debug_log); + close(fd); + close(cfd); execlp(command, "(redirector)", NULL); debug(29, 0, "redirect_create_redirector: %s: %s\n", command, xstrerror()); _exit(1); @@ -171,6 +177,7 @@ static int redirectHandleRead(fd, redirector) "FD %d: Connection from Redirector #%d is closed, disabling\n", fd, redirector->index + 1); redirector->flags = 0; + put_free_4k_page(redirector->inbuf); comm_close(fd); if (--NRedirectorsOpen == 0 && !shutdown_pending && !reread_pending) fatal_dump("All redirectors have exited!"); diff --git a/src/stat.cc b/src/stat.cc index 9a5a73976e..6080786d6b 100644 --- a/src/stat.cc +++ b/src/stat.cc @@ -1,5 +1,5 @@ /* - * $Id: stat.cc,v 1.56 1996/08/29 16:54:16 wessels Exp $ + * $Id: stat.cc,v 1.57 1996/08/30 22:44:12 wessels Exp $ * * DEBUG: section 18 Cache Manager Statistics * AUTHOR: Harvest Derived @@ -1281,3 +1281,8 @@ void stat_rotate_log() } CacheInfo->logfile_access = file_write_lock(CacheInfo->logfile_fd); } + +void statCloseLog() +{ + file_close(CacheInfo->logfile_fd); +} diff --git a/src/store.cc b/src/store.cc index 0ea586581c..76ae3cbeef 100644 --- a/src/store.cc +++ b/src/store.cc @@ -1,5 +1,5 @@ /* - * $Id: store.cc,v 1.91 1996/08/29 16:54:03 wessels Exp $ + * $Id: store.cc,v 1.92 1996/08/30 22:44:13 wessels Exp $ * * DEBUG: section 20 Storeage Manager * AUTHOR: Harvest Derived @@ -2915,3 +2915,9 @@ static char *storeDescribeStatus(e) e->url); return buf; } + +void storeCloseLog() +{ + file_close(swaplog_fd); + file_close(storelog_fd); +} diff --git a/src/tools.cc b/src/tools.cc index 6e9b4a0530..accb2edde4 100644 --- a/src/tools.cc +++ b/src/tools.cc @@ -1,6 +1,6 @@ /* - * $Id: tools.cc,v 1.49 1996/08/26 19:14:54 wessels Exp $ + * $Id: tools.cc,v 1.50 1996/08/30 22:44:15 wessels Exp $ * * DEBUG: section 21 Misc Functions * AUTHOR: Harvest Derived @@ -292,6 +292,9 @@ void normal_shutdown() PrintRusage(NULL, debug_log); debug(21, 0, "Squid Cache (Version %s): Exiting normally.\n", version_string); + storeCloseLog(); + statCloseLog(); + fclose(debug_log); exit(0); }