Authenticate ChildAgentUpdate too.

cpu-performance
Diva Canto 2013-07-14 09:21:28 -07:00
parent f3b3e21dea
commit c61ff917ef
4 changed files with 32 additions and 18 deletions

View File

@ -171,9 +171,10 @@ namespace OpenSim.Framework
/// Soon to be decommissioned /// Soon to be decommissioned
/// </summary> /// </summary>
/// <param name="cAgent"></param> /// <param name="cAgent"></param>
public void CopyFrom(ChildAgentDataUpdate cAgent) public void CopyFrom(ChildAgentDataUpdate cAgent, UUID sid)
{ {
AgentID = new UUID(cAgent.AgentID); AgentID = new UUID(cAgent.AgentID);
SessionID = sid;
// next: ??? // next: ???
Size = new Vector3(); Size = new Vector3();

View File

@ -100,7 +100,7 @@ namespace OpenSim.Framework.Tests
cadu.AVHeight = Size1.Z; cadu.AVHeight = Size1.Z;
AgentPosition position2 = new AgentPosition(); AgentPosition position2 = new AgentPosition();
position2.CopyFrom(cadu); position2.CopyFrom(cadu, position1.SessionID);
Assert.IsTrue( Assert.IsTrue(
position2.AgentID == position1.AgentID position2.AgentID == position1.AgentID

View File

@ -4202,10 +4202,18 @@ namespace OpenSim.Region.Framework.Scenes
if (childAgentUpdate != null) if (childAgentUpdate != null)
{ {
childAgentUpdate.ChildAgentDataUpdate(cAgentData); if (cAgentData.SessionID == childAgentUpdate.ControllingClient.SessionId)
return true; {
childAgentUpdate.ChildAgentDataUpdate(cAgentData);
return true;
}
else
{
m_log.WarnFormat("[SCENE]: Attempt to update agent {0} with invalid session id {1}", childAgentUpdate.UUID, cAgentData.SessionID);
Console.WriteLine(String.Format("[SCENE]: Attempt to update agent {0} ({1}) with invalid session id {2}",
childAgentUpdate.UUID, childAgentUpdate.ControllingClient.SessionId, cAgentData.SessionID));
}
} }
return false; return false;
} }
@ -4221,20 +4229,24 @@ namespace OpenSim.Region.Framework.Scenes
ScenePresence childAgentUpdate = GetScenePresence(cAgentData.AgentID); ScenePresence childAgentUpdate = GetScenePresence(cAgentData.AgentID);
if (childAgentUpdate != null) if (childAgentUpdate != null)
{ {
// I can't imagine *yet* why we would get an update if the agent is a root agent.. if (childAgentUpdate.ControllingClient.SessionId == cAgentData.SessionID)
// however to avoid a race condition crossing borders..
if (childAgentUpdate.IsChildAgent)
{ {
uint rRegionX = (uint)(cAgentData.RegionHandle >> 40); // I can't imagine *yet* why we would get an update if the agent is a root agent..
uint rRegionY = (((uint)(cAgentData.RegionHandle)) >> 8); // however to avoid a race condition crossing borders..
uint tRegionX = RegionInfo.RegionLocX; if (childAgentUpdate.IsChildAgent)
uint tRegionY = RegionInfo.RegionLocY; {
//Send Data to ScenePresence uint rRegionX = (uint)(cAgentData.RegionHandle >> 40);
childAgentUpdate.ChildAgentDataUpdate(cAgentData, tRegionX, tRegionY, rRegionX, rRegionY); uint rRegionY = (((uint)(cAgentData.RegionHandle)) >> 8);
// Not Implemented: uint tRegionX = RegionInfo.RegionLocX;
//TODO: Do we need to pass the message on to one of our neighbors? uint tRegionY = RegionInfo.RegionLocY;
//Send Data to ScenePresence
childAgentUpdate.ChildAgentDataUpdate(cAgentData, tRegionX, tRegionY, rRegionX, rRegionY);
// Not Implemented:
//TODO: Do we need to pass the message on to one of our neighbors?
}
} }
else
m_log.WarnFormat("[SCENE]: Attempt at updating position of agent {0} with invalid session id {1}", childAgentUpdate.UUID, cAgentData.SessionID);
return true; return true;
} }

View File

@ -2927,7 +2927,7 @@ namespace OpenSim.Region.Framework.Scenes
cadu.Velocity = Velocity; cadu.Velocity = Velocity;
AgentPosition agentpos = new AgentPosition(); AgentPosition agentpos = new AgentPosition();
agentpos.CopyFrom(cadu); agentpos.CopyFrom(cadu, ControllingClient.SessionId);
// Let's get this out of the update loop // Let's get this out of the update loop
Util.FireAndForget(delegate { m_scene.SendOutChildAgentUpdates(agentpos, this); }); Util.FireAndForget(delegate { m_scene.SendOutChildAgentUpdates(agentpos, this); });
@ -3266,6 +3266,7 @@ namespace OpenSim.Region.Framework.Scenes
cAgent.AgentID = UUID; cAgent.AgentID = UUID;
cAgent.RegionID = Scene.RegionInfo.RegionID; cAgent.RegionID = Scene.RegionInfo.RegionID;
cAgent.SessionID = ControllingClient.SessionId;
cAgent.Position = AbsolutePosition; cAgent.Position = AbsolutePosition;
cAgent.Velocity = m_velocity; cAgent.Velocity = m_velocity;