]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
keepalive ratio tweaks
authorwessels <>
Sat, 1 Nov 1997 03:01:56 +0000 (03:01 +0000)
committerwessels <>
Sat, 1 Nov 1997 03:01:56 +0000 (03:01 +0000)
src/http.cc

index a62d19d1734f309b33cad979512a60f66940232d..3891d9a714068e8db2821c2dcb2de20eb92c7e0a 100644 (file)
@@ -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,