From: hno <> Date: Sun, 6 Jul 2003 20:16:56 +0000 (+0000) Subject: Bugfix: Speed up processing of queued events significantly, to not cause X-Git-Tag: SQUID_3_0_PRE1~70 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b300c36da2d5240512a55fcda46040fe40c8695a;p=thirdparty%2Fsquid.git Bugfix: Speed up processing of queued events significantly, to not cause large delays when under low load. --- diff --git a/src/comm.cc b/src/comm.cc index 12d0bfd741..93c0e08cef 100644 --- a/src/comm.cc +++ b/src/comm.cc @@ -1,6 +1,6 @@ /* - * $Id: comm.cc,v 1.379 2003/06/24 12:42:25 robertc Exp $ + * $Id: comm.cc,v 1.380 2003/07/06 14:16:56 hno Exp $ * * DEBUG: section 5 Socket Functions * AUTHOR: Harvest Derived @@ -580,6 +580,8 @@ comm_calliocallback(void) */ PROF_start(comm_calliocallback); + debug(5, 7) ("comm_calliocallback: %p\n", CommCallbackList.head); + while (CommCallbackList.head != NULL && oldseqnum != ((CommCallbackData *)CommCallbackList.head->data)->result.seqnum) { dlink_node *node = (dlink_node *)CommCallbackList.head; cio = (CommCallbackData *)node->data; @@ -590,6 +592,13 @@ comm_calliocallback(void) PROF_stop(comm_calliocallback); } +bool +comm_iocallbackpending(void) +{ + debug(5, 7) ("comm_iocallbackpending: %p\n", CommCallbackList.head); + return CommCallbackList.head != NULL; +} + void CommRead::queueCallback(size_t retval, comm_err_t errcode, int xerrno) { diff --git a/src/comm_poll.cc b/src/comm_poll.cc index 96b97c2565..6111a66f35 100644 --- a/src/comm_poll.cc +++ b/src/comm_poll.cc @@ -1,6 +1,6 @@ /* - * $Id: comm_poll.cc,v 1.12 2003/07/06 12:03:40 hno Exp $ + * $Id: comm_poll.cc,v 1.13 2003/07/06 14:16:57 hno Exp $ * * DEBUG: section 5 Socket Functions * @@ -435,6 +435,9 @@ comm_select(int msec) return COMM_SHUTDOWN; } + if (comm_iocallbackpending()) + npending++; + if (npending) msec = 0; diff --git a/src/comm_select.cc b/src/comm_select.cc index 08824ab66d..e87f7498c7 100644 --- a/src/comm_select.cc +++ b/src/comm_select.cc @@ -1,6 +1,6 @@ /* - * $Id: comm_select.cc,v 1.70 2003/07/06 12:03:40 hno Exp $ + * $Id: comm_select.cc,v 1.71 2003/07/06 14:16:57 hno Exp $ * * DEBUG: section 5 Socket Functions * @@ -467,6 +467,9 @@ comm_select(int msec) if (msec > MAX_POLL_TIME) msec = MAX_POLL_TIME; + if (comm_iocallbackpending()) + pending++; + if (pending) msec = 0; diff --git a/src/protos.h b/src/protos.h index f248f54be9..895b017e60 100644 --- a/src/protos.h +++ b/src/protos.h @@ -1,6 +1,6 @@ /* - * $Id: protos.h,v 1.479 2003/06/19 13:47:25 hno Exp $ + * $Id: protos.h,v 1.480 2003/07/06 14:16:56 hno Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -123,6 +123,7 @@ extern void clientAccessCheck(void *); /* comm.c */ extern void comm_calliocallback(void); +extern bool comm_iocallbackpending(void); /* inline candidate */ extern int comm_listen(int fd); SQUIDCEXTERN int commSetNonBlocking(int fd);