* Removed the unused m_agentUpdates collection and some extra work that was being done for AgentUpdate packets

* Start LLUDPClients unpaused (this variable is not being used yet)
prioritization
John Hurliman 2009-10-20 15:19:19 -07:00
parent d38f33736c
commit 1833c69568
2 changed files with 34 additions and 94 deletions

View File

@ -98,7 +98,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
/// <summary>True when this connection is alive, otherwise false</summary> /// <summary>True when this connection is alive, otherwise false</summary>
public bool IsConnected = true; public bool IsConnected = true;
/// <summary>True when this connection is paused, otherwise false</summary> /// <summary>True when this connection is paused, otherwise false</summary>
public bool IsPaused = true; public bool IsPaused;
/// <summary>Environment.TickCount when the last packet was received for this client</summary> /// <summary>Environment.TickCount when the last packet was received for this client</summary>
public int TickLastPacketReceived; public int TickLastPacketReceived;
/// <summary>Environment.TickCount of the last time the outgoing packet handler executed for this client</summary> /// <summary>Environment.TickCount of the last time the outgoing packet handler executed for this client</summary>

View File

@ -128,8 +128,6 @@ namespace OpenSim.Region.Framework.Scenes
private bool m_setAlwaysRun; private bool m_setAlwaysRun;
private bool m_updatesAllowed = true;
private List<AgentUpdateArgs> m_agentUpdates = new List<AgentUpdateArgs>();
private string m_movementAnimation = "DEFAULT"; private string m_movementAnimation = "DEFAULT";
private long m_animPersistUntil = 0; private long m_animPersistUntil = 0;
private bool m_allowFalling = false; private bool m_allowFalling = false;
@ -1090,34 +1088,6 @@ namespace OpenSim.Region.Framework.Scenes
} }
// These methods allow to queue up agent updates (like key presses)
// until all attachment scripts are running and the animations from
// AgentDataUpdate have been started. It is essential for combat
// devices, weapons and AOs that keypresses are not processed
// until scripts that are potentially interested in them are
// up and running and that animations a script knows to be running
// from before a crossing are running again
//
public void LockAgentUpdates()
{
m_updatesAllowed = false;
}
public void UnlockAgentUpdates()
{
lock (m_agentUpdates)
{
if (m_updatesAllowed == false)
{
foreach (AgentUpdateArgs a in m_agentUpdates)
RealHandleAgentUpdate(ControllingClient, a);
m_agentUpdates.Clear();
m_updatesAllowed = true;
}
}
}
/// <summary> /// <summary>
/// Callback for the Camera view block check. Gets called with the results of the camera view block test /// Callback for the Camera view block check. Gets called with the results of the camera view block test
/// hitYN is true when there's something in the way. /// hitYN is true when there's something in the way.
@ -1155,30 +1125,12 @@ namespace OpenSim.Region.Framework.Scenes
} }
} }
Array m_dirControlFlags = Enum.GetValues(typeof(Dir_ControlFlags));
/// <summary> /// <summary>
/// This is the event handler for client movement. If a client is moving, this event is triggering. /// This is the event handler for client movement. If a client is moving, this event is triggering.
/// </summary> /// </summary>
public void HandleAgentUpdate(IClientAPI remoteClient, AgentUpdateArgs agentData) public void HandleAgentUpdate(IClientAPI remoteClient, AgentUpdateArgs agentData)
{
const int AGENT_UPDATE_TIMEOUT_MS = 1000 * 3;
if (System.Threading.Monitor.TryEnter(m_agentUpdates, AGENT_UPDATE_TIMEOUT_MS))
{
try
{
if (m_updatesAllowed)
{
RealHandleAgentUpdate(remoteClient, agentData);
return;
}
m_agentUpdates.Add(agentData);
}
finally { System.Threading.Monitor.Exit(m_agentUpdates); }
}
}
private void RealHandleAgentUpdate(IClientAPI remoteClient, AgentUpdateArgs agentData)
{ {
//if (m_isChildAgent) //if (m_isChildAgent)
//{ //{
@ -1186,18 +1138,17 @@ namespace OpenSim.Region.Framework.Scenes
// return; // return;
//} //}
m_perfMonMS = Environment.TickCount;
m_movementUpdateCount++; ++m_movementUpdateCount;
if (m_movementUpdateCount >= int.MaxValue) if (m_movementUpdateCount < 1)
m_movementUpdateCount = 1; m_movementUpdateCount = 1;
// Must check for standing up even when PhysicsActor is null, // Must check for standing up even when PhysicsActor is null,
// since sitting currently removes avatar from physical scene // since sitting currently removes avatar from physical scene
//m_log.Debug("agentPos:" + AbsolutePosition.ToString()); //m_log.Debug("agentPos:" + AbsolutePosition.ToString());
// This is irritating. Really. // This is irritating. Really.
if (!AbsolutePosition.IsFinite()) if (!AbsolutePosition.IsFinite())
{ {
RemoveFromPhysicalScene(); RemoveFromPhysicalScene();
@ -1218,8 +1169,8 @@ namespace OpenSim.Region.Framework.Scenes
{ {
m_LastFinitePos = m_pos; m_LastFinitePos = m_pos;
} }
//m_physicsActor.AddForce(new PhysicsVector(999999999, 99999999, 999999999999999), true);
//m_physicsActor.AddForce(new PhysicsVector(999999999, 99999999, 999999999999999), true);
//ILandObject land = LandChannel.GetLandObject(agent.startpos.X, agent.startpos.Y); //ILandObject land = LandChannel.GetLandObject(agent.startpos.X, agent.startpos.Y);
//if (land != null) //if (land != null)
@ -1230,8 +1181,6 @@ namespace OpenSim.Region.Framework.Scenes
//} //}
//} //}
m_perfMonMS = Environment.TickCount;
uint flags = agentData.ControlFlags; uint flags = agentData.ControlFlags;
Quaternion bodyRotation = agentData.BodyRotation; Quaternion bodyRotation = agentData.BodyRotation;
@ -1253,7 +1202,7 @@ namespace OpenSim.Region.Framework.Scenes
// The Agent's Draw distance setting // The Agent's Draw distance setting
m_DrawDistance = agentData.Far; m_DrawDistance = agentData.Far;
if ((flags & (uint) AgentManager.ControlFlags.AGENT_CONTROL_STAND_UP) != 0) if ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_STAND_UP) != 0)
{ {
StandUp(); StandUp();
} }
@ -1268,7 +1217,6 @@ namespace OpenSim.Region.Framework.Scenes
// Raycast from the avatar's head to the camera to see if there's anything blocking the view // Raycast from the avatar's head to the camera to see if there's anything blocking the view
if ((m_movementUpdateCount % NumMovementsBetweenRayCast) == 0 && m_scene.PhysicsScene.SupportsRayCast()) if ((m_movementUpdateCount % NumMovementsBetweenRayCast) == 0 && m_scene.PhysicsScene.SupportsRayCast())
{ {
if (m_followCamAuto) if (m_followCamAuto)
{ {
Vector3 headadjustment = new Vector3(0, 0, 0.3f); Vector3 headadjustment = new Vector3(0, 0, 0.3f);
@ -1276,21 +1224,15 @@ namespace OpenSim.Region.Framework.Scenes
} }
} }
m_mouseLook = (flags & (uint) AgentManager.ControlFlags.AGENT_CONTROL_MOUSELOOK) != 0; m_mouseLook = (flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_MOUSELOOK) != 0;
m_leftButtonDown = (flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_LBUTTON_DOWN) != 0; m_leftButtonDown = (flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_LBUTTON_DOWN) != 0;
lock (scriptedcontrols) lock (scriptedcontrols)
{ {
if (scriptedcontrols.Count > 0) if (scriptedcontrols.Count > 0)
{ {
SendControlToScripts(flags); SendControlToScripts(flags);
flags = RemoveIgnoredControls(flags, IgnoredControls); flags = RemoveIgnoredControls(flags, IgnoredControls);
} }
} }
@ -1302,7 +1244,7 @@ namespace OpenSim.Region.Framework.Scenes
if (m_autopilotMoving) if (m_autopilotMoving)
CheckAtSitTarget(); CheckAtSitTarget();
if ((flags & (uint) AgentManager.ControlFlags.AGENT_CONTROL_SIT_ON_GROUND) != 0) if ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_SIT_ON_GROUND) != 0)
{ {
// TODO: This doesn't prevent the user from walking yet. // TODO: This doesn't prevent the user from walking yet.
// Setting parent ID would fix this, if we knew what value // Setting parent ID would fix this, if we knew what value
@ -1363,9 +1305,9 @@ namespace OpenSim.Region.Framework.Scenes
dirVectors = Dir_Vectors; dirVectors = Dir_Vectors;
foreach (Dir_ControlFlags DCF in Enum.GetValues(typeof (Dir_ControlFlags))) foreach (Dir_ControlFlags DCF in m_dirControlFlags)
{ {
if ((flags & (uint) DCF) != 0) if ((flags & (uint)DCF) != 0)
{ {
bResetMoveToPosition = true; bResetMoveToPosition = true;
DCFlagKeyPressed = true; DCFlagKeyPressed = true;
@ -1378,17 +1320,17 @@ namespace OpenSim.Region.Framework.Scenes
// Why did I get this? // Why did I get this?
} }
if ((m_movementflag & (uint) DCF) == 0) if ((m_movementflag & (uint)DCF) == 0)
{ {
m_movementflag += (byte) (uint) DCF; m_movementflag += (byte)(uint)DCF;
update_movementflag = true; update_movementflag = true;
} }
} }
else else
{ {
if ((m_movementflag & (uint) DCF) != 0) if ((m_movementflag & (uint)DCF) != 0)
{ {
m_movementflag -= (byte) (uint) DCF; m_movementflag -= (byte)(uint)DCF;
update_movementflag = true; update_movementflag = true;
} }
else else
@ -1479,10 +1421,8 @@ namespace OpenSim.Region.Framework.Scenes
} }
catch (Exception) catch (Exception)
{ {
//Avoid system crash, can be slower but... //Avoid system crash, can be slower but...
} }
} }
} }
} }
@ -1494,8 +1434,8 @@ namespace OpenSim.Region.Framework.Scenes
if (m_physicsActor != null && m_physicsActor.Flying && !m_forceFly) if (m_physicsActor != null && m_physicsActor.Flying && !m_forceFly)
{ {
// Are the landing controls requirements filled? // Are the landing controls requirements filled?
bool controlland = (((flags & (uint) AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG) != 0) || bool controlland = (((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG) != 0) ||
((flags & (uint) AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_UP_NEG) != 0)); ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_UP_NEG) != 0));
// Are the collision requirements fulfilled? // Are the collision requirements fulfilled?
bool colliding = (m_physicsActor.IsColliding == true); bool colliding = (m_physicsActor.IsColliding == true);
@ -1508,9 +1448,9 @@ namespace OpenSim.Region.Framework.Scenes
if (update_movementflag || (update_rotation && DCFlagKeyPressed)) if (update_movementflag || (update_rotation && DCFlagKeyPressed))
{ {
// m_log.DebugFormat("{0} {1}", update_movementflag, (update_rotation && DCFlagKeyPressed)); // m_log.DebugFormat("{0} {1}", update_movementflag, (update_rotation && DCFlagKeyPressed));
// m_log.DebugFormat( // m_log.DebugFormat(
// "In {0} adding velocity to {1} of {2}", m_scene.RegionInfo.RegionName, Name, agent_control_v3); // "In {0} adding velocity to {1} of {2}", m_scene.RegionInfo.RegionName, Name, agent_control_v3);
AddNewMovement(agent_control_v3, q); AddNewMovement(agent_control_v3, q);