From: wessels <> Date: Sat, 1 Nov 1997 03:01:56 +0000 (+0000) Subject: keepalive ratio tweaks X-Git-Tag: SQUID_3_0_PRE1~4596 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=9a1d2653a10f185e129ee139b8df95047b16c1bb;p=thirdparty%2Fsquid.git keepalive ratio tweaks --- diff --git a/src/http.cc b/src/http.cc index a62d19d173..3891d9a714 100644 --- a/src/http.cc +++ b/src/http.cc @@ -1,6 +1,6 @@ /* - * $Id: http.cc,v 1.210 1997/10/31 19:54:14 wessels Exp $ + * $Id: http.cc,v 1.211 1997/10/31 20:01:56 wessels Exp $ * * DEBUG: section 11 Hypertext Transfer Protocol (HTTP) * AUTHOR: Harvest Derived @@ -875,6 +875,7 @@ httpSendRequest(int fd, void *data) int cfd; static int xcount = 0; peer *p = httpState->peer; + double d; debug(11, 5) ("httpSendRequest: FD %d: httpState %p.\n", fd, httpState); buflen = strlen(req->urlpath); @@ -903,13 +904,14 @@ httpSendRequest(int fd, void *data) if (p != NULL) BIT_SET(httpState->flags, HTTP_PROXYING); if (req->method == METHOD_GET) { - BIT_SET(httpState->flags, HTTP_KEEPALIVE); if (p) { - p->stats.n_keepalives_sent++; + d = (double) ++p->stats.n_keepalives_recv / p->stats.n_keepalives_sent; if ((xcount++ & 0x3F) == 0) - debug(0, 0) ("%s Keepalive Ratio = %f\n", - p->host, - (double) p->stats.n_keepalives_recv / (double) p->stats.n_keepalives_sent); + debug(0, 0) ("%s Keepalive Ratio = %f\n", p->host, d); + if (d > 0.50 || p->stats.n_keepalives_sent < 10) + BIT_SET(httpState->flags, HTTP_KEEPALIVE); + } else { + BIT_SET(httpState->flags, HTTP_KEEPALIVE); } } len = httpBuildRequestHeader(req,