aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Communications/Cache
diff options
context:
space:
mode:
authorJustin Clarke Casey2008-04-11 17:02:20 +0000
committerJustin Clarke Casey2008-04-11 17:02:20 +0000
commite26d4fc08556252c09e46bfa6aa2b59119f702dc (patch)
tree1be8d7ef98d58153ae3ab5904eec652f4edcb0af /OpenSim/Framework/Communications/Cache
parent* minor documenting, cleanup, renaming in user profile cache service (diff)
downloadopensim-SC-e26d4fc08556252c09e46bfa6aa2b59119f702dc.zip
opensim-SC-e26d4fc08556252c09e46bfa6aa2b59119f702dc.tar.gz
opensim-SC-e26d4fc08556252c09e46bfa6aa2b59119f702dc.tar.bz2
opensim-SC-e26d4fc08556252c09e46bfa6aa2b59119f702dc.tar.xz
* minor: replace test of CachedUserInfo.RootFolder != null with something more readable, and make RootFolder get only
Diffstat (limited to 'OpenSim/Framework/Communications/Cache')
-rw-r--r--OpenSim/Framework/Communications/Cache/CachedUserInfo.cs16
-rw-r--r--OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs18
2 files changed, 20 insertions, 14 deletions
diff --git a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs
index 9ece581..1208605 100644
--- a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs
+++ b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs
@@ -49,7 +49,8 @@ namespace OpenSim.Framework.Communications.Cache
49 public UserProfileData UserProfile { get { return m_userProfile; } } 49 public UserProfileData UserProfile { get { return m_userProfile; } }
50 50
51 // FIXME: These need to be hidden behind accessors 51 // FIXME: These need to be hidden behind accessors
52 public InventoryFolderImpl RootFolder = null; 52 private InventoryFolderImpl m_rootFolder;
53 public InventoryFolderImpl RootFolder { get { return m_rootFolder; } }
53 54
54 /// <summary> 55 /// <summary>
55 /// Stores received folders for which we have not yet received the parents. 56 /// Stores received folders for which we have not yet received the parents.
@@ -67,6 +68,11 @@ namespace OpenSim.Framework.Communications.Cache
67 m_commsManager = commsManager; 68 m_commsManager = commsManager;
68 m_userProfile = userProfile; 69 m_userProfile = userProfile;
69 } 70 }
71
72 /// <summary>
73 /// Has this user info object yet received its inventory information from the invetnroy service?
74 /// </summary>
75 public bool HasInventory { get { return RootFolder != null; } }
70 76
71 /// <summary> 77 /// <summary>
72 /// Store a folder pending categorization when its parent is received. 78 /// Store a folder pending categorization when its parent is received.
@@ -134,7 +140,7 @@ namespace OpenSim.Framework.Communications.Cache
134 { 140 {
135 if (folderInfo.ParentID == LLUUID.Zero) 141 if (folderInfo.ParentID == LLUUID.Zero)
136 { 142 {
137 RootFolder = folderInfo; 143 m_rootFolder = folderInfo;
138 } 144 }
139 } 145 }
140 else if (RootFolder.ID == folderInfo.ParentID) 146 else if (RootFolder.ID == folderInfo.ParentID)
@@ -208,7 +214,7 @@ namespace OpenSim.Framework.Communications.Cache
208 214
209 public void AddItem(LLUUID userID, InventoryItemBase itemInfo) 215 public void AddItem(LLUUID userID, InventoryItemBase itemInfo)
210 { 216 {
211 if ((userID == UserProfile.ID) && (RootFolder != null)) 217 if ((userID == UserProfile.ID) && HasInventory)
212 { 218 {
213 ItemReceive(userID, itemInfo); 219 ItemReceive(userID, itemInfo);
214 m_commsManager.InventoryService.AddNewInventoryItem(userID, itemInfo); 220 m_commsManager.InventoryService.AddNewInventoryItem(userID, itemInfo);
@@ -217,7 +223,7 @@ namespace OpenSim.Framework.Communications.Cache
217 223
218 public void UpdateItem(LLUUID userID, InventoryItemBase itemInfo) 224 public void UpdateItem(LLUUID userID, InventoryItemBase itemInfo)
219 { 225 {
220 if ((userID == UserProfile.ID) && (RootFolder != null)) 226 if ((userID == UserProfile.ID) && HasInventory)
221 { 227 {
222 m_commsManager.InventoryService.AddNewInventoryItem(userID, itemInfo); 228 m_commsManager.InventoryService.AddNewInventoryItem(userID, itemInfo);
223 } 229 }
@@ -226,7 +232,7 @@ namespace OpenSim.Framework.Communications.Cache
226 public bool DeleteItem(LLUUID userID, InventoryItemBase item) 232 public bool DeleteItem(LLUUID userID, InventoryItemBase item)
227 { 233 {
228 bool result = false; 234 bool result = false;
229 if ((userID == UserProfile.ID) && (RootFolder != null)) 235 if ((userID == UserProfile.ID) && HasInventory)
230 { 236 {
231 result = RootFolder.DeleteItem(item.ID); 237 result = RootFolder.DeleteItem(item.ID);
232 if (result) 238 if (result)
diff --git a/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs b/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs
index 586c24e..b924d5c 100644
--- a/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs
+++ b/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs
@@ -125,7 +125,7 @@ namespace OpenSim.Framework.Communications.Cache
125 125
126 if (m_userProfiles.TryGetValue(remoteClient.AgentId, out userProfile)) 126 if (m_userProfiles.TryGetValue(remoteClient.AgentId, out userProfile))
127 { 127 {
128 if (userProfile.RootFolder != null) 128 if (userProfile.HasInventory)
129 { 129 {
130 if (userProfile.RootFolder.ID == parentID) 130 if (userProfile.RootFolder.ID == parentID)
131 { 131 {
@@ -175,7 +175,7 @@ namespace OpenSim.Framework.Communications.Cache
175 175
176 if (m_userProfiles.TryGetValue(remoteClient.AgentId, out userProfile)) 176 if (m_userProfiles.TryGetValue(remoteClient.AgentId, out userProfile))
177 { 177 {
178 if (userProfile.RootFolder != null) 178 if (userProfile.HasInventory)
179 { 179 {
180 InventoryFolderBase baseFolder = new InventoryFolderBase(); 180 InventoryFolderBase baseFolder = new InventoryFolderBase();
181 baseFolder.Owner = remoteClient.AgentId; 181 baseFolder.Owner = remoteClient.AgentId;
@@ -195,7 +195,7 @@ namespace OpenSim.Framework.Communications.Cache
195 195
196 if (m_userProfiles.TryGetValue(remoteClient.AgentId, out userProfile)) 196 if (m_userProfiles.TryGetValue(remoteClient.AgentId, out userProfile))
197 { 197 {
198 if (userProfile.RootFolder != null) 198 if (userProfile.HasInventory)
199 { 199 {
200 InventoryFolderBase baseFolder = new InventoryFolderBase(); 200 InventoryFolderBase baseFolder = new InventoryFolderBase();
201 baseFolder.Owner = remoteClient.AgentId; 201 baseFolder.Owner = remoteClient.AgentId;
@@ -248,21 +248,21 @@ namespace OpenSim.Framework.Communications.Cache
248 // inventory failure. 248 // inventory failure.
249 // 249 //
250 // This is a crude way of dealing with that by retrying the lookup. 250 // This is a crude way of dealing with that by retrying the lookup.
251 if (userProfile.RootFolder == null) 251 if (!userProfile.HasInventory)
252 { 252 {
253 int attempts = 5; 253 int attempts = 5;
254 while (attempts-- > 0) 254 while (attempts-- > 0)
255 { 255 {
256 Thread.Sleep(3000); 256 Thread.Sleep(3000);
257 257
258 if (userProfile.RootFolder != null) 258 if (userProfile.HasInventory)
259 { 259 {
260 break; 260 break;
261 } 261 }
262 } 262 }
263 } 263 }
264 264
265 if (userProfile.RootFolder != null) 265 if (userProfile.HasInventory)
266 { 266 {
267 if (userProfile.RootFolder.ID == folderID) 267 if (userProfile.RootFolder.ID == folderID)
268 { 268 {
@@ -346,7 +346,7 @@ namespace OpenSim.Framework.Communications.Cache
346 CachedUserInfo userProfile; 346 CachedUserInfo userProfile;
347 if (m_userProfiles.TryGetValue(agentID, out userProfile)) 347 if (m_userProfiles.TryGetValue(agentID, out userProfile))
348 { 348 {
349 if (userProfile.RootFolder != null) 349 if (userProfile.HasInventory)
350 { 350 {
351 if (userProfile.RootFolder.ID == folderID) 351 if (userProfile.RootFolder.ID == folderID)
352 { 352 {
@@ -393,7 +393,7 @@ namespace OpenSim.Framework.Communications.Cache
393 CachedUserInfo userProfile; 393 CachedUserInfo userProfile;
394 if (m_userProfiles.TryGetValue(remoteClient.AgentId, out userProfile)) 394 if (m_userProfiles.TryGetValue(remoteClient.AgentId, out userProfile))
395 { 395 {
396 if (userProfile.RootFolder != null) 396 if (userProfile.HasInventory)
397 { 397 {
398 InventoryFolderImpl subFolder = userProfile.RootFolder.HasSubFolder(folderID); 398 InventoryFolderImpl subFolder = userProfile.RootFolder.HasSubFolder(folderID);
399 if (subFolder != null) 399 if (subFolder != null)
@@ -420,7 +420,7 @@ namespace OpenSim.Framework.Communications.Cache
420 CachedUserInfo userProfile; 420 CachedUserInfo userProfile;
421 if (m_userProfiles.TryGetValue(remoteClient.AgentId, out userProfile)) 421 if (m_userProfiles.TryGetValue(remoteClient.AgentId, out userProfile))
422 { 422 {
423 if (userProfile.RootFolder != null) 423 if (userProfile.HasInventory)
424 { 424 {
425 InventoryItemBase item = userProfile.RootFolder.HasItem(itemID); 425 InventoryItemBase item = userProfile.RootFolder.HasItem(itemID);
426 if (item != null) 426 if (item != null)