/*
- * $Id: forward.cc,v 1.37 1998/12/14 05:19:36 wessels Exp $
+ * $Id: forward.cc,v 1.38 1998/12/16 06:04:15 wessels Exp $
*
* DEBUG: section 17 Request Forwarding
* AUTHOR: Duane Wessels
static int fwdCheckRetry(FwdState * fwdState);
static int fwdReforward(FwdState *);
static void fwdStartFail(FwdState *);
+static void fwdLogReplyStatus(int tries, http_status status);
+static OBJH fwdStats;
+
+#define MAX_FWD_STATS_IDX 9
+static int FwdReplyCodes[MAX_FWD_STATS_IDX+1][HTTP_INVALID_HEADER+1];
static void
fwdServerFree(FwdServer * fs)
storeUrl(e));
if (fwdState->server_fd > -1)
fwdUnregister(fwdState->server_fd, fwdState);
+ fwdLogReplyStatus(fwdState->n_tries, e->mem_obj->reply->sline.status);
storeEntryReset(e);
fwdStartComplete(fwdState->servers, fwdState);
} else {
fwdStateFree(fwdState);
}
}
+
+void
+fwdInit(void)
+{
+ cachemgrRegister("forward",
+ "Request Forwarding Statistics",
+ fwdStats, 0, 1);
+}
+
+static void
+fwdLogReplyStatus(int tries, http_status status)
+{
+ if (status > HTTP_INVALID_HEADER)
+ return;
+ assert(tries);
+ tries--;
+ if (tries > MAX_FWD_STATS_IDX)
+ tries = MAX_FWD_STATS_IDX;
+ FwdReplyCodes[tries][status]++;
+}
+
+static void
+fwdStats(StoreEntry *s)
+{
+ int i;
+ int j;
+ for (i=0; i<=(int) HTTP_INVALID_HEADER; i++) {
+ storeAppendPrintf(s, "%3d", i);
+ for (j=0; j<=MAX_FWD_STATS_IDX; j++) {
+ storeAppendPrintf(s, "\t%d", FwdReplyCodes[j][i]);
+ }
+ storeAppendPrintf(s, "\n");
+ }
+}
/*
- * $Id: main.cc,v 1.281 1998/12/11 21:01:13 wessels Exp $
+ * $Id: main.cc,v 1.282 1998/12/16 06:04:16 wessels Exp $
*
* DEBUG: section 1 Startup and Main Loop
* AUTHOR: Harvest Derived
#if DELAY_POOLS
delayPoolsInit();
#endif
+ fwdInit();
}
serverConnectionsOpen();
if (theOutIcpConnection >= 0) {
/*
- * $Id: protos.h,v 1.296 1998/12/11 23:45:12 wessels Exp $
+ * $Id: protos.h,v 1.297 1998/12/16 06:04:17 wessels Exp $
*
*
* SQUID Internet Object Cache http://squid.nlanr.net/Squid/
extern STABH fwdAbort;
extern void fwdUnregister(int fd, FwdState *);
extern void fwdComplete(FwdState * fwdState);
-
+extern void fwdInit(void);
extern void urnStart(request_t *, StoreEntry *);
/*
* store_swapout.c
*/
-extern void storeSwapOutStart(StoreEntry * e);
-extern void storeSwapOutHandle(int fdnotused, int flag, size_t len, void *data);
extern void storeCheckSwapOut(StoreEntry * e);
extern void storeSwapOutFileClose(StoreEntry * e);
extern int storeSwapOutWriteQueued(MemObject * mem);