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
/// </summary>
/// <param name="cAgent"></param>
public void CopyFrom(ChildAgentDataUpdate cAgent)
public void CopyFrom(ChildAgentDataUpdate cAgent, UUID sid)
{
AgentID = new UUID(cAgent.AgentID);
SessionID = sid;
// next: ???
Size = new Vector3();

View File

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

View File

@ -4202,10 +4202,18 @@ namespace OpenSim.Region.Framework.Scenes
if (childAgentUpdate != null)
{
childAgentUpdate.ChildAgentDataUpdate(cAgentData);
return true;
if (cAgentData.SessionID == childAgentUpdate.ControllingClient.SessionId)
{
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;
}
@ -4221,20 +4229,24 @@ namespace OpenSim.Region.Framework.Scenes
ScenePresence childAgentUpdate = GetScenePresence(cAgentData.AgentID);
if (childAgentUpdate != null)
{
// I can't imagine *yet* why we would get an update if the agent is a root agent..
// however to avoid a race condition crossing borders..
if (childAgentUpdate.IsChildAgent)
if (childAgentUpdate.ControllingClient.SessionId == cAgentData.SessionID)
{
uint rRegionX = (uint)(cAgentData.RegionHandle >> 40);
uint rRegionY = (((uint)(cAgentData.RegionHandle)) >> 8);
uint tRegionX = RegionInfo.RegionLocX;
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?
// I can't imagine *yet* why we would get an update if the agent is a root agent..
// however to avoid a race condition crossing borders..
if (childAgentUpdate.IsChildAgent)
{
uint rRegionX = (uint)(cAgentData.RegionHandle >> 40);
uint rRegionY = (((uint)(cAgentData.RegionHandle)) >> 8);
uint tRegionX = RegionInfo.RegionLocX;
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;
}

View File

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