Merge branch 'ubitworkmaster'
commit
b96f951a6a
|
@ -856,6 +856,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
|
|
||||||
public void MoveAgentIntoRegion(RegionInfo regInfo, Vector3 pos, Vector3 look)
|
public void MoveAgentIntoRegion(RegionInfo regInfo, Vector3 pos, Vector3 look)
|
||||||
{
|
{
|
||||||
|
m_thisAgentUpdateArgs.CameraAtAxis.X = float.MinValue;
|
||||||
|
m_thisAgentUpdateArgs.ControlFlags = uint.MaxValue;
|
||||||
|
|
||||||
AgentMovementCompletePacket mov = (AgentMovementCompletePacket)PacketPool.Instance.GetPacket(PacketType.AgentMovementComplete);
|
AgentMovementCompletePacket mov = (AgentMovementCompletePacket)PacketPool.Instance.GetPacket(PacketType.AgentMovementComplete);
|
||||||
mov.SimData.ChannelVersion = m_channelVersion;
|
mov.SimData.ChannelVersion = m_channelVersion;
|
||||||
mov.AgentData.SessionID = m_sessionId;
|
mov.AgentData.SessionID = m_sessionId;
|
||||||
|
@ -5734,7 +5737,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
#region Scene/Avatar
|
#region Scene/Avatar
|
||||||
|
|
||||||
// Threshold for body rotation to be a significant agent update
|
// Threshold for body rotation to be a significant agent update
|
||||||
private const float QDELTA = 0.000001f;
|
// use the abs of cos
|
||||||
|
private const float QDELTABody = 1.0f - 0.0001f;
|
||||||
|
private const float QDELTAHead = 1.0f - 0.0001f;
|
||||||
// Threshold for camera rotation to be a significant agent update
|
// Threshold for camera rotation to be a significant agent update
|
||||||
private const float VDELTA = 0.01f;
|
private const float VDELTA = 0.01f;
|
||||||
|
|
||||||
|
@ -5757,18 +5762,18 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
/// <param name='x'></param>
|
/// <param name='x'></param>
|
||||||
private bool CheckAgentMovementUpdateSignificance(AgentUpdatePacket.AgentDataBlock x)
|
private bool CheckAgentMovementUpdateSignificance(AgentUpdatePacket.AgentDataBlock x)
|
||||||
{
|
{
|
||||||
float qdelta1 = 1 - (float)Math.Pow(Quaternion.Dot(x.BodyRotation, m_thisAgentUpdateArgs.BodyRotation), 2);
|
float qdelta1 = Math.Abs(Quaternion.Dot(x.BodyRotation, m_thisAgentUpdateArgs.BodyRotation));
|
||||||
//qdelta2 = 1 - (float)Math.Pow(Quaternion.Dot(x.HeadRotation, m_thisAgentUpdateArgs.HeadRotation), 2);
|
//qdelta2 = Math.Abs(Quaternion.Dot(x.HeadRotation, m_thisAgentUpdateArgs.HeadRotation));
|
||||||
|
|
||||||
bool movementSignificant =
|
bool movementSignificant =
|
||||||
(qdelta1 > QDELTA) // significant if body rotation above threshold
|
(x.ControlFlags != m_thisAgentUpdateArgs.ControlFlags) // significant if control flags changed
|
||||||
// Ignoring head rotation altogether, because it's not being used for anything interesting up the stack
|
|
||||||
// || (qdelta2 > QDELTA * 10) // significant if head rotation above threshold
|
|
||||||
|| (x.ControlFlags != m_thisAgentUpdateArgs.ControlFlags) // significant if control flags changed
|
|
||||||
|| (x.ControlFlags != (byte)AgentManager.ControlFlags.NONE) // significant if user supplying any movement update commands
|
|| (x.ControlFlags != (byte)AgentManager.ControlFlags.NONE) // significant if user supplying any movement update commands
|
||||||
|| (x.Far != m_thisAgentUpdateArgs.Far) // significant if far distance changed
|
|
||||||
|| (x.Flags != m_thisAgentUpdateArgs.Flags) // significant if Flags changed
|
|| (x.Flags != m_thisAgentUpdateArgs.Flags) // significant if Flags changed
|
||||||
|| (x.State != m_thisAgentUpdateArgs.State) // significant if Stats changed
|
|| (x.State != m_thisAgentUpdateArgs.State) // significant if Stats changed
|
||||||
|
|| (qdelta1 < QDELTABody) // significant if body rotation above(below cos) threshold
|
||||||
|
// Ignoring head rotation altogether, because it's not being used for anything interesting up the stack
|
||||||
|
// || (qdelta2 < QDELTAHead) // significant if head rotation above(below cos) threshold
|
||||||
|
|| (x.Far != m_thisAgentUpdateArgs.Far) // significant if far distance changed
|
||||||
;
|
;
|
||||||
//if (movementSignificant)
|
//if (movementSignificant)
|
||||||
//{
|
//{
|
||||||
|
@ -5811,7 +5816,7 @@ 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
|
||||||
|
|
||||||
|
@ -5819,47 +5824,55 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
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);
|
||||||
}
|
|
||||||
// Was there a significant camera(s) change?
|
|
||||||
if (camera)
|
|
||||||
if (handlerAgentCameraUpdate != null)
|
|
||||||
handlerAgentCameraUpdate(this, m_thisAgentUpdateArgs);
|
|
||||||
|
|
||||||
handlerAgentUpdate = null;
|
handlerAgentUpdate = null;
|
||||||
handlerPreAgentUpdate = null;
|
handlerPreAgentUpdate = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Was there a significant camera(s) change?
|
||||||
|
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)
|
||||||
|
handlerAgentCameraUpdate(this, m_thisAgentUpdateArgs);
|
||||||
|
|
||||||
handlerAgentCameraUpdate = null;
|
handlerAgentCameraUpdate = null;
|
||||||
|
}
|
||||||
|
|
||||||
PacketPool.Instance.ReturnPacket(packet);
|
PacketPool.Instance.ReturnPacket(packet);
|
||||||
|
|
||||||
|
@ -6747,6 +6760,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
|
|
||||||
private bool HandleCompleteAgentMovement(IClientAPI sender, Packet Pack)
|
private bool HandleCompleteAgentMovement(IClientAPI sender, Packet Pack)
|
||||||
{
|
{
|
||||||
|
m_log.DebugFormat("[LLClientView] HandleCompleteAgentMovement");
|
||||||
|
|
||||||
Action<IClientAPI, bool> handlerCompleteMovementToRegion = OnCompleteMovementToRegion;
|
Action<IClientAPI, bool> handlerCompleteMovementToRegion = OnCompleteMovementToRegion;
|
||||||
if (handlerCompleteMovementToRegion != null)
|
if (handlerCompleteMovementToRegion != null)
|
||||||
{
|
{
|
||||||
|
|
|
@ -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)
|
||||||
|
@ -1421,6 +1422,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
else if (packet.Type == PacketType.CompleteAgentMovement)
|
else if (packet.Type == PacketType.CompleteAgentMovement)
|
||||||
{
|
{
|
||||||
// Send ack straight away to let the viewer know that we got it.
|
// Send ack straight away to let the viewer know that we got it.
|
||||||
|
@ -1434,6 +1436,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
// Determine which agent this packet came from
|
// Determine which agent this packet came from
|
||||||
|
@ -1553,24 +1556,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
|
||||||
|
|
||||||
|
@ -1611,11 +1597,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
incomingPacket = new IncomingPacket((LLClientView)client, packet);
|
incomingPacket = new IncomingPacket((LLClientView)client, packet);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (incomingPacket.Packet.Type == PacketType.AgentUpdate ||
|
// if (incomingPacket.Packet.Type == PacketType.AgentUpdate ||
|
||||||
incomingPacket.Packet.Type == PacketType.ChatFromViewer)
|
// incomingPacket.Packet.Type == PacketType.ChatFromViewer)
|
||||||
|
if (incomingPacket.Packet.Type == PacketType.ChatFromViewer)
|
||||||
packetInbox.EnqueueHigh(incomingPacket);
|
packetInbox.EnqueueHigh(incomingPacket);
|
||||||
else
|
else
|
||||||
packetInbox.EnqueueLow(incomingPacket);
|
packetInbox.EnqueueLow(incomingPacket);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#region BinaryStats
|
#region BinaryStats
|
||||||
|
@ -1732,7 +1720,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// DateTime startTime = DateTime.Now;
|
// DateTime startTime = DateTime.Now;
|
||||||
object[] array = (object[])o;
|
object[] array = (object[])o;
|
||||||
endPoint = (IPEndPoint)array[0];
|
endPoint = (IPEndPoint)array[0];
|
||||||
UseCircuitCodePacket uccp = (UseCircuitCodePacket)array[1];
|
UseCircuitCodePacket uccp = (UseCircuitCodePacket)array[1];
|
||||||
|
@ -1754,7 +1742,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
sessionInfo);
|
sessionInfo);
|
||||||
|
|
||||||
// Now we know we can handle more data
|
// Now we know we can handle more data
|
||||||
// Thread.Sleep(200);
|
Thread.Sleep(200);
|
||||||
|
|
||||||
// Obtain the pending queue and remove it from the cache
|
// Obtain the pending queue and remove it from the cache
|
||||||
Queue<UDPPacketBuffer> queue = null;
|
Queue<UDPPacketBuffer> queue = null;
|
||||||
|
@ -1765,6 +1753,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
{
|
{
|
||||||
m_log.DebugFormat("[LLUDPSERVER]: Client created but no pending queue present");
|
m_log.DebugFormat("[LLUDPSERVER]: Client created but no pending queue present");
|
||||||
return;
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
m_pendingCache.Remove(endPoint);
|
m_pendingCache.Remove(endPoint);
|
||||||
}
|
}
|
||||||
|
@ -1772,11 +1761,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
m_log.DebugFormat("[LLUDPSERVER]: Client created, processing pending queue, {0} entries", queue.Count);
|
m_log.DebugFormat("[LLUDPSERVER]: Client created, processing pending queue, {0} entries", queue.Count);
|
||||||
|
|
||||||
// Reinject queued packets
|
// Reinject queued packets
|
||||||
while(queue.Count > 0)
|
while (queue.Count > 0)
|
||||||
{
|
{
|
||||||
UDPPacketBuffer buf = queue.Dequeue();
|
UDPPacketBuffer buf = queue.Dequeue();
|
||||||
PacketReceived(buf);
|
PacketReceived(buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
queue = null;
|
queue = null;
|
||||||
|
|
||||||
// Send ack straight away to let the viewer know that the connection is active.
|
// Send ack straight away to let the viewer know that the connection is active.
|
||||||
|
@ -1803,7 +1793,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
lock (m_pendingCache)
|
lock (m_pendingCache)
|
||||||
m_pendingCache.Remove(endPoint);
|
m_pendingCache.Remove(endPoint);
|
||||||
}
|
}
|
||||||
|
|
||||||
// m_log.DebugFormat(
|
// m_log.DebugFormat(
|
||||||
// "[LLUDPSERVER]: Handling UseCircuitCode request from {0} took {1}ms",
|
// "[LLUDPSERVER]: Handling UseCircuitCode request from {0} took {1}ms",
|
||||||
// buffer.RemoteEndPoint, (DateTime.Now - startTime).Milliseconds);
|
// buffer.RemoteEndPoint, (DateTime.Now - startTime).Milliseconds);
|
||||||
|
@ -1820,7 +1809,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
e.StackTrace);
|
e.StackTrace);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
private void HandleCompleteMovementIntoRegion(object o)
|
private void HandleCompleteMovementIntoRegion(object o)
|
||||||
{
|
{
|
||||||
IPEndPoint endPoint = null;
|
IPEndPoint endPoint = null;
|
||||||
|
@ -1930,6 +1919,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
e.StackTrace);
|
e.StackTrace);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Send an ack immediately to the given endpoint.
|
/// Send an ack immediately to the given endpoint.
|
||||||
|
@ -2067,7 +2057,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
m_incomingPacketPool.ReturnObject(incomingPacket);
|
m_incomingPacketPool.ReturnObject(incomingPacket);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch(Exception ex)
|
||||||
{
|
{
|
||||||
m_log.Error("[LLUDPSERVER]: Error in the incoming packet handler loop: " + ex.Message, ex);
|
m_log.Error("[LLUDPSERVER]: Error in the incoming packet handler loop: " + ex.Message, ex);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue