diff options
author | Justin Clarke Casey | 2008-04-11 18:46:54 +0000 |
---|---|---|
committer | Justin Clarke Casey | 2008-04-11 18:46:54 +0000 |
commit | 7ac7f79f88f51504680a24f1621115c595492f62 (patch) | |
tree | a1b29254a35ca97f4d44dffa1bb4bd2eb863e938 /OpenSim | |
parent | * Minor inventory code cleanup following on from last patch (diff) | |
download | opensim-SC-7ac7f79f88f51504680a24f1621115c595492f62.zip opensim-SC-7ac7f79f88f51504680a24f1621115c595492f62.tar.gz opensim-SC-7ac7f79f88f51504680a24f1621115c595492f62.tar.bz2 opensim-SC-7ac7f79f88f51504680a24f1621115c595492f62.tar.xz |
* Eliminate a class of errors where an inventory request could be made before the region had completely received the inventory for the user.
* A much larger race condition where the inventory request could be made before the region gets any data at all will also be fixed in the near future.
* This change also fixes a regression from two patches ago where items stopped appearing in standalone inventory
Diffstat (limited to '')
3 files changed, 31 insertions, 14 deletions
diff --git a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs index d97cf01..686f8d2 100644 --- a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs +++ b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs | |||
@@ -47,10 +47,18 @@ namespace OpenSim.Framework.Communications.Cache | |||
47 | 47 | ||
48 | private UserProfileData m_userProfile; | 48 | private UserProfileData m_userProfile; |
49 | public UserProfileData UserProfile { get { return m_userProfile; } } | 49 | public UserProfileData UserProfile { get { return m_userProfile; } } |
50 | |||
51 | |||
52 | private bool m_hasInventory; | ||
53 | |||
54 | /// <summary> | ||
55 | /// Has this user info object yet received its inventory information from the invetnroy service? | ||
56 | /// </summary> | ||
57 | public bool HasInventory { get { return m_hasInventory; } } | ||
50 | 58 | ||
51 | // FIXME: These need to be hidden behind accessors | 59 | // FIXME: These need to be hidden behind accessors |
52 | private InventoryFolderImpl m_rootFolder; | 60 | private InventoryFolderImpl m_rootFolder; |
53 | public InventoryFolderImpl RootFolder { get { return m_rootFolder; } } | 61 | public InventoryFolderImpl RootFolder { get { return m_rootFolder; } } |
54 | 62 | ||
55 | /// <summary> | 63 | /// <summary> |
56 | /// Stores received folders for which we have not yet received the parents. | 64 | /// Stores received folders for which we have not yet received the parents. |
@@ -68,11 +76,6 @@ namespace OpenSim.Framework.Communications.Cache | |||
68 | m_commsManager = commsManager; | 76 | m_commsManager = commsManager; |
69 | m_userProfile = userProfile; | 77 | m_userProfile = userProfile; |
70 | } | 78 | } |
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; } } | ||
76 | 79 | ||
77 | /// <summary> | 80 | /// <summary> |
78 | /// Store a folder pending categorization when its parent is received. | 81 | /// Store a folder pending categorization when its parent is received. |
@@ -142,8 +145,10 @@ namespace OpenSim.Framework.Communications.Cache | |||
142 | } | 145 | } |
143 | catch (Exception e) | 146 | catch (Exception e) |
144 | { | 147 | { |
145 | m_log.ErrorFormat("[INVENTORY CACHE]: {0}", e); | 148 | m_log.ErrorFormat("[INVENTORY CACHE]: Error processing inventory received from inventory service, {0}", e); |
146 | } | 149 | } |
150 | |||
151 | m_hasInventory = true; | ||
147 | } | 152 | } |
148 | 153 | ||
149 | /// <summary> | 154 | /// <summary> |
@@ -153,9 +158,9 @@ namespace OpenSim.Framework.Communications.Cache | |||
153 | /// <param name="folderInfo"></param> | 158 | /// <param name="folderInfo"></param> |
154 | private void FolderReceive(LLUUID userID, InventoryFolderImpl folderInfo) | 159 | private void FolderReceive(LLUUID userID, InventoryFolderImpl folderInfo) |
155 | { | 160 | { |
156 | // m_log.DebugFormat( | 161 | m_log.DebugFormat( |
157 | // "[INVENTORY CACHE]: Received folder {0} {1} for user {2}", | 162 | "[INVENTORY CACHE]: Received folder {0} {1} for user {2}", |
158 | // folderInfo.name, folderInfo.folderID, userID); | 163 | folderInfo.Name, folderInfo.ID, userID); |
159 | 164 | ||
160 | if (userID == UserProfile.ID) | 165 | if (userID == UserProfile.ID) |
161 | { | 166 | { |
@@ -207,6 +212,10 @@ namespace OpenSim.Framework.Communications.Cache | |||
207 | /// <param name="folderInfo"></param> | 212 | /// <param name="folderInfo"></param> |
208 | private void ItemReceive(LLUUID userID, InventoryItemBase itemInfo) | 213 | private void ItemReceive(LLUUID userID, InventoryItemBase itemInfo) |
209 | { | 214 | { |
215 | m_log.DebugFormat( | ||
216 | "[INVENTORY CACHE]: Received item {0} {1} for user {2}", | ||
217 | itemInfo.Name, itemInfo.ID, userID); | ||
218 | |||
210 | if ((userID == UserProfile.ID) && (RootFolder != null)) | 219 | if ((userID == UserProfile.ID) && (RootFolder != null)) |
211 | { | 220 | { |
212 | if (itemInfo.Folder == RootFolder.ID) | 221 | if (itemInfo.Folder == RootFolder.ID) |
diff --git a/OpenSim/Region/Communications/Local/LocalInventoryService.cs b/OpenSim/Region/Communications/Local/LocalInventoryService.cs index e81a39f..dafd637 100644 --- a/OpenSim/Region/Communications/Local/LocalInventoryService.cs +++ b/OpenSim/Region/Communications/Local/LocalInventoryService.cs | |||
@@ -39,13 +39,18 @@ namespace OpenSim.Region.Communications.Local | |||
39 | /// </summary> | 39 | /// </summary> |
40 | public class LocalInventoryService : InventoryServiceBase | 40 | public class LocalInventoryService : InventoryServiceBase |
41 | { | 41 | { |
42 | private static readonly log4net.ILog m_log | ||
43 | = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); | ||
44 | |||
42 | public override void RequestInventoryForUser(LLUUID userID, InventoryReceiptCallback callback) | 45 | public override void RequestInventoryForUser(LLUUID userID, InventoryReceiptCallback callback) |
43 | { | 46 | { |
47 | m_log.InfoFormat("[LOCAL INVENTORY SERVICE]: Requesting inventory for user {0}", userID); | ||
48 | |||
44 | List<InventoryFolderBase> skeletonFolders = GetInventorySkeleton(userID); | 49 | List<InventoryFolderBase> skeletonFolders = GetInventorySkeleton(userID); |
45 | InventoryFolderImpl rootFolder = null; | 50 | InventoryFolderImpl rootFolder = null; |
46 | 51 | ||
47 | ICollection<InventoryFolderImpl> folders = new List<InventoryFolderImpl>(); | 52 | List<InventoryFolderImpl> folders = new List<InventoryFolderImpl>(); |
48 | ICollection<InventoryItemBase> items = new List<InventoryItemBase>(); | 53 | List<InventoryItemBase> items = new List<InventoryItemBase>(); |
49 | 54 | ||
50 | // Need to retrieve the root folder on the first pass | 55 | // Need to retrieve the root folder on the first pass |
51 | foreach (InventoryFolderBase folder in skeletonFolders) | 56 | foreach (InventoryFolderBase folder in skeletonFolders) |
@@ -54,6 +59,7 @@ namespace OpenSim.Region.Communications.Local | |||
54 | { | 59 | { |
55 | rootFolder = new InventoryFolderImpl(folder); | 60 | rootFolder = new InventoryFolderImpl(folder); |
56 | folders.Add(rootFolder); | 61 | folders.Add(rootFolder); |
62 | items.AddRange(RequestFolderItems(rootFolder.ID)); | ||
57 | } | 63 | } |
58 | } | 64 | } |
59 | 65 | ||
@@ -64,6 +70,7 @@ namespace OpenSim.Region.Communications.Local | |||
64 | if (folder.ID != rootFolder.ID) | 70 | if (folder.ID != rootFolder.ID) |
65 | { | 71 | { |
66 | folders.Add(new InventoryFolderImpl(folder)); | 72 | folders.Add(new InventoryFolderImpl(folder)); |
73 | items.AddRange(RequestFolderItems(folder.ID)); | ||
67 | } | 74 | } |
68 | } | 75 | } |
69 | } | 76 | } |
diff --git a/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs b/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs index dc26ce2..8f293f9 100644 --- a/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs +++ b/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs | |||
@@ -38,7 +38,8 @@ namespace OpenSim.Region.Communications.OGS1 | |||
38 | { | 38 | { |
39 | public class OGS1InventoryService : IInventoryServices | 39 | public class OGS1InventoryService : IInventoryServices |
40 | { | 40 | { |
41 | private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); | 41 | private static readonly log4net.ILog m_log |
42 | = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); | ||
42 | 43 | ||
43 | private string _inventoryServerUrl; | 44 | private string _inventoryServerUrl; |
44 | private Dictionary<LLUUID, InventoryRequest> m_RequestingInventory = new Dictionary<LLUUID, InventoryRequest>(); | 45 | private Dictionary<LLUUID, InventoryRequest> m_RequestingInventory = new Dictionary<LLUUID, InventoryRequest>(); |