From: wessels <> Date: Fri, 20 Jun 1997 06:00:10 +0000 (+0000) Subject: - memCopy needs to return a signed value to report errors, so we need X-Git-Tag: SQUID_3_0_PRE1~4924 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=02be0294cd01fe75dd73f20cb8cdf1a0252dd6ed;p=thirdparty%2Fsquid.git - memCopy needs to return a signed value to report errors, so we need to have 'ssize_t' - Fixed FTP end-of-transfer confusion - Rearranged assertions in icpSendMoreData to account for STORE_ABORT --- diff --git a/src/client_side.cc b/src/client_side.cc index 7f67ddf7ae..22dc5984df 100644 --- a/src/client_side.cc +++ b/src/client_side.cc @@ -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; diff --git a/src/comm.cc b/src/comm.cc index 6a96a56f72..35276acc56 100644 --- a/src/comm.cc +++ b/src/comm.cc @@ -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 */ diff --git a/src/ftp.cc b/src/ftp.cc index 02906c4d14..359db7477d 100644 --- a/src/ftp.cc +++ b/src/ftp.cc @@ -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 diff --git a/src/squid.h b/src/squid.h index ab910e9470..30b5e7f90c 100644 --- a/src/squid.h +++ b/src/squid.h @@ -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" diff --git a/src/stmem.cc b/src/stmem.cc index 3faac8cdb5..659b5f0fe0 100644 --- a/src/stmem.cc +++ b/src/stmem.cc @@ -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; diff --git a/src/store.cc b/src/store.cc index 5d662572e1..44c7c4e87c 100644 --- a/src/store.cc +++ b/src/store.cc @@ -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);