aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Communications/Cache/AgentAssetTransactionsManager.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Framework/Communications/Cache/AgentAssetTransactionsManager.cs')
-rw-r--r--OpenSim/Framework/Communications/Cache/AgentAssetTransactionsManager.cs116
1 files changed, 81 insertions, 35 deletions
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}