Revert "Merging in diva's locking fixes"

This reverts commit 832cc68513.
prioritization
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,12 +128,16 @@ 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)
@ -141,6 +145,8 @@ namespace OpenSim.Framework.Communications.Cache
else
return null;
}
}
}
/// <summary>
/// Get details of the given user.
@ -154,15 +160,21 @@ namespace OpenSim.Framework.Communications.Cache
return null;
lock (m_userProfilesById)
{
if (m_userProfilesById.ContainsKey(userID))
{
return m_userProfilesById[userID];
}
else
{
UserProfileData userProfile = m_commsManager.UserService.GetUserProfile(userID);
if (userProfile != null)
return AddToCaches(userProfile);
else
return null;
}
}
}
/// <summary>
/// Update an existing profile
@ -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;
}
}
return createdUserInfo;
}
@ -214,22 +230,18 @@ 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))
{
m_userProfilesByName.Remove(userInfo.UserProfile.Name);
}
return true;
}
}

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,

View File

@ -3546,7 +3546,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
objectData.TextureAnim = textureanim;
}
bool doUpdate = false;
lock (m_primFullUpdates)
{
if (m_primFullUpdates.Count == 0)
@ -3555,11 +3554,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
m_primFullUpdates.Add(objectData);
if (m_primFullUpdates.Count >= m_primFullUpdatesPerPacket)
doUpdate = true;
}
if (doUpdate)
ProcessPrimFullUpdates(this, null);
}
}
void HandleQueueEmpty(ThrottleOutPacketType queue)
{
@ -3579,16 +3576,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
void ProcessPrimFullUpdates(object sender, ElapsedEventArgs e)
{
bool stopTimer = false;
lock (m_primFullUpdates)
{
if (m_primFullUpdates.Count == 0 && m_primFullUpdateTimer.Enabled)
stopTimer = true;
}
if (stopTimer)
{
lock (m_primFullUpdateTimer)
m_primFullUpdateTimer.Stop();
return;
}
@ -3611,8 +3605,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
byte[] zerobuffer = new byte[1024];
byte[] blockbuffer = new byte[1024];
lock (m_primFullUpdates)
{
for (count = 0 ; count < max ; count++)
{
int length = 0;
@ -3636,13 +3628,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
OutPacket(outPacket, ThrottleOutPacketType.Task);
if (m_primFullUpdates.Count == 0 && m_primFullUpdateTimer.Enabled)
stopTimer = true;
}
if (stopTimer)
lock (m_primFullUpdateTimer)
m_primFullUpdateTimer.Stop();
}
}
/// <summary>
///
@ -3660,7 +3649,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
CreatePrimImprovedBlock(localID, position, rotation,
velocity, rotationalvelocity, state);
bool doUpdate = false;
lock (m_primTerseUpdates)
{
if (m_primTerseUpdates.Count == 0)
@ -3669,21 +3657,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP
m_primTerseUpdates.Add(objectData);
if (m_primTerseUpdates.Count >= m_primTerseUpdatesPerPacket)
doUpdate = true;
}
if (doUpdate)
ProcessPrimTerseUpdates(this, null);
}
}
void ProcessPrimTerseUpdates(object sender, ElapsedEventArgs e)
{
bool stopTimer = false;
lock (m_primTerseUpdates)
{
if (m_primTerseUpdates.Count == 0)
stopTimer = true;
}
if (stopTimer)
{
lock (m_primTerseUpdateTimer)
m_primTerseUpdateTimer.Stop();
@ -3711,8 +3693,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
byte[] zerobuffer = new byte[1024];
byte[] blockbuffer = new byte[1024];
lock (m_primTerseUpdates)
{
for (count = 0 ; count < max ; count++)
{
int length = 0;
@ -3738,12 +3718,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
OutPacket(outPacket, ThrottleOutPacketType.Task);
if (m_primTerseUpdates.Count == 0)
stopTimer = true;
}
if (stopTimer)
lock (m_primTerseUpdateTimer)
m_primTerseUpdateTimer.Stop();
}
}
public void FlushPrimUpdates()
{

View File

@ -442,13 +442,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
private ScenePresence GetRootPresenceFromAgentID(UUID AgentID)
{
List<Scene> scenes = null;
lock (m_scenes)
scenes = new List<Scene>(m_scenes.Values);
ScenePresence returnAgent = null;
lock (m_scenes)
{
ScenePresence queryagent = null;
foreach (Scene scene in scenes)
foreach (Scene scene in m_scenes.Values)
{
queryagent = scene.GetScenePresence(AgentID);
if (queryagent != null)
@ -460,17 +458,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
}
}
}
}
return returnAgent;
}
private ScenePresence GetAnyPresenceFromAgentID(UUID AgentID)
{
List<Scene> scenes = null;
lock (m_scenes)
scenes = new List<Scene>(m_scenes.Values);
ScenePresence returnAgent = null;
lock (m_scenes)
{
ScenePresence queryagent = null;
foreach (Scene scene in m_scenes.Values)
{
@ -481,7 +477,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
break;
}
}
}
return returnAgent;
}

