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

@ -4201,11 +4201,19 @@ namespace OpenSim.Region.Framework.Scenes
ScenePresence childAgentUpdate = WaitGetScenePresence(cAgentData.AgentID);
if (childAgentUpdate != null)
{
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;
}
@ -4220,6 +4228,8 @@ namespace OpenSim.Region.Framework.Scenes
//m_log.Debug(" XXX Scene IncomingChildAgentDataUpdate POSITION in " + RegionInfo.RegionName);
ScenePresence childAgentUpdate = GetScenePresence(cAgentData.AgentID);
if (childAgentUpdate != null)
{
if (childAgentUpdate.ControllingClient.SessionId == cAgentData.SessionID)
{
// 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..
@ -4234,7 +4244,9 @@ namespace OpenSim.Region.Framework.Scenes
// 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;