From 4e2d08016baeaa1737ad652f8f01806582e4c34e Mon Sep 17 00:00:00 2001 From: Jeff Trawick Date: Thu, 12 Oct 2000 01:50:51 +0000 Subject: [PATCH] Avoid swap-til-you-drop by cutting off a loop once the client closes. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@86551 13f79535-47bb-0310-9956-ffa450edef68 --- modules/http/http_core.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/modules/http/http_core.c b/modules/http/http_core.c index e309a74d04..f2ab725fcc 100644 --- a/modules/http/http_core.c +++ b/modules/http/http_core.c @@ -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 -- 2.50.1