void LLAssetStorage::_cleanupRequests(BOOL all, S32 error) { F64 mt_secs = LLMessageSystem::getMessageTimeSeconds(); request_list_t timed_out; S32 rt; for (rt = 0; rt < RT_COUNT; rt++) { request_list_t* requests = getRequestList((ERequestType)rt); for (request_list_t::iterator iter = requests->begin(); iter != requests->end(); ) { request_list_t::iterator curiter = iter++; LLAssetRequest* tmp = *curiter; // if all is true, we want to clean up everything // otherwise just check for timed out requests // EXCEPT for upload timeouts if (all || ((RT_DOWNLOAD == rt) && LL_ASSET_STORAGE_TIMEOUT < (mt_secs - tmp->mTime))) { llwarns << "Asset " << getRequestName((ERequestType)rt) << " request " << (all ? "aborted" : "timed out") << " for " << tmp->getUUID() << "." << LLAssetType::lookup(tmp->getType()) << llendl; timed_out.push_front(tmp); iter = requests->erase(curiter); } } } LLAssetInfo info; for (request_list_t::iterator iter = timed_out.begin(); iter != timed_out.end(); ) { request_list_t::iterator curiter = iter++; LLAssetRequest* tmp = *curiter; if (tmp->mUpCallback) { tmp->mUpCallback(tmp->getUUID(), tmp->mUserData, error, LL_EXSTAT_NONE); } if (tmp->mDownCallback) { tmp->mDownCallback(mVFS, tmp->getUUID(), tmp->getType(), tmp->mUserData, error, LL_EXSTAT_NONE); } if (tmp->mInfoCallback) { tmp->mInfoCallback(&info, tmp->mUserData, error); } delete tmp; } }
// virtual bool LLAssetStorage::deletePendingRequest(LLAssetStorage::ERequestType rt, LLAssetType::EType asset_type, const LLUUID& asset_id) { request_list_t* requests = getRequestList(rt); if (deletePendingRequestImpl(requests, asset_type, asset_id)) { llinfos << "Asset " << getRequestName(rt) << " request for " << asset_id << "." << LLAssetType::lookup(asset_type) << " removed from pending queue." << llendl; return true; } return false; }
// virtual bool LLHTTPAssetStorage::deletePendingRequest(LLAssetStorage::ERequestType rt, LLAssetType::EType asset_type, const LLUUID& asset_id) { // Try removing this from the running list first. request_list_t* running = getRunningList(rt); if (running) { LLAssetRequest* req = findRequest(running, asset_type, asset_id); if (req) { // Remove this request from the running list to get it out of curl. running->remove(req); // Find this request in the pending list, so we can move it to the end of the line. request_list_t* pending = getRequestList(rt); if (pending) { request_list_t::iterator result = std::find_if(pending->begin(), pending->end(), std::bind2nd(ll_asset_request_equal<LLAssetRequest*>(), req)); if (pending->end() != result) { // This request was found in the pending list. Move it to the end! LLAssetRequest* pending_req = *result; pending->remove(pending_req); pending->push_back(pending_req); llinfos << "Asset " << getRequestName(rt) << " request for " << asset_id << "." << LLAssetType::lookup(asset_type) << " removed from curl and placed at the end of the pending queue." << llendl; } else { llwarns << "Unable to find pending " << getRequestName(rt) << " request for " << asset_id << "." << LLAssetType::lookup(asset_type) << llendl; } } delete req; return true; } } return LLAssetStorage::deletePendingRequest(rt, asset_type, asset_id); }