]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
more misc, massive cleanup
authorwessels <>
Sat, 3 May 1997 03:34:04 +0000 (03:34 +0000)
committerwessels <>
Sat, 3 May 1997 03:34:04 +0000 (03:34 +0000)
src/comm.cc
src/disk.cc
src/fd.cc
src/send-announce.cc
src/squid.h
src/stat.cc
src/store.cc
src/store_dir.cc
src/tools.cc
src/useragent.cc
src/wais.cc

index 67f0fc57d3c99061e1b706883ee7384c3b0dbe49..cc055e668f7f48e05f8d0ea11d5a1029751aeb23 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: comm.cc,v 1.148 1997/04/30 20:06:25 wessels Exp $
+ * $Id: comm.cc,v 1.149 1997/05/02 21:34:04 wessels Exp $
  *
  * DEBUG: section 5     Socket Functions
  * AUTHOR: Harvest Derived
@@ -120,30 +120,28 @@ int RESERVED_FD = 64;
 #define min(x,y) ((x)<(y)? (x) : (y))
 #define max(a,b) ((a)>(b)? (a) : (b))
 
-typedef struct _RWStateData {
+struct _cwstate {
     char *buf;
     long size;
     long offset;
-    RWCB *handler;
+    CWCB *handler;
     void *handler_data;
     void (*free) (void *);
-} RWStateData;
+};
 
 /* GLOBAL */
 FD_ENTRY *fd_table = NULL;     /* also used in disk.c */
 
 /* STATIC */
 static int commBind _PARAMS((int s, struct in_addr, u_short port));
-static int comm_cleanup_fd_entry _PARAMS((int));
 #ifndef USE_POLL
 static int examine_select _PARAMS((fd_set *, fd_set *));
 #endif
 static void checkTimeouts _PARAMS((void));
-static void Reserve_More_FDs _PARAMS((void));
 static void commSetReuseAddr _PARAMS((int));
 static void commSetNoLinger _PARAMS((int));
 static void comm_select_incoming _PARAMS((void));
-static void RWStateCallbackAndFree _PARAMS((int fd, int code));
+static void CommWriteStateCallbackAndFree _PARAMS((int fd, int code));
 #ifdef TCP_NODELAY
 static void commSetTcpNoDelay _PARAMS((int));
 #endif
@@ -155,38 +153,38 @@ static void commHandleWrite _PARAMS((int fd, void *data));
 static struct timeval zero_tv;
 
 void
