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: uriStringiar_mods
parent
29eb3b2eb5
commit
5b9fe4497d
|
@ -130,6 +130,8 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
|
|||
public void Close()
|
||||
{
|
||||
m_Scenes.Clear();
|
||||
|
||||
lock (m_UserCache)
|
||||
m_UserCache.Clear();
|
||||
}
|
||||
|
||||
|
@ -188,12 +190,15 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
|
|||
{
|
||||
string[] returnstring = new string[2];
|
||||
|
||||
lock (m_UserCache)
|
||||
{
|
||||
if (m_UserCache.ContainsKey(uuid))
|
||||
{
|
||||
returnstring[0] = m_UserCache[uuid].FirstName;
|
||||
returnstring[1] = m_UserCache[uuid].LastName;
|
||||
return returnstring;
|
||||
}
|
||||
}
|
||||
|
||||
UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(UUID.Zero, uuid);
|
||||
|
||||
|
@ -236,23 +241,36 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
|
|||
}
|
||||
|
||||
public string GetUserHomeURL(UUID userID)
|
||||
{
|
||||
lock (m_UserCache)
|
||||
{
|
||||
if (m_UserCache.ContainsKey(userID))
|
||||
return m_UserCache[userID].HomeURL;
|
||||
}
|
||||
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
public string GetUserServerURL(UUID userID, string serverType)
|
||||
{
|
||||
if (m_UserCache.ContainsKey(userID))
|
||||
lock (m_UserCache)
|
||||
m_UserCache.TryGetValue(userID, out userdata);
|
||||
|
||||
if (userdata != null)
|
||||
{
|
||||
UserData userdata = m_UserCache[userID];
|
||||
// m_log.DebugFormat("[USER MANAGEMENT MODULE]: Requested url type {0} for {1}", serverType, userID);
|
||||
|
||||
if (userdata.ServerURLs != null && userdata.ServerURLs.ContainsKey(serverType) && userdata.ServerURLs[serverType] != null)
|
||||
{
|
||||
return userdata.ServerURLs[serverType].ToString();
|
||||
}
|
||||
|
||||
if (userdata.HomeURL != string.Empty)
|
||||
{
|
||||
// m_log.DebugFormat(
|
||||
// "[USER MANAGEMENT MODULE]: Did not find url type {0} so requesting urls from {1} for {2}",
|
||||
// serverType, userdata.HomeURL, userID);
|
||||
|
||||
UserAgentServiceConnector uConn = new UserAgentServiceConnector(userdata.HomeURL);
|
||||
userdata.ServerURLs = uConn.GetServerURLs(userID);
|
||||
if (userdata.ServerURLs != null && userdata.ServerURLs.ContainsKey(serverType) && userdata.ServerURLs[serverType] != null)
|
||||
|
@ -269,9 +287,11 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
|
|||
if (account != null)
|
||||
return userID.ToString();
|
||||
|
||||
if (m_UserCache.ContainsKey(userID))
|
||||
lock (m_UserCache)
|
||||
m_UserCache.TryGetValue(userID, out ud);
|
||||
|
||||
if (ud != null)
|
||||
{
|
||||
UserData ud = m_UserCache[userID];
|
||||
string homeURL = ud.HomeURL;
|
||||
string first = ud.FirstName, last = ud.LastName;
|
||||
if (ud.LastName.StartsWith("@"))
|
||||
|
@ -290,9 +310,12 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
|
|||
}
|
||||
|
||||
public void AddUser(UUID uuid, string first, string last)
|
||||
{
|
||||
lock (m_UserCache)
|
||||
{
|
||||
if (m_UserCache.ContainsKey(uuid))
|
||||
return;
|
||||
}
|
||||
|
||||
UserData user = new UserData();
|
||||
user.Id = uuid;
|
||||
|
@ -309,9 +332,12 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
|
|||
}
|
||||
|
||||
public void AddUser(UUID id, string creatorData)
|
||||
{
|
||||
lock (m_UserCache)
|
||||
{
|
||||
if (m_UserCache.ContainsKey(id))
|
||||
return;
|
||||
}
|
||||
|
||||
// m_log.DebugFormat("[USER MANAGEMENT MODULE]: Adding user with id {0}, craetorData {1}", id, creatorData);
|
||||
|
||||
|
@ -401,6 +427,8 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
|
|||
#endregion IUserManagement
|
||||
|
||||
private void HandleShowUsers(string module, string[] cmd)
|
||||
{
|
||||
lock (m_UserCache)
|
||||
{
|
||||
if (m_UserCache.Count == 0)
|
||||
{
|
||||
|
@ -415,9 +443,9 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
|
|||
MainConsole.Instance.Output(String.Format("{0} {1} {2}",
|
||||
kvp.Key, kvp.Value.FirstName, kvp.Value.LastName));
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue