]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
STORE fixes and async cleanup from trying to get ASYNCUFS working
authorwessels <>
Sat, 26 Jun 1999 05:37:31 +0000 (05:37 +0000)
committerwessels <>
Sat, 26 Jun 1999 05:37:31 +0000 (05:37 +0000)
with FreeBSD 3.1.

src/store_client.cc
src/store_io.cc
src/store_swapin.cc
src/store_swapout.cc
src/typedefs.h

index e7568ecfa336782e09fb30a10b97711b6546d81b..ee94b6b673be35de45a868339e616f8432f9fba2 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: store_client.cc,v 1.72 1999/06/19 16:36:05 wessels Exp $
+ * $Id: store_client.cc,v 1.73 1999/06/25 23:37:31 wessels Exp $
  *
  * DEBUG: section 20    Storage Manager Client-Side Interface
  * AUTHOR: Duane Wessels
@@ -303,7 +303,7 @@ storeClientFileRead(store_client * sc)
 }
 
 static void
-storeClientReadBody(void *data, const char *buf, size_t len)
+storeClientReadBody(void *data, const char *buf, ssize_t len)
 {
     store_client *sc = data;
     MemObject *mem = sc->entry->mem_obj;
@@ -319,7 +319,7 @@ storeClientReadBody(void *data, const char *buf, size_t len)
 }
 
 static void
-storeClientReadHeader(void *data, const char *buf, size_t len)
+storeClientReadHeader(void *data, const char *buf, ssize_t len)
 {
     store_client *sc = data;
     StoreEntry *e = sc->entry;
index 359c4e38fd2915885000bdd4512953aa009434ff..fcf6ae369607a1fc56f0094339f0cf87d249461c 100644 (file)
@@ -14,7 +14,8 @@ void
 storeClose(storeIOState * sio)
 {
     SwapDir *SD = &Config.cacheSwap.swapDirs[sio->swap_file_number >> SWAP_DIR_SHIFT];
-    assert(!sio->flags.closing);
+    if (sio->flags.closing)
+       return;
     sio->flags.closing = 1;
     SD->obj.close(sio);
 }
index 7656daeacae1e8809c3f1013cdfbbc6641790e8b..2d2f6d0d55086724a731a07c9c58794eba933d60 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: store_swapin.cc,v 1.18 1999/05/03 21:55:13 wessels Exp $
+ * $Id: store_swapin.cc,v 1.19 1999/06/25 23:37:33 wessels Exp $
  *
  * DEBUG: section 20    Storage Manager Swapin Functions
  * AUTHOR: Duane Wessels
@@ -55,8 +55,15 @@ storeSwapInStart(StoreEntry * e)
     }
     debug(20, 3) ("storeSwapInStart: called for %08X %s \n",
        e->swap_file_number, storeKeyText(e->key));
-    assert(e->swap_status == SWAPOUT_WRITING || e->swap_status == SWAPOUT_DONE);
-    assert(e->swap_file_number >= 0);
+    if (e->swap_status != SWAPOUT_WRITING && e->swap_status != SWAPOUT_DONE) {
+       debug(20, 1) ("storeSwapInStart: bad swap_status (%s)\n",
+           swapStatusStr[e->swap_status]);
+       return NULL;
+    }
+    if (e->swap_file_number < 0) {
+       debug(20, 1) ("storeSwapInStart: swap_file_number < 0\n");
+       return NULL;
+    }
     assert(e->mem_obj != NULL);
     debug(20, 3) ("storeSwapInStart: Opening fileno %08X\n",
        e->swap_file_number);
index 098e0dd0c34055c6c572ee0c88f6f91a37900d22..6f574a963b68a98bccaf9f720143ad82343e8575 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: store_swapout.cc,v 1.54 1999/06/24 20:20:17 wessels Exp $
+ * $Id: store_swapout.cc,v 1.55 1999/06/25 23:37:34 wessels Exp $
  *
  * DEBUG: section 20    Storage Manager Swapout Functions
  * AUTHOR: Duane Wessels
@@ -199,11 +199,10 @@ storeSwapOutFileClose(StoreEntry * e)
     MemObject *mem = e->mem_obj;
     assert(mem != NULL);
     debug(20, 3) ("storeSwapOutFileClose: %s\n", storeKeyText(e->key));
+    debug(20, 3) ("storeSwapOutFileClose: sio = %p\n", mem->swapout.sio);
     if (mem->swapout.sio == NULL)
        return;
     storeClose(mem->swapout.sio);
-    mem->swapout.sio = NULL;
-    storeUnlockObject(e);
 }
 
 static void
@@ -217,7 +216,6 @@ storeSwapOutFileClosed(void *data, int errflag, storeIOState * sio)
     if (errflag) {
        debug(20, 1) ("storeSwapOutFileClosed: swapfile %08X, errflag=%d\n\t%s\n",
            e->swap_file_number, errflag, xstrerror());
-       storeDirMapBitReset(e->swap_file_number);
        /*
         * yuck.  don't clear the filemap bit for some errors so that
         * we don't try re-using it over and over
@@ -229,9 +227,9 @@ storeSwapOutFileClosed(void *data, int errflag, storeIOState * sio)
            storeDirConfigure();
            storeConfigure();
        }
+       storeReleaseRequest(e);
        e->swap_file_number = -1;
        e->swap_status = SWAPOUT_NONE;
-       return;
     } else {
        /* swapping complete */
        debug(20, 3) ("storeSwapOutFileClosed: SwapOut complete: '%s' to %08X\n",
@@ -247,7 +245,10 @@ storeSwapOutFileClosed(void *data, int errflag, storeIOState * sio)
            storeDirSwapLog(e, SWAP_LOG_ADD);
        }
     }
+    debug(20, 3) ("storeSwapOutFileClosed: %s:%d\n", __FILE__, __LINE__);
+    mem->swapout.sio = NULL;
     cbdataUnlock(sio);
+    storeUnlockObject(e);
 }
 
 /*
index 34cc32c56a0c6471ebf8f461bf8ec1d68384ff13..8a49b43d8b5f3b3763a7a0fc55ae17b664857f4a 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: typedefs.h,v 1.95 1999/05/27 03:21:43 wessels Exp $
+ * $Id: typedefs.h,v 1.96 1999/06/25 23:37:35 wessels Exp $
  *
  *
  * SQUID Internet Object Cache  http://squid.nlanr.net/Squid/
@@ -198,7 +198,7 @@ typedef void UH(void *data, wordlist *);
 typedef int DEFER(int fd, void *data);
 
 typedef void STIOCB(void *their_data, int errflag, storeIOState *);
-typedef void STRCB(void *their_data, const char *buf, size_t len);
+typedef void STRCB(void *their_data, const char *buf, ssize_t len);
 
 typedef void SIH(storeIOState *, void *);      /* swap in */
 typedef int QS(const void *, const void *);    /* qsort */