]> granicus.if.org Git - apache/commitdiff
Avoid swap-til-you-drop by cutting off a loop once the client closes.
authorJeff Trawick <trawick@apache.org>
Thu, 12 Oct 2000 01:50:51 +0000 (01:50 +0000)
committerJeff Trawick <trawick@apache.org>
Thu, 12 Oct 2000 01:50:51 +0000 (01:50 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@86551 13f79535-47bb-0310-9956-ffa450edef68

modules/http/http_core.c

index e309a74d040598989552c9872f99dbe31db30046..f2ab725fcce2197753d16b1361c61741aae8a779 100644 (file)
@@ -3307,11 +3307,21 @@ static int core_input_filter(ap_filter_t *f, ap_bucket_brigade *b)
 {
     apr_socket_t *csock = NULL;
     ap_bucket *e;
-
-    ap_bpop_socket(&csock, f->c->client);
-    e = ap_bucket_create_socket(csock);
-    AP_BRIGADE_INSERT_TAIL(b, e);
-    return APR_SUCCESS;
+    
+    if (!f->ctx) {    /* If we haven't passed up the socket yet... */
+        f->ctx = (void *)1;
+        ap_bpop_socket(&csock, f->c->client);
+        e = ap_bucket_create_socket(csock);
+        AP_BRIGADE_INSERT_TAIL(b, e);
+        return APR_SUCCESS;
+    }
+    else {            
+        /* Either some code lost track of the socket
+         * bucket or we already found out that the
+         * client closed.
+         */
+        return APR_EOF;
+    }
 }
 
 /* Default filter.  This filter should almost always be used.  Its only job