mirror of
https://github.com/opensim/opensim.git
synced 2026-08-08 18:25:33 +08:00
* 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.
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user