// virtual LLSD LLHTTPAssetStorage::getPendingDetails(LLAssetStorage::ERequestType rt, LLAssetType::EType asset_type, const std::string& detail_prefix) const { LLSD sd = LLAssetStorage::getPendingDetails(rt, asset_type, detail_prefix); const request_list_t* running = getRunningList(rt); if (running) { // Loop through the pending requests sd, and add extra info about its running status. S32 num_pending = sd["requests"].size(); S32 i; for (i = 0; i < num_pending; ++i) { LLSD& pending = sd["requests"][i]; // See if this pending request is running. const LLAssetRequest* req = findRequest(running, LLAssetType::lookup(pending["type"].asString().c_str()), pending["asset_id"]); if (req) { // Keep the detail_url so we don't have to rebuild it. LLURI detail_url = pending["detail"]; pending = req->getTerseDetails(); pending["detail"] = detail_url; pending["is_running"] = true; } else { pending["is_running"] = false; } } } return sd; }
// 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); if (!pending_req->mIsUserWaiting) //A user is waiting on this request. Toss it. { pending->push_back(pending_req); } else { if (pending_req->mUpCallback) //Clean up here rather than _callUploadCallbacks because this request is already cleared the req. { pending_req->mUpCallback(pending_req->getUUID(), pending_req->mUserData, -1, LL_EXSTAT_REQUEST_DROPPED); } } 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); }
void LLHTTPAssetStorage::removeRunningRequest(ERequestType rt, LLHTTPAssetRequest* request) { request_list_t* requests = getRunningList(rt); if (requests) { requests->remove(request); } else { llerrs << "LLHTTPAssetStorage::removeRunningRequest - Destroyed request is not an upload OR download, this is bad!" << llendl; } }
void LLHTTPAssetStorage::addRunningRequest(ERequestType rt, LLHTTPAssetRequest* request) { request_list_t* requests = getRunningList(rt); if (requests) { requests->push_back(request); } else { llerrs << "LLHTTPAssetStorage::addRunningRequest - Request is not an upload OR download, this is bad!" << llendl; } }
// 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); }
// virtual LLSD LLHTTPAssetStorage::getPendingRequest(LLAssetStorage::ERequestType rt, LLAssetType::EType asset_type, const LLUUID& asset_id) const { // Look for this asset in the running list first. const request_list_t* running = getRunningList(rt); if (running) { LLSD sd = LLAssetStorage::getPendingRequest(running, asset_type, asset_id); if (sd) { sd["is_running"] = true; return sd; } } LLSD sd = LLAssetStorage::getPendingRequest(rt, asset_type, asset_id); if (sd) { sd["is_running"] = false; } return sd; }