#include <llhttpassetstorage.h>
Inheritance diagram for LLHTTPAssetStorage:
Public Member Functions | |
LLHTTPAssetStorage (LLMessageSystem *msg, LLXferManager *xfer, LLVFS *vfs, const LLHost &upstream_host, const char *web_host, const char *local_web_host, const char *host_name) | |
LLHTTPAssetStorage (LLMessageSystem *msg, LLXferManager *xfer, LLVFS *vfs, const char *web_host, const char *local_web_host, const char *host_name) | |
virtual | ~LLHTTPAssetStorage () |
virtual void | storeAssetData (const LLUUID &uuid, LLAssetType::EType atype, LLStoreAssetCallback callback, void *user_data, bool temp_file=false, bool is_priority=false, bool store_local=false, const LLUUID &requesting_agent_id=LLUUID::null, bool user_waiting=FALSE, F64 timeout=LL_ASSET_STORAGE_TIMEOUT) |
virtual void | storeAssetData (const char *filename, const LLUUID &asset_id, LLAssetType::EType atype, LLStoreAssetCallback callback, void *user_data, bool temp_file, bool is_priority, bool user_waiting=FALSE, F64 timeout=LL_ASSET_STORAGE_TIMEOUT) |
virtual LLSD | getPendingDetails (ERequestType rt, LLAssetType::EType asset_type, const std::string &detail_prefix) const |
virtual LLSD | getPendingRequest (ERequestType rt, LLAssetType::EType asset_type, const LLUUID &asset_id) const |
virtual bool | deletePendingRequest (ERequestType rt, LLAssetType::EType asset_type, const LLUUID &asset_id) |
S32 | getURLToFile (const LLUUID &uuid, LLAssetType::EType asset_type, const LLString &url, const char *filename, progress_callback callback, void *userdata) |
LLAssetRequest * | findNextRequest (request_list_t &pending, request_list_t &running) |
void | checkForTimeouts () |
void | addRunningRequest (ERequestType rt, LLHTTPAssetRequest *request) |
void | removeRunningRequest (ERequestType rt, LLHTTPAssetRequest *request) |
request_list_t * | getRunningList (ERequestType rt) |
const request_list_t * | getRunningList (ERequestType rt) const |
virtual void | addTempAssetData (const LLUUID &asset_id, const LLUUID &agent_id, const std::string &host_name) |
virtual BOOL | hasTempAssetData (const LLUUID &texture_id) const |
virtual std::string | getTempAssetHostName (const LLUUID &texture_id) const |
virtual LLUUID | getTempAssetAgentID (const LLUUID &texture_id) const |
virtual void | removeTempAssetData (const LLUUID &asset_id) |
virtual void | removeTempAssetDataByAgentID (const LLUUID &agent_id) |
virtual void | dumpTempAssetData (const LLUUID &avatar_id) const |
virtual void | clearTempAssetData () |
Static Public Member Functions | |
static size_t | curlDownCallback (void *data, size_t size, size_t nmemb, void *user_data) |
static size_t | curlFileDownCallback (void *data, size_t size, size_t nmemb, void *user_data) |
static size_t | curlUpCallback (void *data, size_t size, size_t nmemb, void *user_data) |
static size_t | nullOutputCallback (void *data, size_t size, size_t nmemb, void *user_data) |
Protected Member Functions | |
void | _queueDataRequest (const LLUUID &uuid, LLAssetType::EType type, void(*callback)(LLVFS *vfs, const LLUUID &, LLAssetType::EType, void *, S32, LLExtStat), void *user_data, BOOL duplicate, BOOL is_priority) |
Protected Attributes | |
std::string | mBaseURL |
std::string | mLocalBaseURL |
std::string | mHostName |
CURLM * | mCurlMultiHandle |
request_list_t | mRunningDownloads |
request_list_t | mRunningUploads |
request_list_t | mRunningLocalUploads |
uuid_tempdata_map | mTempAssets |
Private Member Functions | |
void | _init (const char *web_host, const char *local_web_host, const char *host_name) |
std::string | getBaseURL (const LLUUID &asset_id, LLAssetType::EType asset_type) |
void | bumpTimedOutUploads () |
Definition at line 46 of file llhttpassetstorage.h.
LLHTTPAssetStorage::LLHTTPAssetStorage | ( | LLMessageSystem * | msg, | |
LLXferManager * | xfer, | |||
LLVFS * | vfs, | |||
const LLHost & | upstream_host, | |||
const char * | web_host, | |||
const char * | local_web_host, | |||
const char * | host_name | |||
) |
LLHTTPAssetStorage::LLHTTPAssetStorage | ( | LLMessageSystem * | msg, | |
LLXferManager * | xfer, | |||
LLVFS * | vfs, | |||
const char * | web_host, | |||
const char * | local_web_host, | |||
const char * | host_name | |||
) |
LLHTTPAssetStorage::~LLHTTPAssetStorage | ( | ) | [virtual] |
void LLHTTPAssetStorage::_init | ( | const char * | web_host, | |
const char * | local_web_host, | |||
const char * | host_name | |||
) | [private] |
Definition at line 419 of file llhttpassetstorage.cpp.
References mBaseURL, mCurlMultiHandle, mHostName, and mLocalBaseURL.
Referenced by LLHTTPAssetStorage().
void LLHTTPAssetStorage::_queueDataRequest | ( | const LLUUID & | uuid, | |
LLAssetType::EType | type, | |||
void(*)(LLVFS *vfs, const LLUUID &, LLAssetType::EType, void *, S32, LLExtStat) | callback, | |||
void * | user_data, | |||
BOOL | duplicate, | |||
BOOL | is_priority | |||
) | [protected, virtual] |
Reimplemented from LLAssetStorage.
Definition at line 673 of file llhttpassetstorage.cpp.
References LLAssetType::AT_TEXTURE, LLAssetRequest::getType(), LLAssetRequest::mDownCallback, LLAssetRequest::mIsPriority, LLAssetStorage::mPendingDownloads, and LLAssetRequest::mUserData.
void LLHTTPAssetStorage::addRunningRequest | ( | ERequestType | rt, | |
LLHTTPAssetRequest * | request | |||
) |
Definition at line 1251 of file llhttpassetstorage.cpp.
References getRunningList(), llendl, llerrs, and request().
Referenced by LLHTTPAssetRequest::setupCurlHandle().
void LLHTTPAssetStorage::addTempAssetData | ( | const LLUUID & | asset_id, | |
const LLUUID & | agent_id, | |||
const std::string & | host_name | |||
) | [virtual] |
Reimplemented from LLAssetStorage.
Definition at line 1278 of file llhttpassetstorage.cpp.
References LLUUID::isNull(), llendl, llwarns, LLTempAssetData::mAgentID, LLTempAssetData::mAssetID, LLTempAssetData::mHostName, and mTempAssets.
Referenced by checkForTimeouts().
void LLHTTPAssetStorage::bumpTimedOutUploads | ( | ) | [private] |
Definition at line 1006 of file llhttpassetstorage.cpp.
References deletePendingRequest(), end, FALSE, LLMessageSystem::getMessageTimeSeconds(), llendl, llwarns, LLAssetType::lookup(), LLAssetRequest::mIsUserWaiting, LLAssetStorage::mPendingUploads, mRunningUploads, and LLAssetStorage::RT_UPLOAD.
Referenced by checkForTimeouts().
void LLHTTPAssetStorage::checkForTimeouts | ( | ) | [virtual] |
Reimplemented from LLAssetStorage.
Definition at line 732 of file llhttpassetstorage.cpp.
References LLAssetStorage::_callUploadCallbacks(), addTempAssetData(), LLAssetType::AT_OBJECT, bumpTimedOutUploads(), LLAssetStorage::checkForTimeouts(), LLHTTPAssetRequest::cleanupCurlHandle(), count, LLHTTPAssetRequest::curlCompressedUploadCallback(), curlDownCallback(), curlUpCallback(), deletePendingRequest(), LLAssetStorage::downloadCompleteCallback(), findNextRequest(), LLUUID::generate(), getBaseURL(), LLVFile::getSize(), LLAssetRequest::getType(), LLAssetRequest::getUUID(), HTTP_MISSING, HTTP_NO_CONTENT, HTTP_OK, HTTP_PUT_OK, HTTP_SERVER_BAD_GATEWAY, HTTP_SERVER_TEMP_UNAVAILABLE, LL_ERR_ASSET_REQUEST_FAILED, LL_ERR_ASSET_REQUEST_NOT_IN_DATABASE, LL_ERR_NOERR, LL_EXSTAT_CURL_RESULT, llendl, llinfos, llwarns, LLAssetType::lookup(), MAX_STRING, mBaseURL, LLHTTPAssetRequest::mCurlHandle, mCurlMultiHandle, mHostName, LLAssetRequest::mIsUserWaiting, mLocalBaseURL, LLAssetStorage::mPendingDownloads, LLAssetStorage::mPendingLocalUploads, LLAssetStorage::mPendingUploads, LLAssetRequest::mRequestingAgentID, LLHTTPAssetRequest::mRequestType, mRunningDownloads, mRunningLocalUploads, mRunningUploads, LLAssetRequest::mTime, LLAssetRequest::mTimeout, LLHTTPAssetRequest::mTmpUUID, LLHTTPAssetRequest::mURLBuffer, LLHTTPAssetRequest::mVFile, LLAssetStorage::mVFS, NULL, nullOutputCallback(), LLHTTPAssetRequest::prepareCompressedUpload(), LLVFile::remove(), LLVFile::rename(), LLAssetStorage::RT_DOWNLOAD, LLAssetStorage::RT_LOCALUPLOAD, LLAssetStorage::RT_UPLOAD, S32, LLHTTPAssetRequest::setupCurlHandle(), LLUUID::toString(), TRUE, and UUID_STR_LENGTH.
void LLHTTPAssetStorage::clearTempAssetData | ( | ) | [virtual] |
Reimplemented from LLAssetStorage.
Definition at line 1401 of file llhttpassetstorage.cpp.
References llendl, llinfos, and mTempAssets.
size_t LLHTTPAssetStorage::curlDownCallback | ( | void * | data, | |
size_t | size, | |||
size_t | nmemb, | |||
void * | user_data | |||
) | [static] |
Definition at line 1048 of file llhttpassetstorage.cpp.
References LLVFile::APPEND, LLAssetType::AT_NONE, gAssetStorage, LLVFile::getSize(), llendl, llmax(), llmin(), llwarns, LLHTTPAssetRequest::mTmpUUID, LLHTTPAssetRequest::mVFile, LLAssetStorage::mVFS, NULL, S32, LLVFile::setMaxSize(), and LLVFile::write().
Referenced by checkForTimeouts().
size_t LLHTTPAssetStorage::curlFileDownCallback | ( | void * | data, | |
size_t | size, | |||
size_t | nmemb, | |||
void * | user_data | |||
) | [static] |
Definition at line 1205 of file llhttpassetstorage.cpp.
References llendl, llwarns, LLHTTPAssetRequest::mFP, and NULL.
Referenced by getURLToFile().
size_t LLHTTPAssetStorage::curlUpCallback | ( | void * | data, | |
size_t | size, | |||
size_t | nmemb, | |||
void * | user_data | |||
) | [static] |
Definition at line 1078 of file llhttpassetstorage.cpp.
References gAssetStorage, LLVFile::getLastBytesRead(), LLVFile::getSize(), LLAssetRequest::getType(), LLAssetRequest::getUUID(), llendl, llmin(), llwarns, LLHTTPAssetRequest::mVFile, LLAssetStorage::mVFS, NULL, LLVFile::read(), LLVFile::READ, S32, and LLVFile::tell().
Referenced by checkForTimeouts().
virtual bool LLHTTPAssetStorage::deletePendingRequest | ( | ERequestType | rt, | |
LLAssetType::EType | asset_type, | |||
const LLUUID & | asset_id | |||
) | [virtual] |
Referenced by bumpTimedOutUploads(), and checkForTimeouts().
Reimplemented from LLAssetStorage.
Definition at line 1372 of file llhttpassetstorage.cpp.
References count, end, LLUUID::isNull(), llendl, llinfos, mTempAssets, and S32.
LLAssetRequest* LLHTTPAssetStorage::findNextRequest | ( | request_list_t & | pending, | |
request_list_t & | running | |||
) |
Referenced by checkForTimeouts().
std::string LLHTTPAssetStorage::getBaseURL | ( | const LLUUID & | asset_id, | |
LLAssetType::EType | asset_type | |||
) | [private] |
Definition at line 1356 of file llhttpassetstorage.cpp.
References LLAssetType::AT_TEXTURE, llformat(), LOCAL_ASSET_URL_FORMAT, mBaseURL, and mTempAssets.
Referenced by checkForTimeouts().
virtual LLSD LLHTTPAssetStorage::getPendingDetails | ( | ERequestType | rt, | |
LLAssetType::EType | asset_type, | |||
const std::string & | detail_prefix | |||
) | const [virtual] |
virtual LLSD LLHTTPAssetStorage::getPendingRequest | ( | ERequestType | rt, | |
LLAssetType::EType | asset_type, | |||
const LLUUID & | asset_id | |||
) | const [virtual] |
const request_list_t* LLHTTPAssetStorage::getRunningList | ( | ERequestType | rt | ) | const |
request_list_t* LLHTTPAssetStorage::getRunningList | ( | ERequestType | rt | ) |
Referenced by addRunningRequest(), and removeRunningRequest().
Reimplemented from LLAssetStorage.
Definition at line 1317 of file llhttpassetstorage.cpp.
References mTempAssets, and LLUUID::null.
std::string LLHTTPAssetStorage::getTempAssetHostName | ( | const LLUUID & | texture_id | ) | const [virtual] |
Reimplemented from LLAssetStorage.
Definition at line 1303 of file llhttpassetstorage.cpp.
References mTempAssets.
S32 LLHTTPAssetStorage::getURLToFile | ( | const LLUUID & | uuid, | |
LLAssetType::EType | asset_type, | |||
const LLString & | url, | |||
const char * | filename, | |||
progress_callback | callback, | |||
void * | userdata | |||
) |
Definition at line 1113 of file llhttpassetstorage.cpp.
References curlFileDownCallback(), LLFile::fopen(), GET_URL_TO_FILE_TIMEOUT, LLTimer::hasExpired(), HTTP_MISSING, HTTP_OK, LL_ERR_ASSET_REQUEST_FAILED, LL_ERR_ASSET_REQUEST_NOT_IN_DATABASE, lldebugs, llendl, llinfos, llwarns, mCurlMultiHandle, LLFile::remove(), LLAssetStorage::RT_DOWNLOAD, S32, LLTimer::setTimerExpirySec(), size, and TRUE.
Reimplemented from LLAssetStorage.
Definition at line 1295 of file llhttpassetstorage.cpp.
References mTempAssets.
void LLHTTPAssetStorage::removeRunningRequest | ( | ERequestType | rt, | |
LLHTTPAssetRequest * | request | |||
) |
Definition at line 1264 of file llhttpassetstorage.cpp.
References getRunningList(), llendl, llerrs, and request().
Referenced by LLHTTPAssetRequest::cleanupCurlHandle().
Reimplemented from LLAssetStorage.
Definition at line 1331 of file llhttpassetstorage.cpp.
References mTempAssets.
Reimplemented from LLAssetStorage.
Definition at line 1337 of file llhttpassetstorage.cpp.
References end, LLTempAssetData::mAgentID, and mTempAssets.
void LLHTTPAssetStorage::storeAssetData | ( | const char * | filename, | |
const LLUUID & | asset_id, | |||
LLAssetType::EType | atype, | |||
LLStoreAssetCallback | callback, | |||
void * | user_data, | |||
bool | temp_file, | |||
bool | is_priority, | |||
bool | user_waiting = FALSE , |
|||
F64 | timeout = LL_ASSET_STORAGE_TIMEOUT | |||
) | [virtual] |
Definition at line 488 of file llhttpassetstorage.cpp.
References LLFile::fopen(), LLAssetStorage::legacyStoreDataCallback(), LL_ERR_CANNOT_OPEN_FILE, LL_EXSTAT_BLOCKED_FILE, llendl, llinfos, LLAssetType::lookup(), LLLegacyAssetRequest::mUpCallback, LLLegacyAssetRequest::mUserData, LLAssetStorage::mVFS, LLUUID::null, LLFile::remove(), S32, LLVFile::setMaxSize(), size, storeAssetData(), LLVFile::write(), and LLVFile::WRITE.
virtual void LLHTTPAssetStorage::storeAssetData | ( | const LLUUID & | uuid, | |
LLAssetType::EType | atype, | |||
LLStoreAssetCallback | callback, | |||
void * | user_data, | |||
bool | temp_file = false , |
|||
bool | is_priority = false , |
|||
bool | store_local = false , |
|||
const LLUUID & | requesting_agent_id = LLUUID::null , |
|||
bool | user_waiting = FALSE , |
|||
F64 | timeout = LL_ASSET_STORAGE_TIMEOUT | |||
) | [virtual] |
Referenced by storeAssetData().
std::string LLHTTPAssetStorage::mBaseURL [protected] |
Definition at line 148 of file llhttpassetstorage.h.
Referenced by _init(), checkForTimeouts(), and getBaseURL().
CURLM* LLHTTPAssetStorage::mCurlMultiHandle [protected] |
Definition at line 152 of file llhttpassetstorage.h.
Referenced by _init(), checkForTimeouts(), getURLToFile(), and ~LLHTTPAssetStorage().
std::string LLHTTPAssetStorage::mHostName [protected] |
std::string LLHTTPAssetStorage::mLocalBaseURL [protected] |
request_list_t LLHTTPAssetStorage::mRunningDownloads [protected] |
request_list_t LLHTTPAssetStorage::mRunningUploads [protected] |
Definition at line 155 of file llhttpassetstorage.h.
Referenced by bumpTimedOutUploads(), and checkForTimeouts().
uuid_tempdata_map LLHTTPAssetStorage::mTempAssets [protected] |
Definition at line 158 of file llhttpassetstorage.h.
Referenced by addTempAssetData(), clearTempAssetData(), dumpTempAssetData(), getBaseURL(), getTempAssetAgentID(), getTempAssetHostName(), hasTempAssetData(), removeTempAssetData(), and removeTempAssetDataByAgentID().