aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/CoreModules/Agent/AssetTransaction/AgentAssetsTransactions.cs8
-rw-r--r--OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs77
2 files changed, 49 insertions, 36 deletions
diff --git a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AgentAssetsTransactions.cs b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AgentAssetsTransactions.cs
index 59d0075..0271738 100644
--- a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AgentAssetsTransactions.cs
+++ b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AgentAssetsTransactions.cs
@@ -73,7 +73,7 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
73 { 73 {
74 if (!XferUploaders.ContainsKey(transactionID)) 74 if (!XferUploaders.ContainsKey(transactionID))
75 { 75 {
76 uploader = new AssetXferUploader(this, m_Scene, m_dumpAssetsToFile); 76 uploader = new AssetXferUploader(this, m_Scene, transactionID, m_dumpAssetsToFile);
77 77
78// m_log.DebugFormat( 78// m_log.DebugFormat(
79// "[AGENT ASSETS TRANSACTIONS]: Adding asset xfer uploader {0} since it didn't previously exist", transactionID); 79// "[AGENT ASSETS TRANSACTIONS]: Adding asset xfer uploader {0} since it didn't previously exist", transactionID);
@@ -151,7 +151,7 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
151 AssetXferUploader uploader = RequestXferUploader(transactionID); 151 AssetXferUploader uploader = RequestXferUploader(transactionID);
152 152
153 uploader.RequestCreateInventoryItem( 153 uploader.RequestCreateInventoryItem(
154 remoteClient, transactionID, folderID, callbackID, 154 remoteClient, folderID, callbackID,
155 description, name, invType, type, wearableType, nextOwnerMask); 155 description, name, invType, type, wearableType, nextOwnerMask);
156 } 156 }
157 157
@@ -161,7 +161,7 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
161 { 161 {
162 AssetXferUploader uploader = RequestXferUploader(transactionID); 162 AssetXferUploader uploader = RequestXferUploader(transactionID);
163 163
164 uploader.RequestUpdateTaskInventoryItem(remoteClient, transactionID, item); 164 uploader.RequestUpdateTaskInventoryItem(remoteClient, item);
165 } 165 }
166 166
167 public void RequestUpdateInventoryItem(IClientAPI remoteClient, 167 public void RequestUpdateInventoryItem(IClientAPI remoteClient,
@@ -169,7 +169,7 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
169 { 169 {
170 AssetXferUploader uploader = RequestXferUploader(transactionID); 170 AssetXferUploader uploader = RequestXferUploader(transactionID);
171 171
172 uploader.RequestUpdateInventoryItem(remoteClient, transactionID, item); 172 uploader.RequestUpdateInventoryItem(remoteClient, item);
173 } 173 }
174 } 174 }
175} \ No newline at end of file 175} \ No newline at end of file
diff --git a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs
index 96f0d0f..a852767 100644
--- a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs
+++ b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs
@@ -88,16 +88,33 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
88 private bool m_storeLocal; 88 private bool m_storeLocal;
89 private uint nextPerm = 0; 89 private uint nextPerm = 0;
90 private IClientAPI ourClient; 90 private IClientAPI ourClient;
91 private UUID TransactionID = UUID.Zero; 91
92 private UUID m_transactionID;
93
92 private sbyte type = 0; 94 private sbyte type = 0;
93 private byte wearableType = 0; 95 private byte wearableType = 0;
94 private byte[] m_oldData = null; 96 private byte[] m_oldData = null;
95 public ulong XferID; 97 public ulong XferID;
96 private Scene m_Scene; 98 private Scene m_Scene;
97 99
98 public AssetXferUploader(AgentAssetTransactions transactions, Scene scene, bool dumpAssetToFile) 100 /// <summary>
101 /// AssetXferUploader constructor
102 /// </summary>
103 /// <param name='transactions'>/param>
104 /// <param name='scene'></param>
105 /// <param name='transactionID'></param>
106 /// <param name='dumpAssetToFile'>
107 /// If true then when the asset is uploaded it is dumped to a file with the format
108 /// String.Format("{6}_{7}_{0:d2}{1:d2}{2:d2}_{3:d2}{4:d2}{5:d2}.dat",
109 /// now.Year, now.Month, now.Day, now.Hour, now.Minute,
110 /// now.Second, m_asset.Name, m_asset.Type);
111 /// for debugging purposes.
112 /// </param>
113 public AssetXferUploader(
114 AgentAssetTransactions transactions, Scene scene, UUID transactionID, bool dumpAssetToFile)
99 { 115 {
100 m_transactions = transactions; 116 m_transactions = transactions;
117 m_transactionID = transactionID;
101 m_Scene = scene; 118 m_Scene = scene;
102 m_dumpAssetToFile = dumpAssetToFile; 119 m_dumpAssetToFile = dumpAssetToFile;
103 } 120 }
@@ -189,7 +206,6 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
189 m_asset.Local = storeLocal; 206 m_asset.Local = storeLocal;
190 m_asset.Temporary = tempFile; 207 m_asset.Temporary = tempFile;
191 208
192 TransactionID = transaction;
193 m_storeLocal = storeLocal; 209 m_storeLocal = storeLocal;
194 210
195 if (m_asset.Data.Length > 2) 211 if (m_asset.Data.Length > 2)
@@ -234,13 +250,13 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
234 // Remove ourselves from the list of transactions if completion was delayed until the transaction 250 // Remove ourselves from the list of transactions if completion was delayed until the transaction
235 // was complete. 251 // was complete.
236 // TODO: Should probably do the same for create item. 252 // TODO: Should probably do the same for create item.
237 m_transactions.RemoveXferUploader(TransactionID); 253 m_transactions.RemoveXferUploader(m_transactionID);
238 } 254 }
239 else if (m_updateTaskItem) 255 else if (m_updateTaskItem)
240 { 256 {
241 StoreAssetForTaskItemUpdate(m_updateTaskItemData); 257 StoreAssetForTaskItemUpdate(m_updateTaskItemData);
242 258
243 m_transactions.RemoveXferUploader(TransactionID); 259 m_transactions.RemoveXferUploader(m_transactionID);
244 } 260 }
245 else if (m_storeLocal) 261 else if (m_storeLocal)
246 { 262 {
@@ -250,7 +266,7 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
250 266
251 m_log.DebugFormat( 267 m_log.DebugFormat(
252 "[ASSET XFER UPLOADER]: Uploaded asset {0} for transaction {1}", 268 "[ASSET XFER UPLOADER]: Uploaded asset {0} for transaction {1}",
253 m_asset.FullID, TransactionID); 269 m_asset.FullID, m_transactionID);
254 270
255 if (m_dumpAssetToFile) 271 if (m_dumpAssetToFile)
256 { 272 {
@@ -278,40 +294,37 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
278 } 294 }
279 295
280 public void RequestCreateInventoryItem(IClientAPI remoteClient, 296 public void RequestCreateInventoryItem(IClientAPI remoteClient,
281 UUID transactionID, UUID folderID, uint callbackID, 297 UUID folderID, uint callbackID,
282 string description, string name, sbyte invType, 298 string description, string name, sbyte invType,
283 sbyte type, byte wearableType, uint nextOwnerMask) 299 sbyte type, byte wearableType, uint nextOwnerMask)
284 { 300 {
285 if (TransactionID == transactionID) 301 InventFolder = folderID;
302 m_name = name;
303 m_description = description;
304 this.type = type;
305 this.invType = invType;
306 this.wearableType = wearableType;
307 nextPerm = nextOwnerMask;
308 m_asset.Name = name;
309 m_asset.Description = description;
310 m_asset.Type = type;
311
312 // We must lock to avoid a race with a separate thread uploading the asset.
313 lock (this)
286 { 314 {
287 InventFolder = folderID; 315 if (m_uploadState == UploadState.Complete)
288 m_name = name;
289 m_description = description;
290 this.type = type;
291 this.invType = invType;
292 this.wearableType = wearableType;
293 nextPerm = nextOwnerMask;
294 m_asset.Name = name;
295 m_asset.Description = description;
296 m_asset.Type = type;
297
298 // We must lock to avoid a race with a separate thread uploading the asset.
299 lock (this)
300 { 316 {
301 if (m_uploadState == UploadState.Complete) 317 DoCreateItem(callbackID);
302 { 318 }
303 DoCreateItem(callbackID); 319 else
304 } 320 {
305 else 321 m_createItem = true; //set flag so the inventory item is created when upload is complete
306 { 322 m_createItemCallback = callbackID;
307 m_createItem = true; //set flag so the inventory item is created when upload is complete
308 m_createItemCallback = callbackID;
309 }
310 } 323 }
311 } 324 }
312 } 325 }
313 326
314 public void RequestUpdateInventoryItem(IClientAPI remoteClient, UUID transactionID, InventoryItemBase item) 327 public void RequestUpdateInventoryItem(IClientAPI remoteClient, InventoryItemBase item)
315 { 328 {
316 // We must lock to avoid a race with a separate thread uploading the asset. 329 // We must lock to avoid a race with a separate thread uploading the asset.
317 lock (this) 330 lock (this)
@@ -342,7 +355,7 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
342 } 355 }
343 } 356 }
344 357
345 public void RequestUpdateTaskInventoryItem(IClientAPI remoteClient, UUID transactionID, TaskInventoryItem taskItem) 358 public void RequestUpdateTaskInventoryItem(IClientAPI remoteClient, TaskInventoryItem taskItem)
346 { 359 {
347 // We must lock to avoid a race with a separate thread uploading the asset. 360 // We must lock to avoid a race with a separate thread uploading the asset.
348 lock (this) 361 lock (this)