aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2012-09-25 22:08:11 +0100
committerJustin Clark-Casey (justincc)2012-09-25 22:08:11 +0100
commit2f795e4fa6433269748f4e062d4bba7197e46ab1 (patch)
tree1e0dc74b54aa905225962031af777e19638f683f /OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs
parentFix occasional race condition failure when creating new clothing/body parts i... (diff)
downloadopensim-SC-2f795e4fa6433269748f4e062d4bba7197e46ab1.zip
opensim-SC-2f795e4fa6433269748f4e062d4bba7197e46ab1.tar.gz
opensim-SC-2f795e4fa6433269748f4e062d4bba7197e46ab1.tar.bz2
opensim-SC-2f795e4fa6433269748f4e062d4bba7197e46ab1.tar.xz
Move UDP update task item code to AssetXferUploader to match existing create user item and update user item mechanisms
This is done for consistency and to allow removal or some access methods that increase code complexity. However, this path has not been used for a long time, not even by LL 1.23 - viewers use caps http upload for this instead
Diffstat (limited to 'OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs')
-rw-r--r--OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs67
1 files changed, 49 insertions, 18 deletions
diff --git a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs
index 9f05120..08c3134 100644
--- a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs
+++ b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs
@@ -65,11 +65,15 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
65 private UUID InventFolder = UUID.Zero; 65 private UUID InventFolder = UUID.Zero;
66 private sbyte invType = 0; 66 private sbyte invType = 0;
67 67
68 private bool m_createItem = false; 68 private bool m_createItem;
69 private uint m_createItemCallback = 0; 69 private uint m_createItemCallback;
70 private bool m_updateItem = false; 70
71 private bool m_updateItem;
71 private InventoryItemBase m_updateItemData; 72 private InventoryItemBase m_updateItemData;
72 73
74 private bool m_updateTaskItem;
75 private TaskInventoryItem m_updateTaskItemData;
76
73 private string m_description = String.Empty; 77 private string m_description = String.Empty;
74 private bool m_dumpAssetToFile; 78 private bool m_dumpAssetToFile;
75 private string m_name = String.Empty; 79 private string m_name = String.Empty;
@@ -223,6 +227,12 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
223 // TODO: Should probably do the same for create item. 227 // TODO: Should probably do the same for create item.
224 m_transactions.RemoveXferUploader(TransactionID); 228 m_transactions.RemoveXferUploader(TransactionID);
225 } 229 }
230 else if (m_updateTaskItem)
231 {
232 StoreAssetForTaskItemUpdate(m_updateTaskItemData);
233
234 m_transactions.RemoveXferUploader(TransactionID);
235 }
226 else if (m_storeLocal) 236 else if (m_storeLocal)
227 { 237 {
228 m_Scene.AssetService.Store(m_asset); 238 m_Scene.AssetService.Store(m_asset);
@@ -323,8 +333,30 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
323 } 333 }
324 } 334 }
325 335
336 public void RequestUpdateTaskInventoryItem(IClientAPI remoteClient, UUID transactionID, TaskInventoryItem taskItem)
337 {
338 // We must lock to avoid a race with a separate thread uploading the asset.
339 lock (this)
340 {
341 m_asset.Name = taskItem.Name;
342 m_asset.Description = taskItem.Description;
343 m_asset.Type = (sbyte)taskItem.Type;
344 taskItem.AssetID = m_asset.FullID;
345
346 if (m_uploadState == UploadState.Complete)
347 {
348 StoreAssetForTaskItemUpdate(taskItem);
349 }
350 else
351 {
352 m_updateTaskItem = true;
353 m_updateTaskItemData = taskItem;
354 }
355 }
356 }
357
326 /// <summary> 358 /// <summary>
327 /// Store the asset for the given item. 359 /// Store the asset for the given item when it has been uploaded.
328 /// </summary> 360 /// </summary>
329 /// <param name="item"></param> 361 /// <param name="item"></param>
330 private void StoreAssetForItemUpdate(InventoryItemBase item) 362 private void StoreAssetForItemUpdate(InventoryItemBase item)
@@ -336,6 +368,19 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
336 m_Scene.AssetService.Store(m_asset); 368 m_Scene.AssetService.Store(m_asset);
337 } 369 }
338 370
371 /// <summary>
372 /// Store the asset for the given task item when it has been uploaded.
373 /// </summary>
374 /// <param name="taskItem"></param>
375 private void StoreAssetForTaskItemUpdate(TaskInventoryItem taskItem)
376 {
377// m_log.DebugFormat(
378// "[ASSET XFER UPLOADER]: Storing asset {0} for earlier task item update for {1} for {2}",
379// m_asset.FullID, taskItem.Name, ourClient.Name);
380
381 m_Scene.AssetService.Store(m_asset);
382 }
383
339 private void DoCreateItem(uint callbackID) 384 private void DoCreateItem(uint callbackID)
340 { 385 {
341 m_Scene.AssetService.Store(m_asset); 386 m_Scene.AssetService.Store(m_asset);
@@ -363,19 +408,5 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
363 else 408 else
364 ourClient.SendAlertMessage("Unable to create inventory item"); 409 ourClient.SendAlertMessage("Unable to create inventory item");
365 } 410 }
366
367 /// <summary>
368 /// Get the asset data uploaded in this transfer.
369 /// </summary>
370 /// <returns>null if the asset has not finished uploading</returns>
371 public AssetBase GetAssetData()
372 {
373 if (m_uploadState == UploadState.Complete)
374 {
375 return m_asset;
376 }
377
378 return null;
379 }
380 } 411 }
381} \ No newline at end of file 412} \ No newline at end of file