diff options
author | Justin Clark-Casey (justincc) | 2012-11-23 02:22:30 +0000 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2012-11-23 02:22:30 +0000 |
commit | 8c8c8a00a47b61fcfd4a500ac8f13aa1aafaad26 (patch) | |
tree | fbaa01d3747e741d3384603b77c72813b2aa8b86 /OpenSim/Region/Application | |
parent | Add regression test for checking scene close when SceneManager is asked to close (diff) | |
download | opensim-SC_OLD-8c8c8a00a47b61fcfd4a500ac8f13aa1aafaad26.zip opensim-SC_OLD-8c8c8a00a47b61fcfd4a500ac8f13aa1aafaad26.tar.gz opensim-SC_OLD-8c8c8a00a47b61fcfd4a500ac8f13aa1aafaad26.tar.bz2 opensim-SC_OLD-8c8c8a00a47b61fcfd4a500ac8f13aa1aafaad26.tar.xz |
Fix problem where restarting the currently selected region would stop various console commands (e.g. "show users") from working.
This was because the "currently selected" scene reference was being left as the dead scene instead of the restarted Scene object.
Diffstat (limited to 'OpenSim/Region/Application')
-rw-r--r-- | OpenSim/Region/Application/OpenSim.cs | 20 | ||||
-rw-r--r-- | OpenSim/Region/Application/OpenSimBase.cs | 11 |
2 files changed, 26 insertions, 5 deletions
diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs index 17b2167..cffbb3b 100644 --- a/OpenSim/Region/Application/OpenSim.cs +++ b/OpenSim/Region/Application/OpenSim.cs | |||
@@ -664,12 +664,20 @@ namespace OpenSim | |||
664 | 664 | ||
665 | if (!SceneManager.TrySetCurrentScene(newRegionName)) | 665 | if (!SceneManager.TrySetCurrentScene(newRegionName)) |
666 | MainConsole.Instance.Output(String.Format("Couldn't select region {0}", newRegionName)); | 666 | MainConsole.Instance.Output(String.Format("Couldn't select region {0}", newRegionName)); |
667 | else | ||
668 | RefreshPrompt(); | ||
667 | } | 669 | } |
668 | else | 670 | else |
669 | { | 671 | { |
670 | MainConsole.Instance.Output("Usage: change region <region name>"); | 672 | MainConsole.Instance.Output("Usage: change region <region name>"); |
671 | } | 673 | } |
674 | } | ||
672 | 675 | ||
676 | /// <summary> | ||
677 | /// Refreshs prompt with the current selection details. | ||
678 | /// </summary> | ||
679 | private void RefreshPrompt() | ||
680 | { | ||
673 | string regionName = (SceneManager.CurrentScene == null ? "root" : SceneManager.CurrentScene.RegionInfo.RegionName); | 681 | string regionName = (SceneManager.CurrentScene == null ? "root" : SceneManager.CurrentScene.RegionInfo.RegionName); |
674 | MainConsole.Instance.Output(String.Format("Currently selected region is {0}", regionName)); | 682 | MainConsole.Instance.Output(String.Format("Currently selected region is {0}", regionName)); |
675 | 683 | ||
@@ -691,6 +699,18 @@ namespace OpenSim | |||
691 | m_console.ConsoleScene = SceneManager.CurrentScene; | 699 | m_console.ConsoleScene = SceneManager.CurrentScene; |
692 | } | 700 | } |
693 | 701 | ||
702 | protected override void HandleRestartRegion(RegionInfo whichRegion) | ||
703 | { | ||
704 | base.HandleRestartRegion(whichRegion); | ||
705 | |||
706 | // Where we are restarting multiple scenes at once, a previous call to RefreshPrompt may have set the | ||
707 | // m_console.ConsoleScene to null (indicating all scenes). | ||
708 | if (m_console.ConsoleScene != null && whichRegion.RegionName == ((Scene)m_console.ConsoleScene).Name) | ||
709 | SceneManager.TrySetCurrentScene(whichRegion.RegionName); | ||
710 | |||
711 | RefreshPrompt(); | ||
712 | } | ||
713 | |||
694 | /// <summary> | 714 | /// <summary> |
695 | /// Turn on some debugging values for OpenSim. | 715 | /// Turn on some debugging values for OpenSim. |
696 | /// </summary> | 716 | /// </summary> |
diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs index b40aa4b..c3c87e7 100644 --- a/OpenSim/Region/Application/OpenSimBase.cs +++ b/OpenSim/Region/Application/OpenSimBase.cs | |||
@@ -299,7 +299,7 @@ namespace OpenSim | |||
299 | // Called from base.StartUp() | 299 | // Called from base.StartUp() |
300 | 300 | ||
301 | m_httpServerPort = m_networkServersInfo.HttpListenerPort; | 301 | m_httpServerPort = m_networkServersInfo.HttpListenerPort; |
302 | SceneManager.OnRestartSim += handleRestartRegion; | 302 | SceneManager.OnRestartSim += HandleRestartRegion; |
303 | 303 | ||
304 | // Only enable the watchdogs when all regions are ready. Otherwise we get false positives when cpu is | 304 | // Only enable the watchdogs when all regions are ready. Otherwise we get false positives when cpu is |
305 | // heavily used during initial startup. | 305 | // heavily used during initial startup. |
@@ -735,9 +735,11 @@ namespace OpenSim | |||
735 | } | 735 | } |
736 | } | 736 | } |
737 | 737 | ||
738 | public void handleRestartRegion(RegionInfo whichRegion) | 738 | protected virtual void HandleRestartRegion(RegionInfo whichRegion) |
739 | { | 739 | { |
740 | m_log.Info("[OPENSIM]: Got restart signal from SceneManager"); | 740 | m_log.InfoFormat( |
741 | "[OPENSIM]: Got restart signal from SceneManager for region {0} ({1},{2})", | ||
742 | whichRegion.RegionName, whichRegion.RegionLocX, whichRegion.RegionLocY); | ||
741 | 743 | ||
742 | ShutdownClientServer(whichRegion); | 744 | ShutdownClientServer(whichRegion); |
743 | IScene scene; | 745 | IScene scene; |
@@ -883,7 +885,6 @@ namespace OpenSim | |||
883 | m_log.Info("[SHUTDOWN]: Closing all threads"); | 885 | m_log.Info("[SHUTDOWN]: Closing all threads"); |
884 | m_log.Info("[SHUTDOWN]: Killing listener thread"); | 886 | m_log.Info("[SHUTDOWN]: Killing listener thread"); |
885 | m_log.Info("[SHUTDOWN]: Killing clients"); | 887 | m_log.Info("[SHUTDOWN]: Killing clients"); |
886 | // TODO: implement this | ||
887 | m_log.Info("[SHUTDOWN]: Closing console and terminating"); | 888 | m_log.Info("[SHUTDOWN]: Closing console and terminating"); |
888 | 889 | ||
889 | try | 890 | try |
@@ -892,7 +893,7 @@ namespace OpenSim | |||
892 | } | 893 | } |
893 | catch (Exception e) | 894 | catch (Exception e) |
894 | { | 895 | { |
895 | m_log.ErrorFormat("[SHUTDOWN]: Ignoring failure during shutdown - {0}", e); | 896 | m_log.Error("[SHUTDOWN]: Ignoring failure during shutdown - ", e); |
896 | } | 897 | } |
897 | } | 898 | } |
898 | 899 | ||