]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
- Fixed ENTRY_DISPATCHED bug. ENTRY_DISPATCHED was not always getting
authorwessels <>
Sat, 31 Aug 1996 04:44:09 +0000 (04:44 +0000)
committerwessels <>
Sat, 31 Aug 1996 04:44:09 +0000 (04:44 +0000)
          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.

src/neighbors.cc
src/redirect.cc
src/stat.cc
src/store.cc
src/tools.cc

index e45d91712d9b3cf1dea0fcf516197cd4bb5db3f7..1d46a891815ad0da0654ce293f3c8880f80b7b18 100644 (file)
@@ -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;
index f700cb6fc8b0e4fbb9ec6b2ea59d2abc4db6e3c4..2f8639b4182c1f2ecf3e9fe6aaadaa6c856c2b2e 100644 (file)
@@ -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!");
index 9a5a73976e884c2860dbbfbb17141a7092dc9f64..6080786d6b7078154d5098704cd77962c013e02a 100644 (file)
@@ -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);
+}
index 0ea586581c2c4fc77250f6384e66a8fd4add2ea3..76ae3cbeef852960cf527e876b2a8ad3a9a3cd57 100644 (file)
@@ -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);
+}
index 6e9b4a0530591e8d9e2f601d6359f3179ff08ae4..accb2edde424a03cf5560b3cc9226e25ef27b932 100644 (file)
@@ -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);
 }