aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/CoreModules/Agent/AssetTransaction/AgentAssetsTransactions.cs47
-rw-r--r--OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetTransactionModule.cs2
-rw-r--r--OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs67
3 files changed, 52 insertions, 64 deletions
diff --git a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AgentAssetsTransactions.cs b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AgentAssetsTransactions.cs
index bba7b9c..59d0075 100644
--- a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AgentAssetsTransactions.cs
+++ b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AgentAssetsTransactions.cs
@@ -155,56 +155,13 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
155 description, name, invType, type, wearableType, nextOwnerMask); 155 description, name, invType, type, wearableType, nextOwnerMask);
156 } 156 }
157 157
158 /// <summary>
159 /// Get an uploaded asset. If the data is successfully retrieved,
160 /// the transaction will be removed.
161 /// </summary>
162 /// <param name="transactionID"></param>
163 /// <returns>The asset if the upload has completed, null if it has not.</returns>
164 private AssetBase GetTransactionAsset(UUID transactionID)
165 {
166 lock (XferUploaders)
167 {
168 if (XferUploaders.ContainsKey(transactionID))
169 {
170 AssetXferUploader uploader = XferUploaders[transactionID];
171 AssetBase asset = uploader.GetAssetData();
172 RemoveXferUploader(transactionID);
173
174 return asset;
175 }
176 }
177
178 return null;
179 }
180
181 public void RequestUpdateTaskInventoryItem(IClientAPI remoteClient, 158 public void RequestUpdateTaskInventoryItem(IClientAPI remoteClient,
182 SceneObjectPart part, UUID transactionID, 159 SceneObjectPart part, UUID transactionID,
183 TaskInventoryItem item) 160 TaskInventoryItem item)
184 { 161 {
185 AssetBase asset = GetTransactionAsset(transactionID); 162 AssetXferUploader uploader = RequestXferUploader(transactionID);
186
187 // Only legacy viewers use this, and they prefer CAPS, which
188 // we have, so this really never runs.
189 // Allow it, but only for "safe" types.
190 if ((InventoryType)item.InvType != InventoryType.Notecard &&
191 (InventoryType)item.InvType != InventoryType.LSL)
192 return;
193 163
194 if (asset != null) 164 uploader.RequestUpdateTaskInventoryItem(remoteClient, transactionID, item);
195 {
196// m_log.DebugFormat(
197// "[AGENT ASSETS TRANSACTIONS]: Updating item {0} in {1} for transaction {2}",
198// item.Name, part.Name, transactionID);
199
200 asset.FullID = UUID.Random();
201 asset.Name = item.Name;
202 asset.Description = item.Description;
203 asset.Type = (sbyte)item.Type;
204 item.AssetID = asset.FullID;
205
206 m_Scene.AssetService.Store(asset);
207 }
208 } 165 }
209 166
210 public void RequestUpdateInventoryItem(IClientAPI remoteClient, 167 public void RequestUpdateInventoryItem(IClientAPI remoteClient,
diff --git a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetTransactionModule.cs b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetTransactionModule.cs
index 10a0794..73d1f72 100644
--- a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetTransactionModule.cs
+++ b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetTransactionModule.cs
@@ -215,7 +215,7 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
215 IClientAPI remoteClient, SceneObjectPart part, UUID transactionID, TaskInventoryItem item) 215 IClientAPI remoteClient, SceneObjectPart part, UUID transactionID, TaskInventoryItem item)
216 { 216 {
217 m_log.DebugFormat( 217 m_log.DebugFormat(
218 "[TRANSACTIONS MANAGER] Called HandleTaskItemUpdateFromTransaction with item {0} in {1} for {2} in {3}", 218 "[ASSET TRANSACTION MODULE] Called HandleTaskItemUpdateFromTransaction with item {0} in {1} for {2} in {3}",
219 item.Name, part.Name, remoteClient.Name, m_Scene.RegionInfo.RegionName); 219 item.Name, part.Name, remoteClient.Name, m_Scene.RegionInfo.RegionName);
220 220
221 AgentAssetTransactions transactions = 221 AgentAssetTransactions transactions =
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