From: wessels <> Date: Sat, 29 Nov 1997 06:48:07 +0000 (+0000) Subject: code reuse; commCallCloseHandlers() X-Git-Tag: SQUID_3_0_PRE1~4458 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=3be3bbc6d403e8051299003b30017917d88b2a5b;p=thirdparty%2Fsquid.git code reuse; commCallCloseHandlers() --- diff --git a/src/comm.cc b/src/comm.cc index 335e8a84d9..019a3c3600 100644 --- a/src/comm.cc +++ b/src/comm.cc @@ -1,6 +1,6 @@ /* - * $Id: comm.cc,v 1.207 1997/11/28 19:47:22 wessels Exp $ + * $Id: comm.cc,v 1.208 1997/11/28 23:48:07 wessels Exp $ * * DEBUG: section 5 Socket Functions * AUTHOR: Harvest Derived @@ -912,7 +912,6 @@ comm_poll(time_t sec) } if (revents & POLLNVAL) { close_handler *ch; - close_handler *next; fde *F = &fd_table[fd]; debug(5, 0) ("WARNING: FD %d has handlers, but it's invalid.\n", fd); debug(5, 0) ("FD %d is a %s\n", fd, fdstatTypeStr[fd_table[fd].type]); @@ -924,13 +923,7 @@ comm_poll(time_t sec) for (ch = F->close_handler; ch; ch = ch->next) debug(5, 0) (" close handler: %p\n", ch->handler); if (F->close_handler) { - for (ch = F->close_handler; ch; ch = next) { - next = ch->next; - if (cbdataValid(ch->data)) - ch->handler(fd, ch->data); - cbdataUnlock(ch->data); - safe_free(ch); - } + commCallCloseHandlers(fd); } else if (F->timeout_handler) { debug(5, 0) ("comm_poll: Calling Timeout Handler\n"); F->timeout_handler(fd, F->timeout_data); @@ -1232,7 +1225,6 @@ examine_select(fd_set * readfds, fd_set * writefds) int num; struct timeval tv; close_handler *ch = NULL; - close_handler *next = NULL; fde *F = NULL; debug(5, 0) ("examine_select: Examining open file descriptors...\n"); @@ -1265,13 +1257,7 @@ examine_select(fd_set * readfds, fd_set * writefds) for (ch = F->close_handler; ch; ch = ch->next) debug(5, 0) (" close handler: %p\n", ch->handler); if (F->close_handler) { - for (ch = F->close_handler; ch; ch = next) { - next = ch->next; - if (cbdataValid(ch->data)) - ch->handler(fd, ch->data); - cbdataUnlock(ch->data); - safe_free(ch); - } + commCallCloseHandlers(fd); } else if (F->timeout_handler) { debug(5, 0) ("examine_select: Calling Timeout Handler\n"); F->timeout_handler(fd, F->timeout_data);