aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2011-11-15 23:12:41 +0000
committerJustin Clark-Casey (justincc)2011-11-15 23:12:41 +0000
commit5b9fe4497df2aef7411a81517525fc2d7456420d (patch)
tree8227d9edb0b856e943f08442c0c187b2cecae226 /OpenSim
parentimprove formatting of "show threads" (diff)
downloadopensim-SC_OLD-5b9fe4497df2aef7411a81517525fc2d7456420d.zip
opensim-SC_OLD-5b9fe4497df2aef7411a81517525fc2d7456420d.tar.gz
opensim-SC_OLD-5b9fe4497df2aef7411a81517525fc2d7456420d.tar.bz2
opensim-SC_OLD-5b9fe4497df2aef7411a81517525fc2d7456420d.tar.xz
Do proper locking of UserManagementModule.m_UserCache when getting.
This might help with [USER AGENT CONNECTOR]: new connector to () [USER AGENT CONNECTOR]: Unable to contact remote server for GetServerURLs [USER AGENT CONNECTOR]: Malformed Uri : Argument cannot be null. Parameter name: uriString
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs86
1 files changed, 57 insertions, 29 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs
index bef0d69..55279cc 100644
--- a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs
@@ -130,7 +130,9 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
130 public void Close() 130 public void Close()
131 { 131 {
132 m_Scenes.Clear(); 132 m_Scenes.Clear();
133 m_UserCache.Clear(); 133
134 lock (m_UserCache)
135 m_UserCache.Clear();
134 } 136 }
135 137
136 #endregion ISharedRegionModule 138 #endregion ISharedRegionModule
@@ -188,11 +190,14 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
188 { 190 {
189 string[] returnstring = new string[2]; 191 string[] returnstring = new string[2];
190 192
191 if (m_UserCache.ContainsKey(uuid)) 193 lock (m_UserCache)
192 { 194 {
193 returnstring[0] = m_UserCache[uuid].FirstName; 195 if (m_UserCache.ContainsKey(uuid))
194 returnstring[1] = m_UserCache[uuid].LastName; 196 {
195 return returnstring; 197 returnstring[0] = m_UserCache[uuid].FirstName;
198 returnstring[1] = m_UserCache[uuid].LastName;
199 return returnstring;
200 }
196 } 201 }
197 202
198 UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(UUID.Zero, uuid); 203 UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(UUID.Zero, uuid);
@@ -237,22 +242,35 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
237 242
238 public string GetUserHomeURL(UUID userID) 243 public string GetUserHomeURL(UUID userID)
239 { 244 {
240 if (m_UserCache.ContainsKey(userID)) 245 lock (m_UserCache)
241 return m_UserCache[userID].HomeURL; 246 {
247 if (m_UserCache.ContainsKey(userID))
248 return m_UserCache[userID].HomeURL;
249 }
242 250
243 return string.Empty; 251 return string.Empty;
244 } 252 }
245 253
246 public string GetUserServerURL(UUID userID, string serverType) 254 public string GetUserServerURL(UUID userID, string serverType)
247 { 255 {
248 if (m_UserCache.ContainsKey(userID)) 256 lock (m_UserCache)
257 m_UserCache.TryGetValue(userID, out userdata);
258
259 if (userdata != null)
249 { 260 {
250 UserData userdata = m_UserCache[userID]; 261// m_log.DebugFormat("[USER MANAGEMENT MODULE]: Requested url type {0} for {1}", serverType, userID);
262
251 if (userdata.ServerURLs != null && userdata.ServerURLs.ContainsKey(serverType) && userdata.ServerURLs[serverType] != null) 263 if (userdata.ServerURLs != null && userdata.ServerURLs.ContainsKey(serverType) && userdata.ServerURLs[serverType] != null)
264 {
252 return userdata.ServerURLs[serverType].ToString(); 265 return userdata.ServerURLs[serverType].ToString();
266 }
253 267
254 if (userdata.HomeURL != string.Empty) 268 if (userdata.HomeURL != string.Empty)
255 { 269 {
270// m_log.DebugFormat(
271// "[USER MANAGEMENT MODULE]: Did not find url type {0} so requesting urls from {1} for {2}",
272// serverType, userdata.HomeURL, userID);
273
256 UserAgentServiceConnector uConn = new UserAgentServiceConnector(userdata.HomeURL); 274 UserAgentServiceConnector uConn = new UserAgentServiceConnector(userdata.HomeURL);
257 userdata.ServerURLs = uConn.GetServerURLs(userID); 275 userdata.ServerURLs = uConn.GetServerURLs(userID);
258 if (userdata.ServerURLs != null && userdata.ServerURLs.ContainsKey(serverType) && userdata.ServerURLs[serverType] != null) 276 if (userdata.ServerURLs != null && userdata.ServerURLs.ContainsKey(serverType) && userdata.ServerURLs[serverType] != null)
@@ -269,9 +287,11 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
269 if (account != null) 287 if (account != null)
270 return userID.ToString(); 288 return userID.ToString();
271 289
272 if (m_UserCache.ContainsKey(userID)) 290 lock (m_UserCache)
291 m_UserCache.TryGetValue(userID, out ud);
292
293 if (ud != null)
273 { 294 {
274 UserData ud = m_UserCache[userID];
275 string homeURL = ud.HomeURL; 295 string homeURL = ud.HomeURL;
276 string first = ud.FirstName, last = ud.LastName; 296 string first = ud.FirstName, last = ud.LastName;
277 if (ud.LastName.StartsWith("@")) 297 if (ud.LastName.StartsWith("@"))
@@ -291,8 +311,11 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
291 311
292 public void AddUser(UUID uuid, string first, string last) 312 public void AddUser(UUID uuid, string first, string last)
293 { 313 {
294 if (m_UserCache.ContainsKey(uuid)) 314 lock (m_UserCache)
295 return; 315 {
316 if (m_UserCache.ContainsKey(uuid))
317 return;
318 }
296 319
297 UserData user = new UserData(); 320 UserData user = new UserData();
298 user.Id = uuid; 321 user.Id = uuid;
@@ -310,8 +333,11 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
310 333
311 public void AddUser(UUID id, string creatorData) 334 public void AddUser(UUID id, string creatorData)
312 { 335 {
313 if (m_UserCache.ContainsKey(id)) 336 lock (m_UserCache)
314 return; 337 {
338 if (m_UserCache.ContainsKey(id))
339 return;
340 }
315 341
316// m_log.DebugFormat("[USER MANAGEMENT MODULE]: Adding user with id {0}, craetorData {1}", id, creatorData); 342// m_log.DebugFormat("[USER MANAGEMENT MODULE]: Adding user with id {0}, craetorData {1}", id, creatorData);
317 343
@@ -402,22 +428,24 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
402 428
403 private void HandleShowUsers(string module, string[] cmd) 429 private void HandleShowUsers(string module, string[] cmd)
404 { 430 {
405 if (m_UserCache.Count == 0) 431 lock (m_UserCache)
406 { 432 {
407 MainConsole.Instance.Output("No users not found"); 433 if (m_UserCache.Count == 0)
434 {
435 MainConsole.Instance.Output("No users not found");
436 return;
437 }
438
439 MainConsole.Instance.Output("UUID User Name");
440 MainConsole.Instance.Output("-----------------------------------------------------------------------------");
441 foreach (KeyValuePair<UUID, UserData> kvp in m_UserCache)
442 {
443 MainConsole.Instance.Output(String.Format("{0} {1} {2}",
444 kvp.Key, kvp.Value.FirstName, kvp.Value.LastName));
445 }
446
408 return; 447 return;
409 } 448 }
410
411 MainConsole.Instance.Output("UUID User Name");
412 MainConsole.Instance.Output("-----------------------------------------------------------------------------");
413 foreach (KeyValuePair<UUID, UserData> kvp in m_UserCache)
414 {
415 MainConsole.Instance.Output(String.Format("{0} {1} {2}",
416 kvp.Key, kvp.Value.FirstName, kvp.Value.LastName));
417 }
418 return;
419 } 449 }
420
421
422 } 450 }
423} 451} \ No newline at end of file