* Fixed about 7 issues with restarting sims and resolved interRegion comms issues. This includes the issue that MW described this morning.

There's a lot of little nit picky changes that make a world of difference.
This commit is contained in:
Teravus Ovares
2007-11-29 02:07:19 +00:00
parent 2364e6779b
commit 81ba94fde8
6 changed files with 217 additions and 145 deletions

View File

@@ -277,15 +277,41 @@ namespace OpenSim.Region.Environment.Scenes
// This fails to get the desired effect and needs further work.
if (RegionInfo.RegionHandle != otherRegion.RegionHandle)
{
if (!(m_regionRestartNotifyList.Contains(otherRegion)))
if (Math.Abs(otherRegion.RegionLocX - RegionInfo.RegionLocX) <= 1 || Math.Abs(otherRegion.RegionLocY - RegionInfo.RegionLocY) <= 1)
{
m_regionRestartNotifyList.Add(otherRegion);
m_restartWaitTimer = new Timer(20000);
m_restartWaitTimer.AutoReset = false;
m_restartWaitTimer.Elapsed += new ElapsedEventHandler(restart_Notify_Wait_Elapsed);
m_restartWaitTimer.Start();
try
{
ForEachScenePresence(delegate(ScenePresence agent)
{
if (!(agent.IsChildAgent))
{
//agent.ControllingClient.new
//this.CommsManager.InterRegion.InformRegionOfChildAgent(otherRegion.RegionHandle, agent.ControllingClient.RequestClientInfo());
InformClientOfNeighbor(agent, otherRegion);
}
}
);
}
catch (System.NullReferenceException)
{
// This means that we're not booted up completely yet.
}
}
else
{
MainLog.Instance.Verbose("INTERGRID", "Got notice about Region at X:" + otherRegion.RegionLocX.ToString() + " Y:" + otherRegion.RegionLocY.ToString() + " but it was too far away to send to the client");
}
//if (!(m_regionRestartNotifyList.Contains(otherRegion)))
//{
//m_regionRestartNotifyList.Add(otherRegion);
//m_restartWaitTimer = new Timer(20000);
//m_restartWaitTimer.AutoReset = false;
// m_restartWaitTimer.Elapsed += new ElapsedEventHandler(restart_Notify_Wait_Elapsed);
//m_restartWaitTimer.Start();
//}
}
return true;
}
@@ -342,25 +368,7 @@ namespace OpenSim.Region.Environment.Scenes
m_restartWaitTimer.Stop();
foreach (RegionInfo region in m_regionRestartNotifyList)
{
try
{
ForEachScenePresence(delegate(ScenePresence agent)
{
if (!(agent.IsChildAgent))
{
//agent.ControllingClient.new
//this.CommsManager.InterRegion.InformRegionOfChildAgent(otherRegion.RegionHandle, agent.ControllingClient.RequestClientInfo());
InformClientOfNeighbor(agent, region);
}
}
);
}
catch (System.NullReferenceException)
{
// This means that we're not booted up completely yet.
}
}
// Reset list to nothing.
m_regionRestartNotifyList = new List<RegionInfo>();

View File

@@ -58,6 +58,7 @@ namespace OpenSim.Region.Environment.Scenes
//MainLog.Instance.Verbose("INTER", debugRegionName + ": SceneCommunicationService: registered with gridservice and got" + regionCommsHost.ToString());
regionCommsHost.debugRegionName = _debugRegionName;
regionCommsHost.OnExpectUser += NewUserConnection;
regionCommsHost.OnAvatarCrossingIntoRegion += AgentCrossing;
regionCommsHost.OnPrimCrossingIntoRegion += PrimCrossing;
@@ -222,7 +223,56 @@ namespace OpenSim.Region.Environment.Scenes
}
#endregion
public delegate void InformNeighbourThatRegionUpDelegate(RegionInfo region, ulong regionhandle);
private void InformNeighborsThatRegionisUpCompleted(IAsyncResult iar)
{
InformNeighbourThatRegionUpDelegate icon = (InformNeighbourThatRegionUpDelegate)iar.AsyncState;
icon.EndInvoke(iar);
}
private void InformNeighboursThatRegionIsUpAsync(RegionInfo region, ulong regionhandle)
{
MainLog.Instance.Notice("INTERGRID", "Starting to inform neighbors that I'm here");
bool regionAccepted = m_commsProvider.InterRegion.RegionUp((new SearializableRegionInfo(region)), regionhandle);
if (regionAccepted)
{
MainLog.Instance.Notice("INTERGRID", "Completed informing neighbors that I'm here");
}
else
{
MainLog.Instance.Notice("INTERGRID", "Failed to inform neighbors that I'm here");
}
}
public void InformNeighborsThatRegionisUp(RegionInfo region)
{
//MainLog.Instance.Verbose("INTER", debugRegionName + ": SceneCommunicationService: Sending InterRegion Notification that region is up " + region.RegionName);
List<SimpleRegionInfo> neighbours = new List<SimpleRegionInfo>();
lock (neighbours)
{
neighbours = m_commsProvider.GridService.RequestNeighbours(m_regionInfo.RegionLocX, m_regionInfo.RegionLocY);
if (neighbours != null)
{
for (int i = 0; i < neighbours.Count; i++)
{
InformNeighbourThatRegionUpDelegate d = InformNeighboursThatRegionIsUpAsync;
// race condition! Arg! I hate race conditions.
lock (d)
{
d.BeginInvoke(region, neighbours[i].RegionHandle,
InformNeighborsThatRegionisUpCompleted,
d);
}
}
}
}
//bool val = m_commsProvider.InterRegion.RegionUp(new SearializableRegionInfo(region));
}
/// <summary>
///
/// </summary>
@@ -320,11 +370,7 @@ namespace OpenSim.Region.Environment.Scenes
return m_commsProvider.InterRegion.ExpectAvatarCrossing(regionhandle, agentID, position, isFlying);
}
public void InformNeighborsThatRegionisUp(RegionInfo region)
{
//MainLog.Instance.Verbose("INTER", debugRegionName + ": SceneCommunicationService: Sending InterRegion Notification that region is up " + region.RegionName);
bool val = m_commsProvider.InterRegion.RegionUp(new SearializableRegionInfo(region));
}
public bool PrimCrossToNeighboringRegion(ulong regionhandle, LLUUID primID, LLVector3 position, bool isPhysical)
{