]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
- removed storeAbort callback-server side argument
authorwessels <>
Wed, 13 Jan 1999 06:37:41 +0000 (06:37 +0000)
committerwessels <>
Wed, 13 Jan 1999 06:37:41 +0000 (06:37 +0000)
- removed _fde->mode, I guess it was a bad idea anyway
- removed recently added ENTRY_ABORTED checks in server modules
- replaced fwdAbort()
- fixed a mem_obj->request == NULL bug when fwdStart() returns
    503 service unavailable.

src/fd.cc
src/forward.cc
src/ftp.cc
src/gopher.cc
src/http.cc
src/protos.h
src/store.cc
src/store_client.cc
src/store_swapout.cc
src/structs.h
src/wais.cc

index be6c81c2d81e61cd817b95b8667259afb76c5c7b..f4d7cb0fd65b60fac068cdf6c625ef4fca0b93c5 100644 (file)
--- a/src/fd.cc
+++ b/src/fd.cc
@@ -1,6 +1,6 @@
 
 /*
- * $Id: fd.cc,v 1.29 1999/01/12 16:42:18 wessels Exp $
+ * $Id: fd.cc,v 1.30 1999/01/12 23:37:41 wessels Exp $
  *
  * DEBUG: section 51    Filedescriptor Functions
  * AUTHOR: Duane Wessels
@@ -97,7 +97,7 @@ fd_open(int fd, unsigned int type, const char *desc)
 {
     fde *F = &fd_table[fd];
     assert(fd >= 0);
-    if (!F->flags.open) {
+    if (F->flags.open) {
        debug(51, 1) ("WARNING: Closing open FD %4d\n", fd);
        fd_close(fd);
     }
@@ -150,8 +150,10 @@ fdDumpOpen(void)
            continue;
        if (i == fileno(debug_log))
            continue;
-       debug(51, 1) ("Open FD %s %4d %s\n",
-           F->type == FD_READ ? "reading" : "writing",
+       debug(51, 1) ("Open FD %-10s %4d %s\n",
+           F->bytes_read && F->bytes_written ? "READ/WRITE" :
+           F->bytes_read ? "READING" :
+           F->bytes_written ? "WRITING" : null_string,
            i, F->desc);
     }
 }
index 1be1cab9444bc8b530c05a95db1df2d4d334b6e3..276db3aab3f24d25f2c1aebf8d58524959bb3fed 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: forward.cc,v 1.43 1999/01/11 23:29:42 wessels Exp $
+ * $Id: forward.cc,v 1.44 1999/01/12 23:37:42 wessels Exp $
  *
  * DEBUG: section 17    Request Forwarding
  * AUTHOR: Duane Wessels
@@ -48,6 +48,7 @@ static int fwdReforward(FwdState *);
 static void fwdStartFail(FwdState *);
 static void fwdLogReplyStatus(int tries, http_status status);
 static OBJH fwdStats;
+static STABH fwdAbort;
 
 #define MAX_FWD_STATS_IDX 9
 static int FwdReplyCodes[MAX_FWD_STATS_IDX + 1][HTTP_INVALID_HEADER + 1];
@@ -396,6 +397,9 @@ fwdStart(int fd, StoreEntry * e, request_t * r, struct in_addr client_addr)
            return;
        }
     }
+    debug(17, 3) ("fwdStart: '%s'\n", storeUrl(e));
+    e->mem_obj->request = requestLink(r);
+    e->mem_obj->fd = fd;
     if (shutting_down) {
        /* more yuck */
        err = errorCon(ERR_SHUTTING_DOWN, HTTP_SERVICE_UNAVAILABLE);
@@ -403,9 +407,6 @@ fwdStart(int fd, StoreEntry * e, request_t * r, struct in_addr client_addr)
        errorAppendEntry(e, err);
        return;
     }
