--------------------- PatchSet 10652 Date: 2008/07/16 10:47:54 Author: adri Branch: delay_pool_write Tag: (none) Log: Add in a delayid parameter to clientHttpRequest representing the write-side delay pool. Use it when issuing comm_write*() calls. This still hasn't been tested! Members: src/client_side.c:1.236->1.236.2.1 src/delay_pools.c:1.21->1.21.4.1 src/structs.h:1.188.2.2->1.188.2.3 Index: squid/src/client_side.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/client_side.c,v retrieving revision 1.236 retrieving revision 1.236.2.1 diff -u -r1.236 -r1.236.2.1 --- squid/src/client_side.c 11 Jul 2008 19:54:20 -0000 1.236 +++ squid/src/client_side.c 16 Jul 2008 10:47:54 -0000 1.236.2.1 @@ -1,6 +1,6 @@ /* - * $Id: client_side.c,v 1.236 2008/07/11 19:54:20 squidadm Exp $ + * $Id: client_side.c,v 1.236.2.1 2008/07/16 10:47:54 adri Exp $ * * DEBUG: section 33 Client-side Routines * AUTHOR: Duane Wessels @@ -3096,6 +3096,11 @@ /* write headers and initial body */ if (mb.size > 0) { comm_write_mbuf(http->conn->fd, mb, clientWriteComplete, http); +#if 0 + /* XXX no need to delay the headers? Maybe; maybe not -adrian */ + if (http->delayid) + comm_write_set_delaypool(http->conn->fd, http->delayid); +#endif } else { storeClientRef(http->sc, http->entry, http->out.offset, @@ -3158,6 +3163,8 @@ /* XXX eww - these refcounting semantics should be better adrian! fix it! */ http->nr = ref; comm_write(fd, buf, size, clientWriteBodyComplete, http, NULL); + if (http->delayid) + comm_write_set_delaypool(fd, http->delayid); /* NULL because clientWriteBodyComplete frees it */ return; } @@ -3200,6 +3207,8 @@ } else { comm_write_mbuf(fd, mb, clientWriteComplete, http); } + if (http->delayid) + comm_write_set_delaypool(fd, http->delayid); stmemNodeUnref(&ref); } @@ -3327,6 +3336,11 @@ /* Finish chunked transfer encoding */ http->request->flags.chunked_response = 0; /* no longer chunking */ comm_write(http->conn->fd, "0\r\n\r\n", 5, clientWriteComplete, http, NULL); +#if 0 + /* XXX No need to really "delay" the end chunk? -adrian */ + if (http->delayid) + comm_write_set_delaypool(fd, http->delayid); +#endif } else if (http->request->body_reader == clientReadBody) { debug(33, 5) ("clientWriteComplete: closing, but first we need to read the rest of the request\n"); /* XXX We assumes the reply does fit in the TCP transmit window. Index: squid/src/delay_pools.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/delay_pools.c,v retrieving revision 1.21 retrieving revision 1.21.4.1 diff -u -r1.21 -r1.21.4.1 --- squid/src/delay_pools.c 11 Apr 2008 08:53:26 -0000 1.21 +++ squid/src/delay_pools.c 16 Jul 2008 10:47:55 -0000 1.21.4.1 @@ -1,6 +1,6 @@ /* - * $Id: delay_pools.c,v 1.21 2008/04/11 08:53:26 squidadm Exp $ + * $Id: delay_pools.c,v 1.21.4.1 2008/07/16 10:47:55 adri Exp $ * * DEBUG: section 77 Delay Pools * AUTHOR: David Luyer @@ -311,6 +311,13 @@ return (pool << 16) | position; } +/* + * Select a delay_id for the given clientHttpRequest. + * + * The -pool- part of delay_id is selected by the request_t information. + * The -client- part of delay_id is selected from the client connection + * source address. + */ delay_id delayClient(clientHttpRequest * http) { Index: squid/src/structs.h =================================================================== RCS file: /cvsroot/squid-sf//squid/src/structs.h,v retrieving revision 1.188.2.2 retrieving revision 1.188.2.3 diff -u -r1.188.2.2 -r1.188.2.3 --- squid/src/structs.h 15 Jul 2008 16:33:34 -0000 1.188.2.2 +++ squid/src/structs.h 16 Jul 2008 10:47:55 -0000 1.188.2.3 @@ -1,6 +1,6 @@ /* - * $Id: structs.h,v 1.188.2.2 2008/07/15 16:33:34 adri Exp $ + * $Id: structs.h,v 1.188.2.3 2008/07/16 10:47:55 adri Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -1291,6 +1291,9 @@ ushort delayAssignedPool; mem_node_ref nr; int is_modified; +#if DELAY_POOLS + delay_id delayid; /* Delay id for the -write- side delay id */ +#endif }; struct _ConnStateData {