-commCancelRWHandler(int fd)
+commCancelWriteHandler(int fd)
 {
-    RWStateData *RWState = fd_table[fd].rwstate;
-    if (RWState) {
-       RWState->handler = NULL;
-       RWState->handler_data = NULL;
+    CommWriteStateData *CommWriteState = fd_table[fd].rwstate;
+    if (CommWriteState) {
+       CommWriteState->handler = NULL;
+       CommWriteState->handler_data = NULL;
     }
 }
 
 
 static void
-RWStateCallbackAndFree(int fd, int code)
+CommWriteStateCallbackAndFree(int fd, int code)
 {
-    RWStateData *RWState = fd_table[fd].rwstate;
-    RWCB *callback = NULL;
+    CommWriteStateData *CommWriteState = fd_table[fd].rwstate;
+    CWCB *callback = NULL;
     fd_table[fd].rwstate = NULL;
-    if (RWState == NULL)
+    if (CommWriteState == NULL)
        return;
-    if (RWState->free) {
-       RWState->free(RWState->buf);
-       RWState->buf = NULL;
+    if (CommWriteState->free) {
+       CommWriteState->free(CommWriteState->buf);
+       CommWriteState->buf = NULL;
     }
-    callback = RWState->handler;
-    RWState->handler = NULL;
+    callback = CommWriteState->handler;
+    CommWriteState->handler = NULL;
     if (callback) {
        callback(fd,
-           RWState->buf,
-           RWState->offset,
+           CommWriteState->buf,
+           CommWriteState->offset,
            code,
-           RWState->handler_data);
+           CommWriteState->handler_data);
     }
-    safe_free(RWState);
+    safe_free(CommWriteState);
 }
 
 /* Return the local port associated with fd. */
@@ -256,7 +254,6 @@ comm_open(int sock_type,
        case ENFILE:
        case EMFILE:
            debug(50, 1, "comm_open: socket failure: %s\n", xstrerror());
-           Reserve_More_FDs();
            break;
        default:
            debug(50, 0, "comm_open: socket failure: %s\n", xstrerror());
@@ -476,7 +473,6 @@ comm_accept(int fd, struct sockaddr_in *peer, struct sockaddr_in *me)
            return COMM_NOMESSAGE;
        case ENFILE:
        case EMFILE:
-           Reserve_More_FDs();
            return COMM_ERROR;
        default:
            debug(50, 1, "comm_accept: FD %d: accept failure: %s\n",
@@ -531,7 +527,7 @@ comm_close(int fd)
     if (fd_table[fd].type == FD_FILE)
        fatal_dump("comm_close: not a SOCKET");
     fde->open = 0;
-    RWStateCallbackAndFree(fd, COMM_ERROR);
+    CommWriteStateCallbackAndFree(fd, COMM_ERROR);
     commCallCloseHandlers(fd);
     fd_close(fd);              /* update fdstat */
 #if USE_ASYNC_IO
@@ -541,16 +537,6 @@ comm_close(int fd)
 #endif
 }
 
-/* use to clean up fdtable when socket is closed without
- * using comm_close */
-static int
-comm_cleanup_fd_entry(int fd)
-{
-    RWStateCallbackAndFree(fd, COMM_ERROR);
-    fd_close(fd);
-    return 0;
-}
-
 
 /* Send a udp datagram to specified PORT at HOST. */
 int
@@ -1333,44 +1319,18 @@ checkTimeouts(void)
            callback = fde->timeout_handler;
            fde->timeout_handler = NULL;
            callback(fd, fde->timeout_data);
-       } else if (fde->read_handler) {
-           debug(5, 5, "checkTimeouts: FD %d: Call read handler\n", fd);
-           callback = fde->read_handler;
-           fde->read_handler = NULL;
-           callback(fd, fde->read_data);
-       } else if (fde->write_handler) {
-           debug(5, 5, "checkTimeouts: FD %d: Call write handler\n", fd);
-           callback = fde->write_handler;
-           fde->write_handler = NULL;
-           callback(fd, fde->write_data);
        } else {
            debug(5, 5, "checkTimeouts: FD %d: Forcing comm_close()\n", fd);
            comm_close(fd);
-           comm_cleanup_fd_entry(fd);
        }
     }
 }
 
-/*
- * Reserve_More_FDs() called when acceopt(), open(), or socket is failing
- */
-static void
-Reserve_More_FDs(void)
-{
-    if (RESERVED_FD < Squid_MaxFD - 64) {
-       RESERVED_FD = RESERVED_FD + 1;
-    } else if (RESERVED_FD == Squid_MaxFD - 64) {
-       RESERVED_FD = RESERVED_FD + 1;
-       debug(5, 0, "Don't you have a tiny open-file table size of %d\n",
-           Squid_MaxFD - RESERVED_FD);
-    }
-}
-
 /* Write to FD. */
 static void
 commHandleWrite(int fd, void *data)
 {
-    RWStateData *state = data;
+    CommWriteStateData *state = data;
     int len = 0;
     int nleft;
 
@@ -1386,7 +1346,7 @@ commHandleWrite(int fd, void *data)
        /* We're done */
        if (nleft != 0)
            debug(5, 2, "commHandleWrite: FD %d: write failure: connection closed with %d bytes remaining.\n", fd, nleft);
-       RWStateCallbackAndFree(fd, nleft ? COMM_ERROR : COMM_OK);
+       CommWriteStateCallbackAndFree(fd, nleft ? COMM_ERROR : COMM_OK);
     } else if (len < 0) {
        /* An error */
        if (errno == EWOULDBLOCK || errno == EAGAIN || errno == EINTR) {
@@ -1400,7 +1360,7 @@ commHandleWrite(int fd, void *data)
        } else {
            debug(50, 2, "commHandleWrite: FD %d: write failure: %s.\n",
                fd, xstrerror());
-           RWStateCallbackAndFree(fd, COMM_ERROR);
+           CommWriteStateCallbackAndFree(fd, COMM_ERROR);
        }
     } else {
        /* A successful write, continue */
@@ -1413,7 +1373,7 @@ commHandleWrite(int fd, void *data)
                state,
                0);
        } else {
-           RWStateCallbackAndFree(fd, COMM_OK);
+           CommWriteStateCallbackAndFree(fd, COMM_OK);
        }
     }
 }
