aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-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 08c3134..52d7d57 100644
--- a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs
+++ b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs
@@ -80,15 +80,32 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
80 private bool m_storeLocal; 80 private bool m_storeLocal;
81 private uint nextPerm = 0; 81 private uint nextPerm = 0;
82 private IClientAPI ourClient; 82 private IClientAPI ourClient;
83 private UUID TransactionID = UUID.Zero; 83
84 private UUID m_transactionID;
85
84 private sbyte type = 0; 86 private sbyte type = 0;
85 private byte wearableType = 0; 87 private byte wearableType = 0;
86 public ulong XferID; 88 public ulong XferID;
87 private Scene m_Scene; 89 private Scene m_Scene;
88 90
89 public AssetXferUploader(AgentAssetTransactions transactions, Scene scene, bool dumpAssetToFile) 91 /// <summary>
92 /// AssetXferUploader constructor
93 /// </summary>
94 /// <param name='transactions'>/param>
95 /// <param name='scene'></param>
96 /// <param name='transactionID'></param>
97 /// <param name='dumpAssetToFile'>
98 /// If true then when the asset is uploaded it is dumped to a file with the format
99 /// String.Format("{6}_{7}_{0:d2}{1:d2}{2:d2}_{3:d2}{4:d2}{5:d2}.dat",
100 /// now.Year, now.Month, now.Day, now.Hour, now.Minute,
101 /// now.Second, m_asset.Name, m_asset.Type);
102 /// for debugging purposes.
103 /// </param>
104 public AssetXferUploader(
105 AgentAssetTransactions transactions, Scene scene, UUID transactionID, bool dumpAssetToFile)
90 { 106 {
91 m_transactions = transactions; 107 m_transactions = transactions;
108 m_transactionID = transactionID;
92 m_Scene = scene; 109 m_Scene = scene;
93 m_dumpAssetToFile = dumpAssetToFile; 110 m_dumpAssetToFile = dumpAssetToFile;
94 } 111 }
@@ -180,7 +197,6 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
180 m_asset.Local = storeLocal; 197 m_asset.Local = storeLocal;
181 m_asset.Temporary = tempFile; 198 m_asset.Temporary = tempFile;
182 199
183 TransactionID = transaction;
184 m_storeLocal = storeLocal; 200 m_storeLocal = storeLocal;
185 201
186 if (m_asset.Data.Length > 2) 202 if (m_asset.Data.Length > 2)
@@ -225,13 +241,13 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
225 // Remove ourselves from the list of transactions if completion was delayed until the transaction 241 // Remove ourselves from the list of transactions if completion was delayed until the transaction
226 // was complete. 242 // was complete.
227 // TODO: Should probably do the same for create item. 243 // TODO: Should probably do the same for create item.
228 m_transactions.RemoveXferUploader(TransactionID); 244 m_transactions.RemoveXferUploader(m_transactionID);
229 } 245 }
230 else if (m_updateTaskItem) 246 else if (m_updateTaskItem)
231 { 247 {
232 StoreAssetForTaskItemUpdate(m_updateTaskItemData); 248 StoreAssetForTaskItemUpdate(m_updateTaskItemData);
233 249
234 m_transactions.RemoveXferUploader(TransactionID); 250 m_transactions.RemoveXferUploader(m_transactionID);
235 } 251 }
236 else if (m_storeLocal) 252 else if (m_storeLocal)
237 { 253 {
@@ -241,7 +257,7 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
241 257
242 m_log.DebugFormat( 258 m_log.DebugFormat(
243 "[ASSET XFER UPLOADER]: Uploaded asset {0} for transaction {1}", 259 "[ASSET XFER UPLOADER]: Uploaded asset {0} for transaction {1}",
244 m_asset.FullID, TransactionID); 260 m_asset.FullID, m_transactionID);
245 261
246 if (m_dumpAssetToFile) 262 if (m_dumpAssetToFile)
247 { 263 {
@@ -269,40 +285,37 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
269 } 285 }
270 286
271 public void RequestCreateInventoryItem(IClientAPI remoteClient, 287 public void RequestCreateInventoryItem(IClientAPI remoteClient,
272 UUID transactionID, UUID folderID, uint callbackID, 288 UUID folderID, uint callbackID,
273 string description, string name, sbyte invType, 289 string description, string name, sbyte invType,
274 sbyte type, byte wearableType, uint nextOwnerMask) 290 sbyte type, byte wearableType, uint nextOwnerMask)
275 { 291 {
276 if (TransactionID == transactionID) 292 InventFolder = folderID;
293 m_name = name;
294 m_description = description;
295 this.type = type;
296 this.invType = invType;
297 this.wearableType = wearableType;
298 nextPerm = nextOwnerMask;
299 m_asset.Name = name;
300 m_asset.Description = description;
301 m_asset.Type = type;
302
303 // We must lock to avoid a race with a separate thread uploading the asset.
304 lock (this)
277 { 305 {
278 InventFolder = folderID; 306 if (m_uploadState == UploadState.Complete)
279 m_name = name; 307 {
280 m_description = description; 308 DoCreateItem(callbackID);
281 this.type = type; 309 }
282 this.invType = invType; 310 else
283 this.wearableType = wearableType;
284 nextPerm = nextOwnerMask;
285 m_asset.Name = name;
286 m_asset.Description = description;
287 m_asset.Type = type;
288
289 // We must lock to avoid a race with a separate thread uploading the asset.
290 lock (this)
291 { 311 {
292 if (m_uploadState == UploadState.Complete) 312 m_createItem = true; //set flag so the inventory item is created when upload is complete
293 { 313 m_createItemCallback = callbackID;
294 DoCreateItem(callbackID);
295 }
296 else
297 {
298 m_createItem = true; //set flag so the inventory item is created when upload is complete
299 m_createItemCallback = callbackID;
300 }
301 } 314 }
302 } 315 }
303 } 316 }
304 317
305 public void RequestUpdateInventoryItem(IClientAPI remoteClient, UUID transactionID, InventoryItemBase item) 318 public void RequestUpdateInventoryItem(IClientAPI remoteClient, InventoryItemBase item)
306 { 319 {
307 // We must lock to avoid a race with a separate thread uploading the asset. 320 // We must lock to avoid a race with a separate thread uploading the asset.
308 lock (this) 321 lock (this)
@@ -333,7 +346,7 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
333 } 346 }
334 } 347 }
335 348
336 public void RequestUpdateTaskInventoryItem(IClientAPI remoteClient, UUID transactionID, TaskInventoryItem taskItem) 349 public void RequestUpdateTaskInventoryItem(IClientAPI remoteClient, TaskInventoryItem taskItem)
337 { 350 {
338 // We must lock to avoid a race with a separate thread uploading the asset. 351 // We must lock to avoid a race with a separate thread uploading the asset.
339 lock (this) 352 lock (this)