/*
- * $Id: fd.cc,v 1.29 1999/01/12 16:42:18 wessels Exp $
+ * $Id: fd.cc,v 1.30 1999/01/12 23:37:41 wessels Exp $
*
* DEBUG: section 51 Filedescriptor Functions
* AUTHOR: Duane Wessels
{
fde *F = &fd_table[fd];
assert(fd >= 0);
- if (!F->flags.open) {
+ if (F->flags.open) {
debug(51, 1) ("WARNING: Closing open FD %4d\n", fd);
fd_close(fd);
}
continue;
if (i == fileno(debug_log))
continue;
- debug(51, 1) ("Open FD %s %4d %s\n",
- F->type == FD_READ ? "reading" : "writing",
+ debug(51, 1) ("Open FD %-10s %4d %s\n",
+ F->bytes_read && F->bytes_written ? "READ/WRITE" :
+ F->bytes_read ? "READING" :
+ F->bytes_written ? "WRITING" : null_string,
i, F->desc);
}
}
/*
- * $Id: forward.cc,v 1.43 1999/01/11 23:29:42 wessels Exp $
+ * $Id: forward.cc,v 1.44 1999/01/12 23:37:42 wessels Exp $
*
* DEBUG: section 17 Request Forwarding
* AUTHOR: Duane Wessels
static void fwdStartFail(FwdState *);
static void fwdLogReplyStatus(int tries, http_status status);
static OBJH fwdStats;
+static STABH fwdAbort;
#define MAX_FWD_STATS_IDX 9
static int FwdReplyCodes[MAX_FWD_STATS_IDX + 1][HTTP_INVALID_HEADER + 1];
return;
}
}
+ debug(17, 3) ("fwdStart: '%s'\n", storeUrl(e));
+ e->mem_obj->request = requestLink(r);
+ e->mem_obj->fd = fd;
if (shutting_down) {
/* more yuck */
err = errorCon(ERR_SHUTTING_DOWN, HTTP_SERVICE_UNAVAILABLE);
errorAppendEntry(e, err);
return;
}
- debug(17, 3) ("fwdStart: '%s'\n", storeUrl(e));
- e->mem_obj->request = requestLink(r);
- e->mem_obj->fd = fd;
switch (r->protocol) {
/*
* Note, don't create fwdState for these requests
fwdState->request = requestLink(r);
fwdState->start = squid_curtime;
storeLockObject(e);
+ storeRegisterAbort(e, fwdAbort, fwdState);
peerSelect(r, e, fwdStartComplete, fwdState);
}
fwdState->fail.xerrno = xerrno;
}
+/*
+ * Called when someone else calls StoreAbort() on this entry
+ */
+void
+fwdAbort(void *data)
+{
+ FwdState *fwdState = data;
+ debug(17, 3) ("fwdAbort: %s\n", storeUrl(fwdState->entry));
+ fwdStateFree(fwdState);
+}
+
/*
* Frees fwdState without closing FD or generating an abort
*/
/*
- * $Id: ftp.cc,v 1.262 1999/01/12 15:47:51 wessels Exp $
+ * $Id: ftp.cc,v 1.263 1999/01/12 23:37:43 wessels Exp $
*
* DEBUG: section 9 File Transfer Protocol (FTP)
* AUTHOR: Harvest Derived
delay_id delay_id = delayMostBytesAllowed(mem);
#endif
assert(fd == ftpState->data.fd);
- if (EBIT_TEST(entry->flags, ENTRY_ABORTED)) {
- comm_close(fd);
- return;
- }
errno = 0;
read_sz = ftpState->data.size - ftpState->data.offset;
#if DELAY_POOLS
/*
- * $Id: gopher.cc,v 1.143 1999/01/12 15:47:52 wessels Exp $
+ * $Id: gopher.cc,v 1.144 1999/01/12 23:37:45 wessels Exp $
*
* DEBUG: section 10 Gopher
* AUTHOR: Harvest Derived
#if DELAY_POOLS
delay_id delay_id = delayMostBytesAllowed(entry->mem_obj);
#endif
- if (EBIT_TEST(entry->flags, ENTRY_ABORTED)) {
- comm_close(fd);
- return;
- }
errno = 0;
buf = memAllocate(MEM_4K_BUF);
read_sz = 4096 - 1; /* leave room for termination */
/*
- * $Id: http.cc,v 1.337 1999/01/12 15:47:53 wessels Exp $
+ * $Id: http.cc,v 1.338 1999/01/12 23:37:46 wessels Exp $
*
* DEBUG: section 11 Hypertext Transfer Protocol (HTTP)
* AUTHOR: Harvest Derived
#if DELAY_POOLS
delay_id delay_id = delayMostBytesAllowed(entry->mem_obj);
#endif
- if (EBIT_TEST(entry->flags, ENTRY_ABORTED)) {
- comm_close(fd);
- return;
- }
/* check if we want to defer reading */
errno = 0;
read_sz = SQUID_TCP_SO_RCVBUF;
/*
- * $Id: protos.h,v 1.301 1999/01/12 15:47:54 wessels Exp $
+ * $Id: protos.h,v 1.302 1999/01/12 23:37:47 wessels Exp $
*
*
* SQUID Internet Object Cache http://squid.nlanr.net/Squid/
extern void storeComplete(StoreEntry *);
extern void storeInit(void);
extern int storeClientWaiting(const StoreEntry *);
-extern void storeAbort(StoreEntry *, int);
+extern void storeAbort(StoreEntry *);
extern void storeAppend(StoreEntry *, const char *, int);
extern void storeLockObject(StoreEntry *);
extern void storeSwapInStart(StoreEntry *, SIH *, void *data);
/*
- * $Id: store.cc,v 1.480 1999/01/12 16:23:22 wessels Exp $
+ * $Id: store.cc,v 1.481 1999/01/12 23:37:49 wessels Exp $
*
* DEBUG: section 20 Storage Manager
* AUTHOR: Harvest Derived
* entry for releasing
*/
void
-storeAbort(StoreEntry * e, int cbflag)
+storeAbort(StoreEntry * e)
{
MemObject *mem = e->mem_obj;
STABH *callback;
*/
mem->object_sz = mem->inmem_hi;
/* Notify the server side */
- if (cbflag && mem->abort.callback) {
+ if (mem->abort.callback) {
callback = mem->abort.callback;
data = mem->abort.data;
mem->abort.callback = NULL;
/*
- * $Id: store_client.cc,v 1.52 1999/01/11 16:50:42 wessels Exp $
+ * $Id: store_client.cc,v 1.53 1999/01/12 23:37:50 wessels Exp $
*
* DEBUG: section 20 Storage Manager Client-Side Interface
* AUTHOR: Duane Wessels
if (CheckQuickAbort2(entry) == 0)
return;
Counter.aborted_requests++;
- storeAbort(entry, 1);
+ storeAbort(entry);
}
/*
- * $Id: store_swapout.cc,v 1.41 1999/01/11 16:50:43 wessels Exp $
+ * $Id: store_swapout.cc,v 1.42 1999/01/12 23:37:51 wessels Exp $
*
* DEBUG: section 20 Storage Manager Swapout Functions
* AUTHOR: Duane Wessels
(int) mem->swapout.done_offset);
#if USE_ASYNC_IO
if (mem->inmem_hi < mem->swapout.queue_offset) {
- storeAbort(e, 0);
+ storeAbort(e);
assert(EBIT_TEST(e->flags, RELEASE_REQUEST));
storeSwapOutFileClose(e);
return;
/*
- * $Id: structs.h,v 1.257 1999/01/12 16:42:20 wessels Exp $
+ * $Id: structs.h,v 1.258 1999/01/12 23:37:52 wessels Exp $
*
*
* SQUID Internet Object Cache http://squid.nlanr.net/Squid/
struct _fde {
unsigned int type;
- unsigned int mode; /* FD_READ|FD_WRITE */
u_short local_port;
u_short remote_port;
char ipaddr[16]; /* dotted decimal address of peer */
/*
- * $Id: wais.cc,v 1.125 1999/01/12 15:47:57 wessels Exp $
+ * $Id: wais.cc,v 1.126 1999/01/12 23:37:53 wessels Exp $
*
* DEBUG: section 24 WAIS Relay
* AUTHOR: Harvest Derived
#if DELAY_POOLS
delay_id delay_id = delayMostBytesAllowed(entry->mem_obj);
#endif
- if (EBIT_TEST(entry->flags, ENTRY_ABORTED)) {
- comm_close(fd);
- return;
- }
errno = 0;
read_sz = 4096;
#if DELAY_POOLS