]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
narf, the defer_check needs a separate defer_data. Either that or we
authorwessels <>
Thu, 23 Oct 1997 22:38:09 +0000 (22:38 +0000)
committerwessels <>
Thu, 23 Oct 1997 22:38:09 +0000 (22:38 +0000)
have to write N different 'defer' functions for ftp/http/gopher/wais
because their read_data's are all different.

src/comm.cc
src/ftp.cc
src/gopher.cc
src/http.cc
src/main.cc
src/protos.h
src/structs.h
src/wais.cc

index 89dee33d3cef690c46d3ba632de19e6cff224ea9..6b7bd412a6d0556c094afaadd868f07d7cc553ab 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: comm.cc,v 1.190 1997/10/23 05:13:37 wessels Exp $
+ * $Id: comm.cc,v 1.191 1997/10/23 16:38:09 wessels Exp $
  *
  * DEBUG: section 5     Socket Functions
  * AUTHOR: Harvest Derived
@@ -630,10 +630,11 @@ comm_udp_sendto(int fd,
 }
 
 void
-commSetDefer(int fd, DEFER * func)
+commSetDefer(int fd, DEFER * func, void *data)
 {
     fde *F = &fd_table[fd];
     F->defer_check = func;
+    F->defer_data = data;
 }
 
 static int
@@ -642,7 +643,7 @@ commDeferRead(int fd)
     fde *F = &fd_table[fd];
     if (F->defer_check == NULL)
        return 0;
-    return F->defer_check(fd, F->read_data);
+    return F->defer_check(fd, F->defer_data);
 }
 
 #if HAVE_POLL
index b7bd2900d9b8774ae7c01d23f42fd445d1635bb7..06e38e678e58e5b93cd3add593b895c05e8a199a 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: ftp.cc,v 1.145 1997/10/23 05:13:39 wessels Exp $
+ * $Id: ftp.cc,v 1.146 1997/10/23 16:38:10 wessels Exp $
  *
  * DEBUG: section 9     File Transfer Protocol (FTP)
  * AUTHOR: Harvest Derived
@@ -1431,7 +1431,7 @@ ftpReadList(FtpStateData * ftpState)
            ftpReadData,
            ftpState,
            0);
-       commSetDefer(ftpState->data.fd, protoCheckDeferRead);
+       commSetDefer(ftpState->data.fd, protoCheckDeferRead, ftpState->entry);
        ftpState->state = READING_DATA;
        return;
     } else if (!EBIT_TEST(ftpState->flags, FTP_TRIED_NLST)) {
@@ -1458,7 +1458,7 @@ ftpReadRetr(FtpStateData * ftpState)
            ftpReadData,
            ftpState,
            0);
-       commSetDefer(ftpState->data.fd, protoCheckDeferRead);
+       commSetDefer(ftpState->data.fd, protoCheckDeferRead, ftpState->entry);
        ftpState->state = READING_DATA;
     } else {
        ftpFail(ftpState);
index cc73d3cfba6f543d78c40f5496d4dbccf883a820..4935eff45de934ea469414ee355b178f1c59a947 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: gopher.cc,v 1.101 1997/10/23 05:13:39 wessels Exp $
+ * $Id: gopher.cc,v 1.102 1997/10/23 16:38:10 wessels Exp $
  *
  * DEBUG: section 10    Gopher
  * AUTHOR: Harvest Derived
@@ -759,8 +759,7 @@ static void
 gopherSendComplete(int fd, char *buf, int size, int errflag, void *data)
 {
     GopherStateData *gopherState = (GopherStateData *) data;
-    StoreEntry *entry = NULL;
-    entry = gopherState->entry;
+    StoreEntry *entry = gopherState->entry;
     debug(10, 5) ("gopherSendComplete: FD %d size: %d errflag: %d\n",
        fd, size, errflag);
     if (errflag) {
@@ -811,7 +810,7 @@ gopherSendComplete(int fd, char *buf, int size, int errflag, void *data)
     }
     /* Schedule read reply. */
     commSetSelect(fd, COMM_SELECT_READ, gopherReadReply, gopherState, 0);
-    commSetDefer(fd, protoCheckDeferRead);
+    commSetDefer(fd, protoCheckDeferRead, entry);
     if (buf)
        put_free_4k_page(buf);  /* Allocated by gopherSendRequest. */
 }
index 30bfe43281e2d73002c9e783ff283bd4c59babcb..f06a8225861e2a9bf4d470518d55cab9cc4127eb 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: http.cc,v 1.194 1997/10/23 05:13:40 wessels Exp $
+ * $Id: http.cc,v 1.195 1997/10/23 16:38:11 wessels Exp $
  *
  * DEBUG: section 11    Hypertext Transfer Protocol (HTTP)
  * AUTHOR: Harvest Derived
@@ -709,7 +709,7 @@ httpSendComplete(int fd, char *buf, int size, int errflag, void *data)
            COMM_SELECT_READ,
            httpReadReply,
            httpState, 0);
