* Restarting regions with the estate tools works in sandbox mode. I'm still working on grid mode, however. It doesn't break anything, but that feature doesn't work in grid mode yet either.

afrisby
Teravus Ovares 2007-11-26 05:02:18 +00:00
parent c710525b48
commit 175b6115f1
12 changed files with 230 additions and 28 deletions

View File

@ -33,6 +33,7 @@ namespace OpenSim.Framework.Communications
{
bool InformRegionOfChildAgent(ulong regionHandle, AgentCircuitData agentData);
bool InformRegionOfPrimCrossing(ulong regionHandle, LLUUID primID, string objData);
bool RegionUp(RegionInfo region);
bool ExpectAvatarCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position, bool isFlying);
bool ExpectPrimCrossing(ulong regionHandle, LLUUID primID, LLVector3 position, bool isFlying);

View File

@ -46,6 +46,8 @@ namespace OpenSim.Framework
public delegate void CloseAgentConnection(ulong regionHandle, LLUUID agentID);
public delegate bool RegionUp(RegionInfo region);
public interface IRegionCommsListener
@ -59,5 +61,7 @@ namespace OpenSim.Framework
event AcknowledgePrimCross OnAcknowledgePrimCrossed;
event UpdateNeighbours OnNeighboursUpdate;
event CloseAgentConnection OnCloseAgentConnection;
event RegionUp OnRegionUp;
}
}

View File

@ -30,7 +30,7 @@ using libsecondlife;
namespace OpenSim.Framework
{
public delegate void restart( RegionInfo thisRegion );
public delegate void regionup ( RegionInfo thisRegion );
//public delegate void regionup ( RegionInfo thisRegion );
public enum RegionStatus : int
{
@ -43,13 +43,12 @@ namespace OpenSim.Framework
public interface IScene
{
event restart OnRestart;
event regionup OnRegionUp;
void AddNewClient(IClientAPI client, bool child);
void RemoveClient(LLUUID agentID);
void Restart(int seconds);
void OtherRegionUp(RegionInfo thisRegion);
bool OtherRegionUp(RegionInfo thisRegion);
RegionInfo RegionInfo { get; }
uint NextLocalId { get; }

View File

@ -42,6 +42,8 @@ namespace OpenSim.Framework
public event AcknowledgeAgentCross OnAcknowledgeAgentCrossed;
public event AcknowledgePrimCross OnAcknowledgePrimCrossed;
public event CloseAgentConnection OnCloseAgentConnection;
public event RegionUp OnRegionUp;
/// <summary>
///
@ -68,6 +70,16 @@ namespace OpenSim.Framework
return false;
}
public virtual bool TriggerRegionUp(RegionInfo region)
{
if (OnRegionUp != null)
{
OnRegionUp(region);
return true;
}
return false;
}
public virtual bool TriggerExpectAvatarCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position,
bool isFlying)
{

View File

@ -454,7 +454,7 @@ namespace OpenSim
}
UDPServer restartingRegion = CreateRegion(whichRegion);
restartingRegion.ServerListener();
m_sceneManager.SendSimOnlineNotification(restartingRegion.RegionHandle);
//m_sceneManager.SendSimOnlineNotification(restartingRegion.RegionHandle);
}

View File

