mirror of
https://github.com/opensim/opensim.git
synced 2026-08-11 03:45:35 +08:00
* Rewrote the methods that build ObjectUpdate and ImprovedTerseObjectUpdate packets to fill in the data more accurately and avoid allocating memory that is immediately thrown away
* Changed the Send*Data structs in IClientAPI to use public readonly members instead of private members and getters * Made Parallel.ProcessorCount public * Started switching over packet building methods in LLClientView to use Util.StringToBytes[256/1024]() instead of Utils.StringToBytes() * More cleanup of the ScenePresences vs. ClientManager nightmare * ScenePresence.HandleAgentUpdate() will now time out and drop incoming AgentUpdate packets after three seconds. This fixes a deadlock on m_AgentUpdates that was blocking up the LLUDP server
This commit is contained in:
@@ -357,13 +357,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
get { return m_defaultScriptEngine; }
|
||||
}
|
||||
|
||||
// Reference to all of the agents in the scene (root and child)
|
||||
protected Dictionary<UUID, ScenePresence> m_scenePresences
|
||||
{
|
||||
get { return m_sceneGraph.ScenePresences; }
|
||||
set { m_sceneGraph.ScenePresences = value; }
|
||||
}
|
||||
|
||||
public EntityManager Entities
|
||||
{
|
||||
get { return m_sceneGraph.Entities; }
|
||||
@@ -1183,14 +1176,13 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
/// <param name="stats">Stats on the Simulator's performance</param>
|
||||
private void SendSimStatsPackets(SimStats stats)
|
||||
{
|
||||
List<ScenePresence> StatSendAgents = GetScenePresences();
|
||||
foreach (ScenePresence agent in StatSendAgents)
|
||||
{
|
||||
if (!agent.IsChildAgent)
|
||||
ForEachScenePresence(
|
||||
delegate(ScenePresence agent)
|
||||
{
|
||||
agent.ControllingClient.SendSimStats(stats);
|
||||
if (!agent.IsChildAgent)
|
||||
agent.ControllingClient.SendSimStats(stats);
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -3501,10 +3493,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
{
|
||||
ScenePresence presence;
|
||||
|
||||
lock (m_scenePresences)
|
||||
{
|
||||
m_scenePresences.TryGetValue(agentID, out presence);
|
||||
}
|
||||
lock (m_sceneGraph.ScenePresences)
|
||||
m_sceneGraph.ScenePresences.TryGetValue(agentID, out presence);
|
||||
|
||||
if (presence != null)
|
||||
{
|
||||
@@ -3714,12 +3704,9 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
public void RequestTeleportLocation(IClientAPI remoteClient, ulong regionHandle, Vector3 position,
|
||||
Vector3 lookAt, uint teleportFlags)
|
||||
{
|
||||
ScenePresence sp = null;
|
||||
lock (m_scenePresences)
|
||||
{
|
||||
if (m_scenePresences.ContainsKey(remoteClient.AgentId))
|
||||
sp = m_scenePresences[remoteClient.AgentId];
|
||||
}
|
||||
ScenePresence sp;
|
||||
lock (m_sceneGraph.ScenePresences)
|
||||
m_sceneGraph.ScenePresences.TryGetValue(remoteClient.AgentId, out sp);
|
||||
|
||||
if (sp != null)
|
||||
{
|
||||
@@ -4168,7 +4155,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
public void ForEachScenePresence(Action<ScenePresence> action)
|
||||
{
|
||||
// We don't want to try to send messages if there are no avatars.
|
||||
if (m_scenePresences != null)
|
||||
if (m_sceneGraph != null && m_sceneGraph.ScenePresences != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
@@ -3791,15 +3791,15 @@ if (m_shape != null) {
|
||||
if (ParentGroup.RootPart == this)
|
||||
lPos = AbsolutePosition;
|
||||
}
|
||||
|
||||
|
||||
// Causes this thread to dig into the Client Thread Data.
|
||||
// Remember your locking here!
|
||||
remoteClient.SendPrimTerseUpdate(new SendPrimitiveTerseData(m_regionHandle,
|
||||
(ushort)(m_parentGroup.GetTimeDilation() *
|
||||
(float)ushort.MaxValue), LocalId, lPos,
|
||||
RotationOffset, Velocity,
|
||||
RotationOffset, Velocity, Acceleration,
|
||||
RotationalVelocity, state, FromItemID,
|
||||
OwnerID, (int)AttachmentPoint, ParentGroup.GetUpdatePriority(remoteClient)));
|
||||
OwnerID, (int)AttachmentPoint, null, ParentGroup.GetUpdatePriority(remoteClient)));
|
||||
}
|
||||
|
||||
public void AddScriptLPS(int count)
|
||||
|
||||
@@ -1160,15 +1160,21 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
/// </summary>
|
||||
public void HandleAgentUpdate(IClientAPI remoteClient, AgentUpdateArgs agentData)
|
||||
{
|
||||
lock (m_agentUpdates)
|
||||
const int AGENT_UPDATE_TIMEOUT_MS = 1000 * 3;
|
||||
|
||||
if (System.Threading.Monitor.TryEnter(m_agentUpdates, AGENT_UPDATE_TIMEOUT_MS))
|
||||
{
|
||||
if (m_updatesAllowed)
|
||||
try
|
||||
{
|
||||
RealHandleAgentUpdate(remoteClient, agentData);
|
||||
return;
|
||||
if (m_updatesAllowed)
|
||||
{
|
||||
RealHandleAgentUpdate(remoteClient, agentData);
|
||||
return;
|
||||
}
|
||||
|
||||
m_agentUpdates.Add(agentData);
|
||||
}
|
||||
|
||||
m_agentUpdates.Add(agentData);
|
||||
finally { System.Threading.Monitor.Exit(m_agentUpdates); }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2471,7 +2477,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
pos.Z -= m_appearance.HipOffset;
|
||||
|
||||
remoteClient.SendAvatarTerseUpdate(new SendAvatarTerseData(m_regionHandle, (ushort)(m_scene.TimeDilation * ushort.MaxValue), LocalId,
|
||||
pos, m_velocity, m_rotation, m_uuid, GetUpdatePriority(remoteClient)));
|
||||
pos, m_velocity, Vector3.Zero, m_rotation, Vector4.Zero, m_uuid, null, GetUpdatePriority(remoteClient)));
|
||||
|
||||
m_scene.StatsReporter.AddAgentTime(Environment.TickCount - m_perfMonMS);
|
||||
m_scene.StatsReporter.AddAgentUpdates(1);
|
||||
@@ -3504,7 +3510,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
public void Close()
|
||||
{
|
||||
|
||||
lock (m_attachments)
|
||||
{
|
||||
// Delete attachments from scene
|
||||
@@ -3535,7 +3540,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
m_sceneViewer.Close();
|
||||
|
||||
RemoveFromPhysicalScene();
|
||||
GC.Collect();
|
||||
}
|
||||
|
||||
public ScenePresence()
|
||||
|
||||
Reference in New Issue
Block a user