From: Jeff Trawick Date: Thu, 12 Oct 2000 01:50:51 +0000 (+0000) Subject: Avoid swap-til-you-drop by cutting off a loop once the client closes. X-Git-Tag: APACHE_2_0_ALPHA_8~397 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4e2d08016baeaa1737ad652f8f01806582e4c34e;p=thirdparty%2Fapache%2Fhttpd.git 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 --- diff --git a/modules/http/http_core.c b/modules/http/http_core.c index e309a74d040..f2ab725fcce 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