diff options
author | Justin Clarke Casey | 2008-05-09 21:33:19 +0000 |
---|---|---|
committer | Justin Clarke Casey | 2008-05-09 21:33:19 +0000 |
commit | 3f345bf685a80189c8a33ec1514c356064a6fa70 (patch) | |
tree | a13c5e53faff34b77f974f3a585f5f53c4a7cceb /OpenSim/Framework/Communications | |
parent | m_logs always need to be private static readonly otherwise we (diff) | |
download | opensim-SC-3f345bf685a80189c8a33ec1514c356064a6fa70.zip opensim-SC-3f345bf685a80189c8a33ec1514c356064a6fa70.tar.gz opensim-SC-3f345bf685a80189c8a33ec1514c356064a6fa70.tar.bz2 opensim-SC-3f345bf685a80189c8a33ec1514c356064a6fa70.tar.xz |
* Removing polling delay for non-CAPS inventory fetch if the client has not yet received data from the inventory service
* Replaced instead with the system now used by other requests where the fetch request is placed on a queue and service when the data comes in
Diffstat (limited to 'OpenSim/Framework/Communications')
-rw-r--r-- | OpenSim/Framework/Communications/Cache/CachedUserInfo.cs | 51 | ||||
-rw-r--r-- | OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs | 62 |
2 files changed, 54 insertions, 59 deletions
diff --git a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs index 03ba1db..218fd5a 100644 --- a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs +++ b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs | |||
@@ -42,7 +42,10 @@ namespace OpenSim.Framework.Communications.Cache | |||
42 | internal delegate void CreateFolderDelegate(string folderName, LLUUID folderID, ushort folderType, LLUUID parentID); | 42 | internal delegate void CreateFolderDelegate(string folderName, LLUUID folderID, ushort folderType, LLUUID parentID); |
43 | internal delegate void MoveFolderDelegate(LLUUID folderID, LLUUID parentID); | 43 | internal delegate void MoveFolderDelegate(LLUUID folderID, LLUUID parentID); |
44 | internal delegate void PurgeFolderDelegate(LLUUID folderID); | 44 | internal delegate void PurgeFolderDelegate(LLUUID folderID); |
45 | internal delegate void UpdateFolderDelegate(string name, LLUUID folderID, ushort type, LLUUID parentID); | 45 | internal delegate void UpdateFolderDelegate(string name, LLUUID folderID, ushort type, LLUUID parentID); |
46 | |||
47 | internal delegate void SendInventoryDescendentsDelegate( | ||
48 | IClientAPI client, LLUUID folderID, bool fetchFolders, bool fetchItems); | ||
46 | 49 | ||
47 | /// <summary> | 50 | /// <summary> |
48 | /// Stores user profile and inventory data received from backend services for a particular user. | 51 | /// Stores user profile and inventory data received from backend services for a particular user. |
@@ -557,6 +560,52 @@ namespace OpenSim.Framework.Communications.Cache | |||
557 | 560 | ||
558 | return false; | 561 | return false; |
559 | } | 562 | } |
563 | |||
564 | /// <summary> | ||
565 | /// Send details of the inventory items and/or folders in a given folder to the client. | ||
566 | /// </summary> | ||
567 | /// <param name="client"></param> | ||
568 | /// <param name="folderID"></param> | ||
569 | /// <param name="fetchFolders"></param> | ||
570 | /// <param name="fetchItems"></param> | ||
571 | /// <returns>true if the request was queued or successfully processed, false otherwise</returns> | ||
572 | public bool SendInventoryDecendents(IClientAPI client, LLUUID folderID, bool fetchFolders, bool fetchItems) | ||
573 | { | ||
574 | if (HasInventory) | ||
575 | { | ||
576 | InventoryFolderImpl folder; | ||
577 | |||
578 | if ((folder = RootFolder.FindFolder(folderID)) != null) | ||
579 | { | ||
580 | // m_log.DebugFormat( | ||
581 | // "[AGENT INVENTORY]: Found folder {0} for client {1}", | ||
582 | // folderID, remoteClient.AgentId); | ||
583 | |||
584 | client.SendInventoryFolderDetails( | ||
585 | client.AgentId, folderID, folder.RequestListOfItems(), | ||
586 | folder.RequestListOfFolders(), fetchFolders, fetchItems); | ||
587 | |||
588 | return true; | ||
589 | } | ||
590 | else | ||
591 | { | ||
592 | m_log.WarnFormat( | ||
593 | "[AGENT INVENTORY]: Could not find folder {0} requested by user {1} {2}", | ||
594 | folderID, client.Name, client.AgentId); | ||
595 | |||
596 | return false; | ||
597 | } | ||
598 | } | ||
599 | else | ||
600 | { | ||
601 | AddRequest( | ||
602 | new InventoryRequest( | ||
603 | Delegate.CreateDelegate(typeof(SendInventoryDescendentsDelegate), this, "SendInventoryDecendents"), | ||
604 | new object[] { client, folderID, fetchFolders, fetchItems })); | ||
605 | |||
606 | return true; | ||
607 | } | ||
608 | } | ||
560 | } | 609 | } |
561 | 610 | ||
562 | /// <summary> | 611 | /// <summary> |
diff --git a/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs b/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs index b167682..7f911dc 100644 --- a/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs +++ b/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs | |||
@@ -247,7 +247,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
247 | public void HandleFetchInventoryDescendents(IClientAPI remoteClient, LLUUID folderID, LLUUID ownerID, | 247 | public void HandleFetchInventoryDescendents(IClientAPI remoteClient, LLUUID folderID, LLUUID ownerID, |
248 | bool fetchFolders, bool fetchItems, int sortOrder) | 248 | bool fetchFolders, bool fetchItems, int sortOrder) |
249 | { | 249 | { |
250 | // XXX We're not handling sortOrder yet! | 250 | // FIXME MAYBE: We're not handling sortOrder! |
251 | 251 | ||
252 | InventoryFolderImpl fold = null; | 252 | InventoryFolderImpl fold = null; |
253 | if ((fold = libraryRoot.FindFolder(folderID)) != null) | 253 | if ((fold = libraryRoot.FindFolder(folderID)) != null) |
@@ -262,68 +262,14 @@ namespace OpenSim.Framework.Communications.Cache | |||
262 | CachedUserInfo userProfile; | 262 | CachedUserInfo userProfile; |
263 | if (m_userProfiles.TryGetValue(remoteClient.AgentId, out userProfile)) | 263 | if (m_userProfiles.TryGetValue(remoteClient.AgentId, out userProfile)) |
264 | { | 264 | { |
265 | // XXX: When a client crosses into a scene, their entire inventory is fetched | 265 | userProfile.SendInventoryDecendents(remoteClient, folderID, fetchFolders, fetchItems); |
266 | // asynchronously. However, if the client is logging on and does not have a cached root | ||
267 | // folder, then the root folder request usually comes in *before* the async completes, leading to | ||
268 | // inventory failure. | ||
269 | // | ||
270 | // This is a crude way of dealing with that by retrying the lookup. | ||
271 | //BUG: This should be replaced with a async event. | ||
272 | if (!userProfile.HasInventory) | ||
273 | { | ||
274 | int attempts = 5; | ||
275 | while (attempts-- > 0) | ||
276 | { | ||
277 | Thread.Sleep(2000); | ||
278 | |||
279 | if (userProfile.HasInventory) | ||
280 | { | ||
281 | break; | ||
282 | } | ||
283 | } | ||
284 | } | ||
285 | |||
286 | if (userProfile.HasInventory) | ||
287 | { | ||
288 | if ((fold = userProfile.RootFolder.FindFolder(folderID)) != null) | ||
289 | { | ||
290 | // m_log.DebugFormat( | ||
291 | // "[AGENT INVENTORY]: Found folder {0} for client {1}", | ||
292 | // folderID, remoteClient.AgentId); | ||
293 | |||
294 | remoteClient.SendInventoryFolderDetails( | ||
295 | remoteClient.AgentId, folderID, fold.RequestListOfItems(), | ||
296 | fold.RequestListOfFolders(), fetchFolders, fetchItems); | ||
297 | |||
298 | return; | ||
299 | } | ||
300 | else | ||
301 | { | ||
302 | m_log.WarnFormat( | ||
303 | "[AGENT INVENTORY]: Could not find folder {0} requested by user {1} {2}", | ||
304 | folderID, remoteClient.Name, remoteClient.AgentId); | ||
305 | } | ||
306 | } | ||
307 | else | ||
308 | { | ||
309 | m_log.ErrorFormat("[AGENT INVENTORY]: Could not find root folder for user {0}", remoteClient.Name); | ||
310 | |||
311 | return; | ||
312 | } | ||
313 | } | 266 | } |
314 | else | 267 | else |
315 | { | 268 | { |
316 | m_log.ErrorFormat( | 269 | m_log.ErrorFormat( |
317 | "[AGENT INVENTORY]: Could not find user profile for {0} {1}", | 270 | "[AGENT INVENTORY]: Could not find user profile for {0} {1}", |
318 | remoteClient.Name, remoteClient.AgentId); | 271 | remoteClient.Name, remoteClient.AgentId); |
319 | 272 | } | |
320 | return; | ||
321 | } | ||
322 | |||
323 | // If we've reached this point then we couldn't find the folder, even though the client thinks | ||
324 | // it exists | ||
325 | m_log.ErrorFormat("[AGENT INVENTORY]: Could not find folder {0} for user {1}", | ||
326 | folderID, remoteClient.Name); | ||
327 | } | 273 | } |
328 | 274 | ||
329 | /// <summary> | 275 | /// <summary> |
@@ -345,7 +291,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
345 | // "[INVENTORY CACHE]: Fetching folders ({0}), items ({1}) from {2} for agent {3}", | 291 | // "[INVENTORY CACHE]: Fetching folders ({0}), items ({1}) from {2} for agent {3}", |
346 | // fetchFolders, fetchItems, folderID, agentID); | 292 | // fetchFolders, fetchItems, folderID, agentID); |
347 | 293 | ||
348 | // XXX We're not handling sortOrder yet! | 294 | // FIXME MAYBE: We're not handling sortOrder! |
349 | 295 | ||
350 | InventoryFolderImpl fold; | 296 | InventoryFolderImpl fold; |
351 | if ((fold = libraryRoot.FindFolder(folderID)) != null) | 297 | if ((fold = libraryRoot.FindFolder(folderID)) != null) |