/*
- * $Id: disk.cc,v 1.32 1996/10/09 15:34:24 wessels Exp $
+ * $Id: disk.cc,v 1.33 1996/10/10 22:20:27 wessels Exp $
*
* DEBUG: section 6 Disk I/O Routines
* AUTHOR: Harvest Derived
FD_ENTRY *conn;
int fd;
- if (mode & O_RDWR)
- fatal_dump("file_open: O_RDWR not allowed");
if (mode & O_WRONLY)
mode |= O_APPEND;
#if defined(O_NONBLOCK) && !defined(_SQUID_SUNOS_) && !defined(_SQUID_SOLARIS_)
/*
- * $Id: fqdncache.cc,v 1.23 1996/10/10 19:04:14 wessels Exp $
+ * $Id: fqdncache.cc,v 1.24 1996/10/10 22:20:28 wessels Exp $
*
* DEBUG: section 35 FQDN Cache
* AUTHOR: Harvest Derived
meta_data.fqdncache_count++;
new = xcalloc(1, sizeof(fqdncache_entry));
return new;
-
}
static void
{
fqdncache_entry *f;
fqdncache_entry **list;
+ int i = 0;
+ int j = 0;
int k = 0;
- int j;
list = xcalloc(meta_data.fqdncache_count, sizeof(fqdncache_entry *));
f = (fqdncache_entry *) hash_first(fqdn_table);
- while (f && k < meta_data.fqdncache_count) {
- *(list + k) = f;
- k++;
+ while (f && i < meta_data.fqdncache_count) {
+ *(list + i) = f;
+ i++;
f = (fqdncache_entry *) hash_next(fqdn_table);
}
- for (j = 0; j < k; j++) {
+ for (j = 0; j < i; j++) {
f = *(list + j);
for (k = 0; k < (int) f->name_count; k++)
safe_free(f->names[k]);
/*
- * $Id: icmp.cc,v 1.15 1996/10/10 18:48:49 wessels Exp $
+ * $Id: icmp.cc,v 1.16 1996/10/10 22:20:28 wessels Exp $
*
* DEBUG: section 37 ICMP Routines
* AUTHOR: Duane Wessels
char *msg;
int len;
struct _icmpQueueData *next;
- void (*free) _PARAMS((void *));
+ void (*free_func) _PARAMS((void *));
} icmpQueueData;
static icmpQueueData *IcmpQueueHead = NULL;
static void icmpRecv _PARAMS((int, void *));
static void icmpQueueSend _PARAMS((pingerEchoData * pkt,
int len,
- void (*free) _PARAMS((void *))));
+ void (*free_func) _PARAMS((void *))));
static void icmpSend _PARAMS((int fd, icmpQueueData * queue));
static void icmpHandleSourcePing _PARAMS((struct sockaddr_in * from, char *buf));
icmpQueueData *queue;
debug(29,0,"Closing ICMP socket on FD %d\n", icmp_sock);
comm_close(icmp_sock);
+ comm_set_select_handler(icmp_sock,
+ COMM_SELECT_READ,
+ NULL,
+ NULL);
+ icmp_sock = -1;
while ((queue = IcmpQueueHead)) {
IcmpQueueHead = queue->next;
- if (queue->free)
- queue->free(queue->msg);
+ if (queue->free_func)
+ queue->free_func(queue->msg);
safe_free(queue);
}
}
static void
icmpQueueSend(pingerEchoData * pkt,
int len,
- void (*free) _PARAMS((void *)))
+ void (*free_func) _PARAMS((void *)))
{
icmpQueueData *q = NULL;
icmpQueueData **H = NULL;
+ if (icmp_sock < 0) {
+ if (free_func)
+ free_func(pkt);
+ return;
+ }
debug(37, 3, "icmpQueueSend: Queueing %d bytes\n", len);
q = xcalloc(1, sizeof(icmpQueueData));
q->msg = (char *) pkt;
q->len = len;
- q->free = free;
+ q->free_func = free_func;
for (H = &IcmpQueueHead; *H; H = &(*H)->next);
*H = q;
comm_set_select_handler(icmp_sock,
debug(37, 0, "icmpSend: Wrote %d of %d bytes\n", x, queue->len);
}
IcmpQueueHead = queue->next;
- if (queue->free)
- queue->free(queue->msg);
+ if (queue->free_func)
+ queue->free_func(queue->msg);
safe_free(queue);
}
/* Reinstate handler if needed */
/*
- * $Id: main.cc,v 1.89 1996/10/09 15:43:52 wessels Exp $
+ * $Id: main.cc,v 1.90 1996/10/10 22:20:29 wessels Exp $
*
* DEBUG: section 1 Startup and Main Loop
* AUTHOR: Harvest Derived
theInIcpConnection = -1;
}
#if USE_ICMP
- icmpClose();
+ if (icmp_sock > -1)
+ icmpClose();
#endif
}
/*
- * $Id: redirect.cc,v 1.23 1996/10/09 22:49:41 wessels Exp $
+ * $Id: redirect.cc,v 1.24 1996/10/10 22:20:30 wessels Exp $
*
* DEBUG: section 29 Redirector
* AUTHOR: Duane Wessels
#define REDIRECT_FLAG_ALIVE 0x01
#define REDIRECT_FLAG_BUSY 0x02
-#define REDIRECT_FLAG_CLOSING 0x04
+#define REDIRECT_FLAG_CLOSING 0x04
typedef struct {
int fd;
static void Enqueue _PARAMS((redirectStateData *));
static void redirectDispatch _PARAMS((redirector_t *, redirectStateData *));
-
static redirector_t **redirect_child_table = NULL;
static int NRedirectors = 0;
static int NRedirectorsOpen = 0;
redirect->index + 1, redirect->fd);
comm_close(redirect->fd);
redirect->flags |= REDIRECT_FLAG_CLOSING;
+ redirect->flags |= REDIRECT_FLAG_BUSY;
}
}
/*
- * $Id: tools.cc,v 1.69 1996/10/10 19:04:20 wessels Exp $
+ * $Id: tools.cc,v 1.70 1996/10/10 22:20:30 wessels Exp $
*
* DEBUG: section 21 Misc Functions
* AUTHOR: Harvest Derived
PrintRusage(NULL, debug_log);
storeCloseLog();
statCloseLog();
- fclose(debug_log);
configFreeMemory();
diskFreeMemory();
storeFreeMemory();
fqdncacheFreeMemory();
debug(21, 0, "Squid Cache (Version %s): Exiting normally.\n",
version_string);
+ fclose(debug_log);
exit(0);
}