View File

@ -290,15 +290,14 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
// get the agent. This should work every time, as we just got a packet from it
ScenePresence agent = null;
List<Scene> scenes = null;
lock (m_Scenes)
scenes = new List<Scene>(m_Scenes);
foreach (Scene scene in scenes)
{
foreach (Scene scene in m_Scenes)
{
agent = scene.GetScenePresence(agentID);
if (agent != null) break;
}
}
// just to be paranoid...
if (agent == null)

View File

@ -111,11 +111,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
private Scene FindClientScene(UUID agentId)
{
List<Scene> scenes = null;
lock (m_Scenelist)
scenes = new List<Scene>(m_Scenelist);
foreach (Scene scene in scenes)
{
foreach (Scene scene in m_Scenelist)
{
ScenePresence presence = scene.GetScenePresence(agentId);
if (presence != null)
@ -124,6 +122,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
return scene;
}
}
}
return null;
}

View File

@ -198,11 +198,9 @@ namespace OpenSim.Region.CoreModules.Scripting.EmailModules
private SceneObjectPart findPrim(UUID objectID, out string ObjectRegionName)
{
List<Scene> scenes = null;
lock (m_Scenes)
scenes = new List<Scene>(m_Scenes.Values);
foreach (Scene s in scenes)
{
foreach (Scene s in m_Scenes.Values)
{
SceneObjectPart part = s.GetSceneObjectPart(objectID);
if (part != null)
@ -214,6 +212,7 @@ namespace OpenSim.Region.CoreModules.Scripting.EmailModules
return part;
}
}
}
ObjectRegionName = string.Empty;
return null;
}
@ -364,7 +363,6 @@ namespace OpenSim.Region.CoreModules.Scripting.EmailModules
public Email GetNextEmail(UUID objectID, string sender, string subject)
{
List<Email> queue = null;
List<UUID> removal = new List<UUID>();
lock (m_LastGetEmailCall)
{
@ -377,6 +375,7 @@ namespace OpenSim.Region.CoreModules.Scripting.EmailModules
// Hopefully this isn't too time consuming. If it is, we can always push it into a worker thread.
DateTime now = DateTime.Now;
List<UUID> removal = new List<UUID>();
foreach (UUID uuid in m_LastGetEmailCall.Keys)
{
if ((now - m_LastGetEmailCall[uuid]) > m_QueueTimeout)
@ -384,16 +383,16 @@ namespace OpenSim.Region.CoreModules.Scripting.EmailModules
removal.Add(uuid);
}
}
}
foreach (UUID remove in removal)
{
lock (m_LastGetEmailCall)
m_LastGetEmailCall.Remove(remove);
lock (m_MailQueues)
{
m_MailQueues.Remove(remove);
}
}
}
lock (m_MailQueues)
{

View File

@ -187,16 +187,14 @@ namespace OpenSim.Region.CoreModules.World.Land
LandData newData = data.Copy();
newData.LocalID = local_id;
ILandObject land = null;
lock (m_landList)
{
if (m_landList.ContainsKey(local_id))
{
m_landList[local_id].LandData = newData;
land = m_landList[local_id];
m_scene.EventManager.TriggerLandObjectUpdated((uint)local_id, m_landList[local_id]);
}
}
m_scene.EventManager.TriggerLandObjectUpdated((uint)local_id, land);
}
public bool AllowedForcefulBans
@ -506,7 +504,6 @@ namespace OpenSim.Region.CoreModules.World.Land
/// <param name="local_id">Land.localID of the peice of land to remove.</param>
public void removeLandObject(int local_id)
{
UUID id = UUID.Zero;
lock (m_landList)
{
for (int x = 0; x < 64; x++)
@ -523,10 +520,9 @@ namespace OpenSim.Region.CoreModules.World.Land
}
}
id = m_landList[local_id].LandData.GlobalID;
m_scene.EventManager.TriggerLandObjectRemoved(m_landList[local_id].LandData.GlobalID);
m_landList.Remove(local_id);
}
m_scene.EventManager.TriggerLandObjectRemoved(id);
}
private void performFinalLandJoin(ILandObject master, ILandObject slave)

