/* copy bytes requested by the client */ void storeClientCopy(StoreEntry * e, off_t seen_offset, off_t copy_offset, size_t size, char *buf, STCB * callback, void *data) { store_client *sc; assert(!EBIT_TEST(e->flags, ENTRY_ABORTED)); debug(20, 3) ("storeClientCopy: %s, seen %d, want %d, size %d, cb %p, cbdata %p\n", storeKeyText(e->key), (int) seen_offset, (int) copy_offset, (int) size, callback, data); sc = storeClientListSearch(e->mem_obj, data); assert(sc != NULL); assert(sc->callback == NULL); sc->copy_offset = copy_offset; sc->seen_offset = seen_offset; sc->callback = callback; sc->copy_buf = buf; sc->copy_size = size; sc->copy_offset = copy_offset; storeClientCopy2(e, sc); }
/* copy bytes requested by the client */ void storeClientCopy(store_client * sc, StoreEntry * e, squid_off_t seen_offset, squid_off_t copy_offset, size_t size, char *buf, STCB * callback, void *data) { assert(!EBIT_TEST(e->flags, ENTRY_ABORTED)); debug(20, 3) ("storeClientCopy: %s, seen %" PRINTF_OFF_T ", want %" PRINTF_OFF_T ", size %d, cb %p, cbdata %p\n", storeKeyText(e->hash.key), seen_offset, copy_offset, (int) size, callback, data); assert(sc != NULL); #if STORE_CLIENT_LIST_DEBUG assert(sc == storeClientListSearch(e->mem_obj, data)); #endif assert(sc->callback == NULL); assert(sc->entry == e); sc->seen_offset = seen_offset; sc->callback = callback; sc->copy_buf = buf; sc->copy_size = size; sc->copy_offset = copy_offset; storeClientCopy2(e, sc); }
static void storeClientCopyEvent(void *data) { store_client *sc = data; debug(20, 3) ("storeClientCopyEvent: Running\n"); sc->flags.copy_event_pending = 0; if (!sc->callback) return; storeClientCopy2(sc->entry, sc); }
/* Call handlers waiting for data to be appended to E. */ void InvokeHandlers(StoreEntry * e) { int i = 0; MemObject *mem = e->mem_obj; store_client *sc; store_client *nx = NULL; assert(mem->clients != NULL || mem->nclients == 0); debug(20, 3) ("InvokeHandlers: %s\n", storeKeyText(e->key)); /* walk the entire list looking for valid callbacks */ for (sc = mem->clients; sc; sc = nx) { nx = sc->next; debug(20, 3) ("InvokeHandlers: checking client #%d\n", i++); if (sc->callback_data == NULL) continue; if (sc->callback == NULL) continue; storeClientCopy2(e, sc); } }
/* Call handlers waiting for data to be appended to E. */ void InvokeHandlers(StoreEntry * e) { int i = 0; MemObject *mem = e->mem_obj; store_client *sc; dlink_node *nx = NULL; dlink_node *node; debug(20, 3) ("InvokeHandlers: %s\n", storeKeyText(e->hash.key)); /* walk the entire list looking for valid callbacks */ for (node = mem->clients.head; node; node = nx) { sc = node->data; nx = node->next; debug(20, 3) ("InvokeHandlers: checking client #%d\n", i++); if (sc->callback == NULL) continue; if (sc->flags.disk_io_pending) continue; storeClientCopy2(e, sc); } }
/* copy bytes requested by the client */ void storeClientCopy(store_client * sc, StoreEntry * e, squid_off_t seen_offset, squid_off_t copy_offset, size_t size, char *buf, STCB * callback, void *data) { debug(20, 3) ("storeClientCopy: %s, seen %" PRINTF_OFF_T ", want %" PRINTF_OFF_T ", size %d, cb %p, cbdata %p\n", storeKeyText(e->hash.key), seen_offset, copy_offset, (int) size, callback, data); assert(sc != NULL); #if STORE_CLIENT_LIST_DEBUG assert(sc == storeClientListSearch(e->mem_obj, data)); #endif assert(sc->callback == NULL); assert(sc->entry == e); sc->seen_offset = seen_offset; sc->callback = callback; sc->callback_data = data; cbdataLock(sc->callback_data); sc->copy_buf = buf; sc->copy_size = size; sc->copy_offset = copy_offset; /* If the read is being deferred, run swapout in case this client has the * lowest seen_offset. storeSwapOut() frees the memory and clears the * ENTRY_DEFER_READ bit if necessary */ if (EBIT_TEST(e->flags, ENTRY_DEFER_READ)) { storeSwapOut(e); } storeClientCopy2(e, sc); }