From: robertc <> Date: Mon, 23 Jun 2003 20:13:03 +0000 (+0000) Subject: Summary: comm cleanups. X-Git-Tag: SQUID_3_0_PRE1~88 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=dec5db5d459869a40175003f45731a99cb9a4999;p=thirdparty%2Fsquid.git Summary: comm cleanups. Keywords: * Add a FIXME comment in disabled client_side code where fd abstraction is broken. * fde.rwstate is actually specific to writes - rename to wstate. * The warning about rwstate should be a fatal, as it leads to incorrect callbacks occuring. disabling persistent connections will disable this bug - so a fatal is no impediment to testers. --- diff --git a/src/client_side.cc b/src/client_side.cc index 8a5748f82d..d19830d33e 100644 --- a/src/client_side.cc +++ b/src/client_side.cc @@ -1,6 +1,6 @@ /* - * $Id: client_side.cc,v 1.642 2003/06/23 08:38:39 hno Exp $ + * $Id: client_side.cc,v 1.643 2003/06/23 14:13:03 robertc Exp $ * * DEBUG: section 33 Client-side Routines * AUTHOR: Duane Wessels @@ -2526,7 +2526,10 @@ requestTimeout(int fd, void *data) ConnStateData *conn = data; debug(33, 3) ("requestTimeout: FD %d: lifetime is expired.\n", fd); - if (fd_table[fd].rwstate) { + if (fd_table[fd].wstate) { + /* FIXME: If this code is reinstated, check the conn counters, + * not the fd table state + */ /* * Some data has been sent to the client, just close the FD */ diff --git a/src/comm.cc b/src/comm.cc index 4d158432b9..a2de29718d 100644 --- a/src/comm.cc +++ b/src/comm.cc @@ -1,6 +1,6 @@ /* - * $Id: comm.cc,v 1.377 2003/06/23 12:27:12 robertc Exp $ + * $Id: comm.cc,v 1.378 2003/06/23 14:13:03 robertc Exp $ * * DEBUG: section 5 Socket Functions * AUTHOR: Harvest Derived @@ -1009,10 +1009,10 @@ comm_accept_check_event(void *data) static void CommWriteStateCallbackAndFree(int fd, comm_err_t code) { - CommWriteStateData *CommWriteState = fd_table[fd].rwstate; + CommWriteStateData *CommWriteState = fd_table[fd].wstate; CWCB *callback = NULL; void *cbdata; - fd_table[fd].rwstate = NULL; + fd_table[fd].wstate = NULL; if (CommWriteState == NULL) return; @@ -2146,8 +2146,6 @@ commHandleWrite(int fd, void *data) { PROF_stop(commHandleWrite); } - - /* * Queue a write. handler/handler_data are called when the write * completes, on error, or on file descriptor close. @@ -2156,7 +2154,7 @@ commHandleWrite(int fd, void *data) { */ void comm_old_write(int fd, const char *buf, int size, CWCB * handler, void *handler_data, FREE * free_func) { - CommWriteStateData *state = fd_table[fd].rwstate; + CommWriteStateData *state = fd_table[fd].wstate; assert(!fd_table[fd].flags.closing); @@ -2164,12 +2162,15 @@ comm_old_write(int fd, const char *buf, int size, CWCB * handler, void *handler_ fd, size, handler, handler_data); if (NULL != state) { - debug(5, 1) ("comm_write: fd_table[%d].rwstate != NULL\n", fd); + /* This means that the write has been scheduled, but has not + * triggered yet + */ + fatalf ("comm_write: fd_table[%d].wstate != NULL\n", fd); memPoolFree(comm_write_pool, state); - fd_table[fd].rwstate = NULL; + fd_table[fd].wstate = NULL; } - fd_table[fd].rwstate = state = (CommWriteStateData *)memPoolAlloc(comm_write_pool); + fd_table[fd].wstate = state = (CommWriteStateData *)memPoolAlloc(comm_write_pool); state->buf = (char *) buf; state->size = size; state->offset = 0; diff --git a/src/fde.h b/src/fde.h index 5f6a282d3a..998455c365 100644 --- a/src/fde.h +++ b/src/fde.h @@ -1,6 +1,6 @@ /* - * $Id: fde.h,v 1.3 2003/03/04 01:40:27 robertc Exp $ + * $Id: fde.h,v 1.4 2003/06/23 14:13:03 robertc Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -109,7 +109,7 @@ unsigned int read_pending: void *timeout_data; void *lifetime_data; close_handler *closeHandler; /* linked list */ - CommWriteStateData *rwstate; /* State data for comm_write */ + CommWriteStateData *wstate; /* State data for comm_write */ READ_HANDLER *read_method; WRITE_HANDLER *write_method; #if USE_SSL