aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Framework/Communications/Cache/AgentAssetTransactions.cs47
-rw-r--r--OpenSim/Framework/Communications/Cache/AgentAssetTransactionsManager.cs116
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.Inventory.cs49
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs1
4 files changed, 134 insertions, 79 deletions
diff --git a/OpenSim/Framework/Communications/Cache/AgentAssetTransactions.cs b/OpenSim/Framework/Communications/Cache/AgentAssetTransactions.cs
index e74a06b..92390b5 100644
--- a/OpenSim/Framework/Communications/Cache/AgentAssetTransactions.cs
+++ b/OpenSim/Framework/Communications/Cache/AgentAssetTransactions.cs
@@ -136,6 +136,15 @@ namespace OpenSim.Framework.Communications.Cache
136 wearableType, nextOwnerMask); 136 wearableType, nextOwnerMask);
137 } 137 }
138 } 138 }
139
140 public void RequestUpdateInventoryItem(IClientAPI remoteClient, LLUUID transactionID,
141 InventoryItemBase item)
142 {
143 if (XferUploaders.ContainsKey(transactionID))
144 {
145 XferUploaders[transactionID].RequestUpdateInventoryItem(remoteClient, transactionID, item);
146 }
147 }
139 148
140 /// <summary> 149 /// <summary>
141 /// Get an uploaded asset. If the data is successfully retrieved, the transaction will be removed. 150 /// Get an uploaded asset. If the data is successfully retrieved, the transaction will be removed.
@@ -351,6 +360,44 @@ namespace OpenSim.Framework.Communications.Cache
351 } 360 }
352 } 361 }
353 } 362 }
363
364 public void RequestUpdateInventoryItem(IClientAPI remoteClient, LLUUID transactionID,
365 InventoryItemBase item)
366 {
367 if (TransactionID == transactionID)
368 {
369 CachedUserInfo userInfo =
370 m_userTransactions.Manager.CommsManager.UserProfileCacheService.GetUserDetails(
371 remoteClient.AgentId);
372
373 if (userInfo != null)
374 {
375 LLUUID assetID = LLUUID.Combine(transactionID, remoteClient.SecureSessionId);
376
377 AssetBase asset
378 = m_userTransactions.Manager.CommsManager.AssetCache.GetAsset(
379 assetID, (item.assetType == (int) AssetType.Texture ? true : false));
380
381 if (asset == null)
382 {
383 asset = m_userTransactions.GetTransactionAsset(transactionID);
384 }
385
386 if (asset != null && asset.FullID == assetID)
387 {
388 asset.Name = item.inventoryName;
389 asset.Description = item.inventoryDescription;
390 asset.InvType = (sbyte) item.invType;
391 asset.Type = (sbyte) item.assetType;
392 item.assetID = asset.FullID;
393
394 m_userTransactions.Manager.CommsManager.AssetCache.AddAsset(Asset);
395 }
396
397 userInfo.UpdateItem(remoteClient.AgentId, item);
398 }
399 }
400 }
354 401
355 private void DoCreateItem() 402 private void DoCreateItem()
356 { 403 {
diff --git a/OpenSim/Framework/Communications/Cache/AgentAssetTransactionsManager.cs b/OpenSim/Framework/Communications/Cache/AgentAssetTransactionsManager.cs
index c9c35d2..48b2563 100644
--- a/OpenSim/Framework/Communications/Cache/AgentAssetTransactionsManager.cs
+++ b/OpenSim/Framework/Communications/Cache/AgentAssetTransactionsManager.cs
@@ -34,7 +34,8 @@ using libsecondlife;
34namespace OpenSim.Framework.Communications.Cache 34namespace OpenSim.Framework.Communications.Cache
35{ 35{
36 /// <summary> 36 /// <summary>
37 /// Manage the collection of agent asset transaction collections. Each agent has its own transaction collection 37 /// Provider handlers for processing asset transactions originating from the agent. This encompasses
38 /// clothing creation and update as well as asset uploads.
38 /// </summary> 39 /// </summary>
39 public class AgentAssetTransactionsManager 40 public class AgentAssetTransactionsManager
40 { 41 {
@@ -62,34 +63,76 @@ namespace OpenSim.Framework.Communications.Cache
62 } 63 }
63 64
64 /// <summary> 65 /// <summary>
65 /// Add a collection of asset transactions for the given user 66 /// Get the collection of asset transactions for the given user. If one does not already exist, it
67 /// is created.
66 /// </summary> 68 /// </summary>
67 /// <param name="userID"></param> 69 /// <param name="userID"></param>
68 public void AddUser(LLUUID userID) 70 /// <returns></returns>
71 private AgentAssetTransactions GetUserTransactions(LLUUID userID)
69 { 72 {
70 lock (AgentTransactions) 73 lock (AgentTransactions)
71 { 74 {
72 if (!AgentTransactions.ContainsKey(userID)) 75 if (!AgentTransactions.ContainsKey(userID))
73 { 76 {
74 AgentAssetTransactions transactions = new AgentAssetTransactions(userID, this, m_dumpAssetsToFile); 77 AgentAssetTransactions transactions
75 AgentTransactions.Add(userID, transactions); 78 = new AgentAssetTransactions(userID, this, m_dumpAssetsToFile);
79 AgentTransactions.Add(userID, transactions);
76 } 80 }
77 } 81 }
82
83 return AgentTransactions[userID];
78 } 84 }
79 85
80 /// <summary> 86 /// <summary>
81 /// Get the collection of asset transactions for the given user. 87 /// Create an inventory item from data that has been received through a transaction.
88 ///
89 /// This is called when new clothing or body parts are created. It may also be called in other
90 /// situations.
82 /// </summary> 91 /// </summary>
83 /// <param name="userID"></param> 92 /// <param name="remoteClient"></param>
84 /// <returns>null if this agent does not have an asset transactions collection</returns> 93 /// <param name="transactionID"></param>
85 public AgentAssetTransactions GetUserTransactions(LLUUID userID) 94 /// <param name="folderID"></param>
95 /// <param name="callbackID"></param>
96 /// <param name="description"></param>
97 /// <param name="name"></param>
98 /// <param name="invType"></param>
99 /// <param name="type"></param>
100 /// <param name="wearableType"></param>
101 /// <param name="nextOwnerMask"></param>
102 public void HandleItemCreationFromTransaction(IClientAPI remoteClient, LLUUID transactionID, LLUUID folderID,
103 uint callbackID, string description, string name, sbyte invType,
104 sbyte type, byte wearableType, uint nextOwnerMask)
86 { 105 {
87 if (AgentTransactions.ContainsKey(userID)) 106 m_log.InfoFormat(
88 { 107 "[TRANSACTIONS MANAGER] Called HandleItemCreationFromTransaction with item {0}", name);
89 return AgentTransactions[userID]; 108
90 } 109 AgentAssetTransactions transactions = GetUserTransactions(remoteClient.AgentId);
91 110
92 return null; 111 transactions.RequestCreateInventoryItem(
112 remoteClient, transactionID, folderID, callbackID, description,
113 name, invType, type, wearableType, nextOwnerMask);
114 }
115
116 /// <summary>
117 /// Update an inventory item with data that has been received through a transaction.
118 ///
119 /// This is called when clothing or body parts are updated (for instance, with new textures or
120 /// colours). It may also be called in other situations.
121 /// </summary>
122 /// <param name="remoteClient"></param>
123 /// <param name="transactionID"></param>
124 /// <param name="item"></param>
125 public void HandleItemUpdateFromTransaction(IClientAPI remoteClient, LLUUID transactionID,
126 InventoryItemBase item)
127 {
128 m_log.InfoFormat(
129 "[TRANSACTIONS MANAGER] Called HandleItemUpdateFromTransaction with item {0}",
130 item.inventoryName);
131
132 AgentAssetTransactions transactions
133 = CommsManager.TransactionsManager.GetUserTransactions(remoteClient.AgentId);
134
135 transactions.RequestUpdateInventoryItem(remoteClient, transactionID, item);
93 } 136 }
94 137
95 public void HandleUDPUploadRequest(IClientAPI remoteClient, LLUUID assetID, LLUUID transaction, sbyte type, 138 public void HandleUDPUploadRequest(IClientAPI remoteClient, LLUUID assetID, LLUUID transaction, sbyte type,
@@ -97,36 +140,39 @@ namespace OpenSim.Framework.Communications.Cache
97 { 140 {
98 // Console.WriteLine("asset upload of " + assetID); 141 // Console.WriteLine("asset upload of " + assetID);
99 AgentAssetTransactions transactions = GetUserTransactions(remoteClient.AgentId); 142 AgentAssetTransactions transactions = GetUserTransactions(remoteClient.AgentId);
100 if (transactions != null) 143
144 AgentAssetTransactions.AssetXferUploader uploader = transactions.RequestXferUploader(transaction);
145 if (uploader != null)
101 { 146 {
102 AgentAssetTransactions.AssetXferUploader uploader = transactions.RequestXferUploader(transaction); 147 // Upload has already compelted uploading...
103 if (uploader != null) 148
149 if (uploader.Initialise(remoteClient, assetID, transaction, type, data, storeLocal, tempFile))
104 { 150 {
105 // Upload has already compelted uploading... 151 //[commenting out as this removal breaks uploads]
106 152 /*lock (transactions.XferUploaders)
107 if (uploader.Initialise(remoteClient, assetID, transaction, type, data, storeLocal, tempFile))
108 { 153 {
109 //[commenting out as this removal breaks uploads] 154
110 /*lock (transactions.XferUploaders) 155 // XXX Weak ass way of doing this by directly manipulating this public dictionary, purely temporary
111 { 156 transactions.XferUploaders.Remove(uploader.TransactionID);
112 157
113 // XXX Weak ass way of doing this by directly manipulating this public dictionary, purely temporary 158 //m_log.InfoFormat("[ASSET TRANSACTIONS] Current uploaders: {0}", transactions.XferUploaders.Count);
114 transactions.XferUploaders.Remove(uploader.TransactionID); 159 }*/
115
116 //m_log.InfoFormat("[ASSET TRANSACTIONS] Current uploaders: {0}", transactions.XferUploaders.Count);
117 }*/
118 }
119 } 160 }
120 } 161 }
121 } 162 }
122 163
164 /// <summary>
165 /// Conduct an asset transfer from the client.
166 /// </summary>
167 /// <param name="remoteClient"></param>
168 /// <param name="xferID"></param>
169 /// <param name="packetID"></param>
170 /// <param name="data"></param>
123 public void HandleXfer(IClientAPI remoteClient, ulong xferID, uint packetID, byte[] data) 171 public void HandleXfer(IClientAPI remoteClient, ulong xferID, uint packetID, byte[] data)
124 { 172 {
125 AgentAssetTransactions transactions = GetUserTransactions(remoteClient.AgentId); 173 AgentAssetTransactions transactions = GetUserTransactions(remoteClient.AgentId);
126 if (transactions != null) 174
127 { 175 transactions.HandleXfer(xferID, packetID, data);
128 transactions.HandleXfer(xferID, packetID, data);
129 }
130 } 176 }
131 } 177 }
132} 178}
diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
index 0dc3139..6800d5f 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
@@ -253,6 +253,7 @@ namespace OpenSim.Region.Environment.Scenes
253 if (userInfo != null && userInfo.RootFolder != null) 253 if (userInfo != null && userInfo.RootFolder != null)
254 { 254 {
255 InventoryItemBase item = userInfo.RootFolder.HasItem(itemID); 255 InventoryItemBase item = userInfo.RootFolder.HasItem(itemID);
256
256 if (item != null) 257 if (item != null)
257 { 258 {
258 if (LLUUID.Zero == transactionID) 259 if (LLUUID.Zero == transactionID)
@@ -265,34 +266,8 @@ namespace OpenSim.Region.Environment.Scenes
265 } 266 }
266 else 267 else
267 { 268 {
268 AgentAssetTransactions transactions 269 CommsManager.TransactionsManager.HandleItemUpdateFromTransaction(
269 = CommsManager.TransactionsManager.GetUserTransactions(remoteClient.AgentId); 270 remoteClient, transactionID, item);
270
271 if (transactions != null)
272 {
273 LLUUID assetID = LLUUID.Combine(transactionID, remoteClient.SecureSessionId);
274 AssetBase asset
275 = AssetCache.GetAsset(
276 assetID, (item.assetType == (int) AssetType.Texture ? true : false));
277
278 if (asset == null)
279 {
280 asset = transactions.GetTransactionAsset(transactionID);
281 }
282
283 if (asset != null && asset.FullID == assetID)
284 {
285 asset.Name = item.inventoryName;
286 asset.Description = item.inventoryDescription;
287 asset.InvType = (sbyte) item.invType;
288 asset.Type = (sbyte) item.assetType;
289 item.assetID = asset.FullID;
290
291 AssetCache.AddAsset(asset);
292 }
293
294 userInfo.UpdateItem(remoteClient.AgentId, item);
295 }
296 } 271 }
297 } 272 }
298 else 273 else
@@ -484,21 +459,9 @@ namespace OpenSim.Region.Environment.Scenes
484 } 459 }
485 else 460 else
486 { 461 {
487 AgentAssetTransactions transactions 462 CommsManager.TransactionsManager.HandleItemCreationFromTransaction(
488 = CommsManager.TransactionsManager.GetUserTransactions(remoteClient.AgentId); 463 remoteClient, transactionID, folderID, callbackID, description,
489 464 name, invType, assetType, wearableType, nextOwnerMask);
490 if (transactions != null)
491 {
492 transactions.RequestCreateInventoryItem(
493 remoteClient, transactionID, folderID, callbackID, description,
494 name, invType, assetType, wearableType, nextOwnerMask);
495 }
496 else
497 {
498 m_log.ErrorFormat(
499 "Agent asset transactions for agent {0} uuid {1} in transaction uuid {2} unexpectedly null!",
500 remoteClient.Name, remoteClient.AgentId, transactionID);
501 }
502 } 465 }
503 } 466 }
504 467
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index ba2a2cf..62437cf 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -1311,7 +1311,6 @@ namespace OpenSim.Region.Environment.Scenes
1311 1311
1312 m_LandManager.sendParcelOverlay(client); 1312 m_LandManager.sendParcelOverlay(client);
1313 CommsManager.UserProfileCacheService.AddNewUser(client.AgentId); 1313 CommsManager.UserProfileCacheService.AddNewUser(client.AgentId);
1314 CommsManager.TransactionsManager.AddUser(client.AgentId);
1315 } 1314 }
1316 1315
1317 protected virtual void SubscribeToClientEvents(IClientAPI client) 1316 protected virtual void SubscribeToClientEvents(IClientAPI client)