Revert "Merging in diva's locking fixes"

This reverts commit 832cc68513.
This commit is contained in:
Melanie
2009-10-07 01:44:36 +01:00
parent 312438f145
commit 9618c196c2
12 changed files with 180 additions and 215 deletions

View File

@@ -128,18 +128,24 @@ namespace OpenSim.Framework.Communications.Cache
/// <returns>null if no user details are found</returns>
public CachedUserInfo GetUserDetails(string fname, string lname)
{
CachedUserInfo userInfo;
lock (m_userProfilesByName)
{
{
CachedUserInfo userInfo;
if (m_userProfilesByName.TryGetValue(string.Format(NAME_FORMAT, fname, lname), out userInfo))
{
return userInfo;
}
else
{
UserProfileData userProfile = m_commsManager.UserService.GetUserProfile(fname, lname);
if (userProfile != null)
return AddToCaches(userProfile);
else
return null;
}
}
UserProfileData userProfile = m_commsManager.UserService.GetUserProfile(fname, lname);
if (userProfile != null)
return AddToCaches(userProfile);
else
return null;
}
/// <summary>
@@ -154,14 +160,20 @@ namespace OpenSim.Framework.Communications.Cache
return null;
lock (m_userProfilesById)
{
if (m_userProfilesById.ContainsKey(userID))
{
return m_userProfilesById[userID];
UserProfileData userProfile = m_commsManager.UserService.GetUserProfile(userID);
if (userProfile != null)
return AddToCaches(userProfile);
else
return null;
}
else
{
UserProfileData userProfile = m_commsManager.UserService.GetUserProfile(userID);
if (userProfile != null)
return AddToCaches(userProfile);
else
return null;
}
}
}
/// <summary>
@@ -199,10 +211,14 @@ namespace OpenSim.Framework.Communications.Cache
CachedUserInfo createdUserInfo = new CachedUserInfo(m_InventoryService, userProfile);
lock (m_userProfilesById)
{
m_userProfilesById[createdUserInfo.UserProfile.ID] = createdUserInfo;
lock (m_userProfilesByName)
m_userProfilesByName[createdUserInfo.UserProfile.Name] = createdUserInfo;
lock (m_userProfilesByName)
{
m_userProfilesByName[createdUserInfo.UserProfile.Name] = createdUserInfo;
}
}
return createdUserInfo;
}
@@ -214,25 +230,21 @@ namespace OpenSim.Framework.Communications.Cache
/// <returns>true if there was a profile to remove, false otherwise</returns>
protected bool RemoveFromCaches(UUID userId)
{
CachedUserInfo userInfo = null;
lock (m_userProfilesById)
{
if (m_userProfilesById.ContainsKey(userId))
{
userInfo = m_userProfilesById[userId];
CachedUserInfo userInfo = m_userProfilesById[userId];
m_userProfilesById.Remove(userId);
}
}
if (userInfo != null)
lock (m_userProfilesByName)
{
if (m_userProfilesByName.ContainsKey(userInfo.UserProfile.Name))
lock (m_userProfilesByName)
{
m_userProfilesByName.Remove(userInfo.UserProfile.Name);
return true;
}
return true;
}
}
return false;
}

View File

@@ -168,7 +168,7 @@ namespace OpenSim.Framework
public const bool DefaultUserServerHttpSSL = false;
public const uint DefaultMessageServerHttpPort = 8006;
public const bool DefaultMessageServerHttpSSL = false;
public const uint DefaultGridServerHttpPort = 8003;
public const uint DefaultInventoryServerHttpPort = 8003;
public const uint DefaultGridServerHttpPort = 8001;
public const uint DefaultInventoryServerHttpPort = 8004;
}
}

View File

@@ -56,15 +56,15 @@ namespace OpenSim.Framework
m_configMember.addConfigurationOption("default_inventory_server",
ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY,
"Default Inventory Server URI (this server's external name)",
"http://127.0.0.1:" + ConfigSettings.DefaultInventoryServerHttpPort, false);
"http://127.0.0.1:8004", false);
m_configMember.addConfigurationOption("default_user_server",
ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY,
"Default User Server URI",
"http://127.0.0.1:" + ConfigSettings.DefaultUserServerHttpPort, false);
"http://127.0.0.1:8002", false);
m_configMember.addConfigurationOption("default_asset_server",
ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY,
"Default Asset Server URI",
"http://127.0.0.1:" + ConfigSettings.DefaultAssetServerHttpPort, false);
"http://127.0.0.1:8003", false);
m_configMember.addConfigurationOption("database_provider", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
"DLL for database provider", "OpenSim.Data.MySQL.dll", false);
m_configMember.addConfigurationOption("database_connect", ConfigurationOption.ConfigurationTypes.TYPE_STRING,