MAINT-5357: Added yield between prepare and post in upload.
Removed some commented out code I had missed earlier Moved costing to virtual function in uploadinfo.meow-7.2.2
parent
22bd85441b
commit
62e83193c5
|
|
@ -1005,7 +1005,6 @@ void LLSnapshotLivePreview::saveTexture()
|
|||
std::string who_took_it;
|
||||
LLAgentUI::buildFullname(who_took_it);
|
||||
S32 expected_upload_cost = LLGlobalEconomy::Singleton::getInstance()->getPriceUpload();
|
||||
#if 1
|
||||
std::string name = "Snapshot: " + pos_string;
|
||||
std::string desc = "Taken by " + who_took_it + " at " + pos_string;
|
||||
|
||||
|
|
@ -1017,23 +1016,6 @@ void LLSnapshotLivePreview::saveTexture()
|
|||
|
||||
upload_new_resource(assetUploadInfo);
|
||||
|
||||
#else
|
||||
LLAssetStorage::LLStoreAssetCallback callback = NULL;
|
||||
void *userdata = NULL;
|
||||
|
||||
upload_new_resource(tid, // tid
|
||||
LLAssetType::AT_TEXTURE,
|
||||
"Snapshot : " + pos_string,
|
||||
"Taken by " + who_took_it + " at " + pos_string,
|
||||
0,
|
||||
LLFolderType::FT_SNAPSHOT_CATEGORY,
|
||||
LLInventoryType::IT_SNAPSHOT,
|
||||
PERM_ALL, // Note: Snapshots to inventory is a special case of content upload
|
||||
LLFloaterPerms::getGroupPerms("Uploads"), // that is more permissive than other uploads
|
||||
LLFloaterPerms::getEveryonePerms("Uploads"),
|
||||
"Snapshot : " + pos_string,
|
||||
callback, expected_upload_cost, userdata);
|
||||
#endif
|
||||
gViewerWindow->playSnapshotAnimAndSound();
|
||||
}
|
||||
else
|
||||
|
|
|
|||
|
|
@ -148,6 +148,22 @@ void LLResourceUploadInfo::logPreparedUpload()
|
|||
"Asset Type: " << LLAssetType::lookup(mAssetType) << LL_ENDL;
|
||||
}
|
||||
|
||||
S32 LLResourceUploadInfo::getEconomyUploadCost()
|
||||
{
|
||||
// Update L$ and ownership credit information
|
||||
// since it probably changed on the server
|
||||
if (getAssetType() == LLAssetType::AT_TEXTURE ||
|
||||
getAssetType() == LLAssetType::AT_SOUND ||
|
||||
getAssetType() == LLAssetType::AT_ANIMATION ||
|
||||
getAssetType() == LLAssetType::AT_MESH)
|
||||
{
|
||||
return LLGlobalEconomy::Singleton::getInstance()->getPriceUpload();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
LLUUID LLResourceUploadInfo::finishUpload(LLSD &result)
|
||||
{
|
||||
if (getFolderId().isNull())
|
||||
|
|
@ -660,7 +676,7 @@ void LLViewerAssetUpload::AssetInventoryUploadCoproc(LLCoreHttpUtil::HttpCorouti
|
|||
return;
|
||||
}
|
||||
|
||||
//self.yield();
|
||||
llcoro::yield();
|
||||
|
||||
if (uploadInfo->showUploadDialog())
|
||||
{
|
||||
|
|
@ -686,43 +702,38 @@ void LLViewerAssetUpload::AssetInventoryUploadCoproc(LLCoreHttpUtil::HttpCorouti
|
|||
|
||||
std::string uploader = result["uploader"].asString();
|
||||
|
||||
result = httpAdapter->postFileAndYield(httpRequest, uploader, uploadInfo->getAssetId(), uploadInfo->getAssetType());
|
||||
httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS];
|
||||
status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults);
|
||||
|
||||
if (!status)
|
||||
{
|
||||
HandleUploadError(status, result, uploadInfo);
|
||||
if (uploadInfo->showUploadDialog())
|
||||
LLUploadDialog::modalUploadFinished();
|
||||
return;
|
||||
}
|
||||
|
||||
S32 uploadPrice = 0;
|
||||
|
||||
// Update L$ and ownership credit information
|
||||
// since it probably changed on the server
|
||||
if (uploadInfo->getAssetType() == LLAssetType::AT_TEXTURE ||
|
||||
uploadInfo->getAssetType() == LLAssetType::AT_SOUND ||
|
||||
uploadInfo->getAssetType() == LLAssetType::AT_ANIMATION ||
|
||||
uploadInfo->getAssetType() == LLAssetType::AT_MESH)
|
||||
{
|
||||
uploadPrice = LLGlobalEconomy::Singleton::getInstance()->getPriceUpload();
|
||||
}
|
||||
|
||||
bool success = false;
|
||||
|
||||
if (uploadPrice > 0)
|
||||
if (!uploader.empty() && uploadInfo->getAssetId().notNull())
|
||||
{
|
||||
// this upload costed us L$, update our balance
|
||||
// and display something saying that it cost L$
|
||||
LLStatusBar::sendMoneyBalanceRequest();
|
||||
result = httpAdapter->postFileAndYield(httpRequest, uploader, uploadInfo->getAssetId(), uploadInfo->getAssetType());
|
||||
httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS];
|
||||
status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults);
|
||||
|
||||
LLSD args;
|
||||
args["AMOUNT"] = llformat("%d", uploadPrice);
|
||||
LLNotificationsUtil::add("UploadPayment", args);
|
||||
if (!status)
|
||||
{
|
||||
HandleUploadError(status, result, uploadInfo);
|
||||
if (uploadInfo->showUploadDialog())
|
||||
LLUploadDialog::modalUploadFinished();
|
||||
return;
|
||||
}
|
||||
|
||||
S32 uploadPrice = uploadInfo->getEconomyUploadCost();
|
||||
|
||||
if (uploadPrice > 0)
|
||||
{
|
||||
// this upload costed us L$, update our balance
|
||||
// and display something saying that it cost L$
|
||||
LLStatusBar::sendMoneyBalanceRequest();
|
||||
|
||||
LLSD args;
|
||||
args["AMOUNT"] = llformat("%d", uploadPrice);
|
||||
LLNotificationsUtil::add("UploadPayment", args);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
LL_WARNS() << "No upload url provided. Nothing uploaded, responding with previous result." << LL_ENDL;
|
||||
}
|
||||
|
||||
LLUUID serverInventoryItem = uploadInfo->finishUpload(result);
|
||||
|
||||
if (uploadInfo->showInventoryPanel())
|
||||
|
|
|
|||
|
|
@ -61,6 +61,7 @@ public:
|
|||
virtual LLSD prepareUpload();
|
||||
virtual LLSD generatePostBody();
|
||||
virtual void logPreparedUpload();
|
||||
virtual S32 getEconomyUploadCost();
|
||||
virtual LLUUID finishUpload(LLSD &result);
|
||||
|
||||
LLTransactionID getTransactionId() const { return mTransactionId; }
|
||||
|
|
|
|||
Loading…
Reference in New Issue