View File

@ -122,13 +122,12 @@ namespace OpenSim.Region.Framework.Scenes
public bool InventoryDeQueueAndDelete()
{
DeleteToInventoryHolder x = null;
int left = 0;
try
{
lock (m_inventoryDeletes)
{
left = m_inventoryDeletes.Count;
int left = m_inventoryDeletes.Count;
if (left > 0)
{
x = m_inventoryDeletes.Dequeue();
@ -137,11 +136,7 @@ namespace OpenSim.Region.Framework.Scenes
m_inventoryDeletes.Enqueue(x);
return true;
}
}
}
if (left > 0)
{
m_log.DebugFormat(
"[SCENE]: Sending object to user's inventory, {0} item(s) remaining.", left);
@ -159,6 +154,7 @@ namespace OpenSim.Region.Framework.Scenes
return true;
}
}
}
catch (Exception e)
{
// We can't put the object group details in here since the root part may have disappeared (which is where these sit).

View File

@ -297,43 +297,33 @@ namespace OpenSim.Region.Framework.Scenes
sceneObject.AttachToScene(m_parentScene);
List<SceneObjectPart> parts = null;
bool found = false;
lock (sceneObject)
{
if (!Entities.ContainsKey(sceneObject.UUID))
{
found = true;
Entities.Add(sceneObject);
m_numPrim += sceneObject.Children.Count;
if (attachToBackup)
sceneObject.AttachToBackup();
parts = new List<SceneObjectPart>(sceneObject.Children.Values);
if (OnObjectCreate != null)
OnObjectCreate(sceneObject);
}
}
if (found)
{
lock (m_dictionary_lock)
{
SceneObjectGroupsByFullID[sceneObject.UUID] = sceneObject;
SceneObjectGroupsByLocalID[sceneObject.LocalId] = sceneObject;
foreach (SceneObjectPart part in parts)
foreach (SceneObjectPart part in sceneObject.Children.Values)
{
SceneObjectGroupsByFullID[part.UUID] = sceneObject;
SceneObjectGroupsByLocalID[part.LocalId] = sceneObject;
}
}
if (OnObjectCreate != null)
OnObjectCreate(sceneObject);
return true;
}
}
return false;
}

View File

@ -55,7 +55,7 @@ namespace OpenSim.Tests.Clients.GridClient
new PatternLayout("%date [%thread] %-5level %logger [%property{NDC}] - %message%newline");
log4net.Config.BasicConfigurator.Configure(consoleAppender);
string serverURI = "http://127.0.0.1:" + ConfigSettings.DefaultGridServerHttpPort;
string serverURI = "http://127.0.0.1:8001";
GridServicesConnector m_Connector = new GridServicesConnector(serverURI);
GridRegion r1 = CreateRegion("Test Region 1", 1000, 1000);