Split agent updates into two messages: full update and position+camera update. They're both sent over HTTP PUT. The full update is sent on TPs, for now; later it will also be sent on region crossings.
parent
a7708413ee
commit
4144fd0eb2
|
@ -88,14 +88,28 @@ namespace OpenSim.Framework
|
|||
}
|
||||
}
|
||||
|
||||
public interface IAgentData
|
||||
{
|
||||
UUID AgentID { get; set; }
|
||||
|
||||
OSDMap PackUpdateMessage();
|
||||
void UnpackUpdateMessage(OSDMap map);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Replacement for ChildAgentDataUpdate. Used over RESTComms and LocalComms.
|
||||
/// </summary>
|
||||
public class AgentPosition
|
||||
public class AgentPosition : IAgentData
|
||||
{
|
||||
private UUID m_id;
|
||||
public UUID AgentID
|
||||
{
|
||||
get { return m_id; }
|
||||
set { m_id = value; }
|
||||
}
|
||||
|
||||
public ulong RegionHandle;
|
||||
public uint CircuitCode;
|
||||
public UUID AgentID;
|
||||
public UUID SessionID;
|
||||
|
||||
public float Far;
|
||||
|
@ -272,12 +286,16 @@ namespace OpenSim.Framework
|
|||
}
|
||||
}
|
||||
|
||||
public class AgentData
|
||||
public class AgentData : IAgentData
|
||||
{
|
||||
private UUID m_id;
|
||||
public UUID AgentID
|
||||
{
|
||||
get { return m_id; }
|
||||
set { m_id = value; }
|
||||
}
|
||||
public ulong RegionHandle;
|
||||
public uint CircuitCode;
|
||||
|
||||
public UUID AgentID;
|
||||
public UUID SessionID;
|
||||
|
||||
public Vector3 Position;
|
||||
|
|
|
@ -35,8 +35,38 @@ namespace OpenSim.Region.Environment.Interfaces
|
|||
|
||||
public interface IInterregionCommsOut
|
||||
{
|
||||
/// <summary>
|
||||
/// Full child agent update.
|
||||
/// </summary>
|
||||
/// <param name="regionHandle"></param>
|
||||
/// <param name="data"></param>
|
||||
/// <returns></returns>
|
||||
bool SendChildAgentUpdate(ulong regionHandle, AgentData data);
|
||||
|
||||
/// <summary>
|
||||
/// Short child agent update, mostly for position.
|
||||
/// </summary>
|
||||
/// <param name="regionHandle"></param>
|
||||
/// <param name="data"></param>
|
||||
/// <returns></returns>
|
||||
bool SendChildAgentUpdate(ulong regionHandle, AgentPosition data);
|
||||
|
||||
/// <summary>
|
||||
/// Message from receiving region to departing region, telling it got contacted by the client.
|
||||
/// When sent over REST, it invokes the opaque uri.
|
||||
/// </summary>
|
||||
/// <param name="regionHandle"></param>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="uri"></param>
|
||||
/// <returns></returns>
|
||||
bool SendReleaseAgent(ulong regionHandle, UUID id, string uri);
|
||||
|
||||
/// <summary>
|
||||
/// Close agent.
|
||||
/// </summary>
|
||||
/// <param name="regionHandle"></param>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
bool SendCloseAgent(ulong regionHandle, UUID id);
|
||||
}
|
||||
|
||||
|
|
|
@ -133,6 +133,21 @@ namespace OpenSim.Region.Environment.Modules.Communications.Local
|
|||
return false;
|
||||
}
|
||||
|
||||
public bool SendChildAgentUpdate(ulong regionHandle, AgentPosition cAgentData)
|
||||
{
|
||||
foreach (Scene s in m_sceneList)
|
||||
{
|
||||
if (s.RegionInfo.RegionHandle == regionHandle)
|
||||
{
|
||||
//m_log.Debug("[LOCAL COMMS]: Found region to send ChildAgentUpdate");
|
||||
s.IncomingChildAgentDataUpdate(cAgentData);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
//m_log.Debug("[LOCAL COMMS]: region not found for ChildAgentUpdate");
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool SendReleaseAgent(ulong regionHandle, UUID id, string uri)
|
||||
{
|
||||
//uint x, y;
|
||||
|
|
|
@ -146,6 +146,23 @@ namespace OpenSim.Region.Environment.Modules.Communications.REST
|
|||
|
||||
}
|
||||
|
||||
public bool SendChildAgentUpdate(ulong regionHandle, AgentPosition cAgentData)
|
||||
{
|
||||
// Try local first
|
||||
if (m_localBackend.SendChildAgentUpdate(regionHandle, cAgentData))
|
||||
return true;
|
||||
|
||||
// else do the remote thing
|
||||
RegionInfo regInfo = m_commsManager.GridService.RequestNeighbourInfo(regionHandle);
|
||||
if (regInfo != null)
|
||||
{
|
||||
return DoChildAgentUpdateCall(regInfo, cAgentData);
|
||||
}
|
||||
//else
|
||||
// m_log.Warn("[REST COMMS]: Region not found " + regionHandle);
|
||||
return false;
|
||||
|
||||
}
|
||||
public bool SendReleaseAgent(ulong regionHandle, UUID id, string uri)
|
||||
{
|
||||
// Try local first
|
||||
|
@ -180,7 +197,7 @@ namespace OpenSim.Region.Environment.Modules.Communications.REST
|
|||
// Internal functions for the above public interface
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
protected bool DoChildAgentUpdateCall(RegionInfo region, AgentData cAgentData)
|
||||
protected bool DoChildAgentUpdateCall(RegionInfo region, IAgentData cAgentData)
|
||||
{
|
||||
// Eventually, we want to use a caps url instead of the agentID
|
||||
string uri = "http://" + region.ExternalEndPoint.Address + ":" + region.HttpPort + "/agent/" + cAgentData.AgentID + "/";
|
||||
|
@ -436,6 +453,18 @@ namespace OpenSim.Region.Environment.Modules.Communications.REST
|
|||
if (args["destination_handle"] != null)
|
||||
UInt64.TryParse(args["destination_handle"].AsString(), out regionhandle);
|
||||
|
||||
string messageType;
|
||||
if (args["message_type"] != null)
|
||||
messageType = args["message_type"].AsString();
|
||||
else
|
||||
{
|
||||
m_log.Warn("[REST COMMS]: Agent Put Message Type not found. ");
|
||||
messageType = "AgentData";
|
||||
}
|
||||
|
||||
bool result = true;
|
||||
if ("AgentData".Equals(messageType))
|
||||
{
|
||||
AgentData agent = new AgentData();
|
||||
try
|
||||
{
|
||||
|
@ -447,9 +476,28 @@ namespace OpenSim.Region.Environment.Modules.Communications.REST
|
|||
return;
|
||||
}
|
||||
//agent.Dump();
|
||||
// This is one of the meanings of PUT agent
|
||||
result = m_localBackend.SendChildAgentUpdate(regionhandle, agent);
|
||||
|
||||
}
|
||||
else if ("AgentPosition".Equals(messageType))
|
||||
{
|
||||
AgentPosition agent = new AgentPosition();
|
||||
try
|
||||
{
|
||||
agent.UnpackUpdateMessage(args);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
m_log.InfoFormat("[REST COMMS]: exception on unpacking ChildAgentUpdate message {0}", ex.Message);
|
||||
return;
|
||||
}
|
||||
//agent.Dump();
|
||||
// This is one of the meanings of PUT agent
|
||||
result = m_localBackend.SendChildAgentUpdate(regionhandle, agent);
|
||||
|
||||
}
|
||||
|
||||
// This is the meaning of PUT agent
|
||||
bool result = m_localBackend.SendChildAgentUpdate(regionhandle, agent);
|
||||
|
||||
|
||||
responsedata["int_response_code"] = 200;
|
||||
|
|
|
@ -260,7 +260,7 @@ namespace OpenSim.Region.Environment.Scenes.Hypergrid
|
|||
// Let's send a full update of the agent. This is a synchronous call.
|
||||
AgentData agent = new AgentData();
|
||||
avatar.CopyTo(agent);
|
||||
agent.Position = new Vector3(-1, -1, -1); // this means ignore position info; UGH!!!!
|
||||
agent.Position = position;
|
||||
agent.CallbackURI = "http://" + m_regionInfo.ExternalHostName + ":" + m_regionInfo.HttpPort +
|
||||
"/agent/" + avatar.UUID.ToString() + "/" + avatar.Scene.RegionInfo.RegionHandle.ToString() + "/release/";
|
||||
|
||||
|
|
|
@ -2970,7 +2970,19 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
|
||||
public virtual bool IncomingChildAgentDataUpdate(AgentData cAgentData)
|
||||
{
|
||||
//Console.WriteLine(" XXX Scene IncomingChildAgentDataUpdate in " + RegionInfo.RegionName);
|
||||
//Console.WriteLine(" XXX Scene IncomingChildAgentDataUpdate FULL in " + RegionInfo.RegionName);
|
||||
ScenePresence childAgentUpdate = GetScenePresence(cAgentData.AgentID);
|
||||
if (childAgentUpdate != null)
|
||||
{
|
||||
childAgentUpdate.ChildAgentDataUpdate(cAgentData);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public virtual bool IncomingChildAgentDataUpdate(AgentPosition cAgentData)
|
||||
{
|
||||
//Console.WriteLine(" XXX Scene IncomingChildAgentDataUpdate POSITION in " + RegionInfo.RegionName);
|
||||
ScenePresence childAgentUpdate = GetScenePresence(cAgentData.AgentID);
|
||||
if (childAgentUpdate != null)
|
||||
{
|
||||
|
@ -3174,7 +3186,7 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
return m_sceneGridService.CrossToNeighbouringRegion(regionHandle, agentID, position, isFlying);
|
||||
}
|
||||
|
||||
public void SendOutChildAgentUpdates(AgentData cadu, ScenePresence presence)
|
||||
public void SendOutChildAgentUpdates(AgentPosition cadu, ScenePresence presence)
|
||||
{
|
||||
m_sceneGridService.SendChildAgentDataUpdate(cadu, presence);
|
||||
}
|
||||
|
|
|
@ -538,7 +538,7 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
//bool val = m_commsProvider.InterRegion.RegionUp(new SerializableRegionInfo(region));
|
||||
}
|
||||
|
||||
public delegate void SendChildAgentDataUpdateDelegate(AgentData cAgentData, ulong regionHandle);
|
||||
public delegate void SendChildAgentDataUpdateDelegate(AgentPosition cAgentData, ulong regionHandle);
|
||||
|
||||
/// <summary>
|
||||
/// This informs all neighboring regions about the settings of it's child agent.
|
||||
|
@ -547,7 +547,7 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
/// This contains information, such as, Draw Distance, Camera location, Current Position, Current throttle settings, etc.
|
||||
///
|
||||
/// </summary>
|
||||
private void SendChildAgentDataUpdateAsync(AgentData cAgentData, ulong regionHandle)
|
||||
private void SendChildAgentDataUpdateAsync(AgentPosition cAgentData, ulong regionHandle)
|
||||
{
|
||||
//m_log.Info("[INTERGRID]: Informing neighbors about my agent in " + m_regionInfo.RegionName);
|
||||
try
|
||||
|
@ -577,7 +577,7 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
icon.EndInvoke(iar);
|
||||
}
|
||||
|
||||
public void SendChildAgentDataUpdate(AgentData cAgentData, ScenePresence presence)
|
||||
public void SendChildAgentDataUpdate(AgentPosition cAgentData, ScenePresence presence)
|
||||
{
|
||||
// This assumes that we know what our neighbors are.
|
||||
try
|
||||
|
@ -847,7 +847,7 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
// Let's send a full update of the agent. This is a synchronous call.
|
||||
AgentData agent = new AgentData();
|
||||
avatar.CopyTo(agent);
|
||||
agent.Position = new Vector3(-1, -1, -1); // this means ignore position info; UGH!!!!
|
||||
agent.Position = position;
|
||||
agent.CallbackURI = "http://" + m_regionInfo.ExternalHostName + ":" + m_regionInfo.HttpPort +
|
||||
"/agent/" + avatar.UUID.ToString() + "/" + avatar.Scene.RegionInfo.RegionHandle.ToString() + "/release/";
|
||||
|
||||
|
|
|
@ -2338,10 +2338,10 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
cadu.throttles = ControllingClient.GetThrottlesPacked(multiplier);
|
||||
cadu.Velocity = new sLLVector3(Velocity);
|
||||
|
||||
AgentData agent = new AgentData();
|
||||
agent.CopyFrom(cadu);
|
||||
AgentPosition agentpos = new AgentPosition();
|
||||
agentpos.CopyFrom(cadu);
|
||||
|
||||
m_scene.SendOutChildAgentUpdates(agent, this);
|
||||
m_scene.SendOutChildAgentUpdates(agentpos, this);
|
||||
|
||||
m_LastChildAgentUpdatePosition.X = AbsolutePosition.X;
|
||||
m_LastChildAgentUpdatePosition.Y = AbsolutePosition.Y;
|
||||
|
@ -2583,17 +2583,27 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
}
|
||||
|
||||
#region Child Agent Updates
|
||||
|
||||
public void ChildAgentDataUpdate(AgentData cAgentData)
|
||||
{
|
||||
//Console.WriteLine(" >>> ChildAgentDataUpdate <<< " + Scene.RegionInfo.RegionName);
|
||||
if (!IsChildAgent)
|
||||
return;
|
||||
|
||||
CopyFrom(cAgentData);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This updates important decision making data about a child agent
|
||||
/// The main purpose is to figure out what objects to send to a child agent that's in a neighboring region
|
||||
/// </summary>
|
||||
public void ChildAgentDataUpdate(AgentData cAgentData, uint tRegionX, uint tRegionY, uint rRegionX, uint rRegionY)
|
||||
public void ChildAgentDataUpdate(AgentPosition cAgentData, uint tRegionX, uint tRegionY, uint rRegionX, uint rRegionY)
|
||||
{
|
||||
//
|
||||
if (!IsChildAgent)
|
||||
return;
|
||||
|
||||
//Console.WriteLine(" >>> ChildAgentDataUpdate <<< " + rRegionX + "-" + rRegionY);
|
||||
//Console.WriteLine(" >>> ChildAgentPositionUpdate <<< " + rRegionX + "-" + rRegionY);
|
||||
int shiftx = ((int)rRegionX - (int)tRegionX) * (int)Constants.RegionSize;
|
||||
int shifty = ((int)rRegionY - (int)tRegionY) * (int)Constants.RegionSize;
|
||||
|
||||
|
@ -2602,33 +2612,19 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
m_pos = new Vector3(cAgentData.Position.X + shiftx, cAgentData.Position.Y + shifty, cAgentData.Position.Z);
|
||||
|
||||
// It's hard to say here.. We can't really tell where the camera position is unless it's in world cordinates from the sending region
|
||||
if (cAgentData.Center!= new Vector3(-1, -1, -1)) // UGH!
|
||||
m_CameraCenter = cAgentData.Center;
|
||||
// new Vector3(cAgentData.cameraPosition.x, cAgentData.cameraPosition.y, cAgentData.cameraPosition.z);
|
||||
|
||||
|
||||
m_godlevel = cAgentData.GodLevel;
|
||||
if (cAgentData.Center != new Vector3(-1, -1, -1))
|
||||
m_avHeight = cAgentData.Size.Z;
|
||||
//SetHeight(cAgentData.AVHeight);
|
||||
|
||||
if ((cAgentData.Throttles != null) && cAgentData.Throttles.Length > 0)
|
||||
ControllingClient.SetChildAgentThrottle(cAgentData.Throttles);
|
||||
|
||||
// ugh!!!
|
||||
m_AgentControlFlags = cAgentData.ControlFlags;
|
||||
if (m_physicsActor != null)
|
||||
{
|
||||
m_physicsActor.Flying = ((m_AgentControlFlags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0);
|
||||
}
|
||||
|
||||
// Sends out the objects in the user's draw distance if m_sendTasksToChild is true.
|
||||
if (m_scene.m_seeIntoRegionFromNeighbor)
|
||||
m_pendingObjects = null;
|
||||
|
||||
m_callbackURI = cAgentData.CallbackURI;
|
||||
m_rootRegionHandle = Util.UIntsToLong(rRegionX * Constants.RegionSize, rRegionY * Constants.RegionSize);
|
||||
|
||||
//cAgentData.AVHeight;
|
||||
//cAgentData.regionHandle;
|
||||
//m_velocity = cAgentData.Velocity;
|
||||
|
@ -2638,13 +2634,17 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
{
|
||||
cAgent.AgentID = UUID;
|
||||
cAgent.RegionHandle = m_scene.RegionInfo.RegionHandle;
|
||||
cAgent.AlwaysRun = m_setAlwaysRun;
|
||||
cAgent.Size = new Vector3(0, 0, m_avHeight);
|
||||
|
||||
cAgent.Position = m_pos;
|
||||
cAgent.Velocity = m_velocity;
|
||||
cAgent.Center = m_CameraCenter;
|
||||
cAgent.Size = new Vector3(0, 0, m_avHeight);
|
||||
cAgent.AtAxis = m_CameraAtAxis;
|
||||
cAgent.LeftAxis = m_CameraLeftAxis;
|
||||
cAgent.UpAxis = m_CameraUpAxis;
|
||||
|
||||
cAgent.Far = m_DrawDistance;
|
||||
cAgent.GodLevel = (byte)m_godlevel;
|
||||
cAgent.Position = AbsolutePosition;
|
||||
cAgent.Velocity = Velocity;
|
||||
|
||||
// Throttles
|
||||
float multiplier = 1;
|
||||
int innacurateNeighbors = m_scene.GetInaccurateNeighborCount();
|
||||
|
@ -2659,15 +2659,64 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
//m_log.Info("[NeighborThrottle]: " + m_scene.GetInaccurateNeighborCount().ToString() + " - m: " + multiplier.ToString());
|
||||
cAgent.Throttles = ControllingClient.GetThrottlesPacked(multiplier);
|
||||
|
||||
cAgent.HeadRotation = m_headrotation;
|
||||
cAgent.BodyRotation = m_bodyRot;
|
||||
cAgent.ControlFlags = m_AgentControlFlags;
|
||||
if ((m_physicsActor != null) && (m_physicsActor.Flying))
|
||||
{
|
||||
m_AgentControlFlags |= (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY;
|
||||
cAgent.ControlFlags |= (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY;
|
||||
}
|
||||
cAgent.ControlFlags = m_AgentControlFlags;
|
||||
|
||||
|
||||
cAgent.GodLevel = (byte)m_godlevel;
|
||||
cAgent.AlwaysRun = m_setAlwaysRun;
|
||||
|
||||
//cAgent.AgentTextures = ???
|
||||
//cAgent.GroupID = ??
|
||||
// Groups???
|
||||
// Visual Params???
|
||||
|
||||
// Animations???
|
||||
|
||||
cAgent.VisualParams = m_appearance.VisualParams;
|
||||
}
|
||||
|
||||
public void CopyFrom(AgentData cAgent)
|
||||
{
|
||||
m_rootRegionHandle= cAgent.RegionHandle;
|
||||
m_callbackURI = cAgent.CallbackURI;
|
||||
|
||||
m_pos = cAgent.Position;
|
||||
m_velocity = cAgent.Velocity;
|
||||
m_CameraCenter = cAgent.Center;
|
||||
m_avHeight = cAgent.Size.Z;
|
||||
m_CameraAtAxis = cAgent.AtAxis;
|
||||
m_CameraLeftAxis = cAgent.LeftAxis;
|
||||
m_CameraUpAxis = cAgent.UpAxis;
|
||||
|
||||
m_DrawDistance = cAgent.Far;
|
||||
|
||||
if ((cAgent.Throttles != null) && cAgent.Throttles.Length > 0)
|
||||
ControllingClient.SetChildAgentThrottle(cAgent.Throttles);
|
||||
|
||||
m_headrotation = cAgent.HeadRotation;
|
||||
m_bodyRot = cAgent.BodyRotation;
|
||||
m_AgentControlFlags = cAgent.ControlFlags; // We need more flags!
|
||||
if (m_physicsActor != null)
|
||||
{
|
||||
m_physicsActor.Flying = ((m_AgentControlFlags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0);
|
||||
}
|
||||
|
||||
m_godlevel = cAgent.GodLevel;
|
||||
m_setAlwaysRun = cAgent.AlwaysRun;
|
||||
|
||||
//cAgent.AgentTextures = ???
|
||||
|
||||
//cAgent.GroupID = ??
|
||||
//Groups???
|
||||
|
||||
// Animations???
|
||||
|
||||
m_appearance.VisualParams = cAgent.VisualParams;
|
||||
}
|
||||
|
||||
#endregion Child Agent Updates
|
||||
|
|
Loading…
Reference in New Issue