--------------------- PatchSet 10029 Date: 2007/09/24 14:37:14 Author: adri Branch: store_copy Tag: (none) Log: * make stmemRef() return how many bytes in that page are available; * do the referencing (but untested!) in storeClientCopy3(); * storeClientRef() won't work yet for disk clients and will simply fatal. Members: src/stmem.c:1.10.2.1->1.10.2.2 src/store_client.c:1.25.10.1->1.25.10.2 Index: squid/src/stmem.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/stmem.c,v retrieving revision 1.10.2.1 retrieving revision 1.10.2.2 diff -u -r1.10.2.1 -r1.10.2.2 --- squid/src/stmem.c 24 Sep 2007 14:29:38 -0000 1.10.2.1 +++ squid/src/stmem.c 24 Sep 2007 14:37:14 -0000 1.10.2.2 @@ -1,6 +1,6 @@ /* - * $Id: stmem.c,v 1.10.2.1 2007/09/24 14:29:38 adri Exp $ + * $Id: stmem.c,v 1.10.2.2 2007/09/24 14:37:14 adri Exp $ * * DEBUG: section 19 Store Memory Primitives * AUTHOR: Harvest Derived @@ -174,7 +174,7 @@ bytes_into_this_packet = offset - t_off; r->node = (mem_node *) stmemNodeGet(p); r->offset = bytes_into_this_packet; - return 1; + return p->len - bytes_into_this_packet; } void Index: squid/src/store_client.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/store_client.c,v retrieving revision 1.25.10.1 retrieving revision 1.25.10.2 diff -u -r1.25.10.1 -r1.25.10.2 --- squid/src/store_client.c 24 Sep 2007 14:29:38 -0000 1.25.10.1 +++ squid/src/store_client.c 24 Sep 2007 14:37:14 -0000 1.25.10.2 @@ -1,6 +1,6 @@ /* - * $Id: store_client.c,v 1.25.10.1 2007/09/24 14:29:38 adri Exp $ + * $Id: store_client.c,v 1.25.10.2 2007/09/24 14:37:14 adri Exp $ * * DEBUG: section 20 Storage Manager Client-Side Interface * AUTHOR: Duane Wessels @@ -317,7 +317,7 @@ storeClientCopy3(StoreEntry * e, store_client * sc) { MemObject *mem = e->mem_obj; - ssize_t sz; + ssize_t sz = -1; if (storeClientNoMoreToSend(e, sc)) { /* There is no more to send! */ @@ -375,8 +375,14 @@ if (sc->copy_offset >= mem->inmem_lo && sc->copy_offset < mem->inmem_hi) { /* What the client wants is in memory */ debug(20, 3) ("storeClientCopy3: Copying from memory\n"); - sz = stmemCopy(&mem->data_hdr, - sc->copy_offset, sc->copy_buf, sc->copy_size); + if (sc->callback && ! sc->new_callback) { + sz = stmemCopy(&mem->data_hdr, + sc->copy_offset, sc->copy_buf, sc->copy_size); + } else if (sc->new_callback && ! sc->callback) { + sz = stmemRef(&mem->data_hdr, sc->copy_offset, &sc->node_ref); + } else { + fatal("storeClientCopy3: bad callback/new_callback combination!\n"); + } if (EBIT_TEST(e->flags, RELEASE_REQUEST)) storeSwapOutMaintainMemObject(e); storeClientCallback(sc, sz);