--------------------- PatchSet 957 Date: 2000/12/18 11:10:32 Author: adri Branch: modio Tag: (none) Log: Delete the uses of storeMemHiOffset in the asn code - * detect EOF's by just size == 0 * always try to get data through storeClientCopy() rather then checking if there is any more left (whther seen < storeMemHiOffset()). We will get an EOF if there is no more data. Members: src/asn.c:1.2.2.2->1.2.2.3 Index: squid/src/asn.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/asn.c,v retrieving revision 1.2.2.2 retrieving revision 1.2.2.3 diff -u -r1.2.2.2 -r1.2.2.3 --- squid/src/asn.c 13 Dec 2000 09:45:02 -0000 1.2.2.2 +++ squid/src/asn.c 18 Dec 2000 11:10:32 -0000 1.2.2.3 @@ -1,6 +1,6 @@ /* - * $Id: asn.c,v 1.2.2.2 2000/12/13 09:45:02 rbcollins Exp $ + * $Id: asn.c,v 1.2.2.3 2000/12/18 11:10:32 adri Exp $ * * DEBUG: section 53 AS Number handling * AUTHOR: Duane Wessels, Kostas Anagnostakis @@ -229,16 +229,20 @@ asStateFree(asState); return; } - if (size == 0 && storeMemHiOffset(e) > 0) { + if (size < 0) { + /* Error -- adrian */ + debug(53, 1) ("asHandleReply: Called with size=%d\n", size); memFree(buf, MEM_4K_BUF); asStateFree(asState); return; - } else if (size < 0) { - debug(53, 1) ("asHandleReply: Called with size=%d\n", size); + } else if (size == 0) { + /* EOF */ + debug(53, 3) ("asHandleReply: Done: %s\n", storeUrl(e)); memFree(buf, MEM_4K_BUF); asStateFree(asState); return; } else if (HTTP_OK != e->mem_obj->reply->sline.status) { + /* Bad reply */ debug(53, 1) ("WARNING: AS %d whois request failed\n", asState->as_number); memFree(buf, MEM_4K_BUF); @@ -266,19 +270,14 @@ asState->offset += (s - buf); debug(53, 3) ("asState->seen = %d, asState->offset = %d\n", asState->seen, asState->offset); - if (e->store_status == STORE_PENDING) { - debug(53, 3) ("asHandleReply: store_status == STORE_PENDING: %s\n", storeUrl(e)); - storeClientCopy(asState->sc, - e, - asState->seen, - asState->offset, - SM_PAGE_SIZE, - buf, - asHandleReply, - asState); - } else if (asState->seen < storeMemHiOffset(e)) { - debug(53, 3) ("asHandleReply: asState->seen < storeMemHiOffset(e) %s\n", storeUrl(e)); - storeClientCopy(asState->sc, + debug(53, 3) ("asHandleReply: getting more: %s\n", storeUrl(e)); + + /* + * If we get here we can simply ask for more. If we hit EOF we'll + * get called again with size == 0 to signifiy EOF. + * -- adrian + */ + storeClientCopy(asState->sc, e, asState->seen, asState->offset, @@ -286,11 +285,6 @@ buf, asHandleReply, asState); - } else { - debug(53, 3) ("asHandleReply: Done: %s\n", storeUrl(e)); - memFree(buf, MEM_4K_BUF); - asStateFree(asState); - } } static void