aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2012-09-25 23:30:25 +0100
committerMelanie2012-09-27 15:28:43 +0100
commitfdd4361928e5e3defa2afba5588738f57cdc426d (patch)
treef561942426efeca89f4dab37ca88302018fe96ff /OpenSim/Region
parentComment out old m_storeLocal from AssetXferUploader. (diff)
downloadopensim-SC-fdd4361928e5e3defa2afba5588738f57cdc426d.zip
opensim-SC-fdd4361928e5e3defa2afba5588738f57cdc426d.tar.gz
opensim-SC-fdd4361928e5e3defa2afba5588738f57cdc426d.tar.bz2
opensim-SC-fdd4361928e5e3defa2afba5588738f57cdc426d.tar.xz
Fix very recently introduced race condition where a CreateNewItem outracing an UploadAsset request could throw an exception because m_asset did not yet exist.
This was accidentally introduced in 4fc0cfb This commit also consistently removes the AssetXferUploader when the transaction completes, no matter if it completed on asset upload or item operation. The amount of data being retained was small, since this was clothing/bodypart metadata in the asset rather than textures themselves.
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs37
1 files changed, 18 insertions, 19 deletions
diff --git a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs
index 9a1dd4d..f6dd5af 100644
--- a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs
+++ b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs
@@ -113,6 +113,8 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
113 public AssetXferUploader( 113 public AssetXferUploader(
114 AgentAssetTransactions transactions, Scene scene, UUID transactionID, bool dumpAssetToFile) 114 AgentAssetTransactions transactions, Scene scene, UUID transactionID, bool dumpAssetToFile)
115 { 115 {
116 m_asset = new AssetBase();
117
116 m_transactions = transactions; 118 m_transactions = transactions;
117 m_transactionID = transactionID; 119 m_transactionID = transactionID;
118 m_Scene = scene; 120 m_Scene = scene;
@@ -197,9 +199,7 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
197 199
198 ourClient = remoteClient; 200 ourClient = remoteClient;
199 201
200 m_asset = new AssetBase() { FullID = assetID }; 202 m_asset.FullID = assetID;
201 m_asset.Name = "blank";
202 m_asset.Description = "empty";
203 m_asset.Type = type; 203 m_asset.Type = type;
204 m_asset.CreatorID = remoteClient.AgentId.ToString(); 204 m_asset.CreatorID = remoteClient.AgentId.ToString();
205 m_asset.Data = data; 205 m_asset.Data = data;
@@ -241,22 +241,15 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
241 241
242 if (m_createItem) 242 if (m_createItem)
243 { 243 {
244 DoCreateItem(m_createItemCallback); 244 CompleteCreateItem(m_createItemCallback);
245 } 245 }
246 else if (m_updateItem) 246 else if (m_updateItem)
247 { 247 {
248 StoreAssetForItemUpdate(m_updateItemData); 248 CompleteItemUpdate(m_updateItemData);
249
250 // Remove ourselves from the list of transactions if completion was delayed until the transaction
251 // was complete.
252 // TODO: Should probably do the same for create item.
253 m_transactions.RemoveXferUploader(m_transactionID);
254 } 249 }
255 else if (m_updateTaskItem) 250 else if (m_updateTaskItem)
256 { 251 {
257 StoreAssetForTaskItemUpdate(m_updateTaskItemData); 252 CompleteTaskItemUpdate(m_updateTaskItemData);
258
259 m_transactions.RemoveXferUploader(m_transactionID);
260 } 253 }
261// else if (m_storeLocal) 254// else if (m_storeLocal)
262// { 255// {
@@ -314,7 +307,7 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
314 { 307 {
315 if (m_uploadState == UploadState.Complete) 308 if (m_uploadState == UploadState.Complete)
316 { 309 {
317 DoCreateItem(callbackID); 310 CompleteCreateItem(callbackID);
318 } 311 }
319 else 312 else
320 { 313 {
@@ -341,7 +334,7 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
341 334
342 if (m_uploadState == UploadState.Complete) 335 if (m_uploadState == UploadState.Complete)
343 { 336 {
344 StoreAssetForItemUpdate(item); 337 CompleteItemUpdate(item);
345 } 338 }
346 else 339 else
347 { 340 {
@@ -367,7 +360,7 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
367 360
368 if (m_uploadState == UploadState.Complete) 361 if (m_uploadState == UploadState.Complete)
369 { 362 {
370 StoreAssetForTaskItemUpdate(taskItem); 363 CompleteTaskItemUpdate(taskItem);
371 } 364 }
372 else 365 else
373 { 366 {
@@ -381,29 +374,33 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
381 /// Store the asset for the given item when it has been uploaded. 374 /// Store the asset for the given item when it has been uploaded.
382 /// </summary> 375 /// </summary>
383 /// <param name="item"></param> 376 /// <param name="item"></param>
384 private void StoreAssetForItemUpdate(InventoryItemBase item) 377 private void CompleteItemUpdate(InventoryItemBase item)
385 { 378 {
386// m_log.DebugFormat( 379// m_log.DebugFormat(
387// "[ASSET XFER UPLOADER]: Storing asset {0} for earlier item update for {1} for {2}", 380// "[ASSET XFER UPLOADER]: Storing asset {0} for earlier item update for {1} for {2}",
388// m_asset.FullID, item.Name, ourClient.Name); 381// m_asset.FullID, item.Name, ourClient.Name);
389 382
390 m_Scene.AssetService.Store(m_asset); 383 m_Scene.AssetService.Store(m_asset);
384
385 m_transactions.RemoveXferUploader(m_transactionID);
391 } 386 }
392 387
393 /// <summary> 388 /// <summary>
394 /// Store the asset for the given task item when it has been uploaded. 389 /// Store the asset for the given task item when it has been uploaded.
395 /// </summary> 390 /// </summary>
396 /// <param name="taskItem"></param> 391 /// <param name="taskItem"></param>
397 private void StoreAssetForTaskItemUpdate(TaskInventoryItem taskItem) 392 private void CompleteTaskItemUpdate(TaskInventoryItem taskItem)
398 { 393 {
399// m_log.DebugFormat( 394// m_log.DebugFormat(
400// "[ASSET XFER UPLOADER]: Storing asset {0} for earlier task item update for {1} for {2}", 395// "[ASSET XFER UPLOADER]: Storing asset {0} for earlier task item update for {1} for {2}",
401// m_asset.FullID, taskItem.Name, ourClient.Name); 396// m_asset.FullID, taskItem.Name, ourClient.Name);
402 397
403 m_Scene.AssetService.Store(m_asset); 398 m_Scene.AssetService.Store(m_asset);
399
400 m_transactions.RemoveXferUploader(m_transactionID);
404 } 401 }
405 402
406 private void DoCreateItem(uint callbackID) 403 private void CompleteCreateItem(uint callbackID)
407 { 404 {
408 ValidateAssets(); 405 ValidateAssets();
409 m_Scene.AssetService.Store(m_asset); 406 m_Scene.AssetService.Store(m_asset);
@@ -433,6 +430,8 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
433 ourClient.SendInventoryItemCreateUpdate(item, callbackID); 430 ourClient.SendInventoryItemCreateUpdate(item, callbackID);
434 else 431 else
435 ourClient.SendAlertMessage("Unable to create inventory item"); 432 ourClient.SendAlertMessage("Unable to create inventory item");
433
434 m_transactions.RemoveXferUploader(m_transactionID);
436 } 435 }
437 436
438 private void ValidateAssets() 437 private void ValidateAssets()