@@ -1423,18 +1383,16 @@ commHandleWrite(int fd, void *data)
 /* Select for Writing on FD, until SIZE bytes are sent.  Call
  * * HANDLER when complete. */
 void
-comm_write(int fd, char *buf, int size, RWCB * handler, void *handler_data, void (*free_func) (void *))
+comm_write(int fd, char *buf, int size, CWCB * handler, void *handler_data, FREE *free_func)
 {
-    RWStateData *state = NULL;
-
+    CommWriteStateData *state = NULL;
     debug(5, 5, "comm_write: FD %d: sz %d: hndl %p: data %p.\n",
        fd, size, handler, handler_data);
-
     if (fd_table[fd].rwstate) {
        debug(5, 1, "WARNING: FD %d: A comm_write is already active.\n", fd);
-       RWStateCallbackAndFree(fd, COMM_ERROR);
+       CommWriteStateCallbackAndFree(fd, COMM_ERROR);
     }
-    state = xcalloc(1, sizeof(RWStateData));
+    state = xcalloc(1, sizeof(CommWriteStateData));
     state->buf = buf;
     state->size = size;
     state->offset = 0;
@@ -1448,9 +1406,3 @@ comm_write(int fd, char *buf, int size, RWCB * handler, void *handler_data, void
        fd_table[fd].rwstate,
        0);
 }
-
-void
-commFreeMemory(void)
-{
-    safe_free(fd_table);
-}
index 2fd577a3ba35588eb87eb24a53fdfc20a3a237d2..ab4805b525bb93c302d29282248318d9c423972e 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: disk.cc,v 1.66 1997/04/30 22:46:25 wessels Exp $
+ * $Id: disk.cc,v 1.67 1997/05/02 21:34:06 wessels Exp $
  *
  * DEBUG: section 6     Disk I/O Routines
  * AUTHOR: Harvest Derived
