From d263a044b1ebb13477b2b391637ccc2da4368838 Mon Sep 17 00:00:00 2001 From: Teravus Ovares Date: Sun, 25 Nov 2007 04:52:14 +0000 Subject: * Added the ability to restart your individual sims from within them using the estate tools. * The sims properly restart, however they don't yet notify the existing avatars that they are up. To see the sim again, you'll need to log-out and back in until I can figure out how to get the proper data to the sims and to the avatar so they reconnect again. --- OpenSim/Region/Application/OpenSimMain.cs | 46 ++++++++++++++++++++++++++++++- 1 file changed, 45 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/Application/OpenSimMain.cs') diff --git a/OpenSim/Region/Application/OpenSimMain.cs b/OpenSim/Region/Application/OpenSimMain.cs index ed16cd4..8edfc6f 100644 --- a/OpenSim/Region/Application/OpenSimMain.cs +++ b/OpenSim/Region/Application/OpenSimMain.cs @@ -320,7 +320,7 @@ namespace OpenSim plugin.Initialise(this); m_plugins.Add(plugin); } - + // Start UDP servers for (int i = 0; i < m_udpServers.Count; i++) { @@ -412,6 +412,50 @@ namespace OpenSim m_assetCache = new AssetCache(assetServer, m_log); // m_assetCache = new assetCache("OpenSim.Region.GridInterfaces.Local.dll", m_networkServersInfo.AssetURL, m_networkServersInfo.AssetSendKey); + m_sceneManager.OnReStartSim += handleReStartRegion; + + } + public void handleReStartRegion(RegionInfo whichRegion) + { + MainLog.Instance.Error("MAIN", "Got Restart Singlal from SceneManager"); + // Shutting down the UDP server + bool foundUDPServer = false; + int UDPServerElement = 0; + + for (int i = 0; i < m_udpServers.Count; i++) + { + + if (m_udpServers[i].RegionHandle == whichRegion.RegionHandle) + { + UDPServerElement = i; + foundUDPServer = true; + break; + } + } + if (foundUDPServer) + { + // m_udpServers[UDPServerElement].Server.End + m_udpServers[UDPServerElement].Server.Close(); + m_udpServers.RemoveAt(UDPServerElement); + } + + //Removing the region from the sim's database of regions.. + int RegionHandleElement = -1; + for (int i = 0; i < m_regionData.Count; i++) + { + if (whichRegion.RegionHandle == m_regionData[i].RegionHandle) + { + RegionHandleElement = i; + } + } + if (RegionHandleElement >= 0) + { + m_regionData.RemoveAt(RegionHandleElement); + } + UDPServer restartingRegion = CreateRegion(whichRegion); + restartingRegion.ServerListener(); + m_sceneManager.SendSimOnlineNotification(restartingRegion.RegionHandle); + } protected override LogBase CreateLog() -- cgit v1.1