aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llmessage/lltransfertargetvfile.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--linden/indra/llmessage/lltransfertargetvfile.cpp58
1 files changed, 10 insertions, 48 deletions
diff --git a/linden/indra/llmessage/lltransfertargetvfile.cpp b/linden/indra/llmessage/lltransfertargetvfile.cpp
index ce21605..5a1acf3 100644
--- a/linden/indra/llmessage/lltransfertargetvfile.cpp
+++ b/linden/indra/llmessage/lltransfertargetvfile.cpp
@@ -34,33 +34,8 @@
34#include "llvfile.h" 34#include "llvfile.h"
35 35
36//static 36//static
37std::list<LLTransferTargetParamsVFile*> LLTransferTargetVFile::sCallbackQueue;
38
39//static
40void LLTransferTargetVFile::updateQueue(bool shutdown) 37void LLTransferTargetVFile::updateQueue(bool shutdown)
41{ 38{
42 for(std::list<LLTransferTargetParamsVFile*>::iterator iter = sCallbackQueue.begin();
43 iter != sCallbackQueue.end(); )
44 {
45 std::list<LLTransferTargetParamsVFile*>::iterator curiter = iter++;
46 LLTransferTargetParamsVFile* params = *curiter;
47 LLVFSThread::status_t s = LLVFile::getVFSThread()->getRequestStatus(params->mHandle);
48 if (s == LLVFSThread::STATUS_COMPLETE || s == LLVFSThread::STATUS_EXPIRED)
49 {
50 params->mCompleteCallback(
51 params->mErrCode,
52 params->getAssetID(),
53 params->getAssetType(),
54 params->mUserDatap);
55 delete params;
56 iter = sCallbackQueue.erase(curiter);
57 }
58 else if (shutdown)
59 {
60 delete params;
61 iter = sCallbackQueue.erase(curiter);
62 }
63 }
64} 39}
65 40
66 41
@@ -69,8 +44,7 @@ LLTransferTargetParamsVFile::LLTransferTargetParamsVFile() :
69 mAssetType(LLAssetType::AT_NONE), 44 mAssetType(LLAssetType::AT_NONE),
70 mCompleteCallback(NULL), 45 mCompleteCallback(NULL),
71 mUserDatap(NULL), 46 mUserDatap(NULL),
72 mErrCode(0), 47 mErrCode(0)
73 mHandle(LLVFSThread::nullHandle())
74{ 48{
75} 49}
76 50
@@ -185,7 +159,6 @@ void LLTransferTargetVFile::completionCallback(const LLTSCode status)
185 llwarns << "Aborting vfile transfer after asset storage shut down!" << llendl; 159 llwarns << "Aborting vfile transfer after asset storage shut down!" << llendl;
186 return; 160 return;
187 } 161 }
188 LLVFSThread::handle_t handle = LLVFSThread::nullHandle();
189 162
190 // Still need to gracefully handle error conditions. 163 // Still need to gracefully handle error conditions.
191 S32 err_code = 0; 164 S32 err_code = 0;
@@ -194,11 +167,11 @@ void LLTransferTargetVFile::completionCallback(const LLTSCode status)
194 case LLTS_DONE: 167 case LLTS_DONE:
195 if (!mNeedsCreate) 168 if (!mNeedsCreate)
196 { 169 {
197 handle = LLVFile::getVFSThread()->rename( 170 LLVFile file(gAssetStorage->mVFS, mTempID, mParams.getAssetType(), LLVFile::WRITE);
198 gAssetStorage->mVFS, 171 if (!file.rename(mParams.getAssetID(), mParams.getAssetType()))
199 mTempID, mParams.getAssetType(), 172 {
200 mParams.getAssetID(), mParams.getAssetType(), 173 llerrs << "LLTransferTargetVFile: rename failed" << llendl;
201 LLVFSThread::AUTO_DELETE); 174 }
202 } 175 }
203 err_code = LL_ERR_NOERR; 176 err_code = LL_ERR_NOERR;
204 lldebugs << "LLTransferTargetVFile::completionCallback for " 177 lldebugs << "LLTransferTargetVFile::completionCallback for "
@@ -238,20 +211,9 @@ void LLTransferTargetVFile::completionCallback(const LLTSCode status)
238 } 211 }
239 if (mParams.mCompleteCallback) 212 if (mParams.mCompleteCallback)
240 { 213 {
241 if (handle != LLVFSThread::nullHandle()) 214 mParams.mCompleteCallback(err_code,
242 { 215 mParams.getAssetID(),
243 LLTransferTargetParamsVFile* params = new LLTransferTargetParamsVFile(mParams); 216 mParams.getAssetType(),
244 params->mErrCode = err_code; 217 mParams.mUserDatap);
245 params->mHandle = handle;
246 sCallbackQueue.push_back(params);
247 }
248 else
249 {
250 mParams.mCompleteCallback(
251 err_code,
252 mParams.getAssetID(),
253 mParams.getAssetType(),
254 mParams.mUserDatap);
255 }
256 } 218 }
257} 219}