take agentUpdate checks out of llUDPserver (disabling useless debug) and

do it only where its supposed to be done..
avinationmerge
UbitUmarov 2014-08-12 23:57:41 +01:00
parent f811efde85
commit 20b3cab5d1
2 changed files with 35 additions and 43 deletions

View File

@ -5819,55 +5819,63 @@ namespace OpenSim.Region.ClientStack.LindenUDP
return cameraSignificant; return cameraSignificant;
} }
private bool HandleAgentUpdate(IClientAPI sener, Packet packet) private bool HandleAgentUpdate(IClientAPI sender, Packet packet)
{ {
// We got here, which means that something in agent update was significant // We got here, which means that something in agent update was significant
AgentUpdatePacket agentUpdate = (AgentUpdatePacket)packet; AgentUpdatePacket agentUpdate = (AgentUpdatePacket)packet;
AgentUpdatePacket.AgentDataBlock x = agentUpdate.AgentData; AgentUpdatePacket.AgentDataBlock x = agentUpdate.AgentData;
if (x.AgentID != AgentId || x.SessionID != SessionId) if (x.AgentID != AgentId || x.SessionID != SessionId)
{
PacketPool.Instance.ReturnPacket(packet);
return false; return false;
}
TotalAgentUpdates++;
// Before we update the current m_thisAgentUpdateArgs, let's check this again
// to see what exactly changed
bool movement = CheckAgentMovementUpdateSignificance(x); bool movement = CheckAgentMovementUpdateSignificance(x);
bool camera = CheckAgentCameraUpdateSignificance(x); bool camera = CheckAgentCameraUpdateSignificance(x);
m_thisAgentUpdateArgs.AgentID = x.AgentID;
m_thisAgentUpdateArgs.BodyRotation = x.BodyRotation;
m_thisAgentUpdateArgs.CameraAtAxis = x.CameraAtAxis;
m_thisAgentUpdateArgs.CameraCenter = x.CameraCenter;
m_thisAgentUpdateArgs.CameraLeftAxis = x.CameraLeftAxis;
m_thisAgentUpdateArgs.CameraUpAxis = x.CameraUpAxis;
m_thisAgentUpdateArgs.ControlFlags = x.ControlFlags;
m_thisAgentUpdateArgs.Far = x.Far;
m_thisAgentUpdateArgs.Flags = x.Flags;
m_thisAgentUpdateArgs.HeadRotation = x.HeadRotation;
m_thisAgentUpdateArgs.SessionID = x.SessionID;
m_thisAgentUpdateArgs.State = x.State;
UpdateAgent handlerAgentUpdate = OnAgentUpdate;
UpdateAgent handlerPreAgentUpdate = OnPreAgentUpdate;
UpdateAgent handlerAgentCameraUpdate = OnAgentCameraUpdate;
// Was there a significant movement/state change? // Was there a significant movement/state change?
if (movement) if (movement)
{ {
m_thisAgentUpdateArgs.BodyRotation = x.BodyRotation;
m_thisAgentUpdateArgs.ControlFlags = x.ControlFlags;
m_thisAgentUpdateArgs.Far = x.Far;
m_thisAgentUpdateArgs.Flags = x.Flags;
m_thisAgentUpdateArgs.HeadRotation = x.HeadRotation;
m_thisAgentUpdateArgs.SessionID = x.SessionID;
m_thisAgentUpdateArgs.State = x.State;
UpdateAgent handlerAgentUpdate = OnAgentUpdate;
UpdateAgent handlerPreAgentUpdate = OnPreAgentUpdate;
if (handlerPreAgentUpdate != null) if (handlerPreAgentUpdate != null)
OnPreAgentUpdate(this, m_thisAgentUpdateArgs); OnPreAgentUpdate(this, m_thisAgentUpdateArgs);
if (handlerAgentUpdate != null) if (handlerAgentUpdate != null)
OnAgentUpdate(this, m_thisAgentUpdateArgs); OnAgentUpdate(this, m_thisAgentUpdateArgs);
handlerAgentUpdate = null;
handlerPreAgentUpdate = null;
} }
// Was there a significant camera(s) change? // Was there a significant camera(s) change?
if (camera) if (camera)
{
m_thisAgentUpdateArgs.CameraAtAxis = x.CameraAtAxis;
m_thisAgentUpdateArgs.CameraCenter = x.CameraCenter;
m_thisAgentUpdateArgs.CameraLeftAxis = x.CameraLeftAxis;
m_thisAgentUpdateArgs.CameraUpAxis = x.CameraUpAxis;
UpdateAgent handlerAgentCameraUpdate = OnAgentCameraUpdate;
if (handlerAgentCameraUpdate != null) if (handlerAgentCameraUpdate != null)
handlerAgentCameraUpdate(this, m_thisAgentUpdateArgs); handlerAgentCameraUpdate(this, m_thisAgentUpdateArgs);
handlerAgentUpdate = null; handlerAgentCameraUpdate = null;
handlerPreAgentUpdate = null; }
handlerAgentCameraUpdate = null;
PacketPool.Instance.ReturnPacket(packet); PacketPool.Instance.ReturnPacket(packet);

View File

@ -731,7 +731,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
"debug lludp status", "debug lludp status",
"Return status of LLUDP packet processing.", "Return status of LLUDP packet processing.",
HandleStatusCommand); HandleStatusCommand);
/* disabled
MainConsole.Instance.Commands.AddCommand( MainConsole.Instance.Commands.AddCommand(
"Debug", "Debug",
false, false,
@ -739,6 +739,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
"debug lludp toggle agentupdate", "debug lludp toggle agentupdate",
"Toggle whether agentupdate packets are processed or simply discarded.", "Toggle whether agentupdate packets are processed or simply discarded.",
HandleAgentUpdateCommand); HandleAgentUpdateCommand);
*/
} }
private void HandlePacketCommand(string module, string[] args) private void HandlePacketCommand(string module, string[] args)
@ -1553,24 +1554,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
LogPacketHeader(true, udpClient.CircuitCode, 0, packet.Type, (ushort)packet.Length); LogPacketHeader(true, udpClient.CircuitCode, 0, packet.Type, (ushort)packet.Length);
#endregion BinaryStats #endregion BinaryStats
if (packet.Type == PacketType.AgentUpdate) // AgentUpdate mess removed from here
{
if (m_discardAgentUpdates)
return;
((LLClientView)client).TotalAgentUpdates++;
AgentUpdatePacket agentUpdate = (AgentUpdatePacket)packet;
LLClientView llClient = client as LLClientView;
if (agentUpdate.AgentData.SessionID != client.SessionId
|| agentUpdate.AgentData.AgentID != client.AgentId
|| !(llClient == null || llClient.CheckAgentUpdateSignificance(agentUpdate.AgentData)) )
{
PacketPool.Instance.ReturnPacket(packet);
return;
}
}
#region Ping Check Handling #region Ping Check Handling