]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Summary: comm cleanups.
authorrobertc <>
Mon, 23 Jun 2003 20:13:03 +0000 (20:13 +0000)
committerrobertc <>
Mon, 23 Jun 2003 20:13:03 +0000 (20:13 +0000)
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.

src/client_side.cc
src/comm.cc
src/fde.h

index 8a5748f82d06facd0f45bffb14ad106d3053cfff..d19830d33e4f998dcfcb522ccbc59e34ac4db4b6 100644 (file)
@@ -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
          */
index 4d158432b9e936913b71624f6224b4f8f1280844..a2de29718d48c126c4449cb1d341726d6e87bf22 100644 (file)
@@ -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;
index 5f6a282d3af0cb5e43b4afe23cefdb48e114bd3d..998455c3658e9d9b8bbce659f362b50a44446d1f 100644 (file)
--- 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