diff options
author | Justin Clarke Casey | 2008-03-29 22:18:44 +0000 |
---|---|---|
committer | Justin Clarke Casey | 2008-03-29 22:18:44 +0000 |
commit | 875211b262ecda2eced68b217221dead20cbdb6b (patch) | |
tree | e84ecb6149076e71ce6d9fedeea5f0c49ca46d93 /OpenSim/Framework/Communications/Cache/CachedUserInfo.cs | |
parent | * Updating ODE Libraries to release / dNODEBUG (diff) | |
download | opensim-SC_OLD-875211b262ecda2eced68b217221dead20cbdb6b.zip opensim-SC_OLD-875211b262ecda2eced68b217221dead20cbdb6b.tar.gz opensim-SC_OLD-875211b262ecda2eced68b217221dead20cbdb6b.tar.bz2 opensim-SC_OLD-875211b262ecda2eced68b217221dead20cbdb6b.tar.xz |
* Various 1.19.0.5 grid inventory request fixes. These will only take affect once the region and the grid servers have upgraded to this revision
* You may also need to clear your cache before seeing any effect.
* These fixes may or may not affect inventory on the RC client.
* These fixes should make non-root folders work better, stop inventory failure on first login, allow trash to be emptied and make texture picker in object edit view work properly
* Fixes are 1) make initial root folder request wait for async inventory delivery, 2) deliver all folders in the initial login skeleton, not just the root child ones and 3) deal
with situations where we receive child folders from the inventory service before their parent is received.
Diffstat (limited to 'OpenSim/Framework/Communications/Cache/CachedUserInfo.cs')
-rw-r--r-- | OpenSim/Framework/Communications/Cache/CachedUserInfo.cs | 128 |
1 files changed, 108 insertions, 20 deletions
diff --git a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs index 59e5b6e..f2dd2bf 100644 --- a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs +++ b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs | |||
@@ -25,6 +25,9 @@ | |||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | |||
28 | using libsecondlife; | 31 | using libsecondlife; |
29 | 32 | ||
30 | namespace OpenSim.Framework.Communications.Cache | 33 | namespace OpenSim.Framework.Communications.Cache |
@@ -35,50 +38,135 @@ namespace OpenSim.Framework.Communications.Cache | |||
35 | = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); | 38 | = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); |
36 | 39 | ||
37 | private readonly CommunicationsManager m_parentCommsManager; | 40 | private readonly CommunicationsManager m_parentCommsManager; |
38 | // Fields | 41 | |
42 | // FIXME: These need to be hidden behind accessors | ||
39 | public InventoryFolderImpl RootFolder = null; | 43 | public InventoryFolderImpl RootFolder = null; |
40 | public UserProfileData UserProfile = null; | 44 | public UserProfileData UserProfile = null; |
45 | |||
46 | /// <summary> | ||
47 | /// Stores received folders for which we have not yet received the parents. | ||
48 | /// </summary></param> | ||
49 | private IDictionary<LLUUID, IList<InventoryFolderImpl>> pendingCategorizationFolders | ||
50 | = new Dictionary<LLUUID, IList<InventoryFolderImpl>>(); | ||
41 | 51 | ||
42 | public CachedUserInfo(CommunicationsManager commsManager) | 52 | public CachedUserInfo(CommunicationsManager commsManager) |
43 | { | 53 | { |
44 | m_parentCommsManager = commsManager; | 54 | m_parentCommsManager = commsManager; |
45 | } | 55 | } |
46 | 56 | ||
47 | // Methods | 57 | /// <summary> |
48 | public void FolderReceive(LLUUID userID, InventoryFolderImpl folderInfo) | 58 | /// Store a folder pending categorization when its parent is received. |
59 | /// </summary> | ||
60 | /// <param name="folder"></param> | ||
61 | private void AddPendingFolder(InventoryFolderImpl folder) | ||
49 | { | 62 | { |
50 | //m_log.DebugFormat("[INVENTORY CACHE]: Received folder {0} {1} for user {2}", folderInfo.name, folderInfo.folderID, userID); | 63 | LLUUID parentFolderId = folder.parentID; |
51 | 64 | ||
52 | if (userID == UserProfile.UUID) | 65 | if (pendingCategorizationFolders.ContainsKey(parentFolderId)) |
66 | { | ||
67 | pendingCategorizationFolders[parentFolderId].Add(folder); | ||
68 | } | ||
69 | else | ||
70 | { | ||
71 | IList<InventoryFolderImpl> folders = new List<InventoryFolderImpl>(); | ||
72 | folders.Add(folder); | ||
73 | |||
74 | pendingCategorizationFolders[parentFolderId] = folders; | ||
75 | } | ||
76 | } | ||
77 | |||
78 | /// <summary> | ||
79 | /// Add any pending folders which are children of parent | ||
80 | /// </summary> | ||
81 | /// <param name="parentId"> | ||
82 | /// A <see cref="LLUUID"/> | ||
83 | /// </param> | ||
84 | private void ResolvePendingFolders(InventoryFolderImpl parent) | ||
85 | { | ||
86 | if (pendingCategorizationFolders.ContainsKey(parent.folderID)) | ||
53 | { | 87 | { |
54 | if (RootFolder == null) | 88 | foreach (InventoryFolderImpl folder in pendingCategorizationFolders[parent.folderID]) |
55 | { | 89 | { |
56 | if (folderInfo.parentID == LLUUID.Zero) | 90 | // m_log.DebugFormat( |
91 | // "[INVENTORY CACHE]: Resolving pending received folder {0} {1} into {2} {3}", | ||
92 | // folder.name, folder.folderID, parent.name, parent.folderID); | ||
93 | |||
94 | if (!parent.SubFolders.ContainsKey(folder.folderID)) | ||
57 | { | 95 | { |
58 | RootFolder = folderInfo; | 96 | parent.SubFolders.Add(folder.folderID, folder); |
59 | } | 97 | } |
60 | } | 98 | } |
61 | else if (RootFolder.folderID == folderInfo.parentID) | 99 | } |
100 | } | ||
101 | |||
102 | /// <summary> | ||
103 | /// Callback invoked when a folder is received from an async request to the inventory service. | ||
104 | /// </summary> | ||
105 | /// <param name="userID"></param> | ||
106 | /// <param name="folderInfo"></param> | ||
107 | public void FolderReceive(LLUUID userID, InventoryFolderImpl folderInfo) | ||
108 | { | ||
109 | // FIXME: Exceptions thrown upwards never appear on the console. Could fix further up if these | ||
110 | // are simply being swallowed | ||
111 | try | ||
112 | { | ||
113 | // m_log.DebugFormat( | ||
114 | // "[INVENTORY CACHE]: Received folder {0} {1} for user {2}", | ||
115 | // folderInfo.name, folderInfo.folderID, userID); | ||
116 | |||
117 | if (userID == UserProfile.UUID) | ||
62 | { | 118 | { |
63 | if (!RootFolder.SubFolders.ContainsKey(folderInfo.folderID)) | 119 | if (RootFolder == null) |
64 | { | 120 | { |
65 | RootFolder.SubFolders.Add(folderInfo.folderID, folderInfo); | 121 | if (folderInfo.parentID == LLUUID.Zero) |
122 | { | ||
123 | RootFolder = folderInfo; | ||
124 | } | ||
66 | } | 125 | } |
67 | } | 126 | else if (RootFolder.folderID == folderInfo.parentID) |
68 | else | ||
69 | { | ||
70 | InventoryFolderImpl folder = RootFolder.HasSubFolder(folderInfo.parentID); | ||
71 | if (folder != null) | ||
72 | { | 127 | { |
73 | if (!folder.SubFolders.ContainsKey(folderInfo.folderID)) | 128 | if (!RootFolder.SubFolders.ContainsKey(folderInfo.folderID)) |
74 | { | 129 | { |
75 | folder.SubFolders.Add(folderInfo.folderID, folderInfo); | 130 | RootFolder.SubFolders.Add(folderInfo.folderID, folderInfo); |
76 | } | 131 | } |
132 | else | ||
133 | { | ||
134 | AddPendingFolder(folderInfo); | ||
135 | } | ||
77 | } | 136 | } |
137 | else | ||
138 | { | ||
139 | InventoryFolderImpl folder = RootFolder.HasSubFolder(folderInfo.parentID); | ||
140 | if (folder != null) | ||
141 | { | ||
142 | if (!folder.SubFolders.ContainsKey(folderInfo.folderID)) | ||
143 | { | ||
144 | folder.SubFolders.Add(folderInfo.folderID, folderInfo); | ||
145 | } | ||
146 | } | ||
147 | else | ||
148 | { | ||
149 | AddPendingFolder(folderInfo); | ||
150 | } | ||
151 | } | ||
152 | |||
153 | ResolvePendingFolders(folderInfo); | ||
78 | } | 154 | } |
79 | } | 155 | } |
156 | catch (Exception e) | ||
157 | { | ||
158 | m_log.ErrorFormat("[INVENTORY CACHE] {0}", e); | ||
159 | } | ||
80 | } | 160 | } |
81 | 161 | ||
162 | /// <summary> | ||
163 | /// Callback invoked when an item is received from an async request to the inventory service. | ||
164 | /// | ||
165 | /// FIXME: We're assuming here that items are always received after all the folders have been | ||
166 | /// received. | ||
167 | /// </summary> | ||
168 | /// <param name="userID"></param> | ||
169 | /// <param name="folderInfo"></param> | ||
82 | public void ItemReceive(LLUUID userID, InventoryItemBase itemInfo) | 170 | public void ItemReceive(LLUUID userID, InventoryItemBase itemInfo) |
83 | { | 171 | { |
84 | if ((userID == UserProfile.UUID) && (RootFolder != null)) | 172 | if ((userID == UserProfile.UUID) && (RootFolder != null)) |