aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes
diff options
context:
space:
mode:
authorMelanie2012-07-28 00:39:36 +0100
committerMelanie2012-07-28 00:39:36 +0100
commit771d79e83e9ef5686aee5fe1c572673cff291083 (patch)
treeb37749fc1929ffd6dd1b9c2c4e29120accf26b99 /OpenSim/Region/Framework/Scenes
parentMerge branch 'master' into careminster (diff)
parentLSL/OSSL lacks Math.Min & Math.Max implementations. (diff)
downloadopensim-SC-771d79e83e9ef5686aee5fe1c572673cff291083.zip
opensim-SC-771d79e83e9ef5686aee5fe1c572673cff291083.tar.gz
opensim-SC-771d79e83e9ef5686aee5fe1c572673cff291083.tar.bz2
opensim-SC-771d79e83e9ef5686aee5fe1c572673cff291083.tar.xz
Merge branch 'master' into careminster
Conflicts: OpenSim/Framework/Monitoring/BaseStatsCollector.cs OpenSim/Region/Application/OpenSim.cs OpenSim/Region/Application/OpenSimBase.cs OpenSim/Region/Framework/Scenes/SceneManager.cs bin/OpenMetaverse.Rendering.Meshmerizer.dll bin/OpenMetaverse.StructuredData.dll bin/OpenMetaverse.dll bin/OpenMetaverseTypes.dll prebuild.xml
Diffstat (limited to 'OpenSim/Region/Framework/Scenes')
-rw-r--r--OpenSim/Region/Framework/Scenes/EventManager.cs11
-rw-r--r--OpenSim/Region/Framework/Scenes/RegionStatsHandler.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Inventory.cs69
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs22
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneBase.cs18
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneManager.cs60
-rw-r--r--OpenSim/Region/Framework/Scenes/SimStatsReporter.cs2
7 files changed, 144 insertions, 40 deletions
diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs
index 418904f..7cb3811 100644
--- a/OpenSim/Region/Framework/Scenes/EventManager.cs
+++ b/OpenSim/Region/Framework/Scenes/EventManager.cs
@@ -517,8 +517,7 @@ namespace OpenSim.Region.Framework.Scenes
517 /// A region is considered ready when startup operations such as loading of scripts already on the region 517 /// A region is considered ready when startup operations such as loading of scripts already on the region
518 /// have been completed. 518 /// have been completed.
519 /// </remarks> 519 /// </remarks>
520 public event RegionReady OnRegionReady; 520 public event Action<IScene> OnRegionReadyStatusChange;
521 public delegate void RegionReady(IScene scene);
522 521
523 public delegate void PrimsLoaded(Scene s); 522 public delegate void PrimsLoaded(Scene s);
524 public event PrimsLoaded OnPrimsLoaded; 523 public event PrimsLoaded OnPrimsLoaded;
@@ -2533,13 +2532,13 @@ namespace OpenSim.Region.Framework.Scenes
2533 } 2532 }
2534 } 2533 }
2535 2534
2536 public void TriggerRegionReady(IScene scene) 2535 public void TriggerRegionReadyStatusChange(IScene scene)
2537 { 2536 {
2538 RegionReady handler = OnRegionReady; 2537 Action<IScene> handler = OnRegionReadyStatusChange;
2539 2538
2540 if (handler != null) 2539 if (handler != null)
2541 { 2540 {
2542 foreach (RegionReady d in handler.GetInvocationList()) 2541 foreach (Action<IScene> d in handler.GetInvocationList())
2543 { 2542 {
2544 try 2543 try
2545 { 2544 {
@@ -2547,7 +2546,7 @@ namespace OpenSim.Region.Framework.Scenes
2547 } 2546 }
2548 catch (Exception e) 2547 catch (Exception e)
2549 { 2548 {
2550 m_log.ErrorFormat("[EVENT MANAGER]: Delegate for OnRegionReady failed - continuing {0} - {1}", 2549 m_log.ErrorFormat("[EVENT MANAGER]: Delegate for OnRegionReadyStatusChange failed - continuing {0} - {1}",
2551 e.Message, e.StackTrace); 2550 e.Message, e.StackTrace);
2552 } 2551 }
2553 } 2552 }
diff --git a/OpenSim/Region/Framework/Scenes/RegionStatsHandler.cs b/OpenSim/Region/Framework/Scenes/RegionStatsHandler.cs
index 1365831..c11174d 100644
--- a/OpenSim/Region/Framework/Scenes/RegionStatsHandler.cs
+++ b/OpenSim/Region/Framework/Scenes/RegionStatsHandler.cs
@@ -39,7 +39,7 @@ using OpenSim.Framework.Communications;
39using OpenSim.Framework.Console; 39using OpenSim.Framework.Console;
40using OpenSim.Framework.Servers; 40using OpenSim.Framework.Servers;
41using OpenSim.Framework.Servers.HttpServer; 41using OpenSim.Framework.Servers.HttpServer;
42using OpenSim.Framework.Statistics; 42using OpenSim.Framework.Monitoring;
43using OpenSim.Region.Framework; 43using OpenSim.Region.Framework;
44using OpenSim.Region.Framework.Interfaces; 44using OpenSim.Region.Framework.Interfaces;
45using OpenSim.Region.Framework.Scenes; 45using OpenSim.Region.Framework.Scenes;
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index 98b8fcc..672d95a 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -811,16 +811,20 @@ namespace OpenSim.Region.Framework.Scenes
811 && oldAgentID == LibraryService.LibraryRootFolder.Owner)) 811 && oldAgentID == LibraryService.LibraryRootFolder.Owner))
812 { 812 {
813 CreateNewInventoryItem( 813 CreateNewInventoryItem(
814 remoteClient, item.CreatorId, item.CreatorData, newFolderID, newName, item.Flags, callbackID, asset, (sbyte)item.InvType, 814 remoteClient, item.CreatorId, item.CreatorData, newFolderID,
815 item.BasePermissions, item.CurrentPermissions, item.EveryOnePermissions, item.NextPermissions, item.GroupPermissions, Util.UnixTimeSinceEpoch()); 815 newName, item.Description, item.Flags, callbackID, asset, (sbyte)item.InvType,
816 item.BasePermissions, item.CurrentPermissions, item.EveryOnePermissions,
817 item.NextPermissions, item.GroupPermissions, Util.UnixTimeSinceEpoch());
816 } 818 }
817 else 819 else
818 { 820 {
819 // If item is transfer or permissions are off or calling agent is allowed to copy item owner's inventory item. 821 // If item is transfer or permissions are off or calling agent is allowed to copy item owner's inventory item.
820 if (((item.CurrentPermissions & (uint)PermissionMask.Transfer) != 0) && (m_permissions.BypassPermissions() || m_permissions.CanCopyUserInventory(remoteClient.AgentId, oldItemID))) 822 if (((item.CurrentPermissions & (uint)PermissionMask.Transfer) != 0)
823 && (m_permissions.BypassPermissions()
824 || m_permissions.CanCopyUserInventory(remoteClient.AgentId, oldItemID)))
821 { 825 {
822 CreateNewInventoryItem( 826 CreateNewInventoryItem(
823 remoteClient, item.CreatorId, item.CreatorData, newFolderID, newName, item.Flags, callbackID, 827 remoteClient, item.CreatorId, item.CreatorData, newFolderID, newName, item.Description, item.Flags, callbackID,
824 asset, (sbyte) item.InvType, 828 asset, (sbyte) item.InvType,
825 item.NextPermissions, item.NextPermissions, item.EveryOnePermissions & item.NextPermissions, 829 item.NextPermissions, item.NextPermissions, item.EveryOnePermissions & item.NextPermissions,
826 item.NextPermissions, item.GroupPermissions, Util.UnixTimeSinceEpoch()); 830 item.NextPermissions, item.GroupPermissions, Util.UnixTimeSinceEpoch());
@@ -885,32 +889,50 @@ namespace OpenSim.Region.Framework.Scenes
885 /// <summary> 889 /// <summary>
886 /// Create a new inventory item. 890 /// Create a new inventory item.
887 /// </summary> 891 /// </summary>
888 /// <param name="remoteClient"></param> 892 /// <param name="remoteClient">Client creating this inventory item.</param>
889 /// <param name="folderID"></param> 893 /// <param name="creatorID"></param>
890 /// <param name="callbackID"></param> 894 /// <param name="creatorData"></param>
891 /// <param name="asset"></param> 895 /// <param name="folderID">UUID of folder in which this item should be placed.</param>
892 /// <param name="invType"></param> 896 /// <param name="name">Item name.</para>
893 /// <param name="nextOwnerMask"></param> 897 /// <param name="description">Item description.</param>
894 public void CreateNewInventoryItem(IClientAPI remoteClient, string creatorID, string creatorData, UUID folderID, string name, uint flags, uint callbackID, 898 /// <param name="flags">Item flags</param>
895 AssetBase asset, sbyte invType, uint nextOwnerMask, int creationDate) 899 /// <param name="callbackID">Generated by the client.</para>
900 /// <param name="asset">Asset to which this item refers.</param>
901 /// <param name="invType">Type of inventory item.</param>
902 /// <param name="nextOwnerMask">Next owner pemrissions mask.</param>
903 /// <param name="creationDate">Unix timestamp at which this item was created.</param>
904 public void CreateNewInventoryItem(
905 IClientAPI remoteClient, string creatorID, string creatorData, UUID folderID,
906 string name, string description, uint flags, uint callbackID,
907 AssetBase asset, sbyte invType, uint nextOwnerMask, int creationDate)
896 { 908 {
897 CreateNewInventoryItem( 909 CreateNewInventoryItem(
898 remoteClient, creatorID, creatorData, folderID, name, flags, callbackID, asset, invType, 910 remoteClient, creatorID, creatorData, folderID, name, description, flags, callbackID, asset, invType,
899 (uint)PermissionMask.All, (uint)PermissionMask.All, 0, nextOwnerMask, 0, creationDate); 911 (uint)PermissionMask.All, (uint)PermissionMask.All, 0, nextOwnerMask, 0, creationDate);
900 } 912 }
901 913
902 /// <summary> 914 /// <summary>
903 /// Create a new Inventory Item 915 /// Create a new Inventory Item
904 /// </summary> 916 /// </summary>
905 /// <param name="remoteClient"></param> 917 /// <param name="remoteClient">Client creating this inventory item.</param>
906 /// <param name="folderID"></param> 918 /// <param name="creatorID"></param>
907 /// <param name="callbackID"></param> 919 /// <param name="creatorData"></param>
908 /// <param name="asset"></param> 920 /// <param name="folderID">UUID of folder in which this item should be placed.</param>
909 /// <param name="invType"></param> 921 /// <param name="name">Item name.</para>
910 /// <param name="nextOwnerMask"></param> 922 /// <param name="description">Item description.</param>
911 /// <param name="creationDate"></param> 923 /// <param name="flags">Item flags</param>
924 /// <param name="callbackID">Generated by the client.</para>
925 /// <param name="asset">Asset to which this item refers.</param>
926 /// <param name="invType">Type of inventory item.</param>
927 /// <param name="baseMask">Base permissions mask.</param>
928 /// <param name="currentMask">Current permissions mask.</param>
929 /// <param name="everyoneMask">Everyone permissions mask.</param>
930 /// <param name="nextOwnerMask">Next owner pemrissions mask.</param>
931 /// <param name="groupMask">Group permissions mask.</param>
932 /// <param name="creationDate">Unix timestamp at which this item was created.</param>
912 private void CreateNewInventoryItem( 933 private void CreateNewInventoryItem(
913 IClientAPI remoteClient, string creatorID, string creatorData, UUID folderID, string name, uint flags, uint callbackID, AssetBase asset, sbyte invType, 934 IClientAPI remoteClient, string creatorID, string creatorData, UUID folderID,
935 string name, string description, uint flags, uint callbackID, AssetBase asset, sbyte invType,
914 uint baseMask, uint currentMask, uint everyoneMask, uint nextOwnerMask, uint groupMask, int creationDate) 936 uint baseMask, uint currentMask, uint everyoneMask, uint nextOwnerMask, uint groupMask, int creationDate)
915 { 937 {
916 InventoryItemBase item = new InventoryItemBase(); 938 InventoryItemBase item = new InventoryItemBase();
@@ -919,8 +941,8 @@ namespace OpenSim.Region.Framework.Scenes
919 item.CreatorData = creatorData; 941 item.CreatorData = creatorData;
920 item.ID = UUID.Random(); 942 item.ID = UUID.Random();
921 item.AssetID = asset.FullID; 943 item.AssetID = asset.FullID;
922 item.Description = asset.Description;
923 item.Name = name; 944 item.Name = name;
945 item.Description = description;
924 item.Flags = flags; 946 item.Flags = flags;
925 item.AssetType = asset.Type; 947 item.AssetType = asset.Type;
926 item.InvType = invType; 948 item.InvType = invType;
@@ -1002,7 +1024,8 @@ namespace OpenSim.Region.Framework.Scenes
1002 asset.Description = description; 1024 asset.Description = description;
1003 1025
1004 CreateNewInventoryItem( 1026 CreateNewInventoryItem(
1005 remoteClient, remoteClient.AgentId.ToString(), string.Empty, folderID, name, 0, callbackID, asset, invType, 1027 remoteClient, remoteClient.AgentId.ToString(), string.Empty, folderID,
1028 name, description, 0, callbackID, asset, invType,
1006 (uint)PermissionMask.All, (uint)PermissionMask.All, (uint)PermissionMask.All, 1029 (uint)PermissionMask.All, (uint)PermissionMask.All, (uint)PermissionMask.All,
1007 (uint)PermissionMask.All, (uint)PermissionMask.All, Util.UnixTimeSinceEpoch()); 1030 (uint)PermissionMask.All, (uint)PermissionMask.All, Util.UnixTimeSinceEpoch());
1008 } 1031 }
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 0bf2259..f7d74db 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -40,6 +40,7 @@ using OpenMetaverse;
40using OpenMetaverse.Packets; 40using OpenMetaverse.Packets;
41using OpenMetaverse.Imaging; 41using OpenMetaverse.Imaging;
42using OpenSim.Framework; 42using OpenSim.Framework;
43using OpenSim.Framework.Monitoring;
43using OpenSim.Services.Interfaces; 44using OpenSim.Services.Interfaces;
44using OpenSim.Framework.Communications; 45using OpenSim.Framework.Communications;
45using OpenSim.Framework.Console; 46using OpenSim.Framework.Console;
@@ -1232,15 +1233,17 @@ namespace OpenSim.Region.Framework.Scenes
1232 avatar.ControllingClient.SendShutdownConnectionNotice(); 1233 avatar.ControllingClient.SendShutdownConnectionNotice();
1233 }); 1234 });
1234 1235
1236 // Stop updating the scene objects and agents.
1237 m_shuttingDown = true;
1238
1235 // Wait here, or the kick messages won't actually get to the agents before the scene terminates. 1239 // Wait here, or the kick messages won't actually get to the agents before the scene terminates.
1240 // We also need to wait to avoid a race condition with the scene update loop which might not yet
1241 // have checked ShuttingDown.
1236 Thread.Sleep(500); 1242 Thread.Sleep(500);
1237 1243
1238 // Stop all client threads. 1244 // Stop all client threads.
1239 ForEachScenePresence(delegate(ScenePresence avatar) { avatar.ControllingClient.Close(); }); 1245 ForEachScenePresence(delegate(ScenePresence avatar) { avatar.ControllingClient.Close(); });
1240 1246
1241 // Stop updating the scene objects and agents.
1242 m_shuttingDown = true;
1243
1244 m_log.Debug("[SCENE]: Persisting changed objects"); 1247 m_log.Debug("[SCENE]: Persisting changed objects");
1245 EventManager.TriggerSceneShuttingDown(this); 1248 EventManager.TriggerSceneShuttingDown(this);
1246 1249
@@ -1255,6 +1258,15 @@ namespace OpenSim.Region.Framework.Scenes
1255 1258
1256 m_sceneGraph.Close(); 1259 m_sceneGraph.Close();
1257 1260
1261 if (PhysicsScene != null)
1262 {
1263 PhysicsScene phys = PhysicsScene;
1264 // remove the physics engine from both Scene and SceneGraph
1265 PhysicsScene = null;
1266 phys.Dispose();
1267 phys = null;
1268 }
1269
1258 if (!GridService.DeregisterRegion(RegionInfo.RegionID)) 1270 if (!GridService.DeregisterRegion(RegionInfo.RegionID))
1259 m_log.WarnFormat("[SCENE]: Deregister from grid failed for region {0}", Name); 1271 m_log.WarnFormat("[SCENE]: Deregister from grid failed for region {0}", Name);
1260 1272
@@ -1553,8 +1565,8 @@ namespace OpenSim.Region.Framework.Scenes
1553 m_sceneGridService.InformNeighborsThatRegionisUp( 1565 m_sceneGridService.InformNeighborsThatRegionisUp(
1554 RequestModuleInterface<INeighbourService>(), RegionInfo); 1566 RequestModuleInterface<INeighbourService>(), RegionInfo);
1555 1567
1556 // Region ready should always be triggered whether logins are immediately enabled or not. 1568 // Region ready should always be set
1557 EventManager.TriggerRegionReady(this); 1569 Ready = true;
1558 } 1570 }
1559 else 1571 else
1560 { 1572 {
diff --git a/OpenSim/Region/Framework/Scenes/SceneBase.cs b/OpenSim/Region/Framework/Scenes/SceneBase.cs
index d55b082..7c8bd88 100644
--- a/OpenSim/Region/Framework/Scenes/SceneBase.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneBase.cs
@@ -124,6 +124,24 @@ namespace OpenSim.Region.Framework.Scenes
124 } 124 }
125 private bool m_loginsEnabled; 125 private bool m_loginsEnabled;
126 126
127 public bool Ready
128 {
129 get
130 {
131 return m_ready;
132 }
133
134 set
135 {
136 if (m_ready != value)
137 {
138 m_ready = value;
139 EventManager.TriggerRegionReadyStatusChange(this);
140 }
141 }
142 }
143 private bool m_ready;
144
127 public float TimeDilation 145 public float TimeDilation
128 { 146 {
129 get { return 1.0f; } 147 get { return 1.0f; }
diff --git a/OpenSim/Region/Framework/Scenes/SceneManager.cs b/OpenSim/Region/Framework/Scenes/SceneManager.cs
index e3fed49..a412414 100644
--- a/OpenSim/Region/Framework/Scenes/SceneManager.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneManager.cs
@@ -47,6 +47,48 @@ namespace OpenSim.Region.Framework.Scenes
47 47
48 public event RestartSim OnRestartSim; 48 public event RestartSim OnRestartSim;
49 49
50 /// <summary>
51 /// Fired when either all regions are ready for use or at least one region has become unready for use where
52 /// previously all regions were ready.
53 /// </summary>
54 public event Action<SceneManager> OnRegionsReadyStatusChange;
55
56 /// <summary>
57 /// Are all regions ready for use?
58 /// </summary>
59 public bool AllRegionsReady
60 {
61 get
62 {
63 return m_allRegionsReady;
64 }
65
66 private set
67 {
68 if (m_allRegionsReady != value)
69 {
70 m_allRegionsReady = value;
71 Action<SceneManager> handler = OnRegionsReadyStatusChange;
72 if (handler != null)
73 {
74 foreach (Action<SceneManager> d in handler.GetInvocationList())
75 {
76 try
77 {
78 d(this);
79 }
80 catch (Exception e)
81 {
82 m_log.ErrorFormat("[SCENE MANAGER]: Delegate for OnRegionsReadyStatusChange failed - continuing {0} - {1}",
83 e.Message, e.StackTrace);
84 }
85 }
86 }
87 }
88 }
89 }
90 private bool m_allRegionsReady;
91
50 private static SceneManager m_instance = null; 92 private static SceneManager m_instance = null;
51 public static SceneManager Instance 93 public static SceneManager Instance
52 { 94 {
@@ -128,9 +170,11 @@ namespace OpenSim.Region.Framework.Scenes
128 170
129 public void Add(Scene scene) 171 public void Add(Scene scene)
130 { 172 {
131 scene.OnRestart += HandleRestart; 173 lock (m_localScenes)
174 m_localScenes.Add(scene.RegionInfo.RegionID, scene.RegionInfo.RegionName, scene);
132 175
133 m_localScenes.Add(scene.RegionInfo.RegionID, scene.RegionInfo.RegionName, scene); 176 scene.OnRestart += HandleRestart;
177 scene.EventManager.OnRegionReadyStatusChange += HandleRegionReadyStatusChange;
134 } 178 }
135 179
136 public void HandleRestart(RegionInfo rdata) 180 public void HandleRestart(RegionInfo rdata)
@@ -138,12 +182,19 @@ namespace OpenSim.Region.Framework.Scenes
138 m_log.Error("[SCENEMANAGER]: Got Restart message for region:" + rdata.RegionName + " Sending up to main"); 182 m_log.Error("[SCENEMANAGER]: Got Restart message for region:" + rdata.RegionName + " Sending up to main");
139 int RegionSceneElement = -1; 183 int RegionSceneElement = -1;
140 184
141 m_localScenes.Remove(rdata.RegionID); 185 lock (m_localScenes)
186 m_localScenes.Remove(rdata.RegionID);
142 187
143 // Send signal to main that we're restarting this sim. 188 // Send signal to main that we're restarting this sim.
144 OnRestartSim(rdata); 189 OnRestartSim(rdata);
145 } 190 }
146 191
192 private void HandleRegionReadyStatusChange(IScene scene)
193 {
194 lock (m_localScenes)
195 AllRegionsReady = m_localScenes.TrueForAll(s => s.Ready);
196 }
197
147 public void SendSimOnlineNotification(ulong regionHandle) 198 public void SendSimOnlineNotification(ulong regionHandle)
148 { 199 {
149 RegionInfo Result = null; 200 RegionInfo Result = null;
@@ -483,7 +534,8 @@ namespace OpenSim.Region.Framework.Scenes
483 534
484 public void CloseScene(Scene scene) 535 public void CloseScene(Scene scene)
485 { 536 {
486 m_localScenes.Remove(scene.RegionInfo.RegionID); 537 lock (m_localScenes)
538 m_localScenes.Remove(scene.RegionInfo.RegionID);
487 539
488 scene.Close(); 540 scene.Close();
489 } 541 }
diff --git a/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs b/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs
index d6ff5a2..20919a1 100644
--- a/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs
+++ b/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs
@@ -30,7 +30,7 @@ using System.Collections.Generic;
30using System.Timers; 30using System.Timers;
31using OpenMetaverse.Packets; 31using OpenMetaverse.Packets;
32using OpenSim.Framework; 32using OpenSim.Framework;
33using OpenSim.Framework.Statistics; 33using OpenSim.Framework.Monitoring;
34using OpenSim.Region.Framework.Interfaces; 34using OpenSim.Region.Framework.Interfaces;
35 35
36namespace OpenSim.Region.Framework.Scenes 36namespace OpenSim.Region.Framework.Scenes