diff options
author | Justin Clarke Casey | 2008-05-04 00:53:01 +0000 |
---|---|---|
committer | Justin Clarke Casey | 2008-05-04 00:53:01 +0000 |
commit | 9646258fdfd317d870872f2af24c86fb34a71686 (patch) | |
tree | 290e2e02903df61a17034b475ef9acca5820f27f /OpenSim/Framework/Communications/Cache | |
parent | * Simplify CreateFolder() by folding previous special root case into FindFold... (diff) | |
download | opensim-SC-9646258fdfd317d870872f2af24c86fb34a71686.zip opensim-SC-9646258fdfd317d870872f2af24c86fb34a71686.tar.gz opensim-SC-9646258fdfd317d870872f2af24c86fb34a71686.tar.bz2 opensim-SC-9646258fdfd317d870872f2af24c86fb34a71686.tar.xz |
* Refactor: Simplify CachedUserInfo.FolderReceive() by removing root folder special case
Diffstat (limited to 'OpenSim/Framework/Communications/Cache')
-rw-r--r-- | OpenSim/Framework/Communications/Cache/CachedUserInfo.cs | 62 |
1 files changed, 29 insertions, 33 deletions
diff --git a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs index 5b84958..18bd994 100644 --- a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs +++ b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs | |||
@@ -117,7 +117,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
117 | } | 117 | } |
118 | 118 | ||
119 | /// <summary> | 119 | /// <summary> |
120 | /// Store a folder pending categorization when its parent is received. | 120 | /// Store a folder pending arrival of its parent |
121 | /// </summary> | 121 | /// </summary> |
122 | /// <param name="folder"></param> | 122 | /// <param name="folder"></param> |
123 | private void AddPendingFolder(InventoryFolderImpl folder) | 123 | private void AddPendingFolder(InventoryFolderImpl folder) |
@@ -138,26 +138,26 @@ namespace OpenSim.Framework.Communications.Cache | |||
138 | } | 138 | } |
139 | 139 | ||
140 | /// <summary> | 140 | /// <summary> |
141 | /// Add any pending folders which are children of parent | 141 | /// Add any pending folders which were received before the given folder |
142 | /// </summary> | 142 | /// </summary> |
143 | /// <param name="parentId"> | 143 | /// <param name="parentId"> |
144 | /// A <see cref="LLUUID"/> | 144 | /// A <see cref="LLUUID"/> |
145 | /// </param> | 145 | /// </param> |
146 | private void ResolvePendingFolders(InventoryFolderImpl parent) | 146 | private void ResolvePendingFolders(InventoryFolderImpl newFolder) |
147 | { | 147 | { |
148 | if (pendingCategorizationFolders.ContainsKey(parent.ID)) | 148 | if (pendingCategorizationFolders.ContainsKey(newFolder.ID)) |
149 | { | 149 | { |
150 | foreach (InventoryFolderImpl folder in pendingCategorizationFolders[parent.ID]) | 150 | foreach (InventoryFolderImpl folder in pendingCategorizationFolders[newFolder.ID]) |
151 | { | 151 | { |
152 | // m_log.DebugFormat( | 152 | // m_log.DebugFormat( |
153 | // "[INVENTORY CACHE]: Resolving pending received folder {0} {1} into {2} {3}", | 153 | // "[INVENTORY CACHE]: Resolving pending received folder {0} {1} into {2} {3}", |
154 | // folder.name, folder.folderID, parent.name, parent.folderID); | 154 | // folder.name, folder.folderID, parent.name, parent.folderID); |
155 | 155 | ||
156 | lock (parent.SubFolders) | 156 | lock (newFolder.SubFolders) |
157 | { | 157 | { |
158 | if (!parent.SubFolders.ContainsKey(folder.ID)) | 158 | if (!newFolder.SubFolders.ContainsKey(folder.ID)) |
159 | { | 159 | { |
160 | parent.SubFolders.Add(folder.ID, folder); | 160 | newFolder.SubFolders.Add(folder.ID, folder); |
161 | } | 161 | } |
162 | } | 162 | } |
163 | } | 163 | } |
@@ -209,7 +209,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
209 | /// </summary> | 209 | /// </summary> |
210 | /// <param name="userID"></param> | 210 | /// <param name="userID"></param> |
211 | /// <param name="folderInfo"></param> | 211 | /// <param name="folderInfo"></param> |
212 | private void FolderReceive(InventoryFolderImpl folderInfo) | 212 | private void FolderReceive(InventoryFolderImpl newFolder) |
213 | { | 213 | { |
214 | // m_log.DebugFormat( | 214 | // m_log.DebugFormat( |
215 | // "[INVENTORY CACHE]: Received folder {0} {1} for user {2}", | 215 | // "[INVENTORY CACHE]: Received folder {0} {1} for user {2}", |
@@ -217,46 +217,42 @@ namespace OpenSim.Framework.Communications.Cache | |||
217 | 217 | ||
218 | if (RootFolder == null) | 218 | if (RootFolder == null) |
219 | { | 219 | { |
220 | if (folderInfo.ParentID == LLUUID.Zero) | 220 | if (newFolder.ParentID == LLUUID.Zero) |
221 | { | 221 | { |
222 | m_rootFolder = folderInfo; | 222 | m_rootFolder = newFolder; |
223 | } | 223 | } |
224 | } | 224 | else |
225 | else if (RootFolder.ID == folderInfo.ParentID) | ||
226 | { | ||
227 | lock (RootFolder.SubFolders) | ||
228 | { | 225 | { |
229 | if (!RootFolder.SubFolders.ContainsKey(folderInfo.ID)) | 226 | AddPendingFolder(newFolder); |
230 | { | ||
231 | RootFolder.SubFolders.Add(folderInfo.ID, folderInfo); | ||
232 | } | ||
233 | else | ||
234 | { | ||
235 | AddPendingFolder(folderInfo); | ||
236 | } | ||
237 | } | 227 | } |
238 | } | 228 | } |
239 | else | 229 | else |
240 | { | 230 | { |
241 | InventoryFolderImpl folder = RootFolder.FindFolder(folderInfo.ParentID); | 231 | InventoryFolderImpl parentFolder = RootFolder.FindFolder(newFolder.ParentID); |
242 | 232 | ||
243 | lock (folder.SubFolders) | 233 | if (parentFolder != null) |
244 | { | 234 | { |
245 | if (folder != null) | 235 | lock (parentFolder.SubFolders) |
246 | { | 236 | { |
247 | if (!folder.SubFolders.ContainsKey(folderInfo.ID)) | 237 | if (!parentFolder.SubFolders.ContainsKey(newFolder.ID)) |
248 | { | 238 | { |
249 | folder.SubFolders.Add(folderInfo.ID, folderInfo); | 239 | parentFolder.SubFolders.Add(newFolder.ID, newFolder); |
240 | } | ||
241 | else | ||
242 | { | ||
243 | m_log.WarnFormat( | ||
244 | "[INVENTORY CACHE]: Received folder {0} {1} from inventory service which has already been received", | ||
245 | newFolder.Name, newFolder.ID); | ||
250 | } | 246 | } |
251 | } | ||
252 | else | ||
253 | { | ||
254 | AddPendingFolder(folderInfo); | ||
255 | } | 247 | } |
256 | } | 248 | } |
249 | else | ||
250 | { | ||
251 | AddPendingFolder(newFolder); | ||
252 | } | ||
257 | } | 253 | } |
258 | 254 | ||
259 | ResolvePendingFolders(folderInfo); | 255 | ResolvePendingFolders(newFolder); |
260 | } | 256 | } |
261 | 257 | ||
262 | /// <summary> | 258 | /// <summary> |