-    debug(17, 3) ("fwdStart: '%s'\n", storeUrl(e));
-    e->mem_obj->request = requestLink(r);
-    e->mem_obj->fd = fd;
     switch (r->protocol) {
        /*
         * Note, don't create fwdState for these requests
@@ -430,6 +431,7 @@ fwdStart(int fd, StoreEntry * e, request_t * r, struct in_addr client_addr)
     fwdState->request = requestLink(r);
     fwdState->start = squid_curtime;
     storeLockObject(e);
+    storeRegisterAbort(e, fwdAbort, fwdState);
     peerSelect(r, e, fwdStartComplete, fwdState);
 }
 
@@ -462,6 +464,17 @@ fwdFail(FwdState * fwdState, int err_code, http_status http_code, int xerrno)
     fwdState->fail.xerrno = xerrno;
 }
 
+/*
+ * Called when someone else calls StoreAbort() on this entry
+ */
+void
+fwdAbort(void *data)
+{
+    FwdState *fwdState = data;
+    debug(17, 3) ("fwdAbort: %s\n", storeUrl(fwdState->entry));
+    fwdStateFree(fwdState);
+}
+
 /*
  * Frees fwdState without closing FD or generating an abort
  */
index db4a30f3fe97b5617fa1bde0e649e4712306dbd4..1f75a241d3c6af2572bcffa4f56ffd4e3586df1d 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: ftp.cc,v 1.262 1999/01/12 15:47:51 wessels Exp $
+ * $Id: ftp.cc,v 1.263 1999/01/12 23:37:43 wessels Exp $
  *
  * DEBUG: section 9     File Transfer Protocol (FTP)
  * AUTHOR: Harvest Derived
@@ -836,10 +836,6 @@ ftpDataRead(int fd, void *data)
     delay_id delay_id = delayMostBytesAllowed(mem);
 #endif
     assert(fd == ftpState->data.fd);
-    if (EBIT_TEST(entry->flags, ENTRY_ABORTED)) {
-        comm_close(fd);
-        return;
-    }
     errno = 0;
     read_sz = ftpState->data.size - ftpState->data.offset;
 #if DELAY_POOLS
index f26048716c8b31a7a6d83e5fdf0e4ccebb9a95c1..8c6b7053e8e2a5039e7d418a29c6b5a45c14bd83 100644 (file)
@@ -1,7 +1,7 @@
 
 
 /*
- * $Id: gopher.cc,v 1.143 1999/01/12 15:47:52 wessels Exp $
+ * $Id: gopher.cc,v 1.144 1999/01/12 23:37:45 wessels Exp $
  *
  * DEBUG: section 10    Gopher
  * AUTHOR: Harvest Derived
@@ -599,10 +599,6 @@ gopherReadReply(int fd, void *data)
 #if DELAY_POOLS
     delay_id delay_id = delayMostBytesAllowed(entry->mem_obj);
 #endif
-    if (EBIT_TEST(entry->flags, ENTRY_ABORTED)) {
-        comm_close(fd);
-        return;
-    }
     errno = 0;
     buf = memAllocate(MEM_4K_BUF);
     read_sz = 4096 - 1;                /* leave room for termination */
index 86361d5612048cc5885a0737145992c158ede339..8c093bf408d18174e4b15851812b45eaf9327a7f 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: http.cc,v 1.337 1999/01/12 15:47:53 wessels Exp $
+ * $Id: http.cc,v 1.338 1999/01/12 23:37:46 wessels Exp $
  *
  * DEBUG: section 11    Hypertext Transfer Protocol (HTTP)
  * AUTHOR: Harvest Derived
@@ -430,10 +430,6 @@ httpReadReply(int fd, void *data)
 #if DELAY_POOLS
     delay_id delay_id = delayMostBytesAllowed(entry->mem_obj);
 #endif
-    if (EBIT_TEST(entry->flags, ENTRY_ABORTED)) {
-       comm_close(fd);
-       return;
-    }
     /* check if we want to defer reading */
     errno = 0;
     read_sz = SQUID_TCP_SO_RCVBUF;
index df649b2f5f792fdd379ddf3e8a33ec17fbf79ea4..3ca6e01da09c08630b0bcf95fbf3927b084db05a 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: protos.h,v 1.301 1999/01/12 15:47:54 wessels Exp $
+ * $Id: protos.h,v 1.302 1999/01/12 23:37:47 wessels Exp $
  *
  *
  * SQUID Internet Object Cache  http://squid.nlanr.net/Squid/
@@ -761,7 +761,7 @@ extern void storeSetPublicKey(StoreEntry *);
 extern void storeComplete(StoreEntry *);
 extern void storeInit(void);
 extern int storeClientWaiting(const StoreEntry *);
-extern void storeAbort(StoreEntry *, int);
+extern void storeAbort(StoreEntry *);
 extern void storeAppend(StoreEntry *, const char *, int);
 extern void storeLockObject(StoreEntry *);
 extern void storeSwapInStart(StoreEntry *, SIH *, void *data);
index f07536abd78f3d6a68762501cd8b137304fab95f..0e51b3b09d073bff134a303d65be08ab2b1e1965 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: store.cc,v 1.480 1999/01/12 16:23:22 wessels Exp $
+ * $Id: store.cc,v 1.481 1999/01/12 23:37:49 wessels Exp $
  *
  * DEBUG: section 20    Storage Manager
  * AUTHOR: Harvest Derived
@@ -591,7 +591,7 @@ storeComplete(StoreEntry * e)
  * entry for releasing 
  */
 void
-storeAbort(StoreEntry * e, int cbflag)
+storeAbort(StoreEntry * e)
 {
     MemObject *mem = e->mem_obj;
     STABH *callback;
@@ -613,7 +613,7 @@ storeAbort(StoreEntry * e, int cbflag)
      */
     mem->object_sz = mem->inmem_hi;
     /* Notify the server side */
-    if (cbflag && mem->abort.callback) {
+    if (mem->abort.callback) {
        callback = mem->abort.callback;
        data = mem->abort.data;
        mem->abort.callback = NULL;
index 1133bf84cfae76e0195102cce6178f6b810ed5c8..5495beef0fe051ba331c67e939e3c50b4efd51aa 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: store_client.cc,v 1.52 1999/01/11 16:50:42 wessels Exp $
+ * $Id: store_client.cc,v 1.53 1999/01/12 23:37:50 wessels Exp $
  *
  * DEBUG: section 20    Storage Manager Client-Side Interface
  * AUTHOR: Duane Wessels
@@ -580,5 +580,5 @@ CheckQuickAbort(StoreEntry * entry)
     if (CheckQuickAbort2(entry) == 0)
        return;
     Counter.aborted_requests++;
-    storeAbort(entry, 1);
+    storeAbort(entry);
 }
index 91219356d2b4466cd4d6371b472e2581d44812de..60e3a912df6a3febdd178deef4ef742cb9129c00 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: store_swapout.cc,v 1.41 1999/01/11 16:50:43 wessels Exp $
+ * $Id: store_swapout.cc,v 1.42 1999/01/12 23:37:51 wessels Exp $
  *
  * DEBUG: section 20    Storage Manager Swapout Functions
  * AUTHOR: Duane Wessels
@@ -156,7 +156,7 @@ storeCheckSwapOut(StoreEntry * e)
        (int) mem->swapout.done_offset);
 #if USE_ASYNC_IO
     if (mem->inmem_hi < mem->swapout.queue_offset) {
-       storeAbort(e, 0);
+       storeAbort(e);
        assert(EBIT_TEST(e->flags, RELEASE_REQUEST));
        storeSwapOutFileClose(e);
        return;
index ab077c35b15d3a1870593b6e5d82b2fdade16d24..2fb1a5ebd189d908a9fca549faf95f0c5ae805d8 100644 (file)
@@ -1,7 +1,7 @@
 
 
 /*
- * $Id: structs.h,v 1.257 1999/01/12 16:42:20 wessels Exp $
+ * $Id: structs.h,v 1.258 1999/01/12 23:37:52 wessels Exp $
  *
  *
  * SQUID Internet Object Cache  http://squid.nlanr.net/Squid/
@@ -491,7 +491,6 @@ struct _ETag {
 
 struct _fde {
     unsigned int type;
-    unsigned int mode;         /* FD_READ|FD_WRITE */
     u_short local_port;
     u_short remote_port;
     char ipaddr[16];           /* dotted decimal address of peer */
index d86ff290b481f829ba6aef9690bbc33599e3c8e0..f22569943f9e67cff552000869c0ebfb7b65c5be 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: wais.cc,v 1.125 1999/01/12 15:47:57 wessels Exp $
+ * $Id: wais.cc,v 1.126 1999/01/12 23:37:53 wessels Exp $
  *
  * DEBUG: section 24    WAIS Relay
  * AUTHOR: Harvest Derived
@@ -91,10 +91,6 @@ waisReadReply(int fd, void *data)
 #if DELAY_POOLS
     delay_id delay_id = delayMostBytesAllowed(entry->mem_obj);
 #endif
-    if (EBIT_TEST(entry->flags, ENTRY_ABORTED)) {
-        comm_close(fd);
-        return;
-    }
     errno = 0;
     read_sz = 4096;
 #if DELAY_POOLS