aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/CoreModules/Agent/AssetTransaction/AgentAssetsTransactions.cs138
-rw-r--r--OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetTransactionModule.cs11
-rw-r--r--OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs233
3 files changed, 183 insertions, 199 deletions
diff --git a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AgentAssetsTransactions.cs b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AgentAssetsTransactions.cs
index b557ffe..0271738 100644
--- a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AgentAssetsTransactions.cs
+++ b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AgentAssetsTransactions.cs
@@ -57,39 +57,36 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
57 } 57 }
58 58
59 /// <summary> 59 /// <summary>
60 /// Return a xfer uploader if one does not already exist. 60 /// Return the xfer uploader for the given transaction.
61 /// </summary> 61 /// </summary>
62 /// <remarks>
63 /// If an uploader does not already exist for this transaction then it is created, otherwise the existing
64 /// uploader is returned.
65 /// </remarks>
62 /// <param name="transactionID"></param> 66 /// <param name="transactionID"></param>
63 /// <param name="assetID"> 67 /// <returns>The asset xfer uploader</returns>
64 /// We must transfer the new asset ID into the uploader on creation, otherwise 68 public AssetXferUploader RequestXferUploader(UUID transactionID)
65 /// we can see race conditions with other threads which can retrieve an item before it is updated with the new
66 /// asset id.
67 /// </param>
68 /// <returns>
69 /// The xfer uploader requested. Null if one is already in existence.
70 /// FIXME: This is a bizarre thing to do, and is probably meant to signal an error condition if multiple
71 /// transfers are made. Needs to be corrected.
72 /// </returns>
73 public AssetXferUploader RequestXferUploader(UUID transactionID, UUID assetID)
74 { 69 {
70 AssetXferUploader uploader;
71
75 lock (XferUploaders) 72 lock (XferUploaders)
76 { 73 {
77 if (!XferUploaders.ContainsKey(transactionID)) 74 if (!XferUploaders.ContainsKey(transactionID))
78 { 75 {
79 AssetXferUploader uploader = new AssetXferUploader(this, m_Scene, assetID, m_dumpAssetsToFile); 76 uploader = new AssetXferUploader(this, m_Scene, transactionID, m_dumpAssetsToFile);
80 77
81// m_log.DebugFormat( 78// m_log.DebugFormat(
82// "[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);
83 80
84 XferUploaders.Add(transactionID, uploader); 81 XferUploaders.Add(transactionID, uploader);
85 82 }
86 return uploader; 83 else
84 {
85 uploader = XferUploaders[transactionID];
87 } 86 }
88 } 87 }
89 88
90 m_log.WarnFormat("[AGENT ASSETS TRANSACTIONS]: Ignoring request for asset xfer uploader {0} since it already exists", transactionID); 89 return uploader;
91
92 return null;
93 } 90 }
94 91
95 public void HandleXfer(ulong xferID, uint packetID, byte[] data) 92 public void HandleXfer(ulong xferID, uint packetID, byte[] data)
@@ -151,115 +148,28 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
151 string description, string name, sbyte invType, 148 string description, string name, sbyte invType,
152 sbyte type, byte wearableType, uint nextOwnerMask) 149 sbyte type, byte wearableType, uint nextOwnerMask)
153 { 150 {
154 AssetXferUploader uploader = null; 151 AssetXferUploader uploader = RequestXferUploader(transactionID);
155
156 lock (XferUploaders)
157 {
158 if (XferUploaders.ContainsKey(transactionID))
159 uploader = XferUploaders[transactionID];
160 }
161 152
162 if (uploader != null) 153 uploader.RequestCreateInventoryItem(
163 uploader.RequestCreateInventoryItem( 154 remoteClient, folderID, callbackID,
164 remoteClient, transactionID, folderID, 155 description, name, invType, type, wearableType, nextOwnerMask);
165 callbackID, description, name, invType, type,
166 wearableType, nextOwnerMask);
167 else
168 m_log.ErrorFormat(
169 "[AGENT ASSET TRANSACTIONS]: Could not find uploader with transaction ID {0} when handling request to create inventory item {1} from {2}",
170 transactionID, name, remoteClient.Name);
171 }
172
173 /// <summary>
174 /// Get an uploaded asset. If the data is successfully retrieved,
175 /// the transaction will be removed.
176 /// </summary>
177 /// <param name="transactionID"></param>
178 /// <returns>The asset if the upload has completed, null if it has not.</returns>
179 private AssetBase GetTransactionAsset(UUID transactionID)
180 {
181 lock (XferUploaders)
182 {
183 if (XferUploaders.ContainsKey(transactionID))
184 {
185 AssetXferUploader uploader = XferUploaders[transactionID];
186 AssetBase asset = uploader.GetAssetData();
187 RemoveXferUploader(transactionID);
188
189 return asset;
190 }
191 }
192
193 return null;
194 } 156 }
195 157
196 public void RequestUpdateTaskInventoryItem(IClientAPI remoteClient, 158 public void RequestUpdateTaskInventoryItem(IClientAPI remoteClient,
197 SceneObjectPart part, UUID transactionID, 159 SceneObjectPart part, UUID transactionID,
198 TaskInventoryItem item) 160 TaskInventoryItem item)
199 { 161 {
200 AssetXferUploader uploader = null; 162 AssetXferUploader uploader = RequestXferUploader(transactionID);
201
202 lock (XferUploaders)
203 {
204 if (XferUploaders.ContainsKey(transactionID))
205 uploader = XferUploaders[transactionID];
206 }
207
208 if (uploader != null)
209 {
210 AssetBase asset = GetTransactionAsset(transactionID);
211
212 // Only legacy viewers use this, and they prefer CAPS, which
213 // we have, so this really never runs.
214 // Allow it, but only for "safe" types.
215 if ((InventoryType)item.InvType != InventoryType.Notecard &&
216 (InventoryType)item.InvType != InventoryType.LSL)
217 return;
218 163
219 if (asset != null) 164 uploader.RequestUpdateTaskInventoryItem(remoteClient, item);
220 {
221// m_log.DebugFormat(
222// "[AGENT ASSETS TRANSACTIONS]: Updating item {0} in {1} for transaction {2}",
223// item.Name, part.Name, transactionID);
224
225 asset.FullID = UUID.Random();
226 asset.Name = item.Name;
227 asset.Description = item.Description;
228 asset.Type = (sbyte)item.Type;
229 item.AssetID = asset.FullID;
230
231 m_Scene.AssetService.Store(asset);
232 }
233 }
234 else
235 {
236 m_log.ErrorFormat(
237 "[AGENT ASSET TRANSACTIONS]: Could not find uploader with transaction ID {0} when handling request to update task inventory item {1} in {2}",
238 transactionID, item.Name, part.Name);
239 }
240 } 165 }
241 166
242 public void RequestUpdateInventoryItem(IClientAPI remoteClient, 167 public void RequestUpdateInventoryItem(IClientAPI remoteClient,
243 UUID transactionID, InventoryItemBase item) 168 UUID transactionID, InventoryItemBase item)
244 { 169 {
245 AssetXferUploader uploader = null; 170 AssetXferUploader uploader = RequestXferUploader(transactionID);
246
247 lock (XferUploaders)
248 {
249 if (XferUploaders.ContainsKey(transactionID))
250 uploader = XferUploaders[transactionID];
251 }
252 171
253 if (uploader != null) 172 uploader.RequestUpdateInventoryItem(remoteClient, item);
254 {
255 uploader.RequestUpdateInventoryItem(remoteClient, transactionID, item);
256 }
257 else
258 {
259 m_log.ErrorFormat(
260 "[AGENT ASSET TRANSACTIONS]: Could not find uploader with transaction ID {0} when handling request to update inventory item {1} for {2}",
261 transactionID, item.Name, remoteClient.Name);
262 }
263 } 173 }
264 } 174 }
265} 175} \ No newline at end of file
diff --git a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetTransactionModule.cs b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetTransactionModule.cs
index 7081989..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 =
@@ -274,13 +274,8 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
274 } 274 }
275 275
276 AgentAssetTransactions transactions = GetUserTransactions(remoteClient.AgentId); 276 AgentAssetTransactions transactions = GetUserTransactions(remoteClient.AgentId);
277 AssetXferUploader uploader = transactions.RequestXferUploader(transaction, assetID); 277 AssetXferUploader uploader = transactions.RequestXferUploader(transaction);
278 278 uploader.StartUpload(remoteClient, assetID, transaction, type, data, storeLocal, tempFile);
279 if (uploader != null)
280 {
281 uploader.Initialise(remoteClient, assetID, transaction, type,
282 data, storeLocal, tempFile);
283 }
284 } 279 }
285 280
286 /// <summary> 281 /// <summary>
diff --git a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs
index ec4dfd0..8add4bb 100644
--- a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs
+++ b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs
@@ -41,38 +41,74 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
41 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 41 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
42 42
43 /// <summary> 43 /// <summary>
44 /// Upload state.
45 /// </summary>
46 /// <remarks>
47 /// New -> Uploading -> Complete
48 /// </remarks>
49 private enum UploadState
50 {
51 New,
52 Uploading,
53 Complete
54 }
55
56 /// <summary>
44 /// Reference to the object that holds this uploader. Used to remove ourselves from it's list if we 57 /// Reference to the object that holds this uploader. Used to remove ourselves from it's list if we
45 /// are performing a delayed update. 58 /// are performing a delayed update.
46 /// </summary> 59 /// </summary>
47 AgentAssetTransactions m_transactions; 60 AgentAssetTransactions m_transactions;
48 61
62 private UploadState m_uploadState = UploadState.New;
63
49 private AssetBase m_asset; 64 private AssetBase m_asset;
50 private UUID InventFolder = UUID.Zero; 65 private UUID InventFolder = UUID.Zero;
51 private sbyte invType = 0; 66 private sbyte invType = 0;
52 67
53 private bool m_createItem = false; 68 private bool m_createItem;
54 private uint m_createItemCallback = 0; 69 private uint m_createItemCallback;
55 private bool m_updateItem = false; 70
71 private bool m_updateItem;
56 private InventoryItemBase m_updateItemData; 72 private InventoryItemBase m_updateItemData;
57 73
74 private bool m_updateTaskItem;
75 private TaskInventoryItem m_updateTaskItemData;
76
58 private string m_description = String.Empty; 77 private string m_description = String.Empty;
59 private bool m_dumpAssetToFile; 78 private bool m_dumpAssetToFile;
60 private bool m_finished = false;
61 private string m_name = String.Empty; 79 private string m_name = String.Empty;
62 private bool m_storeLocal; 80// private bool m_storeLocal;
63 private uint nextPerm = 0; 81 private uint nextPerm = 0;
64 private IClientAPI ourClient; 82 private IClientAPI ourClient;
65 private UUID TransactionID = UUID.Zero; 83
84 private UUID m_transactionID;
85
66 private sbyte type = 0; 86 private sbyte type = 0;
67 private byte wearableType = 0; 87 private byte wearableType = 0;
68 public ulong XferID; 88 public ulong XferID;
69 private Scene m_Scene; 89 private Scene m_Scene;
70 90
71 public AssetXferUploader(AgentAssetTransactions transactions, Scene scene, UUID assetID, 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)
72 { 106 {
107 m_asset = new AssetBase();
108
73 m_transactions = transactions; 109 m_transactions = transactions;
110 m_transactionID = transactionID;
74 m_Scene = scene; 111 m_Scene = scene;
75 m_asset = new AssetBase() { FullID = assetID };
76 m_dumpAssetToFile = dumpAssetToFile; 112 m_dumpAssetToFile = dumpAssetToFile;
77 } 113 }
78 114
@@ -118,30 +154,50 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
118 } 154 }
119 155
120 /// <summary> 156 /// <summary>
121 /// Initialise asset transfer from the client 157 /// Start asset transfer from the client
122 /// </summary> 158 /// </summary>
123 /// <param name="xferID"></param> 159 /// <param name="remoteClient"></param>
124 /// <param name="packetID"></param> 160 /// <param name="assetID"></param>
125 /// <param name="data"></param> 161 /// <param name="transaction"></param>
126 public void Initialise(IClientAPI remoteClient, UUID assetID, 162 /// <param name="type"></param>
127 UUID transaction, sbyte type, byte[] data, bool storeLocal, 163 /// <param name="data">
128 bool tempFile) 164 /// Optional data. If present then the asset is created immediately with this data
165 /// rather than requesting an upload from the client. The data must be longer than 2 bytes.
166 /// </param>
167 /// <param name="storeLocal"></param>
168 /// <param name="tempFile"></param>
169 public void StartUpload(
170 IClientAPI remoteClient, UUID assetID, UUID transaction, sbyte type, byte[] data, bool storeLocal,
171 bool tempFile)
129 { 172 {
130// m_log.DebugFormat( 173// m_log.DebugFormat(
131// "[ASSET XFER UPLOADER]: Initialised xfer from {0}, asset {1}, transaction {2}, type {3}, storeLocal {4}, tempFile {5}, already received data length {6}", 174// "[ASSET XFER UPLOADER]: Initialised xfer from {0}, asset {1}, transaction {2}, type {3}, storeLocal {4}, tempFile {5}, already received data length {6}",
132// remoteClient.Name, assetID, transaction, type, storeLocal, tempFile, data.Length); 175// remoteClient.Name, assetID, transaction, type, storeLocal, tempFile, data.Length);
133 176
177 lock (this)
178 {
179 if (m_uploadState != UploadState.New)
180 {
181 m_log.WarnFormat(
182 "[ASSET XFER UPLOADER]: Tried to start upload of asset {0}, transaction {1} for {2} but this is already in state {3}. Aborting.",
183 assetID, transaction, remoteClient.Name, m_uploadState);
184
185 return;
186 }
187
188 m_uploadState = UploadState.Uploading;
189 }
190
134 ourClient = remoteClient; 191 ourClient = remoteClient;
135 m_asset.Name = "blank"; 192
136 m_asset.Description = "empty"; 193 m_asset.FullID = assetID;
137 m_asset.Type = type; 194 m_asset.Type = type;
138 m_asset.CreatorID = remoteClient.AgentId.ToString(); 195 m_asset.CreatorID = remoteClient.AgentId.ToString();
139 m_asset.Data = data; 196 m_asset.Data = data;
140 m_asset.Local = storeLocal; 197 m_asset.Local = storeLocal;
141 m_asset.Temporary = tempFile; 198 m_asset.Temporary = tempFile;
142 199
143 TransactionID = transaction; 200// m_storeLocal = storeLocal;
144 m_storeLocal = storeLocal;
145 201
146 if (m_asset.Data.Length > 2) 202 if (m_asset.Data.Length > 2)
147 { 203 {
@@ -166,36 +222,35 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
166 222
167 protected void SendCompleteMessage() 223 protected void SendCompleteMessage()
168 { 224 {
169 ourClient.SendAssetUploadCompleteMessage(m_asset.Type, true,
170 m_asset.FullID);
171
172 // We must lock in order to avoid a race with a separate thread dealing with an inventory item or create 225 // We must lock in order to avoid a race with a separate thread dealing with an inventory item or create
173 // message from other client UDP. 226 // message from other client UDP.
174 lock (this) 227 lock (this)
175 { 228 {
176 m_finished = true; 229 m_uploadState = UploadState.Complete;
230
231 ourClient.SendAssetUploadCompleteMessage(m_asset.Type, true, m_asset.FullID);
232
177 if (m_createItem) 233 if (m_createItem)
178 { 234 {
179 DoCreateItem(m_createItemCallback); 235 CompleteCreateItem(m_createItemCallback);
180 } 236 }
181 else if (m_updateItem) 237 else if (m_updateItem)
182 { 238 {
183 StoreAssetForItemUpdate(m_updateItemData); 239 CompleteItemUpdate(m_updateItemData);
184
185 // Remove ourselves from the list of transactions if completion was delayed until the transaction
186 // was complete.
187 // TODO: Should probably do the same for create item.
188 m_transactions.RemoveXferUploader(TransactionID);
189 } 240 }
190 else if (m_storeLocal) 241 else if (m_updateTaskItem)
191 { 242 {
192 m_Scene.AssetService.Store(m_asset); 243 CompleteTaskItemUpdate(m_updateTaskItemData);
193 } 244 }
245// else if (m_storeLocal)
246// {
247// m_Scene.AssetService.Store(m_asset);
248// }
194 } 249 }
195 250
196 m_log.DebugFormat( 251 m_log.DebugFormat(
197 "[ASSET XFER UPLOADER]: Uploaded asset {0} for transaction {1}", 252 "[ASSET XFER UPLOADER]: Uploaded asset {0} for transaction {1}",
198 m_asset.FullID, TransactionID); 253 m_asset.FullID, m_transactionID);
199 254
200 if (m_dumpAssetToFile) 255 if (m_dumpAssetToFile)
201 { 256 {
@@ -223,40 +278,37 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
223 } 278 }
224 279
225 public void RequestCreateInventoryItem(IClientAPI remoteClient, 280 public void RequestCreateInventoryItem(IClientAPI remoteClient,
226 UUID transactionID, UUID folderID, uint callbackID, 281 UUID folderID, uint callbackID,
227 string description, string name, sbyte invType, 282 string description, string name, sbyte invType,
228 sbyte type, byte wearableType, uint nextOwnerMask) 283 sbyte type, byte wearableType, uint nextOwnerMask)
229 { 284 {
230 if (TransactionID == transactionID) 285 InventFolder = folderID;
286 m_name = name;
287 m_description = description;
288 this.type = type;
289 this.invType = invType;
290 this.wearableType = wearableType;
291 nextPerm = nextOwnerMask;
292 m_asset.Name = name;
293 m_asset.Description = description;
294 m_asset.Type = type;
295
296 // We must lock to avoid a race with a separate thread uploading the asset.
297 lock (this)
231 { 298 {
232 InventFolder = folderID; 299 if (m_uploadState == UploadState.Complete)
233 m_name = name;
234 m_description = description;
235 this.type = type;
236 this.invType = invType;
237 this.wearableType = wearableType;
238 nextPerm = nextOwnerMask;
239 m_asset.Name = name;
240 m_asset.Description = description;
241 m_asset.Type = type;
242
243 // We must lock to avoid a race with a separate thread uploading the asset.
244 lock (this)
245 { 300 {
246 if (m_finished) 301 CompleteCreateItem(callbackID);
247 { 302 }
248 DoCreateItem(callbackID); 303 else
249 } 304 {
250 else 305 m_createItem = true; //set flag so the inventory item is created when upload is complete
251 { 306 m_createItemCallback = callbackID;
252 m_createItem = true; //set flag so the inventory item is created when upload is complete
253 m_createItemCallback = callbackID;
254 }
255 } 307 }
256 } 308 }
257 } 309 }
258 310
259 public void RequestUpdateInventoryItem(IClientAPI remoteClient, UUID transactionID, InventoryItemBase item) 311 public void RequestUpdateInventoryItem(IClientAPI remoteClient, InventoryItemBase item)
260 { 312 {
261 // We must lock to avoid a race with a separate thread uploading the asset. 313 // We must lock to avoid a race with a separate thread uploading the asset.
262 lock (this) 314 lock (this)
@@ -271,9 +323,9 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
271 item.AssetID = m_asset.FullID; 323 item.AssetID = m_asset.FullID;
272 m_Scene.InventoryService.UpdateItem(item); 324 m_Scene.InventoryService.UpdateItem(item);
273 325
274 if (m_finished) 326 if (m_uploadState == UploadState.Complete)
275 { 327 {
276 StoreAssetForItemUpdate(item); 328 CompleteItemUpdate(item);
277 } 329 }
278 else 330 else
279 { 331 {
@@ -287,20 +339,59 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
287 } 339 }
288 } 340 }
289 341
342 public void RequestUpdateTaskInventoryItem(IClientAPI remoteClient, TaskInventoryItem taskItem)
343 {
344 // We must lock to avoid a race with a separate thread uploading the asset.
345 lock (this)
346 {
347 m_asset.Name = taskItem.Name;
348 m_asset.Description = taskItem.Description;
349 m_asset.Type = (sbyte)taskItem.Type;
350 taskItem.AssetID = m_asset.FullID;
351
352 if (m_uploadState == UploadState.Complete)
353 {
354 CompleteTaskItemUpdate(taskItem);
355 }
356 else
357 {
358 m_updateTaskItem = true;
359 m_updateTaskItemData = taskItem;
360 }
361 }
362 }
363
290 /// <summary> 364 /// <summary>
291 /// Store the asset for the given item. 365 /// Store the asset for the given item when it has been uploaded.
292 /// </summary> 366 /// </summary>
293 /// <param name="item"></param> 367 /// <param name="item"></param>
294 private void StoreAssetForItemUpdate(InventoryItemBase item) 368 private void CompleteItemUpdate(InventoryItemBase item)
295 { 369 {
296// m_log.DebugFormat( 370// m_log.DebugFormat(
297// "[ASSET XFER UPLOADER]: Storing asset {0} for earlier item update for {1} for {2}", 371// "[ASSET XFER UPLOADER]: Storing asset {0} for earlier item update for {1} for {2}",
298// m_asset.FullID, item.Name, ourClient.Name); 372// m_asset.FullID, item.Name, ourClient.Name);
299 373
300 m_Scene.AssetService.Store(m_asset); 374 m_Scene.AssetService.Store(m_asset);
375
376 m_transactions.RemoveXferUploader(m_transactionID);
301 } 377 }
302 378
303 private void DoCreateItem(uint callbackID) 379 /// <summary>
380 /// Store the asset for the given task item when it has been uploaded.
381 /// </summary>
382 /// <param name="taskItem"></param>
383 private void CompleteTaskItemUpdate(TaskInventoryItem taskItem)
384 {
385// m_log.DebugFormat(
386// "[ASSET XFER UPLOADER]: Storing asset {0} for earlier task item update for {1} for {2}",
387// m_asset.FullID, taskItem.Name, ourClient.Name);
388
389 m_Scene.AssetService.Store(m_asset);
390
391 m_transactions.RemoveXferUploader(m_transactionID);
392 }
393
394 private void CompleteCreateItem(uint callbackID)
304 { 395 {
305 m_Scene.AssetService.Store(m_asset); 396 m_Scene.AssetService.Store(m_asset);
306 397
@@ -326,20 +417,8 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
326 ourClient.SendInventoryItemCreateUpdate(item, callbackID); 417 ourClient.SendInventoryItemCreateUpdate(item, callbackID);
327 else 418 else
328 ourClient.SendAlertMessage("Unable to create inventory item"); 419 ourClient.SendAlertMessage("Unable to create inventory item");
329 }
330
331 /// <summary>
332 /// Get the asset data uploaded in this transfer.
333 /// </summary>
334 /// <returns>null if the asset has not finished uploading</returns>
335 public AssetBase GetAssetData()
336 {
337 if (m_finished)
338 {
339 return m_asset;
340 }
341 420
342 return null; 421 m_transactions.RemoveXferUploader(m_transactionID);
343 } 422 }
344 } 423 }
345} 424} \ No newline at end of file