-       commSetDefer(fd, protoCheckDeferRead);
+       commSetDefer(fd, protoCheckDeferRead, entry);
     }
 }
 
index c7b2818cf3989c14fe671e53d18296a664f2e458..1a87344759e25efe0a6d5b23b0baecfd503a5c5c 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: main.cc,v 1.176 1997/10/23 05:13:42 wessels Exp $
+ * $Id: main.cc,v 1.177 1997/10/23 16:38:13 wessels Exp $
  *
  * DEBUG: section 1     Startup and Main Loop
  * AUTHOR: Harvest Derived
@@ -326,7 +326,7 @@ serverConnectionsOpen(void)
            continue;
        comm_listen(fd);
        commSetSelect(fd, COMM_SELECT_READ, httpAccept, NULL, 0);
-       commSetDefer(fd, httpAcceptDefer);
+       commSetDefer(fd, httpAcceptDefer, NULL);
        debug(1, 1) ("Accepting HTTP connections on port %d, FD %d.\n",
            (int) u->i, fd);
        HttpSockets[NHttpSockets++] = fd;
index 2828256e878d15fb6171c06af019e5d96cfc80aa..5461bdac922c64d1218fb46549bf0b7aa58743ae 100644 (file)
@@ -107,7 +107,7 @@ extern void comm_write _PARAMS((int fd,
        FREE *));
 extern void commCallCloseHandlers _PARAMS((int fd));
 extern int commSetTimeout _PARAMS((int fd, int, PF *, void *));
-extern void commSetDefer(int fd, DEFER * func);
+extern void commSetDefer(int fd, DEFER * func, void *);
 
 extern void _db_init _PARAMS((const char *logfile, const char *options));
 extern void _db_rotate_log _PARAMS((void));
index 89968309805aace067e48253cce57e36653935ce..c5367dbb6b0b96ebba7af38fa06206e0934915a2 100644 (file)
@@ -327,6 +327,7 @@ struct _fde {
     void *lifetime_data;
     close_handler *close_handler;      /* linked list */
     DEFER *defer_check;                /* check if we should defer read */
+    void *defer_data;
     CommWriteStateData *rwstate;       /* State data for comm_write */
 };
 
index ec41d7579541c596b2aacacf8174432876afc97e..8f214fa74566302ed4fc174fb80ef6ee6dc667a8 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: wais.cc,v 1.87 1997/10/23 05:13:46 wessels Exp $
+ * $Id: wais.cc,v 1.88 1997/10/23 16:38:16 wessels Exp $
  *
  * DEBUG: section 24    WAIS Relay
  * AUTHOR: Harvest Derived
@@ -268,7 +268,7 @@ waisSendComplete(int fd, char *buf, int size, int errflag, void *data)
            COMM_SELECT_READ,
            waisReadReply,
            waisState, 0);
-       commSetDefer(fd, protoCheckDeferRead);
+       commSetDefer(fd, protoCheckDeferRead, entry);
     }
 }