From b6c61e911733b1306b1aa5a8c26051a3cd3a3448 Mon Sep 17 00:00:00 2001 From: hno <> Date: Mon, 22 Apr 2002 03:54:40 +0000 Subject: [PATCH] Make delay pools less greedy, to only ask for the amount there is clients asking for. --- src/delay_pools.cc | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/delay_pools.cc b/src/delay_pools.cc index a3099c2214..8832e150aa 100644 --- a/src/delay_pools.cc +++ b/src/delay_pools.cc @@ -1,6 +1,6 @@ /* - * $Id: delay_pools.cc,v 1.23 2002/04/14 21:51:36 hno Exp $ + * $Id: delay_pools.cc,v 1.24 2002/04/21 21:54:40 hno Exp $ * * DEBUG: section 77 Delay Pools * AUTHOR: David Luyer @@ -644,13 +644,19 @@ delayMostBytesWanted(const MemObject * mem, int max) { int i = 0; int found = 0; + int wanted; store_client *sc; dlink_node *node; for (node = mem->clients.head; node; node = node->next) { sc = (store_client *) node->data; + if (sc->callback_data == NULL) /* not waiting for more data */ + continue; if (sc->type != STORE_MEM_CLIENT) continue; - i = delayBytesWanted(sc->delay_id, i, max); + wanted = sc->copy_size; + if (wanted > max) + wanted = max; + i = delayBytesWanted(sc->delay_id, i, wanted); found = 1; } return found ? i : max; @@ -666,11 +672,11 @@ delayMostBytesAllowed(const MemObject * mem) delay_id d = 0; for (node = mem->clients.head; node; node = node->next) { sc = (store_client *) node->data; - if (sc->callback_data == NULL) /* open slot */ + if (sc->callback_data == NULL) /* not waiting for more data */ continue; if (sc->type != STORE_MEM_CLIENT) continue; - j = delayBytesWanted(sc->delay_id, 0, SQUID_TCP_SO_RCVBUF); + j = delayBytesWanted(sc->delay_id, 0, sc->copy_size); if (j > jmax) { jmax = j; d = sc->delay_id; -- 2.47.3