Attempted port for Delay Pools changeset http://www.squid-cache.org/Versions/v2/HEAD/changesets/12093.patch

"
Bug #219: Reassign delay pools after reconfigure

This patch tries to reassign requests to delay pools after reconfigure,
making sure that pending requests still get delayed proper.
"

I'm not sure exactly what the delayMaxBodySize fields of ClientHttpRequest have been converted to for 3.2. Or if it is even still needed in 3.2.

As I understand it, at worst the omission means the pool gets reset to "full" on reconfigure. Which is not good, but still better than not delaying the entire remaining object.

I need:
 * Any hints what to add to fix that remaining delayMaxBodySize bug.
 * assistance testing.


Amos
=== modified file 'src/client_side.cc'
--- src/client_side.cc  2012-04-25 05:29:20 +0000
+++ src/client_side.cc  2012-06-06 02:16:51 +0000
@@ -4111,3 +4111,29 @@
     /* NOTE: pinning.pinned should be kept. This combined with fd == -1 at the 
end of a request indicates that the host
      * connection has gone away */
 }
+
+#if USE_DELAY_POOLS
+// TODO: make this a post-config runner task
+void
+clientReassignDelaypools(void)
+{
+    for (dlink_node *i = ClientActiveRequests.head; i; i = i->next) {
+        ClientHttpRequest *http = static_cast<ClientHttpRequest *>(i->data);
+        if (!http) {
+            debugs(33, DBG_IMPORTANT, "BUG: unable to locate active client 
request state i=" << (i->data));
+            continue;
+        }
+
+       if (http->sc && http->logType != LOG_TCP_DENIED && http->logType != 
LOG_TAG_NONE)
+            /* delay_id is already set on original store client */
+            http->sc->setDelayId(DelayId::DelayClient(http));
+
+#if 0 // XXX: what is this doing in 2.7? is any of it still relevant to 3.x?
+       if (http->reply)
+           http->delayMaxBodySize = 0;
+       http->delayAssignedPool = 0;
+       clientDelayMaxBodySize(http->request, http, http->reply);
+#endif
+    }
+}
+#endif

=== modified file 'src/client_side.h'
--- src/client_side.h   2012-04-25 05:29:20 +0000
+++ src/client_side.h   2012-06-06 01:49:22 +0000
@@ -368,4 +368,10 @@
 
 const char *findTrailingHTTPVersion(const char *uriAndHTTPVersion, const char 
*end = NULL);
 
+#if USE_DELAY_POOLS
+/// Reassign what Delay Pool(s) each active client connection is limited by.
+/// Intended for use after reconfigure changes Delay pools structures
+extern void clientReassignDelayPools(void);
+#endif
+
 #endif /* SQUID_CLIENTSIDE_H */

=== modified file 'src/main.cc'
--- src/main.cc 2012-06-01 07:44:48 +0000
+++ src/main.cc 2012-06-06 01:59:21 +0000
@@ -852,7 +852,8 @@
 #endif
 
 #if USE_DELAY_POOLS
-    Config.ClientDelay.finalize();
+    Config.ClientDelay.finalize(); // client (upload) delay pools
+    clientReassignDelayPools();    // server (download) delay pools
 #endif
 
     if (Config.onoff.announce) {

Reply via email to