]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
- memCopy needs to return a signed value to report errors, so we need
authorwessels <>
Fri, 20 Jun 1997 06:00:10 +0000 (06:00 +0000)
committerwessels <>
Fri, 20 Jun 1997 06:00:10 +0000 (06:00 +0000)
  to have 'ssize_t'
- Fixed FTP end-of-transfer confusion
- Rearranged assertions in icpSendMoreData to account for STORE_ABORT

src/client_side.cc
src/comm.cc
src/ftp.cc
src/squid.h
src/stmem.cc
src/store.cc

index 7f67ddf7ae53cba33efd06047ea460f3a07007d2..22dc5984df4b829b84d02012a209abe137e0ee24 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: client_side.cc,v 1.112 1997/06/17 04:54:08 wessels Exp $
+ * $Id: client_side.cc,v 1.113 1997/06/20 00:00:10 wessels Exp $
  *
  * DEBUG: section 33    Client-side Routines
  * AUTHOR: Duane Wessels
@@ -389,7 +389,7 @@ clientGetsOldEntry(StoreEntry * new_entry, StoreEntry * old_entry, request_t * r
 
 
 static void
-icpHandleIMSReply(void *data, char *buf, size_t size)
+icpHandleIMSReply(void *data, char *buf, ssize_t size)
 {
     clientHttpRequest *http = data;
     int fd = http->conn->fd;
index 6a96a56f72b1159f6728da373576bc94573fab7b..35276acc561ed238f6106cc1d925a47ab7aaa291 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: comm.cc,v 1.167 1997/06/18 16:00:09 wessels Exp $
+ * $Id: comm.cc,v 1.168 1997/06/20 00:00:11 wessels Exp $
  *
  * DEBUG: section 5     Socket Functions
  * AUTHOR: Harvest Derived
@@ -1329,7 +1329,7 @@ commHandleWrite(int fd, void *data)
        /* Note we even call write if nleft == 0 */
        /* We're done */
        if (nleft != 0)
-           debug(5, 2) ("commHandleWrite: FD %d: write failure: connection closed with %d bytes remaining.\n", fd, nleft);
+           debug(5, 1) ("commHandleWrite: FD %d: write failure: connection closed with %d bytes remaining.\n", fd, nleft);
        CommWriteStateCallbackAndFree(fd, nleft ? COMM_ERROR : COMM_OK);
     } else if (len < 0) {
        /* An error */
index 02906c4d149ec5a58525cd4bbb48f5b09965caac..359db7477de553fd81766a9396c8484ba655d08d 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: ftp.cc,v 1.125 1997/06/19 22:51:50 wessels Exp $
+ * $Id: ftp.cc,v 1.126 1997/06/20 00:00:12 wessels Exp $
  *
  * DEBUG: section 9     File Transfer Protocol (FTP)
  * AUTHOR: Harvest Derived
@@ -644,8 +644,7 @@ ftpReadData(int fd, void *data)
     if (len < 0) {
        debug(50, 1) ("ftpReadData: read error: %s\n", xstrerror());
        if (errno == EAGAIN || errno == EWOULDBLOCK || errno == EINTR) {
-           commSetSelect(fd, COMM_SELECT_READ,
-               ftpReadData, data, 0);
+           commSetSelect(fd, COMM_SELECT_READ, ftpReadData, data, 0);
        } else {
            BIT_RESET(entry->flag, ENTRY_CACHABLE);
            storeReleaseRequest(entry);
@@ -661,7 +660,12 @@ ftpReadData(int fd, void *data)
            ftpListingFinish(ftpState);
        storeTimestampsSet(entry);
        storeComplete(entry);
-       ftpDataTransferDone(ftpState);
+       /* expect the "transfer complete" message on the control socket */
+       commSetSelect(ftpState->ctrl.fd,
+               COMM_SELECT_READ,
+               ftpReadControlReply,
+               ftpState,
+               0);
     } else {
        if (EBIT_TEST(ftpState->flags, FTP_ISDIR)) {
            ftpParseListing(ftpState, len);
@@ -913,6 +917,7 @@ ftpWriteCommandCallback(int fd, char *buf, int size, int errflag, void *data)
     StoreEntry *entry = ftpState->entry;
     debug(9, 7) ("ftpWriteCommandCallback: wrote %d bytes\n", size);
     if (errflag) {
+       debug(50,1)("ftpWriteCommandCallback: FD %d: %s\n", fd, xstrerror());
        BIT_RESET(entry->flag, ENTRY_CACHABLE);
        storeReleaseRequest(entry);
        storeAbort(entry, ERR_WRITE_ERROR, xstrerror(), 0);
@@ -1393,6 +1398,7 @@ ftpReadTransferDone(FtpStateData * ftpState)
        debug(9, 1) ("Got code %d after reading data, releasing entry\n");
        storeReleaseRequest(ftpState->entry);
     }
+    ftpDataTransferDone(ftpState);
 }
 
 static void
index ab910e94705801fad1e765253f54b88c94484870..30b5e7f90c27c43a6bbb1c5c17b8f4a6d1ab84a2 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: squid.h,v 1.122 1997/06/18 00:20:03 wessels Exp $
+ * $Id: squid.h,v 1.123 1997/06/20 00:00:14 wessels Exp $
  *
  * AUTHOR: Duane Wessels
  *
@@ -269,7 +269,7 @@ typedef unsigned long u_num32;
 
 typedef void SIH _PARAMS((void *, int));       /* swap in */
 typedef int QS _PARAMS((const void *, const void *));  /* qsort */
-typedef void STCB _PARAMS((void *, char *, size_t));   /* store callback */
+typedef void STCB _PARAMS((void *, char *, ssize_t));  /* store callback */
 
 #include "cache_cf.h"
 #include "fd.h"
index 3faac8cdb5648f0f4b8d514280ea1e8e6da832df..659b5f0fe0514af26837e3034252c4868415aa03 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: stmem.cc,v 1.43 1997/06/04 06:16:10 wessels Exp $
+ * $Id: stmem.cc,v 1.44 1997/06/20 00:00:15 wessels Exp $
  *
  * DEBUG: section 19    Memory Primitives
  * AUTHOR: Harvest Derived
@@ -246,7 +246,7 @@ memAppend(mem_ptr mem, const char *data, int len)
     }
 }
 
-size_t
+ssize_t
 memCopy(const mem_ptr mem, off_t offset, char *buf, size_t size)
 {
     mem_node p = mem->head;
index 5d662572e1c046d96bad34623447b20d38d3e6d9..44c7c4e87cafa70c6ea7ff2626b853dfcffefcd9 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: store.cc,v 1.260 1997/06/19 22:51:55 wessels Exp $
+ * $Id: store.cc,v 1.261 1997/06/20 00:00:16 wessels Exp $
  *
  * DEBUG: section 20    Storeage Manager
  * AUTHOR: Harvest Derived
@@ -879,7 +879,7 @@ InvokeHandlers(StoreEntry * e)
     MemObject *mem = e->mem_obj;
     STCB *callback = NULL;
     struct _store_client *sc;
-    size_t size;
+    ssize_t size;
     if (mem->clients == NULL && mem->nclients) {
        debug_trap("InvokeHandlers: NULL mem->clients");
        return;
@@ -1670,7 +1670,8 @@ storeAbort(StoreEntry * e, log_type abort_code, const char *msg, int cbflag)
     assert(e->store_status == STORE_PENDING);
     assert(mem != NULL);
     safe_free(mem->e_abort_msg);
-    mem->e_abort_msg = xstrdup(msg);
+    if (msg)
+        mem->e_abort_msg = xstrdup(msg);
     debug(20, 6) ("storeAbort: %s %s\n", log_tags[abort_code], e->key);
     storeNegativeCache(e);
     storeReleaseRequest(e);