Unpacking the mess with OtherRegionUp, so we can have a real cache of the neighbours in the grid service modules.
parent
68e40a87ca
commit
5d09c53a1a
|
@ -46,8 +46,6 @@ namespace OpenSim.Framework
|
||||||
|
|
||||||
public delegate bool CloseAgentConnection(UUID agentID);
|
public delegate bool CloseAgentConnection(UUID agentID);
|
||||||
|
|
||||||
public delegate bool RegionUp(RegionInfo region);
|
|
||||||
|
|
||||||
public delegate bool ChildAgentUpdate(ChildAgentDataUpdate cAgentData);
|
public delegate bool ChildAgentUpdate(ChildAgentDataUpdate cAgentData);
|
||||||
|
|
||||||
public delegate void LogOffUser(UUID agentID, UUID regionSecret, string message);
|
public delegate void LogOffUser(UUID agentID, UUID regionSecret, string message);
|
||||||
|
@ -65,7 +63,6 @@ namespace OpenSim.Framework
|
||||||
event AcknowledgePrimCross OnAcknowledgePrimCrossed;
|
event AcknowledgePrimCross OnAcknowledgePrimCrossed;
|
||||||
event UpdateNeighbours OnNeighboursUpdate;
|
event UpdateNeighbours OnNeighboursUpdate;
|
||||||
event CloseAgentConnection OnCloseAgentConnection;
|
event CloseAgentConnection OnCloseAgentConnection;
|
||||||
event RegionUp OnRegionUp;
|
|
||||||
event ChildAgentUpdate OnChildAgentUpdate;
|
event ChildAgentUpdate OnChildAgentUpdate;
|
||||||
event LogOffUser OnLogOffUser;
|
event LogOffUser OnLogOffUser;
|
||||||
event GetLandData OnGetLandData;
|
event GetLandData OnGetLandData;
|
||||||
|
|
|
@ -74,7 +74,7 @@ namespace OpenSim.Framework
|
||||||
void CloseAllAgents(uint circuitcode);
|
void CloseAllAgents(uint circuitcode);
|
||||||
|
|
||||||
void Restart(int seconds);
|
void Restart(int seconds);
|
||||||
bool OtherRegionUp(RegionInfo thisRegion);
|
//RegionInfo OtherRegionUp(RegionInfo thisRegion);
|
||||||
|
|
||||||
string GetSimulatorVersion();
|
string GetSimulatorVersion();
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,6 @@ namespace OpenSim.Framework
|
||||||
private ExpectUserDelegate handlerExpectUser = null; // OnExpectUser
|
private ExpectUserDelegate handlerExpectUser = null; // OnExpectUser
|
||||||
private UpdateNeighbours handlerNeighboursUpdate = null; // OnNeighboursUpdate;
|
private UpdateNeighbours handlerNeighboursUpdate = null; // OnNeighboursUpdate;
|
||||||
private PrimCrossing handlerPrimCrossingIntoRegion = null; // OnPrimCrossingIntoRegion;
|
private PrimCrossing handlerPrimCrossingIntoRegion = null; // OnPrimCrossingIntoRegion;
|
||||||
private RegionUp handlerRegionUp = null; // OnRegionUp;
|
|
||||||
private LogOffUser handlerLogOffUser = null;
|
private LogOffUser handlerLogOffUser = null;
|
||||||
private GetLandData handlerGetLandData = null;
|
private GetLandData handlerGetLandData = null;
|
||||||
|
|
||||||
|
@ -62,7 +61,6 @@ namespace OpenSim.Framework
|
||||||
public event AcknowledgeAgentCross OnAcknowledgeAgentCrossed;
|
public event AcknowledgeAgentCross OnAcknowledgeAgentCrossed;
|
||||||
public event AcknowledgePrimCross OnAcknowledgePrimCrossed;
|
public event AcknowledgePrimCross OnAcknowledgePrimCrossed;
|
||||||
public event CloseAgentConnection OnCloseAgentConnection;
|
public event CloseAgentConnection OnCloseAgentConnection;
|
||||||
public event RegionUp OnRegionUp;
|
|
||||||
public event ChildAgentUpdate OnChildAgentUpdate;
|
public event ChildAgentUpdate OnChildAgentUpdate;
|
||||||
public event LogOffUser OnLogOffUser;
|
public event LogOffUser OnLogOffUser;
|
||||||
public event GetLandData OnGetLandData;
|
public event GetLandData OnGetLandData;
|
||||||
|
@ -108,17 +106,6 @@ namespace OpenSim.Framework
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual bool TriggerRegionUp(RegionInfo region)
|
|
||||||
{
|
|
||||||
handlerRegionUp = OnRegionUp;
|
|
||||||
if (handlerRegionUp != null)
|
|
||||||
{
|
|
||||||
handlerRegionUp(region);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual bool TriggerChildAgentUpdate(ChildAgentDataUpdate cAgentData)
|
public virtual bool TriggerChildAgentUpdate(ChildAgentDataUpdate cAgentData)
|
||||||
{
|
{
|
||||||
handlerChildAgentUpdate = OnChildAgentUpdate;
|
handlerChildAgentUpdate = OnChildAgentUpdate;
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
using OpenSim.Region.Framework.Scenes;
|
using OpenSim.Region.Framework.Scenes;
|
||||||
|
using GridRegion = OpenSim.Services.Interfaces.GridRegion;
|
||||||
|
|
||||||
namespace OpenSim.Region.ClientStack.LindenUDP.Tests
|
namespace OpenSim.Region.ClientStack.LindenUDP.Tests
|
||||||
{
|
{
|
||||||
|
@ -58,7 +59,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
|
||||||
|
|
||||||
public override void RemoveClient(UUID agentID) {}
|
public override void RemoveClient(UUID agentID) {}
|
||||||
public override void CloseAllAgents(uint circuitcode) {}
|
public override void CloseAllAgents(uint circuitcode) {}
|
||||||
public override bool OtherRegionUp(RegionInfo thisRegion) { return false; }
|
public override void OtherRegionUp(GridRegion otherRegion) { }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Doesn't really matter what the call is - we're using this to test that a packet has actually been received
|
/// Doesn't really matter what the call is - we're using this to test that a packet has actually been received
|
||||||
|
|
|
@ -121,7 +121,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Neighbour
|
||||||
|
|
||||||
#region INeighbourService
|
#region INeighbourService
|
||||||
|
|
||||||
public bool HelloNeighbour(ulong regionHandle, RegionInfo thisRegion)
|
public GridRegion HelloNeighbour(ulong regionHandle, RegionInfo thisRegion)
|
||||||
{
|
{
|
||||||
m_log.DebugFormat("[NEIGHBOUR IN CONNECTOR]: HelloNeighbour from {0}, to {1}. Count = {2}",
|
m_log.DebugFormat("[NEIGHBOUR IN CONNECTOR]: HelloNeighbour from {0}, to {1}. Count = {2}",
|
||||||
thisRegion.RegionName, regionHandle, m_Scenes.Count);
|
thisRegion.RegionName, regionHandle, m_Scenes.Count);
|
||||||
|
@ -134,7 +134,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Neighbour
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
m_log.DebugFormat("[NEIGHBOUR IN CONNECTOR]: region handle {0} not found", regionHandle);
|
m_log.DebugFormat("[NEIGHBOUR IN CONNECTOR]: region handle {0} not found", regionHandle);
|
||||||
return false;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion INeighbourService
|
#endregion INeighbourService
|
||||||
|
|
|
@ -119,7 +119,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Neighbour
|
||||||
|
|
||||||
#region INeighbourService
|
#region INeighbourService
|
||||||
|
|
||||||
public bool HelloNeighbour(ulong regionHandle, RegionInfo thisRegion)
|
public GridRegion HelloNeighbour(ulong regionHandle, RegionInfo thisRegion)
|
||||||
{
|
{
|
||||||
m_log.DebugFormat("[NEIGHBOUR CONNECTOR]: HelloNeighbour from {0}, to {1}. Count = {2}",
|
m_log.DebugFormat("[NEIGHBOUR CONNECTOR]: HelloNeighbour from {0}, to {1}. Count = {2}",
|
||||||
thisRegion.RegionName, regionHandle, m_Scenes.Count);
|
thisRegion.RegionName, regionHandle, m_Scenes.Count);
|
||||||
|
@ -132,7 +132,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Neighbour
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
m_log.DebugFormat("[NEIGHBOUR CONNECTOR]: region handle {0} not found", regionHandle);
|
m_log.DebugFormat("[NEIGHBOUR CONNECTOR]: region handle {0} not found", regionHandle);
|
||||||
return false;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion INeighbourService
|
#endregion INeighbourService
|
||||||
|
|
|
@ -141,10 +141,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Neighbour
|
||||||
|
|
||||||
#region INeighbourService
|
#region INeighbourService
|
||||||
|
|
||||||
public override bool HelloNeighbour(ulong regionHandle, RegionInfo thisRegion)
|
public override GridRegion HelloNeighbour(ulong regionHandle, RegionInfo thisRegion)
|
||||||
{
|
{
|
||||||
if (m_LocalService.HelloNeighbour(regionHandle, thisRegion))
|
GridRegion region = m_LocalService.HelloNeighbour(regionHandle, thisRegion);
|
||||||
return true;
|
if (region != null)
|
||||||
|
return region;
|
||||||
|
|
||||||
return base.HelloNeighbour(regionHandle, thisRegion);
|
return base.HelloNeighbour(regionHandle, thisRegion);
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,6 +32,7 @@ using OpenSim.Framework;
|
||||||
using OpenSim.Framework.Client;
|
using OpenSim.Framework.Client;
|
||||||
using OpenSim.Region.Framework.Interfaces;
|
using OpenSim.Region.Framework.Interfaces;
|
||||||
using Caps=OpenSim.Framework.Capabilities.Caps;
|
using Caps=OpenSim.Framework.Capabilities.Caps;
|
||||||
|
using GridRegion = OpenSim.Services.Interfaces.GridRegion;
|
||||||
|
|
||||||
namespace OpenSim.Region.Framework.Scenes
|
namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
|
@ -305,6 +306,9 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
public delegate void Attach(uint localID, UUID itemID, UUID avatarID);
|
public delegate void Attach(uint localID, UUID itemID, UUID avatarID);
|
||||||
public event Attach OnAttach;
|
public event Attach OnAttach;
|
||||||
|
|
||||||
|
public delegate void RegionUp(GridRegion region);
|
||||||
|
public event RegionUp OnRegionUp;
|
||||||
|
|
||||||
public class MoneyTransferArgs : EventArgs
|
public class MoneyTransferArgs : EventArgs
|
||||||
{
|
{
|
||||||
public UUID sender;
|
public UUID sender;
|
||||||
|
@ -446,6 +450,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
private EmptyScriptCompileQueue handlerEmptyScriptCompileQueue = null;
|
private EmptyScriptCompileQueue handlerEmptyScriptCompileQueue = null;
|
||||||
|
|
||||||
private Attach handlerOnAttach = null;
|
private Attach handlerOnAttach = null;
|
||||||
|
private RegionUp handlerOnRegionUp = null;
|
||||||
|
|
||||||
public void TriggerOnAttach(uint localID, UUID itemID, UUID avatarID)
|
public void TriggerOnAttach(uint localID, UUID itemID, UUID avatarID)
|
||||||
{
|
{
|
||||||
|
@ -1035,5 +1040,13 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
if (handlerSetRootAgentScene != null)
|
if (handlerSetRootAgentScene != null)
|
||||||
handlerSetRootAgentScene(agentID, scene);
|
handlerSetRootAgentScene(agentID, scene);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void TriggerOnRegionUp(GridRegion otherRegion)
|
||||||
|
{
|
||||||
|
handlerOnRegionUp = OnRegionUp;
|
||||||
|
if (handlerOnRegionUp != null)
|
||||||
|
handlerOnRegionUp(otherRegion);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -587,10 +587,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Another region is up. Gets called from Grid Comms:
|
/// Another region is up.
|
||||||
/// (OGS1 -> LocalBackEnd -> RegionListened -> SceneCommunicationService)
|
|
||||||
/// We have to tell all our ScenePresences about it, and add it to the
|
|
||||||
/// neighbor list.
|
|
||||||
///
|
///
|
||||||
/// We only add it to the neighbor list if it's within 1 region from here.
|
/// We only add it to the neighbor list if it's within 1 region from here.
|
||||||
/// Agents may have draw distance values that cross two regions though, so
|
/// Agents may have draw distance values that cross two regions though, so
|
||||||
|
@ -599,47 +596,27 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="otherRegion">RegionInfo handle for the new region.</param>
|
/// <param name="otherRegion">RegionInfo handle for the new region.</param>
|
||||||
/// <returns>True after all operations complete, throws exceptions otherwise.</returns>
|
/// <returns>True after all operations complete, throws exceptions otherwise.</returns>
|
||||||
public override bool OtherRegionUp(RegionInfo otherRegion)
|
public override void OtherRegionUp(GridRegion otherRegion)
|
||||||
{
|
{
|
||||||
m_log.InfoFormat("[SCENE]: Region {0} up in coords {1}-{2}", otherRegion.RegionName, otherRegion.RegionLocX, otherRegion.RegionLocY);
|
uint xcell = (uint)((int)otherRegion.RegionLocX / (int)Constants.RegionSize);
|
||||||
|
uint ycell = (uint)((int)otherRegion.RegionLocY / (int)Constants.RegionSize);
|
||||||
|
m_log.InfoFormat("[SCENE]: (on region {0}): Region {1} up in coords {2}-{3}",
|
||||||
|
RegionInfo.RegionName, otherRegion.RegionName, xcell, ycell);
|
||||||
|
|
||||||
if (RegionInfo.RegionHandle != otherRegion.RegionHandle)
|
if (RegionInfo.RegionHandle != otherRegion.RegionHandle)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < m_neighbours.Count; i++)
|
|
||||||
{
|
|
||||||
// The purpose of this loop is to re-update the known neighbors
|
|
||||||
// when another region comes up on top of another one.
|
|
||||||
// The latest region in that location ends up in the
|
|
||||||
// 'known neighbors list'
|
|
||||||
// Additionally, the commFailTF property gets reset to false.
|
|
||||||
if (m_neighbours[i].RegionHandle == otherRegion.RegionHandle)
|
|
||||||
{
|
|
||||||
lock (m_neighbours)
|
|
||||||
{
|
|
||||||
m_neighbours[i] = otherRegion;
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// If the value isn't in the neighbours, add it.
|
|
||||||
// If the RegionInfo isn't exact but is for the same XY World location,
|
|
||||||
// then the above loop will fix that.
|
|
||||||
|
|
||||||
if (!(CheckNeighborRegion(otherRegion)))
|
|
||||||
{
|
|
||||||
lock (m_neighbours)
|
|
||||||
{
|
|
||||||
m_neighbours.Add(otherRegion);
|
|
||||||
//m_log.Info("[UP]: " + otherRegion.RegionHandle.ToString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// If these are cast to INT because long + negative values + abs returns invalid data
|
// If these are cast to INT because long + negative values + abs returns invalid data
|
||||||
int resultX = Math.Abs((int)otherRegion.RegionLocX - (int)RegionInfo.RegionLocX);
|
int resultX = Math.Abs((int)xcell - (int)RegionInfo.RegionLocX);
|
||||||
int resultY = Math.Abs((int)otherRegion.RegionLocY - (int)RegionInfo.RegionLocY);
|
int resultY = Math.Abs((int)ycell - (int)RegionInfo.RegionLocY);
|
||||||
if (resultX <= 1 && resultY <= 1)
|
if (resultX <= 1 && resultY <= 1)
|
||||||
{
|
{
|
||||||
|
RegionInfo regInfo = new RegionInfo(xcell, ycell, otherRegion.InternalEndPoint, otherRegion.ExternalHostName);
|
||||||
|
regInfo.RegionID = otherRegion.RegionID;
|
||||||
|
regInfo.RegionName = otherRegion.RegionName;
|
||||||
|
regInfo.ScopeID = otherRegion.ScopeID;
|
||||||
|
regInfo.ExternalHostName = otherRegion.ExternalHostName;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
ForEachScenePresence(delegate(ScenePresence agent)
|
ForEachScenePresence(delegate(ScenePresence agent)
|
||||||
|
@ -653,7 +630,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
List<ulong> old = new List<ulong>();
|
List<ulong> old = new List<ulong>();
|
||||||
old.Add(otherRegion.RegionHandle);
|
old.Add(otherRegion.RegionHandle);
|
||||||
agent.DropOldNeighbours(old);
|
agent.DropOldNeighbours(old);
|
||||||
InformClientOfNeighbor(agent, otherRegion);
|
InformClientOfNeighbor(agent, regInfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@ -672,7 +649,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
otherRegion.RegionLocY.ToString() + ")");
|
otherRegion.RegionLocY.ToString() + ")");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddNeighborRegion(RegionInfo region)
|
public void AddNeighborRegion(RegionInfo region)
|
||||||
|
@ -704,9 +680,10 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
}
|
}
|
||||||
|
|
||||||
// Alias IncomingHelloNeighbour OtherRegionUp, for now
|
// Alias IncomingHelloNeighbour OtherRegionUp, for now
|
||||||
public bool IncomingHelloNeighbour(RegionInfo neighbour)
|
public GridRegion IncomingHelloNeighbour(RegionInfo neighbour)
|
||||||
{
|
{
|
||||||
return OtherRegionUp(neighbour);
|
OtherRegionUp(new GridRegion(neighbour));
|
||||||
|
return new GridRegion(RegionInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -3104,7 +3081,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
m_sceneGridService.OnExpectUser += HandleNewUserConnection;
|
m_sceneGridService.OnExpectUser += HandleNewUserConnection;
|
||||||
m_sceneGridService.OnAvatarCrossingIntoRegion += AgentCrossing;
|
m_sceneGridService.OnAvatarCrossingIntoRegion += AgentCrossing;
|
||||||
m_sceneGridService.OnCloseAgentConnection += IncomingCloseAgent;
|
m_sceneGridService.OnCloseAgentConnection += IncomingCloseAgent;
|
||||||
m_sceneGridService.OnRegionUp += OtherRegionUp;
|
//m_eventManager.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;
|
||||||
|
@ -3132,7 +3109,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
//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_eventManager.OnRegionUp -= OtherRegionUp;
|
||||||
m_sceneGridService.OnExpectUser -= HandleNewUserConnection;
|
m_sceneGridService.OnExpectUser -= HandleNewUserConnection;
|
||||||
m_sceneGridService.OnAvatarCrossingIntoRegion -= AgentCrossing;
|
m_sceneGridService.OnAvatarCrossingIntoRegion -= AgentCrossing;
|
||||||
m_sceneGridService.OnCloseAgentConnection -= IncomingCloseAgent;
|
m_sceneGridService.OnCloseAgentConnection -= IncomingCloseAgent;
|
||||||
|
|
|
@ -36,6 +36,7 @@ using OpenSim.Framework;
|
||||||
using OpenSim.Framework.Console;
|
using OpenSim.Framework.Console;
|
||||||
using OpenSim.Framework.Communications.Cache;
|
using OpenSim.Framework.Communications.Cache;
|
||||||
using OpenSim.Region.Framework.Interfaces;
|
using OpenSim.Region.Framework.Interfaces;
|
||||||
|
using GridRegion = OpenSim.Services.Interfaces.GridRegion;
|
||||||
|
|
||||||
namespace OpenSim.Region.Framework.Scenes
|
namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
|
@ -227,7 +228,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract bool OtherRegionUp(RegionInfo thisRegion);
|
public abstract void OtherRegionUp(GridRegion otherRegion);
|
||||||
|
|
||||||
public virtual string GetSimulatorVersion()
|
public virtual string GetSimulatorVersion()
|
||||||
{
|
{
|
||||||
|
|
|
@ -93,10 +93,10 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public event PrimCrossing OnPrimCrossingIntoRegion;
|
public event PrimCrossing OnPrimCrossingIntoRegion;
|
||||||
|
|
||||||
/// <summary>
|
///// <summary>
|
||||||
/// A New Region is up and available
|
///// A New Region is up and available
|
||||||
/// </summary>
|
///// </summary>
|
||||||
public event RegionUp OnRegionUp;
|
//public event RegionUp OnRegionUp;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// We have a child agent for this avatar and we're getting a status update about it
|
/// We have a child agent for this avatar and we're getting a status update about it
|
||||||
|
@ -119,7 +119,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
private ExpectPrimDelegate handlerExpectPrim = null; // OnExpectPrim;
|
private ExpectPrimDelegate handlerExpectPrim = null; // OnExpectPrim;
|
||||||
private CloseAgentConnection handlerCloseAgentConnection = null; // OnCloseAgentConnection;
|
private CloseAgentConnection handlerCloseAgentConnection = null; // OnCloseAgentConnection;
|
||||||
private PrimCrossing handlerPrimCrossingIntoRegion = null; // OnPrimCrossingIntoRegion;
|
private PrimCrossing handlerPrimCrossingIntoRegion = null; // OnPrimCrossingIntoRegion;
|
||||||
private RegionUp handlerRegionUp = null; // OnRegionUp;
|
//private RegionUp handlerRegionUp = null; // OnRegionUp;
|
||||||
private ChildAgentUpdate handlerChildAgentUpdate = null; // OnChildAgentUpdate;
|
private ChildAgentUpdate handlerChildAgentUpdate = null; // OnChildAgentUpdate;
|
||||||
//private RemoveKnownRegionsFromAvatarList handlerRemoveKnownRegionFromAvatar = null; // OnRemoveKnownRegionFromAvatar;
|
//private RemoveKnownRegionsFromAvatarList handlerRemoveKnownRegionFromAvatar = null; // OnRemoveKnownRegionFromAvatar;
|
||||||
private LogOffUser handlerLogOffUser = null;
|
private LogOffUser handlerLogOffUser = null;
|
||||||
|
@ -238,22 +238,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// A New Region is now available. Inform the scene that there is a new region available.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="region">Information about the new region that is available</param>
|
|
||||||
/// <returns>True if the event was handled</returns>
|
|
||||||
protected bool newRegionUp(RegionInfo region)
|
|
||||||
{
|
|
||||||
handlerRegionUp = OnRegionUp;
|
|
||||||
if (handlerRegionUp != null)
|
|
||||||
{
|
|
||||||
//m_log.Info("[INTER]: " + debugRegionName + ": SceneCommunicationService: newRegionUp Fired for User:" + region.RegionName);
|
|
||||||
handlerRegionUp(region);
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Inform the scene that we've got an update about a child agent that we have
|
/// Inform the scene that we've got an update about a child agent that we have
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -647,31 +631,23 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
/// <param name="regionhandle"></param>
|
/// <param name="regionhandle"></param>
|
||||||
private void InformNeighboursThatRegionIsUpAsync(INeighbourService neighbourService, RegionInfo region, ulong regionhandle)
|
private void InformNeighboursThatRegionIsUpAsync(INeighbourService neighbourService, RegionInfo region, ulong regionhandle)
|
||||||
{
|
{
|
||||||
m_log.Info("[INTERGRID]: Starting to inform neighbors that I'm here");
|
uint x = 0, y = 0;
|
||||||
//RegionUpData regiondata = new RegionUpData(region.RegionLocX, region.RegionLocY, region.ExternalHostName, region.InternalEndPoint.Port);
|
Utils.LongToUInts(regionhandle, out x, out y);
|
||||||
|
|
||||||
//bool regionAccepted =
|
GridRegion neighbour = null;
|
||||||
// m_commsProvider.InterRegion.RegionUp(new SerializableRegionInfo(region), regionhandle);
|
|
||||||
|
|
||||||
//bool regionAccepted = m_interregionCommsOut.SendHelloNeighbour(regionhandle, region);
|
|
||||||
bool regionAccepted = false;
|
|
||||||
if (neighbourService != null)
|
if (neighbourService != null)
|
||||||
regionAccepted = neighbourService.HelloNeighbour(regionhandle, region);
|
neighbour = neighbourService.HelloNeighbour(regionhandle, region);
|
||||||
else
|
else
|
||||||
m_log.DebugFormat("[SCS]: No neighbour service provided for informing neigbhours of this region");
|
m_log.DebugFormat("[SCS]: No neighbour service provided for informing neigbhours of this region");
|
||||||
|
|
||||||
if (regionAccepted)
|
if (neighbour != null)
|
||||||
{
|
{
|
||||||
m_log.Info("[INTERGRID]: Completed informing neighbors that I'm here");
|
m_log.DebugFormat("[INTERGRID]: Successfully informed neighbour {0}-{1} that I'm here", x / Constants.RegionSize, y / Constants.RegionSize);
|
||||||
handlerRegionUp = OnRegionUp;
|
m_scene.EventManager.TriggerOnRegionUp(neighbour);
|
||||||
|
|
||||||
// yes, we're notifying ourselves.
|
|
||||||
if (handlerRegionUp != null)
|
|
||||||
handlerRegionUp(region);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_log.Warn("[INTERGRID]: Failed to inform neighbors that I'm here.");
|
m_log.WarnFormat("[INTERGRID]: Failed to inform neighbour {0}-{1} that I'm here.", x / Constants.RegionSize, y / Constants.RegionSize);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -680,22 +656,33 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
//m_log.Info("[INTER]: " + debugRegionName + ": SceneCommunicationService: Sending InterRegion Notification that region is up " + region.RegionName);
|
//m_log.Info("[INTER]: " + debugRegionName + ": SceneCommunicationService: Sending InterRegion Notification that region is up " + region.RegionName);
|
||||||
|
|
||||||
|
for (int x = (int)region.RegionLocX - 1; x <= region.RegionLocX + 1; x++)
|
||||||
|
for (int y = (int)region.RegionLocY - 1; y <= region.RegionLocY + 1; y++)
|
||||||
|
if (!((x == region.RegionLocX) && (y == region.RegionLocY))) // skip this region
|
||||||
|
{
|
||||||
|
ulong handle = Utils.UIntsToLong((uint)x * Constants.RegionSize, (uint)y * Constants.RegionSize);
|
||||||
|
InformNeighbourThatRegionUpDelegate d = InformNeighboursThatRegionIsUpAsync;
|
||||||
|
|
||||||
List<GridRegion> neighbours = new List<GridRegion>();
|
d.BeginInvoke(neighbourService, region, handle,
|
||||||
// This stays uncached because we don't already know about our neighbors at this point.
|
InformNeighborsThatRegionisUpCompleted,
|
||||||
|
d);
|
||||||
|
}
|
||||||
|
|
||||||
neighbours = m_scene.GridService.GetNeighbours(m_regionInfo.ScopeID, m_regionInfo.RegionID);
|
//List<GridRegion> neighbours = new List<GridRegion>();
|
||||||
if (neighbours != null)
|
//// This stays uncached because we don't already know about our neighbors at this point.
|
||||||
{
|
|
||||||
for (int i = 0; i < neighbours.Count; i++)
|
|
||||||
{
|
|
||||||
InformNeighbourThatRegionUpDelegate d = InformNeighboursThatRegionIsUpAsync;
|
|
||||||
|
|
||||||
d.BeginInvoke(neighbourService, region, neighbours[i].RegionHandle,
|
//neighbours = m_scene.GridService.GetNeighbours(m_regionInfo.ScopeID, m_regionInfo.RegionID);
|
||||||
InformNeighborsThatRegionisUpCompleted,
|
//if (neighbours != null)
|
||||||
d);
|
//{
|
||||||
}
|
// for (int i = 0; i < neighbours.Count; i++)
|
||||||
}
|
// {
|
||||||
|
// InformNeighbourThatRegionUpDelegate d = InformNeighboursThatRegionIsUpAsync;
|
||||||
|
|
||||||
|
// d.BeginInvoke(neighbourService, region, neighbours[i].RegionHandle,
|
||||||
|
// InformNeighborsThatRegionisUpCompleted,
|
||||||
|
// d);
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
|
||||||
//bool val = m_commsProvider.InterRegion.RegionUp(new SerializableRegionInfo(region));
|
//bool val = m_commsProvider.InterRegion.RegionUp(new SerializableRegionInfo(region));
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,6 +29,7 @@ using System;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
|
using GridRegion = OpenSim.Services.Interfaces.GridRegion;
|
||||||
|
|
||||||
namespace OpenSim.Region.Framework.Scenes.Tests
|
namespace OpenSim.Region.Framework.Scenes.Tests
|
||||||
{
|
{
|
||||||
|
@ -65,7 +66,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool OtherRegionUp(RegionInfo thisRegion)
|
public override void OtherRegionUp(GridRegion otherRegion)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,6 +36,7 @@ using OpenSim.Server.Handlers.Base;
|
||||||
using OpenSim.Services.Interfaces;
|
using OpenSim.Services.Interfaces;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
using OpenSim.Framework.Servers.HttpServer;
|
using OpenSim.Framework.Servers.HttpServer;
|
||||||
|
using GridRegion = OpenSim.Services.Interfaces.GridRegion;
|
||||||
|
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
using OpenMetaverse.StructuredData;
|
using OpenMetaverse.StructuredData;
|
||||||
|
@ -148,11 +149,14 @@ namespace OpenSim.Server.Handlers.Neighbour
|
||||||
}
|
}
|
||||||
|
|
||||||
// Finally!
|
// Finally!
|
||||||
bool success = m_NeighbourService.HelloNeighbour(regionhandle, aRegion);
|
GridRegion thisRegion = m_NeighbourService.HelloNeighbour(regionhandle, aRegion);
|
||||||
|
|
||||||
OSDMap resp = new OSDMap(1);
|
OSDMap resp = new OSDMap(1);
|
||||||
|
|
||||||
resp["success"] = OSD.FromBoolean(success);
|
if (thisRegion != null)
|
||||||
|
resp["success"] = OSD.FromBoolean(true);
|
||||||
|
else
|
||||||
|
resp["success"] = OSD.FromBoolean(false);
|
||||||
|
|
||||||
httpResponse.StatusCode = (int)HttpStatusCode.OK;
|
httpResponse.StatusCode = (int)HttpStatusCode.OK;
|
||||||
|
|
||||||
|
|
|
@ -67,7 +67,7 @@ namespace OpenSim.Services.Connectors
|
||||||
m_GridService = gridServices;
|
m_GridService = gridServices;
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual bool HelloNeighbour(ulong regionHandle, RegionInfo thisRegion)
|
public virtual GridRegion HelloNeighbour(ulong regionHandle, RegionInfo thisRegion)
|
||||||
{
|
{
|
||||||
uint x = 0, y = 0;
|
uint x = 0, y = 0;
|
||||||
Utils.LongToUInts(regionHandle, out x, out y);
|
Utils.LongToUInts(regionHandle, out x, out y);
|
||||||
|
@ -76,11 +76,11 @@ namespace OpenSim.Services.Connectors
|
||||||
// Don't remote-call this instance; that's a startup hickup
|
// Don't remote-call this instance; that's a startup hickup
|
||||||
!((regInfo.ExternalHostName == thisRegion.ExternalHostName) && (regInfo.HttpPort == thisRegion.HttpPort)))
|
!((regInfo.ExternalHostName == thisRegion.ExternalHostName) && (regInfo.HttpPort == thisRegion.HttpPort)))
|
||||||
{
|
{
|
||||||
return DoHelloNeighbourCall(regInfo, thisRegion);
|
DoHelloNeighbourCall(regInfo, thisRegion);
|
||||||
}
|
}
|
||||||
//else
|
//else
|
||||||
// m_log.Warn("[REST COMMS]: Region not found " + regionHandle);
|
// m_log.Warn("[REST COMMS]: Region not found " + regionHandle);
|
||||||
return false;
|
return regInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool DoHelloNeighbourCall(GridRegion region, RegionInfo thisRegion)
|
public bool DoHelloNeighbourCall(GridRegion region, RegionInfo thisRegion)
|
||||||
|
|
|
@ -28,11 +28,12 @@
|
||||||
using System;
|
using System;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
|
using GridRegion = OpenSim.Services.Interfaces.GridRegion;
|
||||||
|
|
||||||
namespace OpenSim.Services.Interfaces
|
namespace OpenSim.Services.Interfaces
|
||||||
{
|
{
|
||||||
public interface INeighbourService
|
public interface INeighbourService
|
||||||
{
|
{
|
||||||
bool HelloNeighbour(ulong regionHandle, RegionInfo thisRegion);
|
GridRegion HelloNeighbour(ulong regionHandle, RegionInfo otherRegion);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3655,6 +3655,7 @@
|
||||||
<Reference name="OpenSim.Region.Framework"/>
|
<Reference name="OpenSim.Region.Framework"/>
|
||||||
<Reference name="OpenSim.Region.CoreModules"/>
|
<Reference name="OpenSim.Region.CoreModules"/>
|
||||||
<Reference name="OpenSim.Region.Physics.Manager"/>
|
<Reference name="OpenSim.Region.Physics.Manager"/>
|
||||||
|
<Reference name="OpenSim.Services.Interfaces"/>
|
||||||
|
|
||||||
<!-- Unit tests -->
|
<!-- Unit tests -->
|
||||||
<!-- <Reference name="OpenSim.Tests.Common"/> -->
|
<!-- <Reference name="OpenSim.Tests.Common"/> -->
|
||||||
|
@ -3708,6 +3709,7 @@
|
||||||
<Reference name="OpenSim.Region.ClientStack"/>
|
<Reference name="OpenSim.Region.ClientStack"/>
|
||||||
<Reference name="OpenSim.Region.ClientStack.LindenUDP"/>
|
<Reference name="OpenSim.Region.ClientStack.LindenUDP"/>
|
||||||
<Reference name="OpenSim.Region.Framework"/>
|
<Reference name="OpenSim.Region.Framework"/>
|
||||||
|
<Reference name="OpenSim.Services.Interfaces"/>
|
||||||
<Reference name="OpenSim.Tests.Common"/>
|
<Reference name="OpenSim.Tests.Common"/>
|
||||||
|
|
||||||
<Files>
|
<Files>
|
||||||
|
|
Loading…
Reference in New Issue