From: wessels <> Date: Thu, 23 Oct 1997 22:38:09 +0000 (+0000) Subject: narf, the defer_check needs a separate defer_data. Either that or we X-Git-Tag: SQUID_3_0_PRE1~4729 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=70a9dab4d5b7bac6d611641dddb1e88231634989;p=thirdparty%2Fsquid.git narf, the defer_check needs a separate defer_data. Either that or we have to write N different 'defer' functions for ftp/http/gopher/wais because their read_data's are all different. --- diff --git a/src/comm.cc b/src/comm.cc index 89dee33d3c..6b7bd412a6 100644 --- a/src/comm.cc +++ b/src/comm.cc @@ -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 diff --git a/src/ftp.cc b/src/ftp.cc index b7bd2900d9..06e38e678e 100644 --- a/src/ftp.cc +++ b/src/ftp.cc @@ -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); diff --git a/src/gopher.cc b/src/gopher.cc index cc73d3cfba..4935eff45d 100644 --- a/src/gopher.cc +++ b/src/gopher.cc @@ -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. */ } diff --git a/src/http.cc b/src/http.cc index 30bfe43281..f06a822586 100644 --- a/src/http.cc +++ b/src/http.cc @@ -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); } } diff --git a/src/main.cc b/src/main.cc index c7b2818cf3..1a87344759 100644 --- a/src/main.cc +++ b/src/main.cc @@ -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; diff --git a/src/protos.h b/src/protos.h index 2828256e87..5461bdac92 100644 --- a/src/protos.h +++ b/src/protos.h @@ -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)); diff --git a/src/structs.h b/src/structs.h index 8996830980..c5367dbb6b 100644 --- a/src/structs.h +++ b/src/structs.h @@ -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 */ }; diff --git a/src/wais.cc b/src/wais.cc index ec41d75795..8f214fa745 100644 --- a/src/wais.cc +++ b/src/wais.cc @@ -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); } }