aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorJustin Clarke Casey2008-04-10 17:44:19 +0000
committerJustin Clarke Casey2008-04-10 17:44:19 +0000
commitb41abbd50e82103865c8c9540a4154fc689e37a9 (patch)
tree85b8a7f72a6260e6f77ec02250616cff7a25fc22 /OpenSim
parent* Refactor GetUsersInventory() (diff)
downloadopensim-SC_OLD-b41abbd50e82103865c8c9540a4154fc689e37a9.zip
opensim-SC_OLD-b41abbd50e82103865c8c9540a4154fc689e37a9.tar.gz
opensim-SC_OLD-b41abbd50e82103865c8c9540a4154fc689e37a9.tar.bz2
opensim-SC_OLD-b41abbd50e82103865c8c9540a4154fc689e37a9.tar.xz
* Minor: really just comment and subsequent indentation adjustment. Preparation for handling inventory problems where the inventory server receives a request and never responds, or is late in responding
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs96
-rw-r--r--OpenSim/Grid/InventoryServer/GridInventoryService.cs6
2 files changed, 61 insertions, 41 deletions
diff --git a/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs b/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs
index 2dc2374..d94ff6c 100644
--- a/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs
+++ b/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs
@@ -293,64 +293,73 @@ namespace OpenSim.Framework.Communications.Cache
293 folderID, remoteClient.Name); 293 folderID, remoteClient.Name);
294 } 294 }
295 295
296 /// <summary>
297 /// Handle the caps inventory descendents fetch.
298 ///
299 /// Since the folder structure is sent to the client on login, I believe we only need to handle items.
300 /// </summary>
301 /// <param name="agentID"></param>
302 /// <param name="folderID"></param>
303 /// <param name="ownerID"></param>
304 /// <param name="fetchFolders"></param>
305 /// <param name="fetchItems"></param>
306 /// <param name="sortOrder"></param>
307 /// <returns></returns>
296 public List<InventoryItemBase> HandleFetchInventoryDescendentsCAPS(LLUUID agentID, LLUUID folderID, LLUUID ownerID, 308 public List<InventoryItemBase> HandleFetchInventoryDescendentsCAPS(LLUUID agentID, LLUUID folderID, LLUUID ownerID,
297 bool fetchFolders, bool fetchItems, int sortOrder) 309 bool fetchFolders, bool fetchItems, int sortOrder)
298 { 310 {
299 // XXX We're not handling sortOrder yet! 311 // XXX We're not handling sortOrder yet!
300 // with CAPS we are only return items in the folders at the moment
301 // need to find the format that sub folder details are sent in
302 // if (fetchItems)
303 // {
304 InventoryFolderImpl fold = null;
305 if (folderID == libraryRoot.ID)
306 {
307 return libraryRoot.RequestListOfItems();
308 }
309 312
310 if ((fold = libraryRoot.HasSubFolder(folderID)) != null) 313 InventoryFolderImpl fold = null;
311 { 314 if (folderID == libraryRoot.ID)
312 return fold.RequestListOfItems(); 315 {
313 } 316 return libraryRoot.RequestListOfItems();
317 }
314 318
315 CachedUserInfo userProfile; 319 if ((fold = libraryRoot.HasSubFolder(folderID)) != null)
316 if (m_userProfiles.TryGetValue(agentID, out userProfile)) 320 {
321 return fold.RequestListOfItems();
322 }
323
324 CachedUserInfo userProfile;
325 if (m_userProfiles.TryGetValue(agentID, out userProfile))
326 {
327 if (userProfile.RootFolder != null)
317 { 328 {
318 if (userProfile.RootFolder != null) 329 if (userProfile.RootFolder.ID == folderID)
319 { 330 {
320 if (userProfile.RootFolder.ID == folderID) 331 return userProfile.RootFolder.RequestListOfItems();
321 {
322 return userProfile.RootFolder.RequestListOfItems();
323 }
324 else
325 {
326 if ((fold = userProfile.RootFolder.HasSubFolder(folderID)) != null)
327 {
328 return fold.RequestListOfItems();
329 }
330 }
331 } 332 }
332 else 333 else
333 { 334 {
334 m_log.ErrorFormat("[INVENTORY CACHE]: Could not find root folder for user {0}", agentID.ToString()); 335 if ((fold = userProfile.RootFolder.HasSubFolder(folderID)) != null)
335 336 {
336 return new List<InventoryItemBase>(); ; 337 return fold.RequestListOfItems();
338 }
337 } 339 }
338 } 340 }
339 else 341 else
340 { 342 {
341 m_log.ErrorFormat( 343 m_log.ErrorFormat("[INVENTORY CACHE]: Could not find root folder for user {0}", agentID.ToString());
342 "[USER CACHE]: HandleFetchInventoryDescendentsCAPS() Could not find user profile for {0}", 344
343 agentID); 345 return new List<InventoryItemBase>(); ;
344
345 return new List<InventoryItemBase>();
346 } 346 }
347 }
348 else
349 {
350 m_log.ErrorFormat(
351 "[USER CACHE]: HandleFetchInventoryDescendentsCAPS() Could not find user profile for {0}",
352 agentID);
353
354 return new List<InventoryItemBase>();
355 }
356
357 // If we've reached this point then we couldn't find the folder, even though the client thinks
358 // it exists
359 m_log.ErrorFormat("[INVENTORY CACHE]: " +
360 "Could not find folder {0} for user {1}",
361 folderID, agentID.ToString());
347 362
348 // If we've reached this point then we couldn't find the folder, even though the client thinks
349 // it exists
350 m_log.ErrorFormat("[INVENTORY CACHE]: " +
351 "Could not find folder {0} for user {1}",
352 folderID, agentID.ToString());
353 // }
354 return new List<InventoryItemBase>(); 363 return new List<InventoryItemBase>();
355 } 364 }
356 365
@@ -400,6 +409,11 @@ namespace OpenSim.Framework.Communications.Cache
400 } 409 }
401 } 410 }
402 411
412 /// <summary>
413 /// Request the inventory data for the given user.
414 /// </summary>
415 /// <param name="userID"></param>
416 /// <param name="userInfo"></param>
403 private void RequestInventoryForUser(LLUUID userID, CachedUserInfo userInfo) 417 private void RequestInventoryForUser(LLUUID userID, CachedUserInfo userInfo)
404 { 418 {
405 m_parent.InventoryService.RequestInventoryForUser(userID, userInfo.FolderReceive, userInfo.ItemReceive); 419 m_parent.InventoryService.RequestInventoryForUser(userID, userInfo.FolderReceive, userInfo.ItemReceive);
diff --git a/OpenSim/Grid/InventoryServer/GridInventoryService.cs b/OpenSim/Grid/InventoryServer/GridInventoryService.cs
index e30c31e..1ae5243 100644
--- a/OpenSim/Grid/InventoryServer/GridInventoryService.cs
+++ b/OpenSim/Grid/InventoryServer/GridInventoryService.cs
@@ -27,7 +27,10 @@
27 27
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Threading;
31
30using libsecondlife; 32using libsecondlife;
33
31using OpenSim.Framework; 34using OpenSim.Framework;
32using OpenSim.Framework.Communications; 35using OpenSim.Framework.Communications;
33using OpenSim.Framework.Console; 36using OpenSim.Framework.Console;
@@ -103,6 +106,9 @@ namespace OpenSim.Grid.InventoryServer
103 /// <returns>The user's inventory. If an inventory cannot be found then an empty collection is returned.</returns> 106 /// <returns>The user's inventory. If an inventory cannot be found then an empty collection is returned.</returns>
104 public InventoryCollection GetUserInventory(Guid rawUserID) 107 public InventoryCollection GetUserInventory(Guid rawUserID)
105 { 108 {
109 // uncomment me to simulate an overloaded inventory server
110 //Thread.Sleep(40000);
111
106 LLUUID userID = new LLUUID(rawUserID); 112 LLUUID userID = new LLUUID(rawUserID);
107 113
108 m_log.InfoFormat("[AGENT INVENTORY]: Processing request for inventory of {0}", userID); 114 m_log.InfoFormat("[AGENT INVENTORY]: Processing request for inventory of {0}", userID);