Final part for implementing SendChildAgentDataUpdate with modules. This is the part that uses the modules in Scene and related classes. This commit breaks compatibility of sim-sim SendChildAgentUpdates with older versions of OpenSim.

0.6.2-post-fixes
diva 2008-12-29 22:22:05 +00:00
parent e12d2ec9dc
commit a3e2e03f7b
4 changed files with 65 additions and 32 deletions

View File

@ -149,6 +149,8 @@ namespace OpenSim.Region.Environment.Scenes
protected IAvatarFactory m_AvatarFactory; protected IAvatarFactory m_AvatarFactory;
protected IConfigSource m_config; protected IConfigSource m_config;
protected IRegionSerialiserModule m_serialiser; protected IRegionSerialiserModule m_serialiser;
protected IInterregionCommsOut m_interregionCommsOut;
protected IInterregionCommsIn m_interregionCommsIn;
// Central Update Loop // Central Update Loop
@ -757,6 +759,8 @@ namespace OpenSim.Region.Environment.Scenes
XferManager = RequestModuleInterface<IXfer>(); XferManager = RequestModuleInterface<IXfer>();
m_AvatarFactory = RequestModuleInterface<IAvatarFactory>(); m_AvatarFactory = RequestModuleInterface<IAvatarFactory>();
m_serialiser = RequestModuleInterface<IRegionSerialiserModule>(); m_serialiser = RequestModuleInterface<IRegionSerialiserModule>();
m_interregionCommsOut = RequestModuleInterface<IInterregionCommsOut>();
m_interregionCommsIn = RequestModuleInterface<IInterregionCommsIn>();
} }
#endregion #endregion
@ -896,10 +900,10 @@ namespace OpenSim.Region.Environment.Scenes
{ {
m_log.Error("[Scene]: Failed with exception " + e.ToString() + " On Region: " + RegionInfo.RegionName); m_log.Error("[Scene]: Failed with exception " + e.ToString() + " On Region: " + RegionInfo.RegionName);
} }
catch (NullReferenceException e) //catch (NullReferenceException e)
{ //{
m_log.Error("[Scene]: Failed with exception " + e.ToString() + " On Region: " + RegionInfo.RegionName); // m_log.Error("[Scene]: Failed with exception " + e.ToString() + " On Region: " + RegionInfo.RegionName);
} //}
catch (InvalidOperationException e) catch (InvalidOperationException e)
{ {
m_log.Error("[Scene]: Failed with exception " + e.ToString() + " On Region: " + RegionInfo.RegionName); m_log.Error("[Scene]: Failed with exception " + e.ToString() + " On Region: " + RegionInfo.RegionName);
@ -1145,7 +1149,7 @@ namespace OpenSim.Region.Environment.Scenes
RegisterCommsEvents(); RegisterCommsEvents();
// These two 'commands' *must be* next to each other or sim rebooting fails. // These two 'commands' *must be* next to each other or sim rebooting fails.
m_sceneGridService.RegisterRegion(RegionInfo); m_sceneGridService.RegisterRegion(m_interregionCommsOut, RegionInfo);
m_sceneGridService.InformNeighborsThatRegionisUp(RegionInfo); m_sceneGridService.InformNeighborsThatRegionisUp(RegionInfo);
Dictionary<string, string> dGridSettings = m_sceneGridService.GetGridSettings(); Dictionary<string, string> dGridSettings = m_sceneGridService.GetGridSettings();
@ -2690,12 +2694,21 @@ namespace OpenSim.Region.Environment.Scenes
m_sceneGridService.OnAvatarCrossingIntoRegion += AgentCrossing; m_sceneGridService.OnAvatarCrossingIntoRegion += AgentCrossing;
m_sceneGridService.OnCloseAgentConnection += CloseConnection; m_sceneGridService.OnCloseAgentConnection += CloseConnection;
m_sceneGridService.OnRegionUp += OtherRegionUp; m_sceneGridService.OnRegionUp += OtherRegionUp;
m_sceneGridService.OnChildAgentUpdate += IncomingChildAgentDataUpdate; //m_sceneGridService.OnChildAgentUpdate += IncomingChildAgentDataUpdate;
m_sceneGridService.OnExpectPrim += IncomingInterRegionPrimGroup; m_sceneGridService.OnExpectPrim += IncomingInterRegionPrimGroup;
//m_sceneGridService.OnRemoveKnownRegionFromAvatar += HandleRemoveKnownRegionsFromAvatar; //m_sceneGridService.OnRemoveKnownRegionFromAvatar += HandleRemoveKnownRegionsFromAvatar;
m_sceneGridService.OnLogOffUser += HandleLogOffUserFromGrid; m_sceneGridService.OnLogOffUser += HandleLogOffUserFromGrid;
m_sceneGridService.KiPrimitive += SendKillObject; m_sceneGridService.KiPrimitive += SendKillObject;
m_sceneGridService.OnGetLandData += GetLandData; m_sceneGridService.OnGetLandData += GetLandData;
if (m_interregionCommsIn != null)
{
m_log.Debug("[SCENE]: Registering with InterregionCommsIn");
m_interregionCommsIn.OnChildAgentUpdate += IncomingChildAgentDataUpdate;
}
else
m_log.Debug("[SCENE]: Unable to register with InterregionCommsIn");
} }
/// <summary> /// <summary>
@ -2707,13 +2720,16 @@ namespace OpenSim.Region.Environment.Scenes
m_sceneGridService.OnLogOffUser -= HandleLogOffUserFromGrid; m_sceneGridService.OnLogOffUser -= HandleLogOffUserFromGrid;
//m_sceneGridService.OnRemoveKnownRegionFromAvatar -= HandleRemoveKnownRegionsFromAvatar; //m_sceneGridService.OnRemoveKnownRegionFromAvatar -= HandleRemoveKnownRegionsFromAvatar;
m_sceneGridService.OnExpectPrim -= IncomingInterRegionPrimGroup; m_sceneGridService.OnExpectPrim -= IncomingInterRegionPrimGroup;
m_sceneGridService.OnChildAgentUpdate -= IncomingChildAgentDataUpdate; //m_sceneGridService.OnChildAgentUpdate -= IncomingChildAgentDataUpdate;
m_sceneGridService.OnRegionUp -= OtherRegionUp; m_sceneGridService.OnRegionUp -= OtherRegionUp;
m_sceneGridService.OnExpectUser -= NewUserConnection; m_sceneGridService.OnExpectUser -= NewUserConnection;
m_sceneGridService.OnAvatarCrossingIntoRegion -= AgentCrossing; m_sceneGridService.OnAvatarCrossingIntoRegion -= AgentCrossing;
m_sceneGridService.OnCloseAgentConnection -= CloseConnection; m_sceneGridService.OnCloseAgentConnection -= CloseConnection;
m_sceneGridService.OnGetLandData -= GetLandData; m_sceneGridService.OnGetLandData -= GetLandData;
if (m_interregionCommsIn != null)
m_interregionCommsIn.OnChildAgentUpdate -= IncomingChildAgentDataUpdate;
m_sceneGridService.Close(); m_sceneGridService.Close();
} }
@ -2937,17 +2953,18 @@ namespace OpenSim.Region.Environment.Scenes
} }
} }
public virtual bool IncomingChildAgentDataUpdate(ChildAgentDataUpdate cAgentData) public virtual bool IncomingChildAgentDataUpdate(AgentData cAgentData)
{ {
ScenePresence childAgentUpdate = GetScenePresence(new UUID(cAgentData.AgentID)); //Console.WriteLine(" XXX Scene IncomingChildAgentDataUpdate in " + RegionInfo.RegionName);
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.. // 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.. // however to avoid a race condition crossing borders..
if (childAgentUpdate.IsChildAgent) if (childAgentUpdate.IsChildAgent)
{ {
uint rRegionX = (uint)(cAgentData.regionHandle >> 40); uint rRegionX = (uint)(cAgentData.RegionHandle >> 40);
uint rRegionY = (((uint)(cAgentData.regionHandle)) >> 8); uint rRegionY = (((uint)(cAgentData.RegionHandle)) >> 8);
uint tRegionX = RegionInfo.RegionLocX; uint tRegionX = RegionInfo.RegionLocX;
uint tRegionY = RegionInfo.RegionLocY; uint tRegionY = RegionInfo.RegionLocY;
//Send Data to ScenePresence //Send Data to ScenePresence
@ -3131,7 +3148,7 @@ namespace OpenSim.Region.Environment.Scenes
return m_sceneGridService.CrossToNeighbouringRegion(regionHandle, agentID, position, isFlying); return m_sceneGridService.CrossToNeighbouringRegion(regionHandle, agentID, position, isFlying);
} }
public void SendOutChildAgentUpdates(ChildAgentDataUpdate cadu, ScenePresence presence) public void SendOutChildAgentUpdates(AgentData cadu, ScenePresence presence)
{ {
m_sceneGridService.SendChildAgentDataUpdate(cadu, presence); m_sceneGridService.SendChildAgentDataUpdate(cadu, presence);
} }

View File

@ -33,6 +33,7 @@ using System.Threading;
using OpenMetaverse; using OpenMetaverse;
using OpenMetaverse.StructuredData; using OpenMetaverse.StructuredData;
using log4net; using log4net;
using OpenSim.Region.Environment.Interfaces;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Framework.Communications; using OpenSim.Framework.Communications;
using OpenSim.Region.Interfaces; using OpenSim.Region.Interfaces;
@ -49,6 +50,7 @@ namespace OpenSim.Region.Environment.Scenes
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
protected CommunicationsManager m_commsProvider; protected CommunicationsManager m_commsProvider;
protected IInterregionCommsOut m_interregionCommsOut;
protected RegionInfo m_regionInfo; protected RegionInfo m_regionInfo;
protected RegionCommsListener regionCommsHost; protected RegionCommsListener regionCommsHost;
@ -87,8 +89,10 @@ namespace OpenSim.Region.Environment.Scenes
/// </summary> /// </summary>
/// <param name="regionInfos"></param> /// <param name="regionInfos"></param>
/// <exception cref="System.Exception">Thrown if region registration fails.</exception> /// <exception cref="System.Exception">Thrown if region registration fails.</exception>
public void RegisterRegion(RegionInfo regionInfos) public void RegisterRegion(IInterregionCommsOut comms_out, RegionInfo regionInfos)
{ {
m_interregionCommsOut = comms_out;
m_regionInfo = regionInfos; m_regionInfo = regionInfos;
m_commsProvider.GridService.gdebugRegionName = regionInfos.RegionName; m_commsProvider.GridService.gdebugRegionName = regionInfos.RegionName;
m_commsProvider.InterRegion.rdebugRegionName = regionInfos.RegionName; m_commsProvider.InterRegion.rdebugRegionName = regionInfos.RegionName;
@ -531,7 +535,7 @@ namespace OpenSim.Region.Environment.Scenes
//bool val = m_commsProvider.InterRegion.RegionUp(new SerializableRegionInfo(region)); //bool val = m_commsProvider.InterRegion.RegionUp(new SerializableRegionInfo(region));
} }
public delegate void SendChildAgentDataUpdateDelegate(ChildAgentDataUpdate cAgentData, ulong regionHandle); public delegate void SendChildAgentDataUpdateDelegate(AgentData cAgentData, ulong regionHandle);
/// <summary> /// <summary>
/// This informs all neighboring regions about the settings of it's child agent. /// This informs all neighboring regions about the settings of it's child agent.
@ -540,13 +544,14 @@ namespace OpenSim.Region.Environment.Scenes
/// This contains information, such as, Draw Distance, Camera location, Current Position, Current throttle settings, etc. /// This contains information, such as, Draw Distance, Camera location, Current Position, Current throttle settings, etc.
/// ///
/// </summary> /// </summary>
private void SendChildAgentDataUpdateAsync(ChildAgentDataUpdate cAgentData, ulong regionHandle) private void SendChildAgentDataUpdateAsync(AgentData cAgentData, ulong regionHandle)
{ {
//m_log.Info("[INTERGRID]: Informing neighbors about my agent in " + presence.Scene.RegionInfo.RegionName); m_log.Info("[INTERGRID]: Informing neighbors about my agent in " + m_regionInfo.RegionName);
//bool regionAccepted = m_commsProvider.InterRegion.ChildAgentUpdate(regionHandle, cAgentData); //bool regionAccepted = m_commsProvider.InterRegion.ChildAgentUpdate(regionHandle, cAgentData);
try try
{ {
m_commsProvider.InterRegion.ChildAgentUpdate(regionHandle, cAgentData); //m_commsProvider.InterRegion.ChildAgentUpdate(regionHandle, cAgentData);
m_interregionCommsOut.SendChildAgentUpdate(regionHandle, cAgentData);
} }
catch catch
{ {
@ -570,18 +575,20 @@ namespace OpenSim.Region.Environment.Scenes
icon.EndInvoke(iar); icon.EndInvoke(iar);
} }
public void SendChildAgentDataUpdate(ChildAgentDataUpdate cAgentData, ScenePresence presence) public void SendChildAgentDataUpdate(AgentData cAgentData, ScenePresence presence)
{ {
// This assumes that we know what our neighbors are. // This assumes that we know what our neighbors are.
try try
{ {
foreach (ulong regionHandle in presence.KnownChildRegionHandles) foreach (ulong regionHandle in presence.KnownChildRegionHandles)
{ {
if (regionHandle != m_regionInfo.RegionHandle)
SendChildAgentDataUpdateDelegate d = SendChildAgentDataUpdateAsync; {
d.BeginInvoke(cAgentData, regionHandle, SendChildAgentDataUpdateDelegate d = SendChildAgentDataUpdateAsync;
SendChildAgentDataUpdateCompleted, d.BeginInvoke(cAgentData, regionHandle,
d); SendChildAgentDataUpdateCompleted,
d);
}
} }
} }
catch (InvalidOperationException) catch (InvalidOperationException)

View File

@ -2326,7 +2326,11 @@ namespace OpenSim.Region.Environment.Scenes
//m_log.Info("[NeighborThrottle]: " + m_scene.GetInaccurateNeighborCount().ToString() + " - m: " + multiplier.ToString()); //m_log.Info("[NeighborThrottle]: " + m_scene.GetInaccurateNeighborCount().ToString() + " - m: " + multiplier.ToString());
cadu.throttles = ControllingClient.GetThrottlesPacked(multiplier); cadu.throttles = ControllingClient.GetThrottlesPacked(multiplier);
cadu.Velocity = new sLLVector3(Velocity); cadu.Velocity = new sLLVector3(Velocity);
m_scene.SendOutChildAgentUpdates(cadu,this);
AgentData agent = new AgentData();
agent.CopyFrom(cadu);
m_scene.SendOutChildAgentUpdates(agent, this);
m_LastChildAgentUpdatePosition.X = AbsolutePosition.X; m_LastChildAgentUpdatePosition.X = AbsolutePosition.X;
m_LastChildAgentUpdatePosition.Y = AbsolutePosition.Y; m_LastChildAgentUpdatePosition.Y = AbsolutePosition.Y;
@ -2571,7 +2575,7 @@ namespace OpenSim.Region.Environment.Scenes
/// This updates important decision making data about a child agent /// 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 /// The main purpose is to figure out what objects to send to a child agent that's in a neighboring region
/// </summary> /// </summary>
public void ChildAgentDataUpdate(ChildAgentDataUpdate cAgentData, uint tRegionX, uint tRegionY, uint rRegionX, uint rRegionY) public void ChildAgentDataUpdate(AgentData cAgentData, uint tRegionX, uint tRegionY, uint rRegionX, uint rRegionY)
{ {
// //
if (!IsChildAgent) if (!IsChildAgent)
@ -2580,19 +2584,19 @@ namespace OpenSim.Region.Environment.Scenes
int shiftx = ((int)rRegionX - (int)tRegionX) * (int)Constants.RegionSize; int shiftx = ((int)rRegionX - (int)tRegionX) * (int)Constants.RegionSize;
int shifty = ((int)rRegionY - (int)tRegionY) * (int)Constants.RegionSize; int shifty = ((int)rRegionY - (int)tRegionY) * (int)Constants.RegionSize;
m_DrawDistance = cAgentData.drawdistance; m_DrawDistance = cAgentData.Far;
m_pos = new Vector3(cAgentData.Position.x + shiftx, cAgentData.Position.y + shifty, cAgentData.Position.z); 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 // 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
m_CameraCenter = m_CameraCenter = cAgentData.Center;
new Vector3(cAgentData.cameraPosition.x, cAgentData.cameraPosition.y, cAgentData.cameraPosition.z); // new Vector3(cAgentData.cameraPosition.x, cAgentData.cameraPosition.y, cAgentData.cameraPosition.z);
m_godlevel = cAgentData.godlevel; m_godlevel = cAgentData.GodLevel;
m_avHeight = cAgentData.AVHeight; m_avHeight = cAgentData.Size.Z;
//SetHeight(cAgentData.AVHeight); //SetHeight(cAgentData.AVHeight);
ControllingClient.SetChildAgentThrottle(cAgentData.throttles); ControllingClient.SetChildAgentThrottle(cAgentData.Throttles);
// Sends out the objects in the user's draw distance if m_sendTasksToChild is true. // Sends out the objects in the user's draw distance if m_sendTasksToChild is true.
if (m_scene.m_seeIntoRegionFromNeighbor) if (m_scene.m_seeIntoRegionFromNeighbor)

View File

@ -179,6 +179,11 @@
;WorldMapModule = "WorldMap" ;WorldMapModule = "WorldMap"
;MapImageModule = "MapImageModule" ;MapImageModule = "MapImageModule"
[Communications]
;InterregionComms = "LocalComms"
InterregionComms = "RESTComms"
;InterregionComms = "HGRESTComms"
[StandAlone] [StandAlone]
accounts_authenticate = true accounts_authenticate = true