aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Communications
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Framework/Communications/Cache/CachedUserInfo.cs23
-rw-r--r--OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs78
2 files changed, 30 insertions, 71 deletions
diff --git a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs
index d85eda0..57f5e76 100644
--- a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs
+++ b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs
@@ -85,8 +85,12 @@ namespace OpenSim.Framework.Communications.Cache
85 /// </summary> 85 /// </summary>
86 private IDictionary<LLUUID, IList<InventoryFolderImpl>> pendingCategorizationFolders 86 private IDictionary<LLUUID, IList<InventoryFolderImpl>> pendingCategorizationFolders
87 = new Dictionary<LLUUID, IList<InventoryFolderImpl>>(); 87 = new Dictionary<LLUUID, IList<InventoryFolderImpl>>();
88 88
89 public LLUUID SessionID { get { return m_session_id; } } 89 public LLUUID SessionID
90 {
91 get { return m_session_id; }
92 set { m_session_id = value; }
93 }
90 private LLUUID m_session_id = LLUUID.Zero; 94 private LLUUID m_session_id = LLUUID.Zero;
91 95
92 /// <summary> 96 /// <summary>
@@ -101,21 +105,6 @@ namespace OpenSim.Framework.Communications.Cache
101 } 105 }
102 106
103 /// <summary> 107 /// <summary>
104 /// Constructor
105 /// </summary>
106 /// <param name="commsManager"></param>
107 /// <param name="userProfile"></param>
108 /// <param name="sessionId">
109 /// Session id of the user. This is used in subsequent security checks.
110 /// </param>
111 public CachedUserInfo(CommunicationsManager commsManager, UserProfileData userProfile, LLUUID sessionId)
112 {
113 m_commsManager = commsManager;
114 m_userProfile = userProfile;
115 m_session_id = sessionId;
116 }
117
118 /// <summary>
119 /// This allows a request to be added to be processed once we receive a user's inventory 108 /// This allows a request to be added to be processed once we receive a user's inventory
120 /// from the inventory service. If we already have the inventory, the request 109 /// from the inventory service. If we already have the inventory, the request
121 /// is executed immediately instead. 110 /// is executed immediately instead.
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>