aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes
diff options
context:
space:
mode:
authorMelanie2012-11-23 03:42:04 +0000
committerMelanie2012-11-23 03:42:04 +0000
commit01f06b90dd5d76833e8f2b4709d901e128a1667b (patch)
treebcd34a45717cfe725a99317135ec754dadb1093c /OpenSim/Region/Framework/Scenes
parentFix new command console code to match the output of the original while keeping (diff)
parentMerge branch 'master' into careminster (diff)
downloadopensim-SC_OLD-01f06b90dd5d76833e8f2b4709d901e128a1667b.zip
opensim-SC_OLD-01f06b90dd5d76833e8f2b4709d901e128a1667b.tar.gz
opensim-SC_OLD-01f06b90dd5d76833e8f2b4709d901e128a1667b.tar.bz2
opensim-SC_OLD-01f06b90dd5d76833e8f2b4709d901e128a1667b.tar.xz
Merge branch 'careminster' into avination
Diffstat (limited to 'OpenSim/Region/Framework/Scenes')
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs10
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneManager.cs32
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneManagerTests.cs58
3 files changed, 81 insertions, 19 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 80d9f6e..c99e37e 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -1167,15 +1167,9 @@ namespace OpenSim.Region.Framework.Scenes
1167 } 1167 }
1168 } 1168 }
1169 1169
1170 m_log.Error("[REGION]: Closing"); 1170 m_log.InfoFormat("[REGION]: Restarting region {0}", Name);
1171 Close();
1172 1171
1173 if (PhysicsScene != null) 1172 Close();
1174 {
1175 PhysicsScene.Dispose();
1176 }
1177
1178 m_log.Error("[REGION]: Firing Region Restart Message");
1179 1173
1180 base.Restart(); 1174 base.Restart();
1181 } 1175 }
diff --git a/OpenSim/Region/Framework/Scenes/SceneManager.cs b/OpenSim/Region/Framework/Scenes/SceneManager.cs
index ff12d94..0e0b6c3 100644
--- a/OpenSim/Region/Framework/Scenes/SceneManager.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneManager.cs
@@ -107,16 +107,19 @@ namespace OpenSim.Region.Framework.Scenes
107 get { return new List<Scene>(m_localScenes.FindAll(delegate(Scene s) { return true; })); } 107 get { return new List<Scene>(m_localScenes.FindAll(delegate(Scene s) { return true; })); }
108 } 108 }
109 109
110 public Scene CurrentScene 110 /// <summary>
111 { 111 /// Scene selected from the console.
112 get { return m_currentScene; } 112 /// </summary>
113 } 113 /// <value>
114 /// If null, then all scenes are considered selected (signalled as "Root" on the console).
115 /// </value>
116 public Scene CurrentScene { get; private set; }
114 117
115 public Scene CurrentOrFirstScene 118 public Scene CurrentOrFirstScene
116 { 119 {
117 get 120 get
118 { 121 {
119 if (m_currentScene == null) 122 if (CurrentScene == null)
120 { 123 {
121 List<Scene> sceneList = Scenes; 124 List<Scene> sceneList = Scenes;
122 if (sceneList.Count == 0) 125 if (sceneList.Count == 0)
@@ -125,7 +128,7 @@ namespace OpenSim.Region.Framework.Scenes
125 } 128 }
126 else 129 else
127 { 130 {
128 return m_currentScene; 131 return CurrentScene;
129 } 132 }
130 } 133 }
131 } 134 }
@@ -169,11 +172,18 @@ namespace OpenSim.Region.Framework.Scenes
169 172
170 public void HandleRestart(RegionInfo rdata) 173 public void HandleRestart(RegionInfo rdata)
171 { 174 {
172 m_log.Error("[SCENEMANAGER]: Got Restart message for region:" + rdata.RegionName + " Sending up to main"); 175 Scene restartedScene = null;
173 int RegionSceneElement = -1;
174 176
175 lock (m_localScenes) 177 lock (m_localScenes)
178 {
179 m_localScenes.TryGetValue(rdata.RegionID, out restartedScene);
176 m_localScenes.Remove(rdata.RegionID); 180 m_localScenes.Remove(rdata.RegionID);
181 }
182
183 // If the currently selected scene has been restarted, then we can't reselect here since we the scene
184 // hasn't yet been recreated. We will have to leave this to the caller.
185 if (CurrentScene == restartedScene)
186 CurrentScene = null;
177 187
178 // Send signal to main that we're restarting this sim. 188 // Send signal to main that we're restarting this sim.
179 OnRestartSim(rdata); 189 OnRestartSim(rdata);
@@ -313,14 +323,14 @@ namespace OpenSim.Region.Framework.Scenes
313 323
314 private void ForEachCurrentScene(Action<Scene> func) 324 private void ForEachCurrentScene(Action<Scene> func)
315 { 325 {
316 if (m_currentScene == null) 326 if (CurrentScene == null)
317 { 327 {
318 List<Scene> sceneList = Scenes; 328 List<Scene> sceneList = Scenes;
319 sceneList.ForEach(func); 329 sceneList.ForEach(func);
320 } 330 }
321 else 331 else
322 { 332 {
323 func(m_currentScene); 333 func(CurrentScene);
324 } 334 }
325 } 335 }
326 336
@@ -340,7 +350,7 @@ namespace OpenSim.Region.Framework.Scenes
340 || (String.Compare(regionName, "..") == 0) 350 || (String.Compare(regionName, "..") == 0)
341 || (String.Compare(regionName, "/") == 0)) 351 || (String.Compare(regionName, "/") == 0))
342 { 352 {
343 m_currentScene = null; 353 CurrentScene = null;
344 return true; 354 return true;
345 } 355 }
346 else 356 else
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneManagerTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneManagerTests.cs
new file mode 100644
index 0000000..ab56f4e
--- /dev/null
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneManagerTests.cs
@@ -0,0 +1,58 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using System.Reflection;
31using System.Threading;
32using NUnit.Framework;
33using OpenMetaverse;
34using OpenSim.Framework;
35using OpenSim.Framework.Communications;
36using OpenSim.Region.Framework.Scenes;
37using OpenSim.Services.Interfaces;
38using OpenSim.Tests.Common;
39using OpenSim.Tests.Common.Mock;
40
41namespace OpenSim.Region.Framework.Scenes.Tests
42{
43 [TestFixture]
44 public class SceneManagerTests
45 {
46 [Test]
47 public void TestClose()
48 {
49 TestHelpers.InMethod();
50
51 SceneHelpers sh = new SceneHelpers();
52 Scene scene = sh.SetupScene();
53
54 sh.SceneManager.Close();
55 Assert.That(scene.ShuttingDown, Is.True);
56 }
57 }
58} \ No newline at end of file