@ -155,11 +155,28 @@ namespace OpenSim.Region.Communications.Local
return mapBlocks;
}
/// <summary>
/// <summary>
/// </summary>
/// <param name="regionHandle"></param>
/// <param name="agentData"></param>
/// <returns></returns>
///
public bool RegionUp(RegionInfo region)
{
foreach (RegionCommsListener listener in m_regionListeners.Values)
{
listener.TriggerRegionUp(region);
}
return true;
}
public bool TriggerRegionUp(RegionInfo region)
{
return false;
}
public bool InformRegionOfChildAgent(ulong regionHandle, AgentCircuitData agentData)
//should change from agentCircuitData
{

View File

@ -380,6 +380,7 @@ namespace OpenSim.Region.Communications.OGS1
InterRegionSingleton.Instance.OnChildAgent += IncomingChildAgent;
InterRegionSingleton.Instance.OnPrimGroupArrival += IncomingPrim;
InterRegionSingleton.Instance.OnPrimGroupNear += TriggerExpectPrimCrossing;
InterRegionSingleton.Instance.OnRegionUp += TriggerRegionUp;
}
@ -465,6 +466,81 @@ namespace OpenSim.Region.Communications.OGS1
}
return true;
}
// UGLY!
public bool RegionUp(RegionInfo region)
{
RegionInfo regInfo = null;
try
{
if (m_localBackend.RegionUp(region))
{
return true;
}
foreach (RegionInfo remoteInfo in m_remoteRegionInfoCache.Values)
{
regInfo = RequestNeighbourInfo(remoteInfo.RegionHandle);
if (regInfo != null)
{
//don't want to be creating a new link to the remote instance every time like we are here
bool retValue = false;
OGS1InterRegionRemoting remObject = (OGS1InterRegionRemoting)Activator.GetObject(
typeof(OGS1InterRegionRemoting),
"tcp://" + regInfo.RemotingAddress +
":" + regInfo.RemotingPort +
"/InterRegions");
if (remObject != null)
{
retValue = remObject.RegionUp(region);
}
else
{
Console.WriteLine("remoting object not found");
}
remObject = null;
}
}
return true;
}
catch (RemotingException e)
{
MainLog.Instance.Warn("Remoting Error: Unable to connect to adjacent region: " + regInfo.RegionName + " " + regInfo.RegionLocX + "," + regInfo.RegionLocY);
MainLog.Instance.Debug(e.ToString());
return false;
}
catch (SocketException e)
{
MainLog.Instance.Warn("Socket Error: Unable to connect to adjacent region: " + regInfo.RegionName + " " + regInfo.RegionLocX + "," + regInfo.RegionLocY);
MainLog.Instance.Debug(e.ToString());
return false;
}
catch (InvalidCredentialException e)
{
MainLog.Instance.Warn("Invalid Credentials: Unable to connect to adjacent region: " + regInfo.RegionName + " " + regInfo.RegionLocX + "," + regInfo.RegionLocY);
MainLog.Instance.Debug(e.ToString());
return false;
}
catch (AuthenticationException e)
{
MainLog.Instance.Warn("Authentication exception: Unable to connect to adjacent region: " + regInfo.RegionName + " " + regInfo.RegionLocX + "," + regInfo.RegionLocY);
MainLog.Instance.Debug(e.ToString());
return false;
}
catch (Exception e)
{
MainLog.Instance.Warn("Unknown exception: Unable to connect to adjacent region: " + regInfo.RegionName + " " + regInfo.RegionLocX + "," + regInfo.RegionLocY);
MainLog.Instance.Debug(e.ToString());
return false;
}
return true;
}
/// <summary>
///
/// </summary>
@ -680,6 +756,20 @@ namespace OpenSim.Region.Communications.OGS1
}
}
public bool TriggerRegionUp(RegionInfo regionData)
{
try
{
return m_localBackend.TriggerRegionUp(regionData);
}
catch (RemotingException e)
{
MainLog.Instance.Error("Remoting Error: Unable to connect to adjacent region.\n" + e.ToString());
return false;
}
}
/// <summary>
///
/// </summary>

View File

