From: adrian <> Date: Wed, 16 Oct 2002 21:03:12 +0000 (+0000) Subject: Don't cheat and schedule immediate callbacks w/ NULL parameters - X-Git-Tag: SQUID_3_0_PRE1~637 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=691476e2f4561390702ab49d58f4fb8238c35779;p=thirdparty%2Fsquid.git Don't cheat and schedule immediate callbacks w/ NULL parameters - copy by deference fails! Instead, just call them manually if they exist. No harm done. --- diff --git a/src/comm.cc b/src/comm.cc index 8e896c2cf8..d78abc8c50 100644 --- a/src/comm.cc +++ b/src/comm.cc @@ -1,6 +1,6 @@ /* - * $Id: comm.cc,v 1.339 2002/10/15 00:59:49 adrian Exp $ + * $Id: comm.cc,v 1.340 2002/10/16 15:03:12 adrian Exp $ * * DEBUG: section 5 Socket Functions * AUTHOR: Harvest Derived @@ -1138,19 +1138,20 @@ _comm_close(int fd, char *file, int line) commSetTimeout(fd, -1, NULL, NULL); CommWriteStateCallbackAndFree(fd, COMM_ERR_CLOSING); - /* Schedule immediate callbacks for the read/accept/fill routines, if any */ + /* Do callbacks for read/accept/fill routines, if any */ if (fdc_table[fd].read.handler) { - comm_addreadcallback(fd, fdc_table[fd].read.handler, fdc_table[fd].read.buf, - 0, COMM_ERR_CLOSING, 0, fdc_table[fd].read.handler_data); + fdc_table[fd].read.handler(fd, fdc_table[fd].read.buf, 0, + COMM_ERR_CLOSING, 0, fdc_table[fd].read.handler_data); fdc_table[fd].read.handler = NULL; } if (fdc_table[fd].accept.handler) { - comm_addacceptcallback(fd, -1, fdc_table[fd].accept.handler, NULL, NULL, - COMM_ERR_CLOSING, 0, fdc_table[fd].accept.handler_data); + fdc_table[fd].accept.handler(fd, -1, NULL, NULL, COMM_ERR_CLOSING, + 0, fdc_table[fd].accept.handler_data); fdc_table[fd].accept.handler = NULL; } if (fdc_table[fd].fill.handler) { - comm_add_fill_callback(fd, 0, COMM_ERR_CLOSING, 0); + fdc_table[fd].fill.handler(fd, fdc_table[fd].fill.requestedData, COMM_ERR_CLOSING, 0, + fdc_table[fd].fill.handler_data); fdc_table[fd].fill.handler = NULL; } /* Complete (w/ COMM_ERR_CLOSING!) any pending io callbacks */