@@ -114,7 +114,7 @@ typedef struct disk_ctrl_t {
 
 
 typedef struct open_ctrl_t {
-    void (*callback) ();
+    FOCB *callback;
     void *callback_data;
     char *path;
 } open_ctrl_t;
@@ -148,7 +148,7 @@ disk_init(void)
 
 /* Open a disk file. Return a file descriptor */
 int
-file_open(const char *path, int (*handler) _PARAMS((void)), int mode, void (*callback) (), void *callback_data)
+file_open(const char *path, int mode, FOCB *callback, void *callback_data)
 {
     int fd;
     open_ctrl_t *ctrlp;
@@ -164,22 +164,16 @@ file_open(const char *path, int (*handler) _PARAMS((void)), int mode, void (*cal
 
     /* Open file */
 #if USE_ASYNC_IO
-    if (callback == NULL) {
-       fd = open(path, mode, 0644);
-       file_open_complete(ctrlp, fd, errno);
-       if (fd < 0)
-           return DISK_ERROR;
-       return fd;
+    if (callback != NULL) {
+        aioOpen(path, mode, 0644, file_open_complete, ctrlp);
+        return DISK_OK;
     }
-    aioOpen(path, mode, 0644, file_open_complete, ctrlp);
-    return DISK_OK;
-#else
+#endif
     fd = open(path, mode, 0644);
     file_open_complete(ctrlp, fd, errno);
     if (fd < 0)
        return DISK_ERROR;
     return fd;
-#endif
 }
 
 
index 44cfc3f0497f13395252031a1a36616ebddaa5fd..d4fa4f5bc2709fb68e98aac73009d2211dc23151 100644 (file)
--- a/src/fd.cc
+++ b/src/fd.cc
@@ -66,3 +66,9 @@ fd_bytes(int fd, int len, unsigned int type)
     else
        fatal_dump("fd_bytes: bad type");
 }
+
+void
+fdFreeMemory(void)
+{
+       safe_free(fd_table);
+}
index ca19d6f4e5a96fe6a884ceede5577178048dc54e..209b20324ab9bd4eaa56b34267ffb60b56f350d3 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: send-announce.cc,v 1.33 1997/04/30 20:06:35 wessels Exp $
+ * $Id: send-announce.cc,v 1.34 1997/05/02 21:34:12 wessels Exp $
  *
  * DEBUG: section 27    Cache Announcer
  * AUTHOR: Duane Wessels
@@ -76,7 +76,7 @@ send_announce(int fd, const ipcache_addrs * ia, void *data)
     strcat(sndbuf, tbuf);
     l = strlen(sndbuf);
     if ((file = Config.Announce.file)) {
-       fd = file_open(file, NULL, O_RDONLY, NULL, NULL);
+       fd = file_open(file, O_RDONLY, NULL, NULL);
        if (fd > -1 && (n = read(fd, sndbuf + l, BUFSIZ - l - 1)) > 0) {
            fd_bytes(fd, n, FD_READ);
            l += n;
index 6e83d02dd12c9722959e9f67bea51b230a180c6e..3f49d6aabbe320ee7747bf54460dcd1b3bdbb150 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: squid.h,v 1.107 1997/04/30 18:31:00 wessels Exp $
+ * $Id: squid.h,v 1.108 1997/05/02 21:34:13 wessels Exp $
  *
  * AUTHOR: Duane Wessels
  *
@@ -234,6 +234,7 @@ typedef struct _request request_t;
 typedef struct _MemObject MemObject;
 typedef struct _cachemgr_passwd cachemgr_passwd;
 typedef struct _fileMap fileMap;
+typedef struct _cwstate CommWriteStateData;
 
 /* 32 bit integer compatability hack */
 #if SIZEOF_INT == 4
index 54c24e1f916ec6e45668f46fe9cac5ba30275252..2495d3af3b79fb7ced72608e12df02fff12b54f6 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: stat.cc,v 1.138 1997/04/30 18:31:02 wessels Exp $
+ * $Id: stat.cc,v 1.139 1997/05/02 21:34:13 wessels Exp $
  *
  * DEBUG: section 18    Cache Manager Statistics
  * AUTHOR: Harvest Derived
@@ -492,7 +492,7 @@ log_get_start(const cacheinfo * obj, StoreEntry * sentry)
        storeComplete(sentry);
        return;
     }
-    fd = file_open(obj->logfilename, NULL, O_RDONLY, NULL, NULL);
+    fd = file_open(obj->logfilename, O_RDONLY, NULL, NULL);
     if (fd < 0) {
        debug(50, 0, "Cannot open logfile: %s: %s\n",
            obj->logfilename, xstrerror());
@@ -540,7 +540,7 @@ squid_get_start(const cacheinfo * obj, StoreEntry * sentry)
 
     data = xcalloc(1, sizeof(squid_read_data_t));
     data->sentry = sentry;
-    data->fd = file_open(ConfigFile, NULL, O_RDONLY, NULL, NULL);
+    data->fd = file_open(ConfigFile, O_RDONLY, NULL, NULL);
     storeAppendPrintf(sentry, open_bracket);
     file_walk(data->fd, squidReadEndHandler, data, squidReadHandler, data);
 }
@@ -1168,7 +1168,7 @@ log_enable(cacheinfo * obj, StoreEntry * sentry)
        obj->logfile_status = LOG_ENABLE;
 
        /* open the logfile */
-       obj->logfile_fd = file_open(obj->logfilename, NULL, O_WRONLY | O_CREAT, NULL, NULL);
+       obj->logfile_fd = file_open(obj->logfilename, O_WRONLY | O_CREAT, NULL, NULL);
        if (obj->logfile_fd == DISK_ERROR) {
            debug(18, 0, "Cannot open logfile: %s\n", obj->logfilename);
            obj->logfile_status = LOG_DISABLE;
@@ -1201,7 +1201,7 @@ log_clear(cacheinfo * obj, StoreEntry * sentry)
     unlink(obj->logfilename);
 
     /* reopen it anyway */
-    obj->logfile_fd = file_open(obj->logfilename, NULL, O_WRONLY | O_CREAT, NULL, NULL);
+    obj->logfile_fd = file_open(obj->logfilename, O_WRONLY | O_CREAT, NULL, NULL);
     if (obj->logfile_fd == DISK_ERROR) {
        debug(18, 0, "Cannot open logfile: %s\n", obj->logfilename);
        obj->logfile_status = LOG_DISABLE;
@@ -1294,7 +1294,7 @@ stat_init(cacheinfo ** object, const char *logfilename)
     if (logfilename) {
        memset(obj->logfilename, '\0', SQUID_MAXPATHLEN);
        xstrncpy(obj->logfilename, logfilename, SQUID_MAXPATHLEN);
-       obj->logfile_fd = file_open(obj->logfilename, NULL, O_WRONLY | O_CREAT, NULL, NULL);
+       obj->logfile_fd = file_open(obj->logfilename, O_WRONLY | O_CREAT, NULL, NULL);
        if (obj->logfile_fd == DISK_ERROR) {
            debug(50, 0, "%s: %s\n", obj->logfilename, xstrerror());
            fatal("Cannot open logfile.");
@@ -1380,7 +1380,7 @@ stat_rotate_log(void)
     /* Close and reopen the log.  It may have been renamed "manually"
      * before HUP'ing us. */
     file_close(HTTPCacheInfo->logfile_fd);
-    HTTPCacheInfo->logfile_fd = file_open(fname, NULL, O_WRONLY | O_CREAT, NULL, NULL);
+    HTTPCacheInfo->logfile_fd = file_open(fname, O_WRONLY | O_CREAT, NULL, NULL);
     if (HTTPCacheInfo->logfile_fd == DISK_ERROR) {
        debug(18, 0, "stat_rotate_log: Cannot open logfile: %s\n", fname);
        HTTPCacheInfo->logfile_status = LOG_DISABLE;
index dbc82547963de1fcea2a02077889d2bd5f4014c1..8c7f0feba8fa585a8fb1da788402b494f8f9e801 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: store.cc,v 1.227 1997/04/30 22:46:27 wessels Exp $
+ * $Id: store.cc,v 1.228 1997/05/02 21:34:15 wessels Exp $
  *
  * DEBUG: section 20    Storeage Manager
  * AUTHOR: Harvest Derived
@@ -165,10 +165,10 @@ const char *memStatusStr[] =
 
 const char *pingStatusStr[] =
 {
+    "PING_NONE",
     "PING_WAITING",
     "PING_TIMEOUT",
-    "PING_DONE",
-    "PING_NONE"
+    "PING_DONE"
 };
 
 const char *storeStatusStr[] =
@@ -568,7 +568,7 @@ storeLockObject(StoreEntry * e, SIH * callback, void *callback_data)
     if (e->mem_status == NOT_IN_MEMORY && e->swap_status == SWAP_OK) {
        /* object is in disk and no swapping daemon running. Bring it in. */
        if (callback == NULL)
-           debug(20, 0, "storeLockObject: NULL callback\n");
+           debug_trap("storeLockObject: NULL callback\n");
        ctrlp = xmalloc(sizeof(lock_ctrl_t));
        ctrlp->callback = callback;
        ctrlp->callback_data = callback_data;
@@ -618,10 +618,8 @@ storeUnlockObject(StoreEntry * e)
     if (e->lock_count)
        return (int) e->lock_count;
     if (e->store_status == STORE_PENDING) {
-#ifdef COMPLAIN
        debug_trap("storeUnlockObject: Someone unlocked STORE_PENDING object");
        debug(20, 1, "   --> Key '%s'\n", e->key);
-#endif
        e->store_status = STORE_ABORTED;
     }
     if (storePendingNClients(e) > 0)
@@ -1171,7 +1169,7 @@ storeSwapInValidateComplete(void *data, int status)
     }
     path = storeSwapFullPath(e->swap_file_number, NULL);
     ctrlp->path = xstrdup(path);
-    file_open(path, NULL, O_RDONLY, storeSwapInStartComplete, ctrlp);
+    file_open(path, O_RDONLY, storeSwapInStartComplete, ctrlp);
 }
 
 static void
@@ -1315,7 +1313,6 @@ storeSwapOutStart(StoreEntry * e)
     ctrlp->swapfileno = swapfileno;
     e->swap_status = SWAPPING_OUT;
     file_open(swapfilename,
-       NULL,
        O_WRONLY | O_CREAT | O_TRUNC,
        storeSwapOutStartComplete,
        ctrlp);
@@ -1764,11 +1761,14 @@ storeAbort(StoreEntry * e, const char *msg)
     char *abort_msg;
     MemObject *mem = e->mem_obj;
 
-    if (e->store_status != STORE_PENDING) {    /* XXX remove later */
+    if (e->store_status != STORE_PENDING) {
        debug_trap("storeAbort: bad store_status");
        return;
-    } else if (mem == NULL) {  /* XXX remove later */
-       debug_trap("storeAbort: null mem");
+    } else if (mem == NULL) {
+       debug_trap("storeAbort: null mem_obj");
+       return;
+    } else if (e->ping_status == PING_WAITING) {
+       debug_trap("storeAbort: ping_status == PING_WAITING");
        return;
     }
     debug(20, 6, "storeAbort: '%s'\n", e->key);
@@ -2460,7 +2460,7 @@ storeInit(void)
     if (strcmp((fname = Config.Log.store), "none") == 0)
        storelog_fd = -1;
     else
-       storelog_fd = file_open(fname, NULL, O_WRONLY | O_CREAT, NULL, NULL);
+       storelog_fd = file_open(fname, O_WRONLY | O_CREAT, NULL, NULL);
     if (storelog_fd < 0)
        debug(20, 1, "Store logging disabled\n");
     if (ncache_dirs < 1)
@@ -2600,7 +2600,10 @@ storeWriteCleanLogs(void)
        cln[dirn] = xstrdup(storeDirSwapLogFile(dirn, ".last-clean"));
        safeunlink(new[dirn], 1);
        safeunlink(cln[dirn], 1);
-       fd[dirn] = open(new[dirn], O_WRONLY | O_APPEND | O_CREAT | O_TRUNC, 0644);
+       fd[dirn] = file_open(new[dirn],
+               O_WRONLY | O_CREAT | O_TRUNC,
+               NULL,
+               NULL);
        if (fd[dirn] < 0) {
            debug(50, 0, "storeWriteCleanLogs: %s: %s\n", new[dirn], xstrerror());
            continue;
@@ -2668,7 +2671,7 @@ storeWriteCleanLogs(void)
     /* touch a timestamp file if we're not still validating */
     for (dirn = 0; dirn < ncache_dirs; dirn++) {
        if (!store_validating)
-           file_close(file_open(cln[dirn], NULL,
+           file_close(file_open(cln[dirn],
                    O_WRONLY | O_CREAT | O_TRUNC, NULL, NULL));
        safe_free(cur[dirn]);
        safe_free(new[dirn]);
@@ -2741,7 +2744,7 @@ storeRotateLog(void)
        sprintf(to, "%s.%d", fname, 0);
        rename(fname, to);
     }
-    storelog_fd = file_open(fname, NULL, O_WRONLY | O_CREAT, NULL, NULL);
+    storelog_fd = file_open(fname, O_WRONLY | O_CREAT, NULL, NULL);
     if (storelog_fd < 0) {
        debug(50, 0, "storeRotateLog: %s: %s\n", fname, xstrerror());
        debug(20, 1, "Store logging disabled\n");
@@ -2827,7 +2830,7 @@ static const char *
 storeDescribeStatus(const StoreEntry * e)
 {
     static char buf[MAX_URL << 1];
-    sprintf(buf, "mem:%13s ping:%12s store:%13s swap:%12s locks:%d %s\n",
+    sprintf(buf, "mem:%s ping:%s store:%s swap:%s locks:%d %s\n",
        memStatusStr[e->mem_status],
        pingStatusStr[e->ping_status],
        storeStatusStr[e->store_status],
index 66dd96668cfb6fd069a91fb2ade1461d3cd0d9dd..bc2e24bbcb47f2940165dc6b34dcfe6e84d0a71d 100644 (file)
@@ -269,7 +269,7 @@ storeDirOpenSwapLogs(void)
     for (i = 0; i < ncache_dirs; i++) {
        SD = &SwapDirs[i];
        path = storeDirSwapLogFile(i, NULL);
-       fd = file_open(path, NULL, O_WRONLY | O_CREAT, NULL, NULL);
+       fd = file_open(path, O_WRONLY | O_CREAT, NULL, NULL);
        if (fd < 0) {
            debug(50, 1, "%s: %s\n", path, xstrerror());
            fatal("storeDirOpenSwapLogs: Failed to open swap log.");
@@ -314,7 +314,7 @@ storeDirOpenTmpSwapLog(int dirn, int *clean_flag)
     if (SD->swaplog_fd >= 0)
        file_close(SD->swaplog_fd);
     /* open a write-only FD for the new log */
-    fd = file_open(new_path, NULL, O_WRONLY | O_CREAT, NULL, NULL);
+    fd = file_open(new_path, O_WRONLY | O_CREAT, NULL, NULL);
     if (fd < 0) {
        debug(50, 1, "%s: %s\n", new_path, xstrerror());
        fatal("storeDirOpenTmpSwapLog: Failed to open swap log.");
@@ -351,7 +351,7 @@ storeDirCloseTmpSwapLog(int dirn)
        fatal("storeDirCloseTmpSwapLog: rename failed");
     }
     file_close(SD->swaplog_fd);
-    fd = file_open(swaplog_path, NULL, O_WRONLY | O_CREAT, NULL, NULL);
+    fd = file_open(swaplog_path, O_WRONLY | O_CREAT, NULL, NULL);
     if (fd < 0) {
        debug(50, 1, "%s: %s\n", swaplog_path, xstrerror());
        fatal("storeDirCloseTmpSwapLog: Failed to open swap log.");
index 92b8de1c38d82303a6ec1ebe3992974924ba2caa..5cdff1e8936882f10c7e6352ea420ed73c06d65c 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: tools.cc,v 1.102 1997/04/30 18:31:03 wessels Exp $
+ * $Id: tools.cc,v 1.103 1997/05/02 21:34:17 wessels Exp $
  *
  * DEBUG: section 21    Misc Functions
  * AUTHOR: Harvest Derived
@@ -362,7 +362,7 @@ normal_shutdown(void)
 #if PURIFY
     configFreeMemory();
     storeFreeMemory();
-    commFreeMemory();
+    fdFreeMemory();
     dnsFreeMemory();
     redirectFreeMemory();
     errorpageFreeMemory();
index ab4ec7c009f59414079695b88c118a8025dabe7b..00a4d4f31e29931a8b31abe9740fb486813d9196 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: useragent.cc,v 1.5 1997/02/26 19:46:27 wessels Exp $
+ * $Id: useragent.cc,v 1.6 1997/05/02 21:34:18 wessels Exp $
  *
  * DEBUG: section 40    User-Agent logging
  * AUTHOR: Joe Ramey <ramey@csc.ti.com>
@@ -48,7 +48,7 @@ useragentOpenLog(void)
        cache_useragent_log = NULL;
     }
     if (fname && strcmp(fname, "none") != 0) {
-       log_fd = file_open(fname, NULL, O_WRONLY | O_CREAT | O_APPEND, NULL, NULL);
+       log_fd = file_open(fname, O_WRONLY | O_CREAT | O_APPEND, NULL, NULL);
        if (log_fd < 0) {
            debug(50, 0, "useragentOpenLog: %s: %s\n", fname, xstrerror());
        } else if ((cache_useragent_log = fdopen(log_fd, "a")) == NULL) {
index 6e5b0f929e3dd1b33d13b1a4a408627d442f3ddb..e5b425d3c2028c396fe15b89458681f52ed5adaa 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: wais.cc,v 1.68 1997/04/30 20:06:37 wessels Exp $
+ * $Id: wais.cc,v 1.69 1997/05/02 21:34:19 wessels Exp $
  *
  * DEBUG: section 24    WAIS Relay
  * AUTHOR: Harvest Derived
@@ -120,10 +120,9 @@ typedef struct {
 } WaisStateData;
 
 static PF waisStateFree;
-static void waisStartComplete _PARAMS((void *, int));
 static PF waisTimeout;
 static PF waisReadReply;
-static void waisSendComplete _PARAMS((int, char *, int, int, void *));
+static CWCB waisSendComplete;
 static PF waisSendRequest;
 static IPH waisConnect;
 static CNCB waisConnectDone;
@@ -335,23 +334,15 @@ waisStart(method_t method, char *mime_hdr, StoreEntry * entry)
        waisStateFree,
        waisState);
     commSetTimeout(fd, Config.Timeout.read, waisTimeout, waisState);
-    storeLockObject(entry, waisStartComplete, waisState);
-    return COMM_OK;
-}
-
-
-static void
-waisStartComplete(void *data, int status)
-{
-    WaisStateData *waisState = data;
+    storeLockObject(entry, NULL, NULL);
     waisState->ip_lookup_pending = 1;
     ipcache_nbgethostbyname(waisState->relayhost,
        waisState->fd,
        waisConnect,
        waisState);
+    return COMM_OK;
 }
 
-
 static void
 waisConnect(int fd, const ipcache_addrs * ia, void *data)
 {