aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorMelanie2012-11-23 03:42:04 +0000
committerMelanie2012-11-23 03:42:04 +0000
commit01f06b90dd5d76833e8f2b4709d901e128a1667b (patch)
treebcd34a45717cfe725a99317135ec754dadb1093c /OpenSim
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')
-rw-r--r--OpenSim/Region/Application/OpenSim.cs20
-rw-r--r--OpenSim/Region/Application/OpenSimBase.cs11
-rw-r--r--OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs25
-rw-r--r--OpenSim/Region/CoreModules/World/Region/RestartModule.cs6
-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
7 files changed, 129 insertions, 33 deletions
diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs
index 7cafc5d..08e4023 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 33680b5..bed9a49 100644
--- a/OpenSim/Region/Application/OpenSimBase.cs
+++ b/OpenSim/Region/Application/OpenSimBase.cs
@@ -314,7 +314,7 @@ namespace OpenSim
314 // Called from base.StartUp() 314 // Called from base.StartUp()
315 315
316 m_httpServerPort = m_networkServersInfo.HttpListenerPort; 316 m_httpServerPort = m_networkServersInfo.HttpListenerPort;
317 SceneManager.OnRestartSim += handleRestartRegion; 317 SceneManager.OnRestartSim += HandleRestartRegion;
318 318
319 // Only enable the watchdogs when all regions are ready. Otherwise we get false positives when cpu is 319 // Only enable the watchdogs when all regions are ready. Otherwise we get false positives when cpu is
320 // heavily used during initial startup. 320 // heavily used during initial startup.
@@ -819,9 +819,11 @@ namespace OpenSim
819 } 819 }
820 } 820 }
821 821
822 public void handleRestartRegion(RegionInfo whichRegion) 822 protected virtual void HandleRestartRegion(RegionInfo whichRegion)
823 { 823 {
824 m_log.Info("[OPENSIM]: Got restart signal from SceneManager"); 824 m_log.InfoFormat(
825 "[OPENSIM]: Got restart signal from SceneManager for region {0} ({1},{2})",
826 whichRegion.RegionName, whichRegion.RegionLocX, whichRegion.RegionLocY);
825 827
826 ShutdownClientServer(whichRegion); 828 ShutdownClientServer(whichRegion);
827 IScene scene; 829 IScene scene;
@@ -967,7 +969,6 @@ namespace OpenSim
967 m_log.Info("[SHUTDOWN]: Closing all threads"); 969 m_log.Info("[SHUTDOWN]: Closing all threads");
968 m_log.Info("[SHUTDOWN]: Killing listener thread"); 970 m_log.Info("[SHUTDOWN]: Killing listener thread");
969 m_log.Info("[SHUTDOWN]: Killing clients"); 971 m_log.Info("[SHUTDOWN]: Killing clients");
970 // TODO: implement this
971 m_log.Info("[SHUTDOWN]: Closing console and terminating"); 972 m_log.Info("[SHUTDOWN]: Closing console and terminating");
972 973
973 try 974 try
@@ -976,7 +977,7 @@ namespace OpenSim
976 } 977 }
977 catch (Exception e) 978 catch (Exception e)
978 { 979 {
979 m_log.ErrorFormat("[SHUTDOWN]: Ignoring failure during shutdown - {0}", e); 980 m_log.Error("[SHUTDOWN]: Ignoring failure during shutdown - ", e);
980 } 981 }
981 } 982 }
982 983
diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
index e1c5418..dc062b6 100644
--- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
+++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
@@ -294,6 +294,10 @@ namespace OpenSim.Region.CoreModules.World.Estate
294 } 294 }
295 295
296 restartModule.ScheduleRestart(UUID.Zero, "Region will restart in {0}", times.ToArray(), false); 296 restartModule.ScheduleRestart(UUID.Zero, "Region will restart in {0}", times.ToArray(), false);
297
298 m_log.InfoFormat(
299 "User {0} requested restart of region {1} in {2} seconds",
300 remoteClient.Name, Scene.Name, times.Count != 0 ? times[0] : 0);
297 } 301 }
298 } 302 }
299 303
@@ -318,7 +322,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
318 322
319 if ((estateAccessType & 4) != 0) // User add 323 if ((estateAccessType & 4) != 0) // User add
320 { 324 {
321 if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || Scene.Permissions.BypassPermissions()) 325 if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true))
322 { 326 {
323 if ((estateAccessType & 1) != 0) // All estates 327 if ((estateAccessType & 1) != 0) // All estates
324 { 328 {
@@ -350,7 +354,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
350 } 354 }
351 if ((estateAccessType & 8) != 0) // User remove 355 if ((estateAccessType & 8) != 0) // User remove
352 { 356 {
353 if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || Scene.Permissions.BypassPermissions()) 357 if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true))
354 { 358 {
355 if ((estateAccessType & 1) != 0) // All estates 359 if ((estateAccessType & 1) != 0) // All estates
356 { 360 {
@@ -381,7 +385,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
381 } 385 }
382 if ((estateAccessType & 16) != 0) // Group add 386 if ((estateAccessType & 16) != 0) // Group add
383 { 387 {
384 if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || Scene.Permissions.BypassPermissions()) 388 if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true))
385 { 389 {
386 if ((estateAccessType & 1) != 0) // All estates 390 if ((estateAccessType & 1) != 0) // All estates
387 { 391 {
@@ -410,9 +414,10 @@ namespace OpenSim.Region.CoreModules.World.Estate
410 remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions"); 414 remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions");
411 } 415 }
412 } 416 }
417
413 if ((estateAccessType & 32) != 0) // Group remove 418 if ((estateAccessType & 32) != 0) // Group remove
414 { 419 {
415 if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || Scene.Permissions.BypassPermissions()) 420 if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true))
416 { 421 {
417 if ((estateAccessType & 1) != 0) // All estates 422 if ((estateAccessType & 1) != 0) // All estates
418 { 423 {
@@ -441,9 +446,10 @@ namespace OpenSim.Region.CoreModules.World.Estate
441 remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions"); 446 remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions");
442 } 447 }
443 } 448 }
449
444 if ((estateAccessType & 64) != 0) // Ban add 450 if ((estateAccessType & 64) != 0) // Ban add
445 { 451 {
446 if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, false) || Scene.Permissions.BypassPermissions()) 452 if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, false))
447 { 453 {
448 EstateBan[] banlistcheck = Scene.RegionInfo.EstateSettings.EstateBans; 454 EstateBan[] banlistcheck = Scene.RegionInfo.EstateSettings.EstateBans;
449 455
@@ -522,9 +528,10 @@ namespace OpenSim.Region.CoreModules.World.Estate
522 remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions"); 528 remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions");
523 } 529 }
524 } 530 }
531
525 if ((estateAccessType & 128) != 0) // Ban remove 532 if ((estateAccessType & 128) != 0) // Ban remove
526 { 533 {
527 if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, false) || Scene.Permissions.BypassPermissions()) 534 if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, false))
528 { 535 {
529 EstateBan[] banlistcheck = Scene.RegionInfo.EstateSettings.EstateBans; 536 EstateBan[] banlistcheck = Scene.RegionInfo.EstateSettings.EstateBans;
530 537
@@ -577,9 +584,10 @@ namespace OpenSim.Region.CoreModules.World.Estate
577 remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions"); 584 remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions");
578 } 585 }
579 } 586 }
587
580 if ((estateAccessType & 256) != 0) // Manager add 588 if ((estateAccessType & 256) != 0) // Manager add
581 { 589 {
582 if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || Scene.Permissions.BypassPermissions()) 590 if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true))
583 { 591 {
584 if ((estateAccessType & 1) != 0) // All estates 592 if ((estateAccessType & 1) != 0) // All estates
585 { 593 {
@@ -608,9 +616,10 @@ namespace OpenSim.Region.CoreModules.World.Estate
608 remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions"); 616 remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions");
609 } 617 }
610 } 618 }
619
611 if ((estateAccessType & 512) != 0) // Manager remove 620 if ((estateAccessType & 512) != 0) // Manager remove
612 { 621 {
613 if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || Scene.Permissions.BypassPermissions()) 622 if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true))
614 { 623 {
615 if ((estateAccessType & 1) != 0) // All estates 624 if ((estateAccessType & 1) != 0) // All estates
616 { 625 {
diff --git a/OpenSim/Region/CoreModules/World/Region/RestartModule.cs b/OpenSim/Region/CoreModules/World/Region/RestartModule.cs
index 287738a..9c441ed 100644
--- a/OpenSim/Region/CoreModules/World/Region/RestartModule.cs
+++ b/OpenSim/Region/CoreModules/World/Region/RestartModule.cs
@@ -26,6 +26,7 @@
26 */ 26 */
27 27
28using System; 28using System;
29using System.Linq;
29using System.Reflection; 30using System.Reflection;
30using System.Timers; 31using System.Timers;
31using System.IO; 32using System.IO;
@@ -305,6 +306,9 @@ namespace OpenSim.Region.CoreModules.World.Region
305 for (int i = 4 ; i < args.Length ; i++) 306 for (int i = 4 ; i < args.Length ; i++)
306 times.Add(Convert.ToInt32(args[i])); 307 times.Add(Convert.ToInt32(args[i]));
307 308
309 MainConsole.Instance.OutputFormat(
310 "Region {0} scheduled for restart in {1} seconds", m_Scene.Name, times.Sum());
311
308 ScheduleRestart(UUID.Zero, args[3], times.ToArray(), notice); 312 ScheduleRestart(UUID.Zero, args[3], times.ToArray(), notice);
309 } 313 }
310 314
@@ -328,4 +332,4 @@ namespace OpenSim.Region.CoreModules.World.Region
328 } 332 }
329 } 333 }
330 } 334 }
331} 335} \ No newline at end of file
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