@ -41,6 +41,8 @@ namespace OpenSim.Region.Communications.OGS1
public delegate bool PrimGroupArrival(ulong regionHandle, LLUUID primID, string objData);
public delegate bool RegionUP (RegionInfo region);
public sealed class InterRegionSingleton
{
private static readonly InterRegionSingleton instance = new InterRegionSingleton();
@ -49,6 +51,8 @@ namespace OpenSim.Region.Communications.OGS1
public event ExpectArrival OnArrival;
public event InformRegionPrimGroup OnPrimGroupNear;
public event PrimGroupArrival OnPrimGroupArrival;
public event RegionUp OnRegionUp;
static InterRegionSingleton()
{
@ -72,6 +76,15 @@ namespace OpenSim.Region.Communications.OGS1
return false;
}
public bool RegionUp(RegionInfo region)
{
if (OnRegionUp != null)
{
return OnRegionUp(region);
}
return false;
}
public bool ExpectAvatarCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position, bool isFlying)
{
if (OnArrival != null)
@ -116,7 +129,18 @@ namespace OpenSim.Region.Communications.OGS1
return false;
}
}
public bool RegionUp(RegionInfo region)
{
try
{
return InterRegionSingleton.Instance.RegionUp(region);
}
catch (RemotingException e)
{
Console.WriteLine("Remoting Error: Unable to connect to remote region.\n" + e.ToString());
return false;
}
}
public bool ExpectAvatarCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position, bool isFlying)
{
try

View File

@ -216,7 +216,7 @@ namespace OpenSim.Region.Environment.Scenes
m_regionHandle = m_regInfo.RegionHandle;
m_regionName = m_regInfo.RegionName;
m_datastore = m_regInfo.DataStore;
RegisterRegionWithComms();
m_physicalPrim = physicalPrim;
m_sendTasksToChild = SendTasksToChild;
@ -244,6 +244,7 @@ namespace OpenSim.Region.Environment.Scenes
httpListener = httpServer;
m_dumpAssetsToFile = dumpAssetsToFile;
RegisterRegionWithComms();
}
#endregion
@ -257,21 +258,29 @@ namespace OpenSim.Region.Environment.Scenes
m_eventManager.OnPermissionError += SendPermissionAlert;
}
public override void OtherRegionUp(RegionInfo otherRegion)
public override bool OtherRegionUp(RegionInfo otherRegion)
{
// Another region is up. We have to tell all our ScenePresences about it
// This fails to get the desired effect and needs further work.
ForEachScenePresence(delegate(ScenePresence agent)
try
{
if (!(agent.IsChildAgent))
{
InformClientOfNeighbor(agent, otherRegion);
this.CommsManager.InterRegion.InformRegionOfChildAgent(otherRegion.RegionHandle, agent.ControllingClient.RequestClientInfo());
ForEachScenePresence(delegate(ScenePresence agent)
{
if (!(agent.IsChildAgent))
{
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.
}
return true;
}
public virtual void Restart(float seconds)
{
@ -1068,9 +1077,13 @@ namespace OpenSim.Region.Environment.Scenes
m_sceneGridService.OnExpectUser += NewUserConnection;
m_sceneGridService.OnAvatarCrossingIntoRegion += AgentCrossing;
m_sceneGridService.OnCloseAgentConnection += CloseConnection;
m_sceneGridService.OnRegionUp += OtherRegionUp;
// Tell Other regions that I'm here.
m_sceneGridService.InformNeighborsThatRegionisUp(RegionInfo);
}
public void UnRegisterReginWithComms()
{
m_sceneGridService.OnRegionUp -= OtherRegionUp;
m_sceneGridService.OnExpectUser -= NewUserConnection;
m_sceneGridService.OnAvatarCrossingIntoRegion -= AgentCrossing;
m_sceneGridService.OnCloseAgentConnection -= CloseConnection;
@ -1578,9 +1591,13 @@ namespace OpenSim.Region.Environment.Scenes
/// <param name="action"></param>
public void ForEachScenePresence(Action<ScenePresence> action)
{
foreach (ScenePresence presence in m_scenePresences.Values)
// We don't want to try to send messages if there are no avatar.
if (!(m_scenePresences.Equals(null)))
{
action(presence);
foreach (ScenePresence presence in m_scenePresences.Values)
{
action(presence);
}
}
}

View File

@ -41,7 +41,6 @@ namespace OpenSim.Region.Environment.Scenes
#region Events
public event restart OnRestart;
public event regionup OnRegionUp;
#endregion
@ -160,7 +159,7 @@ namespace OpenSim.Region.Environment.Scenes
}
public abstract void OtherRegionUp(RegionInfo thisRegion);
public abstract bool OtherRegionUp(RegionInfo thisRegion);
#endregion

View File

@ -21,6 +21,7 @@ namespace OpenSim.Region.Environment.Scenes
public event ExpectUserDelegate OnExpectUser;
public event CloseAgentConnection OnCloseAgentConnection;
public event PrimCrossing OnPrimCrossingIntoRegion;
public event RegionUp OnRegionUp;
public SceneCommunicationService(CommunicationsManager commsMan)
@ -38,6 +39,7 @@ namespace OpenSim.Region.Environment.Scenes
regionCommsHost.OnAvatarCrossingIntoRegion += AgentCrossing;
regionCommsHost.OnPrimCrossingIntoRegion += PrimCrossing;
regionCommsHost.OnCloseAgentConnection += CloseConnection;
regionCommsHost.OnRegionUp += newRegionUp;
}
@ -45,12 +47,16 @@ namespace OpenSim.Region.Environment.Scenes
public void Close()
{
regionCommsHost.OnExpectUser -= NewUserConnection;
regionCommsHost.OnAvatarCrossingIntoRegion -= AgentCrossing;
regionCommsHost.OnPrimCrossingIntoRegion -= PrimCrossing;
regionCommsHost.OnCloseAgentConnection -= CloseConnection;
m_commsProvider.GridService.DeregisterRegion(m_regionInfo);
regionCommsHost = null;
if (regionCommsHost != null)
{
regionCommsHost.OnRegionUp -= newRegionUp;
regionCommsHost.OnExpectUser -= NewUserConnection;
regionCommsHost.OnAvatarCrossingIntoRegion -= AgentCrossing;
regionCommsHost.OnPrimCrossingIntoRegion -= PrimCrossing;
regionCommsHost.OnCloseAgentConnection -= CloseConnection;
m_commsProvider.GridService.DeregisterRegion(m_regionInfo);
regionCommsHost = null;
}
}
#region CommsManager Event handlers
@ -59,6 +65,7 @@ namespace OpenSim.Region.Environment.Scenes
/// </summary>
/// <param name="regionHandle"></param>
/// <param name="agent"></param>
///
protected void NewUserConnection(ulong regionHandle, AgentCircuitData agent)
{
if (OnExpectUser != null)
@ -67,6 +74,15 @@ namespace OpenSim.Region.Environment.Scenes
}
}
protected bool newRegionUp(RegionInfo region)
{
if (OnRegionUp != null)
{
OnRegionUp(region);
}
return true;
}
protected void AgentCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position, bool isFlying)
{
if (OnAvatarCrossingIntoRegion != null)
@ -249,6 +265,11 @@ namespace OpenSim.Region.Environment.Scenes
return m_commsProvider.InterRegion.ExpectAvatarCrossing(regionhandle, agentID, position, isFlying);
}
public void InformNeighborsThatRegionisUp(RegionInfo region)
{
bool val = m_commsProvider.InterRegion.RegionUp(region);
}
public bool PrimCrossToNeighboringRegion(ulong regionhandle, LLUUID primID, LLVector3 position, bool isPhysical)
{
return m_commsProvider.InterRegion.ExpectPrimCrossing(regionhandle, primID, position, isPhysical);

View File

@ -121,17 +121,35 @@ namespace OpenSim.Region.Environment.Scenes
public void SendSimOnlineNotification(ulong regionHandle)
{
RegionInfo Result = null;
for (int i = 0; i < m_localScenes.Count; i++)
{
if (m_localScenes[i].RegionInfo.RegionHandle != regionHandle)
if (m_localScenes[i].RegionInfo.RegionHandle == regionHandle)
{
// Inform other regions to tell their avatar about me
m_localScenes[i].OtherRegionUp(m_localScenes[i].RegionInfo);
Result = m_localScenes[i].RegionInfo;
}
}
if (!(Result.Equals(null)))
{
for (int i = 0; i < m_localScenes.Count; i++)
{
if (m_localScenes[i].RegionInfo.RegionHandle != regionHandle)
{
// Inform other regions to tell their avatar about me
//m_localScenes[i].OtherRegionUp(Result);
}
}
}
else
{
MainLog.Instance.Error("REGION", "Unable to notify Other regions of this Region coming up");
}
}
public void SaveCurrentSceneToXml(string filename)
{