aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs
diff options
context:
space:
mode:
authorJustin Clarke Casey2008-04-11 18:13:10 +0000
committerJustin Clarke Casey2008-04-11 18:13:10 +0000
commita5176c2e2c4d2791ec15a22db4309bb15bc3ae98 (patch)
treebbadbbd793ebda546831e9541e312d480d5dae0c /OpenSim/Framework/Communications/Cache/CachedUserInfo.cs
parent* fix bug 935 (diff)
downloadopensim-SC_OLD-a5176c2e2c4d2791ec15a22db4309bb15bc3ae98.zip
opensim-SC_OLD-a5176c2e2c4d2791ec15a22db4309bb15bc3ae98.tar.gz
opensim-SC_OLD-a5176c2e2c4d2791ec15a22db4309bb15bc3ae98.tar.bz2
opensim-SC_OLD-a5176c2e2c4d2791ec15a22db4309bb15bc3ae98.tar.xz
* Change inventory async response deliver to deliver all items and folders at once, rather than each individual
* This is required in order to work towards eliminating some inventory race conditions and to better deal with situations where a grid inventory server is slow or not responding.
Diffstat (limited to 'OpenSim/Framework/Communications/Cache/CachedUserInfo.cs')
-rw-r--r--OpenSim/Framework/Communications/Cache/CachedUserInfo.cs109
1 files changed, 72 insertions, 37 deletions
diff --git a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs
index 1208605..cf701cb 100644
--- a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs
+++ b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs
@@ -118,64 +118,82 @@ namespace OpenSim.Framework.Communications.Cache
118 } 118 }
119 } 119 }
120 } 120 }
121 121
122 /// <summary> 122 /// <summary>
123 /// Callback invoked when a folder is received from an async request to the inventory service. 123 /// Callback invoked when the inventory is received from an async request to the inventory service
124 /// </summary> 124 /// </summary>
125 /// <param name="userID"></param> 125 /// <param name="userID"></param>
126 /// <param name="folderInfo"></param> 126 /// <param name="inventoryCollection"></param>
127 public void FolderReceive(LLUUID userID, InventoryFolderImpl folderInfo) 127 public void InventoryReceive(LLUUID userID, ICollection<InventoryFolderImpl> folders, ICollection<InventoryItemBase> items)
128 { 128 {
129 // FIXME: Exceptions thrown upwards never appear on the console. Could fix further up if these 129 // FIXME: Exceptions thrown upwards never appear on the console. Could fix further up if these
130 // are simply being swallowed 130 // are simply being swallowed
131 try 131 try
132 {
133 foreach (InventoryFolderImpl folder in folders)
134 {
135 FolderReceive(userID, folder);
136 }
137
138 foreach (InventoryItemBase item in items)
139 {
140 ItemReceive(userID, item);
141 }
142 }
143 catch (Exception e)
132 { 144 {
145 m_log.ErrorFormat("[INVENTORY CACHE]: {0}", e);
146 }
147 }
148
149 /// <summary>
150 /// Callback invoked when a folder is received from an async request to the inventory service.
151 /// </summary>
152 /// <param name="userID"></param>
153 /// <param name="folderInfo"></param>
154 private void FolderReceive(LLUUID userID, InventoryFolderImpl folderInfo)
155 {
133// m_log.DebugFormat( 156// m_log.DebugFormat(
134// "[INVENTORY CACHE]: Received folder {0} {1} for user {2}", 157// "[INVENTORY CACHE]: Received folder {0} {1} for user {2}",
135// folderInfo.name, folderInfo.folderID, userID); 158// folderInfo.name, folderInfo.folderID, userID);
136 159
137 if (userID == UserProfile.ID) 160 if (userID == UserProfile.ID)
161 {
162 if (RootFolder == null)
138 { 163 {
139 if (RootFolder == null) 164 if (folderInfo.ParentID == LLUUID.Zero)
140 { 165 {
141 if (folderInfo.ParentID == LLUUID.Zero) 166 m_rootFolder = folderInfo;
142 {
143 m_rootFolder = folderInfo;
144 }
145 } 167 }
146 else if (RootFolder.ID == folderInfo.ParentID) 168 }
169 else if (RootFolder.ID == folderInfo.ParentID)
170 {
171 if (!RootFolder.SubFolders.ContainsKey(folderInfo.ID))
147 { 172 {
148 if (!RootFolder.SubFolders.ContainsKey(folderInfo.ID)) 173 RootFolder.SubFolders.Add(folderInfo.ID, folderInfo);
149 {
150 RootFolder.SubFolders.Add(folderInfo.ID, folderInfo);
151 }
152 else
153 {
154 AddPendingFolder(folderInfo);
155 }
156 } 174 }
157 else 175 else
158 { 176 {
159 InventoryFolderImpl folder = RootFolder.HasSubFolder(folderInfo.ParentID); 177 AddPendingFolder(folderInfo);
160 if (folder != null) 178 }
161 { 179 }
162 if (!folder.SubFolders.ContainsKey(folderInfo.ID)) 180 else
163 { 181 {
164 folder.SubFolders.Add(folderInfo.ID, folderInfo); 182 InventoryFolderImpl folder = RootFolder.HasSubFolder(folderInfo.ParentID);
165 } 183 if (folder != null)
166 } 184 {
167 else 185 if (!folder.SubFolders.ContainsKey(folderInfo.ID))
168 { 186 {
169 AddPendingFolder(folderInfo); 187 folder.SubFolders.Add(folderInfo.ID, folderInfo);
170 } 188 }
171 } 189 }
172 190 else
173 ResolvePendingFolders(folderInfo); 191 {
192 AddPendingFolder(folderInfo);
193 }
174 } 194 }
175 } 195
176 catch (Exception e) 196 ResolvePendingFolders(folderInfo);
177 {
178 m_log.ErrorFormat("[INVENTORY CACHE] {0}", e);
179 } 197 }
180 } 198 }
181 199
@@ -187,7 +205,7 @@ namespace OpenSim.Framework.Communications.Cache
187 /// </summary> 205 /// </summary>
188 /// <param name="userID"></param> 206 /// <param name="userID"></param>
189 /// <param name="folderInfo"></param> 207 /// <param name="folderInfo"></param>
190 public void ItemReceive(LLUUID userID, InventoryItemBase itemInfo) 208 private void ItemReceive(LLUUID userID, InventoryItemBase itemInfo)
191 { 209 {
192 if ((userID == UserProfile.ID) && (RootFolder != null)) 210 if ((userID == UserProfile.ID) && (RootFolder != null))
193 { 211 {
@@ -212,6 +230,11 @@ namespace OpenSim.Framework.Communications.Cache
212 } 230 }
213 } 231 }
214 232
233 /// <summary>
234 /// Add an item to the user's inventory
235 /// </summary>
236 /// <param name="userID"></param>
237 /// <param name="itemInfo"></param>
215 public void AddItem(LLUUID userID, InventoryItemBase itemInfo) 238 public void AddItem(LLUUID userID, InventoryItemBase itemInfo)
216 { 239 {
217 if ((userID == UserProfile.ID) && HasInventory) 240 if ((userID == UserProfile.ID) && HasInventory)
@@ -221,6 +244,11 @@ namespace OpenSim.Framework.Communications.Cache
221 } 244 }
222 } 245 }
223 246
247 /// <summary>
248 /// Update an item in the user's inventory
249 /// </summary>
250 /// <param name="userID"></param>
251 /// <param name="itemInfo"></param>
224 public void UpdateItem(LLUUID userID, InventoryItemBase itemInfo) 252 public void UpdateItem(LLUUID userID, InventoryItemBase itemInfo)
225 { 253 {
226 if ((userID == UserProfile.ID) && HasInventory) 254 if ((userID == UserProfile.ID) && HasInventory)
@@ -229,6 +257,12 @@ namespace OpenSim.Framework.Communications.Cache
229 } 257 }
230 } 258 }
231 259
260 /// <summary>
261 /// Delete an item from the user's inventory
262 /// </summary>
263 /// <param name="userID"></param>
264 /// <param name="item"></param>
265 /// <returns></returns>
232 public bool DeleteItem(LLUUID userID, InventoryItemBase item) 266 public bool DeleteItem(LLUUID userID, InventoryItemBase item)
233 { 267 {
234 bool result = false; 268 bool result = false;
@@ -240,6 +274,7 @@ namespace OpenSim.Framework.Communications.Cache
240 m_commsManager.InventoryService.DeleteInventoryItem(userID, item); 274 m_commsManager.InventoryService.DeleteInventoryItem(userID, item);
241 } 275 }
242 } 276 }
277
243 return result; 278 return result;
244 } 279 }
245 } 280 }