From: hno <> Date: Sun, 4 Apr 2004 19:37:20 +0000 (+0000) Subject: Bug #862: Repeated POST requests causes number of persistent connections to grow X-Git-Tag: SQUID_3_0_PRE4~1118 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=a93e38e50f9f1b4e31d5b67b14118429b1c4a40d;p=thirdparty%2Fsquid.git Bug #862: Repeated POST requests causes number of persistent connections to grow If responses to POST or other non-indempotent requests allows the connection to be kept persistently open then this can lead to a increased connection usage by Squid. This patch changes the behaviour to keep the number of connections stable by closing a persistent connection before opening the new connection. --- diff --git a/src/forward.cc b/src/forward.cc index 81a215da82..e1ffaea9a0 100644 --- a/src/forward.cc +++ b/src/forward.cc @@ -1,6 +1,6 @@ /* - * $Id: forward.cc,v 1.116 2004/04/03 14:07:39 hno Exp $ + * $Id: forward.cc,v 1.117 2004/04/04 13:37:20 hno Exp $ * * DEBUG: section 17 Request Forwarding * AUTHOR: Duane Wessels @@ -589,8 +589,8 @@ fwdConnectStart(void *data) ctimeout = Config.Timeout.connect; } - if (fwdCheckRetriable(fwdState)) { - if ((fd = pconnPop(host, port, domain)) >= 0) { + if ((fd = pconnPop(host, port, domain)) >= 0) { + if (fwdCheckRetriable(fwdState)) { debug(17, 3) ("fwdConnectStart: reusing pconn FD %d\n", fd); fwdState->server_fd = fd; fwdState->n_tries++; @@ -603,6 +603,12 @@ fwdConnectStart(void *data) fwdDispatch(fwdState); return; + } else { + /* Discard the persistent connection to not cause + * a imbalance in number of conenctions open if there + * is a lot of POST requests + */ + comm_close(fd); } }