diff -N -c -r -X exclude_files squid-1.0.beta8/src/icp.c squid-1.0.beta8.henrik/src/icp.c *** squid-1.0.beta8/src/icp.c Thu May 23 19:10:25 1996 --- squid-1.0.beta8.henrik/src/icp.c Thu May 23 19:13:33 1996 *************** *** 121,128 **** /* This is a handler normally called by comm_close() */ ! int icpStateFree(fdunused, icpState) ! int fdunused; icpStateData *icpState; { int size = 0; --- 121,128 ---- /* This is a handler normally called by comm_close() */ ! int icpStateFree(fd, icpState) ! int fd; icpStateData *icpState; { int size = 0; *************** *** 157,162 **** --- 157,167 ---- safe_free(icpState->request_hdr); if (icpState->request && --icpState->request->link_count == 0) safe_free(icpState->request); + if (icpState->entry) { + storeUnregister(icpState->entry, fd); + storeUnlockObject(icpState->entry); + icpState->entry=NULL; + } safe_free(icpState); return 0; /* XXX gack, all comm handlers return ints */ } *************** *** 433,445 **** entry = icpState->entry; icpFreeBufOrPage(icpState); comm_close(fd); - /* If storeAbort() has been called, then we don't execute this. - * If we timed out on the client side, then we need to - * unregister/unlock */ - if (entry) { - storeUnregister(entry, fd); - storeUnlockObject(entry); - } } /* Send ERROR message. */ --- 438,443 ---- *************** *** 602,611 **** CacheInfo->proto_touchobject(CacheInfo, urlParseProtocol(entry->url), icpState->offset); ! /* Now we release the entry and DON'T touch it from here on out */ comm_close(fd); - storeUnregister(entry, fd); - storeUnlockObject(entry); } else if (icpState->offset < entry->mem_obj->e_current_len) { /* More data available locally; write it now */ icpSendMoreData(fd, icpState); --- 600,607 ---- CacheInfo->proto_touchobject(CacheInfo, urlParseProtocol(entry->url), icpState->offset); ! /* And close the connection */ comm_close(fd); } else if (icpState->offset < entry->mem_obj->e_current_len) { /* More data available locally; write it now */ icpSendMoreData(fd, icpState); *************** *** 616,623 **** CacheInfo->proto_id(entry->url), icpState->offset); comm_close(fd); - storeUnregister(entry, fd); - storeUnlockObject(entry); /* unlock after comm_close().. */ } else { /* More data will be coming from primary server; register with * storage manager. */ --- 612,617 ---- *************** *** 763,768 **** --- 757,770 ---- } } #endif + + /* Get rid of any references to a StoreEntry (if any) */ + if (icpState->entry) { + storeUnregister(icpState->entry, fd); + storeUnlockObject(icpState->entry); + icpState->entry=NULL; + } + entry = storeCreateEntry(url, request_hdr, icpState->flags, *************** *** 1620,1629 **** * URL. */ protoUndispatch(fd, icpState->url, entry, icpState->request); comm_close(fd); - if (entry) { - storeUnregister(entry, fd); - storeUnlockObject(entry); - } } /* Handle a new connection on ascii input socket. */ --- 1622,1627 ---- *************** *** 1657,1662 **** --- 1655,1661 ---- icpState->header.shostid = htonl(peer.sin_addr.s_addr); icpState->peer = peer; icpState->me = me; + icpState->entry = NULL; comm_set_select_handler(fd, COMM_SELECT_LIFETIME, (PF) asciiConnLifetimeHandle, *************** *** 1739,1746 **** CacheInfo->proto_id(entry->url), icpState->offset); comm_close(fd); - storeUnregister(entry, fd); - storeUnlockObject(entry); /* unlock after comm_close().. */ } else { debug(12, 5, "icpDetectClientClose: FD %d\n", fd); debug(12, 5, "--> URL '%s'\n", icpState->url); --- 1738,1743 ---- *************** *** 1759,1767 **** protoUndispatch(fd, icpState->url, entry, icpState->request); icpFreeBufOrPage(icpState); comm_close(fd); - if (entry) { - storeUnregister(entry, fd); - storeUnlockObject(entry); - } } } --- 1756,1760 ----