* Stop locking the scene presences dictionary for the entire agent crossing part of the login sequence

* This may alleviate a little the freezing experienced by existing avatars when a new client logs in
* Race condition risks look minimal since one wouldn't expect another thread to start fiddling with that presence
0.6.1-post-fixes
Justin Clarke Casey 2008-11-12 18:12:18 +00:00
parent 4b5e09a36b
commit e2ab576572
2 changed files with 20 additions and 14 deletions

View File

@ -740,8 +740,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
{ {
//this.UploadAssets = new AgentAssetUpload(this, m_assetCache, m_inventoryCache); //this.UploadAssets = new AgentAssetUpload(this, m_assetCache, m_inventoryCache);
// Establish our two timers. We could probably get this down to one
// Ping the client regularly to check that it's still there // Ping the client regularly to check that it's still there
m_clientPingTimer = new Timer(5000); m_clientPingTimer = new Timer(5000);
m_clientPingTimer.Elapsed += CheckClientConnectivity; m_clientPingTimer.Elapsed += CheckClientConnectivity;

View File

@ -2863,7 +2863,7 @@ namespace OpenSim.Region.Environment.Scenes
} }
/// <summary> /// <summary>
/// /// Triggered when an agent crosses into this sim. Also happens on initial login.
/// </summary> /// </summary>
/// <param name="regionHandle"></param> /// <param name="regionHandle"></param>
/// <param name="agentID"></param> /// <param name="agentID"></param>
@ -2873,21 +2873,29 @@ namespace OpenSim.Region.Environment.Scenes
{ {
if (regionHandle == m_regInfo.RegionHandle) if (regionHandle == m_regInfo.RegionHandle)
{ {
ScenePresence presence;
lock (m_scenePresences) lock (m_scenePresences)
{ {
if (m_scenePresences.ContainsKey(agentID)) m_scenePresences.TryGetValue(agentID, out presence);
}
if (presence != null)
{ {
try try
{ {
m_scenePresences[agentID].MakeRootAgent(position, isFlying); presence.MakeRootAgent(position, isFlying);
} }
catch (Exception e) catch (Exception e)
{ {
m_log.Info("[SCENE]: Unable to do Agent Crossing."); m_log.ErrorFormat("[SCENE]: Unable to do agent crossing, exception {0}", e);
m_log.Debug("[SCENE]: " + e.ToString());
} }
//m_innerScene.SwapRootChildAgent(false);
} }
else
{
m_log.ErrorFormat(
"[SCENE]: Could not find presence for agent {0} crossing into scene {1}",
agentID, RegionInfo.RegionName);
} }
} }
} }