diff options
author | Mike Mazur | 2008-08-12 06:21:02 +0000 |
---|---|---|
committer | Mike Mazur | 2008-08-12 06:21:02 +0000 |
commit | 8ea92c0669de17f4967540ecc1350860aa346f06 (patch) | |
tree | fb3502211612e8b34e1102ba39880a2fd77f2e5c /OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs | |
parent | Remove "static" from the AsyncCommand Manager to make it work properly (diff) | |
download | opensim-SC-8ea92c0669de17f4967540ecc1350860aa346f06.zip opensim-SC-8ea92c0669de17f4967540ecc1350860aa346f06.tar.gz opensim-SC-8ea92c0669de17f4967540ecc1350860aa346f06.tar.bz2 opensim-SC-8ea92c0669de17f4967540ecc1350860aa346f06.tar.xz |
Thanks, lulurun, for a patch that addresses inventory problems that occur
occasionally, but are fixed on restart (issue 1919).
This patch introduces the following changes:
1. when a user teleports out of Region A, remove that user's profile
from the Region A user profile cache
2. when a user crosses between regions out of Region A, remove that
user's profile from the Region A user profile cache
3. the user profile cache's session ID member can now be set (written),
and is updated each time a connection with a new avatar is established (ie: a
new avatar enters the region)
4. when a region server looks up a user profile and a cache miss
occurs, fetch the user profile from the user server first instead of
immediately returning null
Diffstat (limited to 'OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs')
-rw-r--r-- | OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs | 78 |
1 files changed, 24 insertions, 54 deletions
diff --git a/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs b/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs index c4a6b31..db58738 100644 --- a/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs +++ b/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs | |||
@@ -63,58 +63,10 @@ namespace OpenSim.Framework.Communications.Cache | |||
63 | /// A new user has moved into a region in this instance so retrieve their profile from the user service. | 63 | /// A new user has moved into a region in this instance so retrieve their profile from the user service. |
64 | /// </summary> | 64 | /// </summary> |
65 | /// <param name="userID"></param> | 65 | /// <param name="userID"></param> |
66 | public void AddNewUser(IClientAPI remoteClient) | ||
67 | { | ||
68 | m_log.DebugFormat("[USER CACHE]: Adding user profile for {0} {1}", remoteClient.Name, remoteClient.AgentId); | ||
69 | |||
70 | // Potential fix - Multithreading issue. | ||
71 | lock (m_userProfiles) | ||
72 | { | ||
73 | if (!m_userProfiles.ContainsKey(remoteClient.AgentId)) | ||
74 | { | ||
75 | UserProfileData userProfile = m_commsManager.UserService.GetUserProfile(remoteClient.AgentId); | ||
76 | CachedUserInfo userInfo = new CachedUserInfo(m_commsManager, userProfile, remoteClient.SessionId); | ||
77 | |||
78 | if (userInfo.UserProfile != null) | ||
79 | { | ||
80 | // The inventory for the user will be populated when they actually enter the scene | ||
81 | m_userProfiles.Add(remoteClient.AgentId, userInfo); | ||
82 | } | ||
83 | else | ||
84 | { | ||
85 | m_log.ErrorFormat("[USER CACHE]: User profile for user {0} not found.", remoteClient.AgentId); | ||
86 | } | ||
87 | } | ||
88 | } | ||
89 | } | ||
90 | |||
91 | /// <summary> | ||
92 | /// A new user has moved into a region in this instance so retrieve their profile from the user service. | ||
93 | /// </summary> | ||
94 | /// <param name="userID"></param> | ||
95 | public void AddNewUser(LLUUID userID) | 66 | public void AddNewUser(LLUUID userID) |
96 | { | 67 | { |
97 | m_log.DebugFormat("[USER CACHE]: Adding user profile for {0}", userID); | 68 | m_log.DebugFormat("[USER CACHE]: Adding user profile for {0}", userID); |
98 | 69 | GetUserDetails(userID); | |
99 | // Potential fix - Multithreading issue. | ||
100 | lock (m_userProfiles) | ||
101 | { | ||
102 | if (!m_userProfiles.ContainsKey(userID)) | ||
103 | { | ||
104 | UserProfileData userProfile = m_commsManager.UserService.GetUserProfile(userID); | ||
105 | CachedUserInfo userInfo = new CachedUserInfo(m_commsManager, userProfile); | ||
106 | |||
107 | if (userInfo.UserProfile != null) | ||
108 | { | ||
109 | // The inventory for the user will be populated when they actually enter the scene | ||
110 | m_userProfiles.Add(userID, userInfo); | ||
111 | } | ||
112 | else | ||
113 | { | ||
114 | m_log.ErrorFormat("[USER CACHE]: User profile for user {0} not found.", userID); | ||
115 | } | ||
116 | } | ||
117 | } | ||
118 | } | 70 | } |
119 | 71 | ||
120 | /// <summary> | 72 | /// <summary> |
@@ -176,10 +128,28 @@ namespace OpenSim.Framework.Communications.Cache | |||
176 | /// <returns>null if no user details are found</returns> | 128 | /// <returns>null if no user details are found</returns> |
177 | public CachedUserInfo GetUserDetails(LLUUID userID) | 129 | public CachedUserInfo GetUserDetails(LLUUID userID) |
178 | { | 130 | { |
179 | if (m_userProfiles.ContainsKey(userID)) | 131 | lock (m_userProfiles) |
180 | return m_userProfiles[userID]; | 132 | { |
181 | else | 133 | if (m_userProfiles.ContainsKey(userID)) |
182 | return null; | 134 | { |
135 | return m_userProfiles[userID]; | ||
136 | } | ||
137 | else | ||
138 | { | ||
139 | UserProfileData userprofile = m_commsManager.UserService.GetUserProfile(userID); | ||
140 | if (userprofile != null) | ||
141 | { | ||
142 | CachedUserInfo userinfo = new CachedUserInfo(m_commsManager, userprofile); | ||
143 | m_userProfiles.Add(userID, userinfo); | ||
144 | return userinfo; | ||
145 | } | ||
146 | else | ||
147 | { | ||
148 | m_log.ErrorFormat("[USER CACHE]: User profile for user {0} not found.", userID); | ||
149 | return null; | ||
150 | } | ||
151 | } | ||
152 | } | ||
183 | } | 153 | } |
184 | 154 | ||
185 | /// <summary> | 155 | /// <summary> |