diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Scene.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.cs | 867 |
1 files changed, 635 insertions, 232 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index cca295c..2a1949d 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -156,8 +156,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
156 | // TODO: need to figure out how allow client agents but deny | 156 | // TODO: need to figure out how allow client agents but deny |
157 | // root agents when ACL denies access to root agent | 157 | // root agents when ACL denies access to root agent |
158 | public bool m_strictAccessControl = true; | 158 | public bool m_strictAccessControl = true; |
159 | 159 | public bool m_seeIntoBannedRegion = false; | |
160 | public int MaxUndoCount { get; set; } | 160 | public int MaxUndoCount = 5; |
161 | 161 | ||
162 | // Using this for RegionReady module to prevent LoginsDisabled from changing under our feet; | 162 | // Using this for RegionReady module to prevent LoginsDisabled from changing under our feet; |
163 | public bool LoginLock = false; | 163 | public bool LoginLock = false; |
@@ -173,11 +173,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
173 | 173 | ||
174 | protected int m_splitRegionID; | 174 | protected int m_splitRegionID; |
175 | protected Timer m_restartWaitTimer = new Timer(); | 175 | protected Timer m_restartWaitTimer = new Timer(); |
176 | protected Timer m_timerWatchdog = new Timer(); | ||
176 | protected List<RegionInfo> m_regionRestartNotifyList = new List<RegionInfo>(); | 177 | protected List<RegionInfo> m_regionRestartNotifyList = new List<RegionInfo>(); |
177 | protected List<RegionInfo> m_neighbours = new List<RegionInfo>(); | 178 | protected List<RegionInfo> m_neighbours = new List<RegionInfo>(); |
178 | protected string m_simulatorVersion = "OpenSimulator Server"; | 179 | protected string m_simulatorVersion = "OpenSimulator Server"; |
179 | protected AgentCircuitManager m_authenticateHandler; | 180 | protected AgentCircuitManager m_authenticateHandler; |
180 | protected SceneCommunicationService m_sceneGridService; | 181 | protected SceneCommunicationService m_sceneGridService; |
182 | protected ISnmpModule m_snmpService = null; | ||
181 | 183 | ||
182 | protected ISimulationDataService m_SimulationDataService; | 184 | protected ISimulationDataService m_SimulationDataService; |
183 | protected IEstateDataService m_EstateDataService; | 185 | protected IEstateDataService m_EstateDataService; |
@@ -240,8 +242,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
240 | private int m_update_presences = 1; // Update scene presence movements | 242 | private int m_update_presences = 1; // Update scene presence movements |
241 | private int m_update_events = 1; | 243 | private int m_update_events = 1; |
242 | private int m_update_backup = 200; | 244 | private int m_update_backup = 200; |
243 | private int m_update_terrain = 50; | 245 | private int m_update_terrain = 1000; |
244 | // private int m_update_land = 1; | 246 | private int m_update_land = 10; |
245 | private int m_update_coarse_locations = 50; | 247 | private int m_update_coarse_locations = 50; |
246 | 248 | ||
247 | private int agentMS; | 249 | private int agentMS; |
@@ -254,13 +256,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
254 | private int backupMS; | 256 | private int backupMS; |
255 | private int terrainMS; | 257 | private int terrainMS; |
256 | private int landMS; | 258 | private int landMS; |
257 | private int spareMS; | ||
258 | 259 | ||
259 | /// <summary> | 260 | /// <summary> |
260 | /// Tick at which the last frame was processed. | 261 | /// Tick at which the last frame was processed. |
261 | /// </summary> | 262 | /// </summary> |
262 | private int m_lastFrameTick; | 263 | private int m_lastFrameTick; |
263 | 264 | ||
265 | public bool CombineRegions = false; | ||
264 | /// <summary> | 266 | /// <summary> |
265 | /// Tick at which the last maintenance run occurred. | 267 | /// Tick at which the last maintenance run occurred. |
266 | /// </summary> | 268 | /// </summary> |
@@ -291,6 +293,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
291 | /// </summary> | 293 | /// </summary> |
292 | private int m_LastLogin; | 294 | private int m_LastLogin; |
293 | 295 | ||
296 | private int m_lastIncoming; | ||
297 | private int m_lastOutgoing; | ||
298 | private int m_hbRestarts = 0; | ||
299 | |||
300 | |||
294 | /// <summary> | 301 | /// <summary> |
295 | /// Thread that runs the scene loop. | 302 | /// Thread that runs the scene loop. |
296 | /// </summary> | 303 | /// </summary> |
@@ -331,7 +338,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
331 | private volatile bool m_active; | 338 | private volatile bool m_active; |
332 | 339 | ||
333 | // private int m_lastUpdate; | 340 | // private int m_lastUpdate; |
334 | // private bool m_firstHeartbeat = true; | 341 | private bool m_firstHeartbeat = true; |
335 | 342 | ||
336 | private UpdatePrioritizationSchemes m_priorityScheme = UpdatePrioritizationSchemes.Time; | 343 | private UpdatePrioritizationSchemes m_priorityScheme = UpdatePrioritizationSchemes.Time; |
337 | private bool m_reprioritizationEnabled = true; | 344 | private bool m_reprioritizationEnabled = true; |
@@ -376,6 +383,19 @@ namespace OpenSim.Region.Framework.Scenes | |||
376 | get { return m_sceneGridService; } | 383 | get { return m_sceneGridService; } |
377 | } | 384 | } |
378 | 385 | ||
386 | public ISnmpModule SnmpService | ||
387 | { | ||
388 | get | ||
389 | { | ||
390 | if (m_snmpService == null) | ||
391 | { | ||
392 | m_snmpService = RequestModuleInterface<ISnmpModule>(); | ||
393 | } | ||
394 | |||
395 | return m_snmpService; | ||
396 | } | ||
397 | } | ||
398 | |||
379 | public ISimulationDataService SimulationDataService | 399 | public ISimulationDataService SimulationDataService |
380 | { | 400 | { |
381 | get | 401 | get |
@@ -674,6 +694,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
674 | m_SimulationDataService = simDataService; | 694 | m_SimulationDataService = simDataService; |
675 | m_EstateDataService = estateDataService; | 695 | m_EstateDataService = estateDataService; |
676 | m_regionHandle = RegionInfo.RegionHandle; | 696 | m_regionHandle = RegionInfo.RegionHandle; |
697 | m_lastIncoming = 0; | ||
698 | m_lastOutgoing = 0; | ||
677 | 699 | ||
678 | m_asyncSceneObjectDeleter = new AsyncSceneObjectGroupDeleter(this); | 700 | m_asyncSceneObjectDeleter = new AsyncSceneObjectGroupDeleter(this); |
679 | m_asyncSceneObjectDeleter.Enabled = true; | 701 | m_asyncSceneObjectDeleter.Enabled = true; |
@@ -761,132 +783,141 @@ namespace OpenSim.Region.Framework.Scenes | |||
761 | 783 | ||
762 | // Region config overrides global config | 784 | // Region config overrides global config |
763 | // | 785 | // |
764 | if (m_config.Configs["Startup"] != null) | 786 | try |
765 | { | 787 | { |
766 | IConfig startupConfig = m_config.Configs["Startup"]; | 788 | if (m_config.Configs["Startup"] != null) |
767 | |||
768 | StartDisabled = startupConfig.GetBoolean("StartDisabled", false); | ||
769 | |||
770 | m_defaultDrawDistance = startupConfig.GetFloat("DefaultDrawDistance", m_defaultDrawDistance); | ||
771 | m_useBackup = startupConfig.GetBoolean("UseSceneBackup", m_useBackup); | ||
772 | if (!m_useBackup) | ||
773 | m_log.InfoFormat("[SCENE]: Backup has been disabled for {0}", RegionInfo.RegionName); | ||
774 | |||
775 | //Animation states | ||
776 | m_useFlySlow = startupConfig.GetBoolean("enableflyslow", false); | ||
777 | |||
778 | MaxUndoCount = startupConfig.GetInt("MaxPrimUndos", 20); | ||
779 | |||
780 | PhysicalPrims = startupConfig.GetBoolean("physical_prim", PhysicalPrims); | ||
781 | CollidablePrims = startupConfig.GetBoolean("collidable_prim", CollidablePrims); | ||
782 | |||
783 | m_minNonphys = startupConfig.GetFloat("NonPhysicalPrimMin", m_minNonphys); | ||
784 | if (RegionInfo.NonphysPrimMin > 0) | ||
785 | { | 789 | { |
786 | m_minNonphys = RegionInfo.NonphysPrimMin; | 790 | IConfig startupConfig = m_config.Configs["Startup"]; |
787 | } | ||
788 | 791 | ||
789 | m_maxNonphys = startupConfig.GetFloat("NonPhysicalPrimMax", m_maxNonphys); | 792 | StartDisabled = startupConfig.GetBoolean("StartDisabled", false); |
790 | if (RegionInfo.NonphysPrimMax > 0) | ||
791 | { | ||
792 | m_maxNonphys = RegionInfo.NonphysPrimMax; | ||
793 | } | ||
794 | 793 | ||
795 | m_minPhys = startupConfig.GetFloat("PhysicalPrimMin", m_minPhys); | 794 | m_defaultDrawDistance = startupConfig.GetFloat("DefaultDrawDistance",m_defaultDrawDistance); |
796 | if (RegionInfo.PhysPrimMin > 0) | 795 | m_useBackup = startupConfig.GetBoolean("UseSceneBackup", m_useBackup); |
797 | { | 796 | if (!m_useBackup) |
798 | m_minPhys = RegionInfo.PhysPrimMin; | 797 | m_log.InfoFormat("[SCENE]: Backup has been disabled for {0}", RegionInfo.RegionName); |
799 | } | 798 | |
799 | //Animation states | ||
800 | m_useFlySlow = startupConfig.GetBoolean("enableflyslow", false); | ||
800 | 801 | ||
801 | m_maxPhys = startupConfig.GetFloat("PhysicalPrimMax", m_maxPhys); | 802 | PhysicalPrims = startupConfig.GetBoolean("physical_prim", true); |
802 | if (RegionInfo.PhysPrimMax > 0) | 803 | CollidablePrims = startupConfig.GetBoolean("collidable_prim", true); |
803 | { | ||
804 | m_maxPhys = RegionInfo.PhysPrimMax; | ||
805 | } | ||
806 | 804 | ||
807 | // Here, if clamping is requested in either global or | 805 | m_minNonphys = startupConfig.GetFloat("NonPhysicalPrimMin", m_minNonphys); |
808 | // local config, it will be used | 806 | if (RegionInfo.NonphysPrimMin > 0) |
809 | // | 807 | { |
810 | m_clampPrimSize = startupConfig.GetBoolean("ClampPrimSize", m_clampPrimSize); | 808 | m_minNonphys = RegionInfo.NonphysPrimMin; |
811 | if (RegionInfo.ClampPrimSize) | 809 | } |
812 | { | ||
813 | m_clampPrimSize = true; | ||
814 | } | ||
815 | 810 | ||
816 | m_linksetCapacity = startupConfig.GetInt("LinksetPrims", m_linksetCapacity); | 811 | m_maxNonphys = startupConfig.GetFloat("NonPhysicalPrimMax", m_maxNonphys); |
817 | if (RegionInfo.LinksetCapacity > 0) | 812 | if (RegionInfo.NonphysPrimMax > 0) |
818 | { | 813 | { |
819 | m_linksetCapacity = RegionInfo.LinksetCapacity; | 814 | m_maxNonphys = RegionInfo.NonphysPrimMax; |
820 | } | 815 | } |
821 | 816 | ||
822 | m_useTrashOnDelete = startupConfig.GetBoolean("UseTrashOnDelete", m_useTrashOnDelete); | 817 | m_minPhys = startupConfig.GetFloat("PhysicalPrimMin", m_minPhys); |
823 | m_trustBinaries = startupConfig.GetBoolean("TrustBinaries", m_trustBinaries); | 818 | if (RegionInfo.PhysPrimMin > 0) |
824 | m_allowScriptCrossings = startupConfig.GetBoolean("AllowScriptCrossing", m_allowScriptCrossings); | 819 | { |
825 | m_dontPersistBefore = | 820 | m_minPhys = RegionInfo.PhysPrimMin; |
826 | startupConfig.GetLong("MinimumTimeBeforePersistenceConsidered", DEFAULT_MIN_TIME_FOR_PERSISTENCE); | 821 | } |
827 | m_dontPersistBefore *= 10000000; | ||
828 | m_persistAfter = | ||
829 | startupConfig.GetLong("MaximumTimeBeforePersistenceConsidered", DEFAULT_MAX_TIME_FOR_PERSISTENCE); | ||
830 | m_persistAfter *= 10000000; | ||
831 | 822 | ||
832 | m_defaultScriptEngine = startupConfig.GetString("DefaultScriptEngine", "XEngine"); | 823 | m_maxPhys = startupConfig.GetFloat("PhysicalPrimMax", m_maxPhys); |
833 | 824 | ||
834 | SpawnPointRouting = startupConfig.GetString("SpawnPointRouting", "closest"); | 825 | if (RegionInfo.PhysPrimMax > 0) |
835 | TelehubAllowLandmarks = startupConfig.GetBoolean("TelehubAllowLandmark", false); | 826 | { |
827 | m_maxPhys = RegionInfo.PhysPrimMax; | ||
828 | } | ||
836 | 829 | ||
837 | m_strictAccessControl = startupConfig.GetBoolean("StrictAccessControl", m_strictAccessControl); | 830 | m_linksetCapacity = startupConfig.GetInt("LinksetPrims", m_linksetCapacity); |
831 | if (RegionInfo.LinksetCapacity > 0) | ||
832 | { | ||
833 | m_linksetCapacity = RegionInfo.LinksetCapacity; | ||
834 | } | ||
838 | 835 | ||
839 | m_generateMaptiles = startupConfig.GetBoolean("GenerateMaptiles", true); | 836 | SpawnPointRouting = startupConfig.GetString("SpawnPointRouting", "closest"); |
840 | if (m_generateMaptiles) | 837 | TelehubAllowLandmarks = startupConfig.GetBoolean("TelehubAllowLandmark", false); |
841 | { | 838 | |
842 | int maptileRefresh = startupConfig.GetInt("MaptileRefresh", 0); | 839 | // Here, if clamping is requested in either global or |
843 | if (maptileRefresh != 0) | 840 | // local config, it will be used |
841 | // | ||
842 | m_clampPrimSize = startupConfig.GetBoolean("ClampPrimSize", m_clampPrimSize); | ||
843 | if (RegionInfo.ClampPrimSize) | ||
844 | { | 844 | { |
845 | m_mapGenerationTimer.Interval = maptileRefresh * 1000; | 845 | m_clampPrimSize = true; |
846 | m_mapGenerationTimer.Elapsed += RegenerateMaptileAndReregister; | ||
847 | m_mapGenerationTimer.AutoReset = true; | ||
848 | m_mapGenerationTimer.Start(); | ||
849 | } | 846 | } |
850 | } | ||
851 | else | ||
852 | { | ||
853 | string tile = startupConfig.GetString("MaptileStaticUUID", UUID.Zero.ToString()); | ||
854 | UUID tileID; | ||
855 | 847 | ||
856 | if (UUID.TryParse(tile, out tileID)) | 848 | m_useTrashOnDelete = startupConfig.GetBoolean("UseTrashOnDelete",m_useTrashOnDelete); |
849 | m_trustBinaries = startupConfig.GetBoolean("TrustBinaries", m_trustBinaries); | ||
850 | m_allowScriptCrossings = startupConfig.GetBoolean("AllowScriptCrossing", m_allowScriptCrossings); | ||
851 | m_dontPersistBefore = | ||
852 | startupConfig.GetLong("MinimumTimeBeforePersistenceConsidered", DEFAULT_MIN_TIME_FOR_PERSISTENCE); | ||
853 | m_dontPersistBefore *= 10000000; | ||
854 | m_persistAfter = | ||
855 | startupConfig.GetLong("MaximumTimeBeforePersistenceConsidered", DEFAULT_MAX_TIME_FOR_PERSISTENCE); | ||
856 | m_persistAfter *= 10000000; | ||
857 | |||
858 | m_defaultScriptEngine = startupConfig.GetString("DefaultScriptEngine", "XEngine"); | ||
859 | m_log.InfoFormat("[SCENE]: Default script engine {0}", m_defaultScriptEngine); | ||
860 | |||
861 | m_strictAccessControl = startupConfig.GetBoolean("StrictAccessControl", m_strictAccessControl); | ||
862 | m_seeIntoBannedRegion = startupConfig.GetBoolean("SeeIntoBannedRegion", m_seeIntoBannedRegion); | ||
863 | CombineRegions = startupConfig.GetBoolean("CombineContiguousRegions", false); | ||
864 | |||
865 | m_generateMaptiles = startupConfig.GetBoolean("GenerateMaptiles", true); | ||
866 | if (m_generateMaptiles) | ||
857 | { | 867 | { |
858 | RegionInfo.RegionSettings.TerrainImageID = tileID; | 868 | int maptileRefresh = startupConfig.GetInt("MaptileRefresh", 0); |
869 | if (maptileRefresh != 0) | ||
870 | { | ||
871 | m_mapGenerationTimer.Interval = maptileRefresh * 1000; | ||
872 | m_mapGenerationTimer.Elapsed += RegenerateMaptileAndReregister; | ||
873 | m_mapGenerationTimer.AutoReset = true; | ||
874 | m_mapGenerationTimer.Start(); | ||
875 | } | ||
859 | } | 876 | } |
860 | } | 877 | else |
878 | { | ||
879 | string tile = startupConfig.GetString("MaptileStaticUUID", UUID.Zero.ToString()); | ||
880 | UUID tileID; | ||
861 | 881 | ||
862 | string grant = startupConfig.GetString("AllowedClients", String.Empty); | 882 | if (UUID.TryParse(tile, out tileID)) |
863 | if (grant.Length > 0) | 883 | { |
864 | { | 884 | RegionInfo.RegionSettings.TerrainImageID = tileID; |
865 | foreach (string viewer in grant.Split('|')) | 885 | } |
886 | } | ||
887 | |||
888 | string grant = startupConfig.GetString("AllowedClients", String.Empty); | ||
889 | if (grant.Length > 0) | ||
866 | { | 890 | { |
867 | m_AllowedViewers.Add(viewer.Trim().ToLower()); | 891 | foreach (string viewer in grant.Split(',')) |
892 | { | ||
893 | m_AllowedViewers.Add(viewer.Trim().ToLower()); | ||
894 | } | ||
868 | } | 895 | } |
869 | } | ||
870 | 896 | ||
871 | grant = startupConfig.GetString("BannedClients", String.Empty); | 897 | grant = startupConfig.GetString("BannedClients", String.Empty); |
872 | if (grant.Length > 0) | 898 | if (grant.Length > 0) |
873 | { | ||
874 | foreach (string viewer in grant.Split('|')) | ||
875 | { | 899 | { |
876 | m_BannedViewers.Add(viewer.Trim().ToLower()); | 900 | foreach (string viewer in grant.Split(',')) |
901 | { | ||
902 | m_BannedViewers.Add(viewer.Trim().ToLower()); | ||
903 | } | ||
877 | } | 904 | } |
878 | } | ||
879 | 905 | ||
880 | MinFrameTime = startupConfig.GetFloat( "MinFrameTime", MinFrameTime); | 906 | MinFrameTime = startupConfig.GetFloat( "MinFrameTime", MinFrameTime); |
881 | m_update_backup = startupConfig.GetInt( "UpdateStorageEveryNFrames", m_update_backup); | 907 | m_update_backup = startupConfig.GetInt( "UpdateStorageEveryNFrames", m_update_backup); |
882 | m_update_coarse_locations = startupConfig.GetInt( "UpdateCoarseLocationsEveryNFrames", m_update_coarse_locations); | 908 | m_update_coarse_locations = startupConfig.GetInt( "UpdateCoarseLocationsEveryNFrames", m_update_coarse_locations); |
883 | m_update_entitymovement = startupConfig.GetInt( "UpdateEntityMovementEveryNFrames", m_update_entitymovement); | 909 | m_update_entitymovement = startupConfig.GetInt( "UpdateEntityMovementEveryNFrames", m_update_entitymovement); |
884 | m_update_events = startupConfig.GetInt( "UpdateEventsEveryNFrames", m_update_events); | 910 | m_update_events = startupConfig.GetInt( "UpdateEventsEveryNFrames", m_update_events); |
885 | m_update_objects = startupConfig.GetInt( "UpdateObjectsEveryNFrames", m_update_objects); | 911 | m_update_objects = startupConfig.GetInt( "UpdateObjectsEveryNFrames", m_update_objects); |
886 | m_update_physics = startupConfig.GetInt( "UpdatePhysicsEveryNFrames", m_update_physics); | 912 | m_update_physics = startupConfig.GetInt( "UpdatePhysicsEveryNFrames", m_update_physics); |
887 | m_update_presences = startupConfig.GetInt( "UpdateAgentsEveryNFrames", m_update_presences); | 913 | m_update_presences = startupConfig.GetInt( "UpdateAgentsEveryNFrames", m_update_presences); |
888 | m_update_terrain = startupConfig.GetInt( "UpdateTerrainEveryNFrames", m_update_terrain); | 914 | m_update_terrain = startupConfig.GetInt( "UpdateTerrainEveryNFrames", m_update_terrain); |
889 | m_update_temp_cleaning = startupConfig.GetInt( "UpdateTempCleaningEveryNFrames", m_update_temp_cleaning); | 915 | m_update_temp_cleaning = startupConfig.GetInt( "UpdateTempCleaningEveryNFrames", m_update_temp_cleaning); |
916 | } | ||
917 | } | ||
918 | catch (Exception e) | ||
919 | { | ||
920 | m_log.Error("[SCENE]: Failed to load StartupConfig: " + e.ToString()); | ||
890 | } | 921 | } |
891 | 922 | ||
892 | // FIXME: Ultimately this should be in a module. | 923 | // FIXME: Ultimately this should be in a module. |
@@ -931,6 +962,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
931 | StatsReporter = new SimStatsReporter(this); | 962 | StatsReporter = new SimStatsReporter(this); |
932 | StatsReporter.OnSendStatsResult += SendSimStatsPackets; | 963 | StatsReporter.OnSendStatsResult += SendSimStatsPackets; |
933 | StatsReporter.OnStatsIncorrect += m_sceneGraph.RecalculateStats; | 964 | StatsReporter.OnStatsIncorrect += m_sceneGraph.RecalculateStats; |
965 | |||
966 | MainConsole.Instance.Commands.AddCommand("scene", false, "gc collect", "gc collect", "gc collect", "Cause the garbage collector to make a single pass", HandleGcCollect); | ||
934 | } | 967 | } |
935 | 968 | ||
936 | public Scene(RegionInfo regInfo) : base(regInfo) | 969 | public Scene(RegionInfo regInfo) : base(regInfo) |
@@ -1299,9 +1332,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
1299 | // Stop all client threads. | 1332 | // Stop all client threads. |
1300 | ForEachScenePresence(delegate(ScenePresence avatar) { avatar.ControllingClient.Close(); }); | 1333 | ForEachScenePresence(delegate(ScenePresence avatar) { avatar.ControllingClient.Close(); }); |
1301 | 1334 | ||
1302 | m_log.Debug("[SCENE]: Persisting changed objects"); | 1335 | m_log.Debug("[SCENE]: TriggerSceneShuttingDown"); |
1303 | EventManager.TriggerSceneShuttingDown(this); | 1336 | EventManager.TriggerSceneShuttingDown(this); |
1304 | 1337 | ||
1338 | m_log.Debug("[SCENE]: Persisting changed objects"); | ||
1339 | |||
1305 | EntityBase[] entities = GetEntities(); | 1340 | EntityBase[] entities = GetEntities(); |
1306 | foreach (EntityBase entity in entities) | 1341 | foreach (EntityBase entity in entities) |
1307 | { | 1342 | { |
@@ -1311,6 +1346,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1311 | } | 1346 | } |
1312 | } | 1347 | } |
1313 | 1348 | ||
1349 | m_log.Debug("[SCENE]: Graph close"); | ||
1314 | m_sceneGraph.Close(); | 1350 | m_sceneGraph.Close(); |
1315 | 1351 | ||
1316 | if (!GridService.DeregisterRegion(RegionInfo.RegionID)) | 1352 | if (!GridService.DeregisterRegion(RegionInfo.RegionID)) |
@@ -1323,6 +1359,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1323 | // attempt to reference a null or disposed physics scene. | 1359 | // attempt to reference a null or disposed physics scene. |
1324 | if (PhysicsScene != null) | 1360 | if (PhysicsScene != null) |
1325 | { | 1361 | { |
1362 | m_log.Debug("[SCENE]: Dispose Physics"); | ||
1326 | PhysicsScene phys = PhysicsScene; | 1363 | PhysicsScene phys = PhysicsScene; |
1327 | // remove the physics engine from both Scene and SceneGraph | 1364 | // remove the physics engine from both Scene and SceneGraph |
1328 | PhysicsScene = null; | 1365 | PhysicsScene = null; |
@@ -1345,11 +1382,29 @@ namespace OpenSim.Region.Framework.Scenes | |||
1345 | //m_heartbeatTimer.Elapsed += new ElapsedEventHandler(Heartbeat); | 1382 | //m_heartbeatTimer.Elapsed += new ElapsedEventHandler(Heartbeat); |
1346 | if (m_heartbeatThread != null) | 1383 | if (m_heartbeatThread != null) |
1347 | { | 1384 | { |
1385 | m_hbRestarts++; | ||
1386 | if(m_hbRestarts > 10) | ||
1387 | Environment.Exit(1); | ||
1388 | m_log.ErrorFormat("[SCENE]: Restarting heartbeat thread because it hasn't reported in in region {0}", RegionInfo.RegionName); | ||
1389 | |||
1390 | //int pid = System.Diagnostics.Process.GetCurrentProcess().Id; | ||
1391 | //System.Diagnostics.Process proc = new System.Diagnostics.Process(); | ||
1392 | //proc.EnableRaisingEvents=false; | ||
1393 | //proc.StartInfo.FileName = "/bin/kill"; | ||
1394 | //proc.StartInfo.Arguments = "-QUIT " + pid.ToString(); | ||
1395 | //proc.Start(); | ||
1396 | //proc.WaitForExit(); | ||
1397 | //Thread.Sleep(1000); | ||
1398 | //Environment.Exit(1); | ||
1348 | m_heartbeatThread.Abort(); | 1399 | m_heartbeatThread.Abort(); |
1400 | Watchdog.AbortThread(m_heartbeatThread.ManagedThreadId); | ||
1349 | m_heartbeatThread = null; | 1401 | m_heartbeatThread = null; |
1350 | } | 1402 | } |
1351 | // m_lastUpdate = Util.EnvironmentTickCount(); | 1403 | // m_lastUpdate = Util.EnvironmentTickCount(); |
1352 | 1404 | ||
1405 | // m_sceneGraph.PreparePhysicsSimulation(); | ||
1406 | |||
1407 | |||
1353 | m_heartbeatThread | 1408 | m_heartbeatThread |
1354 | = Watchdog.StartThread( | 1409 | = Watchdog.StartThread( |
1355 | Heartbeat, string.Format("Heartbeat ({0})", RegionInfo.RegionName), ThreadPriority.Normal, false, false); | 1410 | Heartbeat, string.Format("Heartbeat ({0})", RegionInfo.RegionName), ThreadPriority.Normal, false, false); |
@@ -1492,16 +1547,20 @@ namespace OpenSim.Region.Framework.Scenes | |||
1492 | endFrame = Frame + frames; | 1547 | endFrame = Frame + frames; |
1493 | 1548 | ||
1494 | float physicsFPS = 0f; | 1549 | float physicsFPS = 0f; |
1495 | int previousFrameTick, tmpMS; | 1550 | int tmpMS; |
1496 | int maintc = Util.EnvironmentTickCount(); | 1551 | int previousFrameTick; |
1552 | int maintc; | ||
1553 | int sleepMS; | ||
1554 | int framestart; | ||
1497 | 1555 | ||
1498 | while (!m_shuttingDown && ((endFrame == null && Active) || Frame < endFrame)) | 1556 | while (!m_shuttingDown && ((endFrame == null && Active) || Frame < endFrame)) |
1499 | { | 1557 | { |
1558 | framestart = Util.EnvironmentTickCount(); | ||
1500 | ++Frame; | 1559 | ++Frame; |
1501 | 1560 | ||
1502 | // m_log.DebugFormat("[SCENE]: Processing frame {0} in {1}", Frame, RegionInfo.RegionName); | 1561 | // m_log.DebugFormat("[SCENE]: Processing frame {0} in {1}", Frame, RegionInfo.RegionName); |
1503 | 1562 | ||
1504 | agentMS = tempOnRezMS = eventMS = backupMS = terrainMS = landMS = spareMS = 0; | 1563 | agentMS = tempOnRezMS = eventMS = backupMS = terrainMS = landMS = 0; |
1505 | 1564 | ||
1506 | try | 1565 | try |
1507 | { | 1566 | { |
@@ -1553,6 +1612,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1553 | m_sceneGraph.UpdatePresences(); | 1612 | m_sceneGraph.UpdatePresences(); |
1554 | 1613 | ||
1555 | agentMS += Util.EnvironmentTickCountSubtract(tmpMS); | 1614 | agentMS += Util.EnvironmentTickCountSubtract(tmpMS); |
1615 | |||
1556 | 1616 | ||
1557 | // Delete temp-on-rez stuff | 1617 | // Delete temp-on-rez stuff |
1558 | if (Frame % m_update_temp_cleaning == 0 && !m_cleaningTemps) | 1618 | if (Frame % m_update_temp_cleaning == 0 && !m_cleaningTemps) |
@@ -1634,34 +1694,37 @@ namespace OpenSim.Region.Framework.Scenes | |||
1634 | 1694 | ||
1635 | Watchdog.UpdateThread(); | 1695 | Watchdog.UpdateThread(); |
1636 | 1696 | ||
1697 | otherMS = tempOnRezMS + eventMS + backupMS + terrainMS + landMS; | ||
1698 | |||
1699 | StatsReporter.AddPhysicsFPS(physicsFPS); | ||
1700 | StatsReporter.AddTimeDilation(TimeDilation); | ||
1701 | StatsReporter.AddFPS(1); | ||
1702 | |||
1703 | StatsReporter.addAgentMS(agentMS); | ||
1704 | StatsReporter.addPhysicsMS(physicsMS + physicsMS2); | ||
1705 | StatsReporter.addOtherMS(otherMS); | ||
1706 | StatsReporter.addScriptLines(m_sceneGraph.GetScriptLPS()); | ||
1707 | |||
1637 | previousFrameTick = m_lastFrameTick; | 1708 | previousFrameTick = m_lastFrameTick; |
1638 | m_lastFrameTick = Util.EnvironmentTickCount(); | 1709 | m_lastFrameTick = Util.EnvironmentTickCount(); |
1639 | tmpMS = Util.EnvironmentTickCountSubtract(m_lastFrameTick, maintc); | 1710 | tmpMS = Util.EnvironmentTickCountSubtract(m_lastFrameTick, framestart); |
1640 | tmpMS = (int)(MinFrameTime * 1000) - tmpMS; | 1711 | tmpMS = (int)(MinFrameTime * 1000) - tmpMS; |
1641 | 1712 | ||
1713 | m_firstHeartbeat = false; | ||
1714 | |||
1715 | sleepMS = Util.EnvironmentTickCount(); | ||
1716 | |||
1642 | if (tmpMS > 0) | 1717 | if (tmpMS > 0) |
1643 | { | ||
1644 | Thread.Sleep(tmpMS); | 1718 | Thread.Sleep(tmpMS); |
1645 | spareMS += tmpMS; | ||
1646 | } | ||
1647 | 1719 | ||
1648 | frameMS = Util.EnvironmentTickCountSubtract(maintc); | 1720 | sleepMS = Util.EnvironmentTickCountSubtract(sleepMS); |
1649 | maintc = Util.EnvironmentTickCount(); | 1721 | frameMS = Util.EnvironmentTickCountSubtract(framestart); |
1650 | 1722 | StatsReporter.addSleepMS(sleepMS); | |
1651 | otherMS = tempOnRezMS + eventMS + backupMS + terrainMS + landMS; | 1723 | StatsReporter.addFrameMS(frameMS); |
1652 | 1724 | ||
1653 | // if (Frame%m_update_avatars == 0) | 1725 | // if (Frame%m_update_avatars == 0) |
1654 | // UpdateInWorldTime(); | 1726 | // UpdateInWorldTime(); |
1655 | StatsReporter.AddPhysicsFPS(physicsFPS); | ||
1656 | StatsReporter.AddTimeDilation(TimeDilation); | ||
1657 | StatsReporter.AddFPS(1); | ||
1658 | 1727 | ||
1659 | StatsReporter.addFrameMS(frameMS); | ||
1660 | StatsReporter.addAgentMS(agentMS); | ||
1661 | StatsReporter.addPhysicsMS(physicsMS + physicsMS2); | ||
1662 | StatsReporter.addOtherMS(otherMS); | ||
1663 | StatsReporter.AddSpareMS(spareMS); | ||
1664 | StatsReporter.addScriptLines(m_sceneGraph.GetScriptLPS()); | ||
1665 | 1728 | ||
1666 | // Optionally warn if a frame takes double the amount of time that it should. | 1729 | // Optionally warn if a frame takes double the amount of time that it should. |
1667 | if (DebugUpdates | 1730 | if (DebugUpdates |
@@ -1779,7 +1842,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1779 | msg.fromAgentName = "Server"; | 1842 | msg.fromAgentName = "Server"; |
1780 | msg.dialog = (byte)19; // Object msg | 1843 | msg.dialog = (byte)19; // Object msg |
1781 | msg.fromGroup = false; | 1844 | msg.fromGroup = false; |
1782 | msg.offline = (byte)0; | 1845 | msg.offline = (byte)1; |
1783 | msg.ParentEstateID = RegionInfo.EstateSettings.ParentEstateID; | 1846 | msg.ParentEstateID = RegionInfo.EstateSettings.ParentEstateID; |
1784 | msg.Position = Vector3.Zero; | 1847 | msg.Position = Vector3.Zero; |
1785 | msg.RegionID = RegionInfo.RegionID.Guid; | 1848 | msg.RegionID = RegionInfo.RegionID.Guid; |
@@ -2001,6 +2064,19 @@ namespace OpenSim.Region.Framework.Scenes | |||
2001 | EventManager.TriggerPrimsLoaded(this); | 2064 | EventManager.TriggerPrimsLoaded(this); |
2002 | } | 2065 | } |
2003 | 2066 | ||
2067 | public bool SuportsRayCastFiltered() | ||
2068 | { | ||
2069 | if (PhysicsScene == null) | ||
2070 | return false; | ||
2071 | return PhysicsScene.SuportsRaycastWorldFiltered(); | ||
2072 | } | ||
2073 | |||
2074 | public object RayCastFiltered(Vector3 position, Vector3 direction, float length, int Count, RayFilterFlags filter) | ||
2075 | { | ||
2076 | if (PhysicsScene == null) | ||
2077 | return null; | ||
2078 | return PhysicsScene.RaycastWorld(position, direction, length, Count,filter); | ||
2079 | } | ||
2004 | 2080 | ||
2005 | /// <summary> | 2081 | /// <summary> |
2006 | /// Gets a new rez location based on the raycast and the size of the object that is being rezzed. | 2082 | /// Gets a new rez location based on the raycast and the size of the object that is being rezzed. |
@@ -2017,14 +2093,24 @@ namespace OpenSim.Region.Framework.Scenes | |||
2017 | /// <returns></returns> | 2093 | /// <returns></returns> |
2018 | public Vector3 GetNewRezLocation(Vector3 RayStart, Vector3 RayEnd, UUID RayTargetID, Quaternion rot, byte bypassRayCast, byte RayEndIsIntersection, bool frontFacesOnly, Vector3 scale, bool FaceCenter) | 2094 | public Vector3 GetNewRezLocation(Vector3 RayStart, Vector3 RayEnd, UUID RayTargetID, Quaternion rot, byte bypassRayCast, byte RayEndIsIntersection, bool frontFacesOnly, Vector3 scale, bool FaceCenter) |
2019 | { | 2095 | { |
2096 | |||
2097 | float wheight = (float)RegionInfo.RegionSettings.WaterHeight; | ||
2098 | Vector3 wpos = Vector3.Zero; | ||
2099 | // Check for water surface intersection from above | ||
2100 | if ( (RayStart.Z > wheight) && (RayEnd.Z < wheight) ) | ||
2101 | { | ||
2102 | float ratio = (RayStart.Z - wheight) / (RayStart.Z - RayEnd.Z); | ||
2103 | wpos.X = RayStart.X - (ratio * (RayStart.X - RayEnd.X)); | ||
2104 | wpos.Y = RayStart.Y - (ratio * (RayStart.Y - RayEnd.Y)); | ||
2105 | wpos.Z = wheight; | ||
2106 | } | ||
2107 | |||
2020 | Vector3 pos = Vector3.Zero; | 2108 | Vector3 pos = Vector3.Zero; |
2021 | if (RayEndIsIntersection == (byte)1) | 2109 | if (RayEndIsIntersection == (byte)1) |
2022 | { | 2110 | { |
2023 | pos = RayEnd; | 2111 | pos = RayEnd; |
2024 | return pos; | ||
2025 | } | 2112 | } |
2026 | 2113 | else if (RayTargetID != UUID.Zero) | |
2027 | if (RayTargetID != UUID.Zero) | ||
2028 | { | 2114 | { |
2029 | SceneObjectPart target = GetSceneObjectPart(RayTargetID); | 2115 | SceneObjectPart target = GetSceneObjectPart(RayTargetID); |
2030 | 2116 | ||
@@ -2046,7 +2132,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2046 | EntityIntersection ei = target.TestIntersectionOBB(NewRay, Quaternion.Identity, frontFacesOnly, FaceCenter); | 2132 | EntityIntersection ei = target.TestIntersectionOBB(NewRay, Quaternion.Identity, frontFacesOnly, FaceCenter); |
2047 | 2133 | ||
2048 | // Un-comment out the following line to Get Raytrace results printed to the console. | 2134 | // Un-comment out the following line to Get Raytrace results printed to the console. |
2049 | // m_log.Info("[RAYTRACERESULTS]: Hit:" + ei.HitTF.ToString() + " Point: " + ei.ipoint.ToString() + " Normal: " + ei.normal.ToString()); | 2135 | // m_log.Info("[RAYTRACERESULTS]: Hit:" + ei.HitTF.ToString() + " Point: " + ei.ipoint.ToString() + " Normal: " + ei.normal.ToString()); |
2050 | float ScaleOffset = 0.5f; | 2136 | float ScaleOffset = 0.5f; |
2051 | 2137 | ||
2052 | // If we hit something | 2138 | // If we hit something |
@@ -2069,13 +2155,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
2069 | //pos.Z -= 0.25F; | 2155 | //pos.Z -= 0.25F; |
2070 | 2156 | ||
2071 | } | 2157 | } |
2072 | |||
2073 | return pos; | ||
2074 | } | 2158 | } |
2075 | else | 2159 | else |
2076 | { | 2160 | { |
2077 | // We don't have a target here, so we're going to raytrace all the objects in the scene. | 2161 | // We don't have a target here, so we're going to raytrace all the objects in the scene. |
2078 | |||
2079 | EntityIntersection ei = m_sceneGraph.GetClosestIntersectingPrim(new Ray(AXOrigin, AXdirection), true, false); | 2162 | EntityIntersection ei = m_sceneGraph.GetClosestIntersectingPrim(new Ray(AXOrigin, AXdirection), true, false); |
2080 | 2163 | ||
2081 | // Un-comment the following line to print the raytrace results to the console. | 2164 | // Un-comment the following line to print the raytrace results to the console. |
@@ -2084,13 +2167,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
2084 | if (ei.HitTF) | 2167 | if (ei.HitTF) |
2085 | { | 2168 | { |
2086 | pos = new Vector3(ei.ipoint.X, ei.ipoint.Y, ei.ipoint.Z); | 2169 | pos = new Vector3(ei.ipoint.X, ei.ipoint.Y, ei.ipoint.Z); |
2087 | } else | 2170 | } |
2171 | else | ||
2088 | { | 2172 | { |
2089 | // fall back to our stupid functionality | 2173 | // fall back to our stupid functionality |
2090 | pos = RayEnd; | 2174 | pos = RayEnd; |
2091 | } | 2175 | } |
2092 | |||
2093 | return pos; | ||
2094 | } | 2176 | } |
2095 | } | 2177 | } |
2096 | else | 2178 | else |
@@ -2101,8 +2183,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
2101 | //increase height so its above the ground. | 2183 | //increase height so its above the ground. |
2102 | //should be getting the normal of the ground at the rez point and using that? | 2184 | //should be getting the normal of the ground at the rez point and using that? |
2103 | pos.Z += scale.Z / 2f; | 2185 | pos.Z += scale.Z / 2f; |
2104 | return pos; | 2186 | // return pos; |
2105 | } | 2187 | } |
2188 | |||
2189 | // check against posible water intercept | ||
2190 | if (wpos.Z > pos.Z) pos = wpos; | ||
2191 | return pos; | ||
2106 | } | 2192 | } |
2107 | 2193 | ||
2108 | 2194 | ||
@@ -2193,12 +2279,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
2193 | { | 2279 | { |
2194 | if (m_sceneGraph.AddRestoredSceneObject(sceneObject, attachToBackup, alreadyPersisted, sendClientUpdates)) | 2280 | if (m_sceneGraph.AddRestoredSceneObject(sceneObject, attachToBackup, alreadyPersisted, sendClientUpdates)) |
2195 | { | 2281 | { |
2282 | sceneObject.IsDeleted = false; | ||
2196 | EventManager.TriggerObjectAddedToScene(sceneObject); | 2283 | EventManager.TriggerObjectAddedToScene(sceneObject); |
2197 | return true; | 2284 | return true; |
2198 | } | 2285 | } |
2199 | 2286 | ||
2200 | return false; | 2287 | return false; |
2201 | |||
2202 | } | 2288 | } |
2203 | 2289 | ||
2204 | /// <summary> | 2290 | /// <summary> |
@@ -2290,6 +2376,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
2290 | /// </summary> | 2376 | /// </summary> |
2291 | public void DeleteAllSceneObjects() | 2377 | public void DeleteAllSceneObjects() |
2292 | { | 2378 | { |
2379 | DeleteAllSceneObjects(false); | ||
2380 | } | ||
2381 | |||
2382 | /// <summary> | ||
2383 | /// Delete every object from the scene. This does not include attachments worn by avatars. | ||
2384 | /// </summary> | ||
2385 | public void DeleteAllSceneObjects(bool exceptNoCopy) | ||
2386 | { | ||
2387 | List<SceneObjectGroup> toReturn = new List<SceneObjectGroup>(); | ||
2293 | lock (Entities) | 2388 | lock (Entities) |
2294 | { | 2389 | { |
2295 | EntityBase[] entities = Entities.GetEntities(); | 2390 | EntityBase[] entities = Entities.GetEntities(); |
@@ -2298,11 +2393,24 @@ namespace OpenSim.Region.Framework.Scenes | |||
2298 | if (e is SceneObjectGroup) | 2393 | if (e is SceneObjectGroup) |
2299 | { | 2394 | { |
2300 | SceneObjectGroup sog = (SceneObjectGroup)e; | 2395 | SceneObjectGroup sog = (SceneObjectGroup)e; |
2301 | if (!sog.IsAttachment) | 2396 | if (sog != null && !sog.IsAttachment) |
2302 | DeleteSceneObject((SceneObjectGroup)e, false); | 2397 | { |
2398 | if (!exceptNoCopy || ((sog.GetEffectivePermissions() & (uint)PermissionMask.Copy) != 0)) | ||
2399 | { | ||
2400 | DeleteSceneObject((SceneObjectGroup)e, false); | ||
2401 | } | ||
2402 | else | ||
2403 | { | ||
2404 | toReturn.Add((SceneObjectGroup)e); | ||
2405 | } | ||
2406 | } | ||
2303 | } | 2407 | } |
2304 | } | 2408 | } |
2305 | } | 2409 | } |
2410 | if (toReturn.Count > 0) | ||
2411 | { | ||
2412 | returnObjects(toReturn.ToArray(), UUID.Zero); | ||
2413 | } | ||
2306 | } | 2414 | } |
2307 | 2415 | ||
2308 | /// <summary> | 2416 | /// <summary> |
@@ -2337,6 +2445,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
2337 | 2445 | ||
2338 | foreach (SceneObjectPart part in partList) | 2446 | foreach (SceneObjectPart part in partList) |
2339 | { | 2447 | { |
2448 | if (part.KeyframeMotion != null) | ||
2449 | { | ||
2450 | part.KeyframeMotion.Delete(); | ||
2451 | part.KeyframeMotion = null; | ||
2452 | } | ||
2453 | |||
2340 | if (part.IsJoint() && ((part.Flags & PrimFlags.Physics) != 0)) | 2454 | if (part.IsJoint() && ((part.Flags & PrimFlags.Physics) != 0)) |
2341 | { | 2455 | { |
2342 | PhysicsScene.RequestJointDeletion(part.Name); // FIXME: what if the name changed? | 2456 | PhysicsScene.RequestJointDeletion(part.Name); // FIXME: what if the name changed? |
@@ -2354,6 +2468,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2354 | } | 2468 | } |
2355 | 2469 | ||
2356 | group.DeleteGroupFromScene(silent); | 2470 | group.DeleteGroupFromScene(silent); |
2471 | if (!silent) | ||
2472 | SendKillObject(new List<uint>() { group.LocalId }); | ||
2357 | 2473 | ||
2358 | // m_log.DebugFormat("[SCENE]: Exit DeleteSceneObject() for {0} {1}", group.Name, group.UUID); | 2474 | // m_log.DebugFormat("[SCENE]: Exit DeleteSceneObject() for {0} {1}", group.Name, group.UUID); |
2359 | } | 2475 | } |
@@ -2644,7 +2760,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2644 | // If the user is banned, we won't let any of their objects | 2760 | // If the user is banned, we won't let any of their objects |
2645 | // enter. Period. | 2761 | // enter. Period. |
2646 | // | 2762 | // |
2647 | if (RegionInfo.EstateSettings.IsBanned(newObject.OwnerID)) | 2763 | if (RegionInfo.EstateSettings.IsBanned(newObject.OwnerID, 36)) |
2648 | { | 2764 | { |
2649 | m_log.InfoFormat("[INTERREGION]: Denied prim crossing for banned avatar {0}", newObject.OwnerID); | 2765 | m_log.InfoFormat("[INTERREGION]: Denied prim crossing for banned avatar {0}", newObject.OwnerID); |
2650 | return false; | 2766 | return false; |
@@ -2652,6 +2768,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2652 | 2768 | ||
2653 | if (newPosition != Vector3.Zero) | 2769 | if (newPosition != Vector3.Zero) |
2654 | newObject.RootPart.GroupPosition = newPosition; | 2770 | newObject.RootPart.GroupPosition = newPosition; |
2771 | if (newObject.RootPart.KeyframeMotion != null) | ||
2772 | newObject.RootPart.KeyframeMotion.UpdateSceneObject(newObject); | ||
2655 | 2773 | ||
2656 | if (!AddSceneObject(newObject)) | 2774 | if (!AddSceneObject(newObject)) |
2657 | { | 2775 | { |
@@ -2696,6 +2814,23 @@ namespace OpenSim.Region.Framework.Scenes | |||
2696 | /// <returns>True if the SceneObjectGroup was added, False if it was not</returns> | 2814 | /// <returns>True if the SceneObjectGroup was added, False if it was not</returns> |
2697 | public bool AddSceneObject(SceneObjectGroup sceneObject) | 2815 | public bool AddSceneObject(SceneObjectGroup sceneObject) |
2698 | { | 2816 | { |
2817 | if (sceneObject.OwnerID == UUID.Zero) | ||
2818 | { | ||
2819 | m_log.ErrorFormat("[SCENE]: Owner ID for {0} was zero", sceneObject.UUID); | ||
2820 | return false; | ||
2821 | } | ||
2822 | |||
2823 | // If the user is banned, we won't let any of their objects | ||
2824 | // enter. Period. | ||
2825 | // | ||
2826 | int flags = GetUserFlags(sceneObject.OwnerID); | ||
2827 | if (RegionInfo.EstateSettings.IsBanned(sceneObject.OwnerID, flags)) | ||
2828 | { | ||
2829 | m_log.InfoFormat("[INTERREGION]: Denied prim crossing for banned avatar {0}", sceneObject.OwnerID); | ||
2830 | |||
2831 | return false; | ||
2832 | } | ||
2833 | |||
2699 | // Force allocation of new LocalId | 2834 | // Force allocation of new LocalId |
2700 | // | 2835 | // |
2701 | SceneObjectPart[] parts = sceneObject.Parts; | 2836 | SceneObjectPart[] parts = sceneObject.Parts; |
@@ -2729,16 +2864,27 @@ namespace OpenSim.Region.Framework.Scenes | |||
2729 | RootPrim.RemFlag(PrimFlags.TemporaryOnRez); | 2864 | RootPrim.RemFlag(PrimFlags.TemporaryOnRez); |
2730 | 2865 | ||
2731 | if (AttachmentsModule != null) | 2866 | if (AttachmentsModule != null) |
2732 | AttachmentsModule.AttachObject(sp, grp, 0, false, false); | 2867 | AttachmentsModule.AttachObject(sp, grp, 0, false, false, false); |
2733 | } | 2868 | } |
2734 | else | 2869 | else |
2735 | { | 2870 | { |
2871 | m_log.DebugFormat("[SCENE]: Attachment {0} arrived and scene presence was not found, setting to temp", sceneObject.UUID); | ||
2736 | RootPrim.RemFlag(PrimFlags.TemporaryOnRez); | 2872 | RootPrim.RemFlag(PrimFlags.TemporaryOnRez); |
2737 | RootPrim.AddFlag(PrimFlags.TemporaryOnRez); | 2873 | RootPrim.AddFlag(PrimFlags.TemporaryOnRez); |
2738 | } | 2874 | } |
2875 | if (sceneObject.OwnerID == UUID.Zero) | ||
2876 | { | ||
2877 | m_log.ErrorFormat("[SCENE]: Owner ID for {0} was zero after attachment processing. BUG!", sceneObject.UUID); | ||
2878 | return false; | ||
2879 | } | ||
2739 | } | 2880 | } |
2740 | else | 2881 | else |
2741 | { | 2882 | { |
2883 | if (sceneObject.OwnerID == UUID.Zero) | ||
2884 | { | ||
2885 | m_log.ErrorFormat("[SCENE]: Owner ID for non-attachment {0} was zero", sceneObject.UUID); | ||
2886 | return false; | ||
2887 | } | ||
2742 | AddRestoredSceneObject(sceneObject, true, false); | 2888 | AddRestoredSceneObject(sceneObject, true, false); |
2743 | } | 2889 | } |
2744 | 2890 | ||
@@ -2755,6 +2901,24 @@ namespace OpenSim.Region.Framework.Scenes | |||
2755 | return 2; // StateSource.PrimCrossing | 2901 | return 2; // StateSource.PrimCrossing |
2756 | } | 2902 | } |
2757 | 2903 | ||
2904 | public int GetUserFlags(UUID user) | ||
2905 | { | ||
2906 | //Unfortunately the SP approach means that the value is cached until region is restarted | ||
2907 | /* | ||
2908 | ScenePresence sp; | ||
2909 | if (TryGetScenePresence(user, out sp)) | ||
2910 | { | ||
2911 | return sp.UserFlags; | ||
2912 | } | ||
2913 | else | ||
2914 | { | ||
2915 | */ | ||
2916 | UserAccount uac = UserAccountService.GetUserAccount(RegionInfo.ScopeID, user); | ||
2917 | if (uac == null) | ||
2918 | return 0; | ||
2919 | return uac.UserFlags; | ||
2920 | //} | ||
2921 | } | ||
2758 | #endregion | 2922 | #endregion |
2759 | 2923 | ||
2760 | #region Add/Remove Avatar Methods | 2924 | #region Add/Remove Avatar Methods |
@@ -2787,7 +2951,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2787 | = (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0 | 2951 | = (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0 |
2788 | || (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0; | 2952 | || (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0; |
2789 | 2953 | ||
2790 | // CheckHeartbeat(); | 2954 | CheckHeartbeat(); |
2791 | 2955 | ||
2792 | sp = GetScenePresence(client.AgentId); | 2956 | sp = GetScenePresence(client.AgentId); |
2793 | 2957 | ||
@@ -2931,19 +3095,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
2931 | // and the scene presence and the client, if they exist | 3095 | // and the scene presence and the client, if they exist |
2932 | try | 3096 | try |
2933 | { | 3097 | { |
2934 | // We need to wait for the client to make UDP contact first. | 3098 | ScenePresence sp = GetScenePresence(agentID); |
2935 | // It's the UDP contact that creates the scene presence | 3099 | |
2936 | ScenePresence sp = WaitGetScenePresence(agentID); | ||
2937 | if (sp != null) | 3100 | if (sp != null) |
2938 | { | 3101 | { |
2939 | PresenceService.LogoutAgent(sp.ControllingClient.SessionId); | 3102 | PresenceService.LogoutAgent(sp.ControllingClient.SessionId); |
2940 | |||
2941 | sp.ControllingClient.Close(); | 3103 | sp.ControllingClient.Close(); |
2942 | } | 3104 | } |
2943 | else | 3105 | |
2944 | { | ||
2945 | m_log.WarnFormat("[SCENE]: Could not find scene presence for {0}", agentID); | ||
2946 | } | ||
2947 | // BANG! SLASH! | 3106 | // BANG! SLASH! |
2948 | m_authenticateHandler.RemoveCircuit(agentID); | 3107 | m_authenticateHandler.RemoveCircuit(agentID); |
2949 | 3108 | ||
@@ -2988,6 +3147,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2988 | client.OnUpdatePrimGroupPosition += m_sceneGraph.UpdatePrimGroupPosition; | 3147 | client.OnUpdatePrimGroupPosition += m_sceneGraph.UpdatePrimGroupPosition; |
2989 | client.OnUpdatePrimSinglePosition += m_sceneGraph.UpdatePrimSinglePosition; | 3148 | client.OnUpdatePrimSinglePosition += m_sceneGraph.UpdatePrimSinglePosition; |
2990 | 3149 | ||
3150 | client.onClientChangeObject += m_sceneGraph.ClientChangeObject; | ||
3151 | |||
2991 | client.OnUpdatePrimGroupRotation += m_sceneGraph.UpdatePrimGroupRotation; | 3152 | client.OnUpdatePrimGroupRotation += m_sceneGraph.UpdatePrimGroupRotation; |
2992 | client.OnUpdatePrimGroupMouseRotation += m_sceneGraph.UpdatePrimGroupRotation; | 3153 | client.OnUpdatePrimGroupMouseRotation += m_sceneGraph.UpdatePrimGroupRotation; |
2993 | client.OnUpdatePrimSingleRotation += m_sceneGraph.UpdatePrimSingleRotation; | 3154 | client.OnUpdatePrimSingleRotation += m_sceneGraph.UpdatePrimSingleRotation; |
@@ -3044,6 +3205,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3044 | client.OnFetchInventory += m_asyncInventorySender.HandleFetchInventory; | 3205 | client.OnFetchInventory += m_asyncInventorySender.HandleFetchInventory; |
3045 | client.OnUpdateInventoryItem += UpdateInventoryItemAsset; | 3206 | client.OnUpdateInventoryItem += UpdateInventoryItemAsset; |
3046 | client.OnCopyInventoryItem += CopyInventoryItem; | 3207 | client.OnCopyInventoryItem += CopyInventoryItem; |
3208 | client.OnMoveItemsAndLeaveCopy += MoveInventoryItemsLeaveCopy; | ||
3047 | client.OnMoveInventoryItem += MoveInventoryItem; | 3209 | client.OnMoveInventoryItem += MoveInventoryItem; |
3048 | client.OnRemoveInventoryItem += RemoveInventoryItem; | 3210 | client.OnRemoveInventoryItem += RemoveInventoryItem; |
3049 | client.OnRemoveInventoryFolder += RemoveInventoryFolder; | 3211 | client.OnRemoveInventoryFolder += RemoveInventoryFolder; |
@@ -3115,6 +3277,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
3115 | client.OnUpdatePrimGroupPosition -= m_sceneGraph.UpdatePrimGroupPosition; | 3277 | client.OnUpdatePrimGroupPosition -= m_sceneGraph.UpdatePrimGroupPosition; |
3116 | client.OnUpdatePrimSinglePosition -= m_sceneGraph.UpdatePrimSinglePosition; | 3278 | client.OnUpdatePrimSinglePosition -= m_sceneGraph.UpdatePrimSinglePosition; |
3117 | 3279 | ||
3280 | client.onClientChangeObject -= m_sceneGraph.ClientChangeObject; | ||
3281 | |||
3118 | client.OnUpdatePrimGroupRotation -= m_sceneGraph.UpdatePrimGroupRotation; | 3282 | client.OnUpdatePrimGroupRotation -= m_sceneGraph.UpdatePrimGroupRotation; |
3119 | client.OnUpdatePrimGroupMouseRotation -= m_sceneGraph.UpdatePrimGroupRotation; | 3283 | client.OnUpdatePrimGroupMouseRotation -= m_sceneGraph.UpdatePrimGroupRotation; |
3120 | client.OnUpdatePrimSingleRotation -= m_sceneGraph.UpdatePrimSingleRotation; | 3284 | client.OnUpdatePrimSingleRotation -= m_sceneGraph.UpdatePrimSingleRotation; |
@@ -3217,7 +3381,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3217 | /// </summary> | 3381 | /// </summary> |
3218 | /// <param name="agentId">The avatar's Unique ID</param> | 3382 | /// <param name="agentId">The avatar's Unique ID</param> |
3219 | /// <param name="client">The IClientAPI for the client</param> | 3383 | /// <param name="client">The IClientAPI for the client</param> |
3220 | public virtual void TeleportClientHome(UUID agentId, IClientAPI client) | 3384 | public virtual bool TeleportClientHome(UUID agentId, IClientAPI client) |
3221 | { | 3385 | { |
3222 | if (EntityTransferModule != null) | 3386 | if (EntityTransferModule != null) |
3223 | { | 3387 | { |
@@ -3228,6 +3392,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3228 | m_log.DebugFormat("[SCENE]: Unable to teleport user home: no AgentTransferModule is active"); | 3392 | m_log.DebugFormat("[SCENE]: Unable to teleport user home: no AgentTransferModule is active"); |
3229 | client.SendTeleportFailed("Unable to perform teleports on this simulator."); | 3393 | client.SendTeleportFailed("Unable to perform teleports on this simulator."); |
3230 | } | 3394 | } |
3395 | return false; | ||
3231 | } | 3396 | } |
3232 | 3397 | ||
3233 | /// <summary> | 3398 | /// <summary> |
@@ -3337,6 +3502,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
3337 | /// <param name="flags"></param> | 3502 | /// <param name="flags"></param> |
3338 | public virtual void SetHomeRezPoint(IClientAPI remoteClient, ulong regionHandle, Vector3 position, Vector3 lookAt, uint flags) | 3503 | public virtual void SetHomeRezPoint(IClientAPI remoteClient, ulong regionHandle, Vector3 position, Vector3 lookAt, uint flags) |
3339 | { | 3504 | { |
3505 | //Add half the avatar's height so that the user doesn't fall through prims | ||
3506 | ScenePresence presence; | ||
3507 | if (TryGetScenePresence(remoteClient.AgentId, out presence)) | ||
3508 | { | ||
3509 | if (presence.Appearance != null) | ||
3510 | { | ||
3511 | position.Z = position.Z + (presence.Appearance.AvatarHeight / 2); | ||
3512 | } | ||
3513 | } | ||
3514 | |||
3340 | if (GridUserService != null && GridUserService.SetHome(remoteClient.AgentId.ToString(), RegionInfo.RegionID, position, lookAt)) | 3515 | if (GridUserService != null && GridUserService.SetHome(remoteClient.AgentId.ToString(), RegionInfo.RegionID, position, lookAt)) |
3341 | // FUBAR ALERT: this needs to be "Home position set." so the viewer saves a home-screenshot. | 3516 | // FUBAR ALERT: this needs to be "Home position set." so the viewer saves a home-screenshot. |
3342 | m_dialogModule.SendAlertToUser(remoteClient, "Home position set."); | 3517 | m_dialogModule.SendAlertToUser(remoteClient, "Home position set."); |
@@ -3474,6 +3649,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3474 | // It's possible for child agents to have transactions if changes are being made cross-border. | 3649 | // It's possible for child agents to have transactions if changes are being made cross-border. |
3475 | if (AgentTransactionsModule != null) | 3650 | if (AgentTransactionsModule != null) |
3476 | AgentTransactionsModule.RemoveAgentAssetTransactions(agentID); | 3651 | AgentTransactionsModule.RemoveAgentAssetTransactions(agentID); |
3652 | m_log.Debug("[Scene] The avatar has left the building"); | ||
3477 | } | 3653 | } |
3478 | catch (Exception e) | 3654 | catch (Exception e) |
3479 | { | 3655 | { |
@@ -3666,38 +3842,39 @@ namespace OpenSim.Region.Framework.Scenes | |||
3666 | agent.firstname, agent.lastname, agent.Viewer); | 3842 | agent.firstname, agent.lastname, agent.Viewer); |
3667 | reason = "Access denied, your viewer is banned by the region owner"; | 3843 | reason = "Access denied, your viewer is banned by the region owner"; |
3668 | return false; | 3844 | return false; |
3669 | } | 3845 | } |
3846 | |||
3847 | |||
3848 | ScenePresence sp = GetScenePresence(agent.AgentID); | ||
3670 | 3849 | ||
3671 | ILandObject land; | 3850 | if (sp != null && !sp.IsChildAgent) |
3851 | { | ||
3852 | // We have a zombie from a crashed session. | ||
3853 | // Or the same user is trying to be root twice here, won't work. | ||
3854 | // Kill it. | ||
3855 | m_log.WarnFormat( | ||
3856 | "[SCENE]: Existing root scene presence detected for {0} {1} in {2} when connecting. Removing existing presence.", | ||
3857 | sp.Name, sp.UUID, RegionInfo.RegionName); | ||
3858 | |||
3859 | sp.ControllingClient.Close(true, true); | ||
3860 | sp = null; | ||
3861 | } | ||
3672 | 3862 | ||
3673 | lock (agent) | 3863 | lock (agent) |
3674 | { | 3864 | { |
3675 | ScenePresence sp = GetScenePresence(agent.AgentID); | ||
3676 | |||
3677 | if (sp != null && !sp.IsChildAgent) | ||
3678 | { | ||
3679 | // We have a zombie from a crashed session. | ||
3680 | // Or the same user is trying to be root twice here, won't work. | ||
3681 | // Kill it. | ||
3682 | m_log.WarnFormat( | ||
3683 | "[SCENE]: Existing root scene presence detected for {0} {1} in {2} when connecting. Removing existing presence.", | ||
3684 | sp.Name, sp.UUID, RegionInfo.RegionName); | ||
3685 | |||
3686 | sp.ControllingClient.Close(true); | ||
3687 | sp = null; | ||
3688 | } | ||
3689 | |||
3690 | land = LandChannel.GetLandObject(agent.startpos.X, agent.startpos.Y); | ||
3691 | |||
3692 | //On login test land permisions | 3865 | //On login test land permisions |
3693 | if (vialogin) | 3866 | if (vialogin) |
3694 | { | 3867 | { |
3695 | if (land != null && !TestLandRestrictions(agent, land, out reason)) | 3868 | IUserAccountCacheModule cache = RequestModuleInterface<IUserAccountCacheModule>(); |
3869 | if (cache != null) | ||
3870 | cache.Remove(agent.firstname + " " + agent.lastname); | ||
3871 | if (!TestLandRestrictions(agent.AgentID, out reason, ref agent.startpos.X, ref agent.startpos.Y)) | ||
3696 | { | 3872 | { |
3873 | m_log.DebugFormat("[CONNECTION BEGIN]: Denying access to {0} due to no land access", agent.AgentID.ToString()); | ||
3697 | return false; | 3874 | return false; |
3698 | } | 3875 | } |
3699 | } | 3876 | } |
3700 | 3877 | ||
3701 | if (sp == null) // We don't have an [child] agent here already | 3878 | if (sp == null) // We don't have an [child] agent here already |
3702 | { | 3879 | { |
3703 | if (requirePresenceLookup) | 3880 | if (requirePresenceLookup) |
@@ -3706,34 +3883,36 @@ namespace OpenSim.Region.Framework.Scenes | |||
3706 | { | 3883 | { |
3707 | if (!VerifyUserPresence(agent, out reason)) | 3884 | if (!VerifyUserPresence(agent, out reason)) |
3708 | return false; | 3885 | return false; |
3709 | } | 3886 | } catch (Exception e) |
3710 | catch (Exception e) | ||
3711 | { | 3887 | { |
3712 | m_log.ErrorFormat( | 3888 | m_log.ErrorFormat( |
3713 | "[SCENE]: Exception verifying presence {0}{1}", e.Message, e.StackTrace); | 3889 | "[SCENE]: Exception verifying presence {0}{1}", e.Message, e.StackTrace); |
3714 | |||
3715 | return false; | 3890 | return false; |
3716 | } | 3891 | } |
3717 | } | 3892 | } |
3718 | 3893 | ||
3719 | try | 3894 | try |
3720 | { | 3895 | { |
3721 | if (!AuthorizeUser(agent, out reason)) | 3896 | // Always check estate if this is a login. Always |
3722 | return false; | 3897 | // check if banned regions are to be blacked out. |
3898 | if (vialogin || (!m_seeIntoBannedRegion)) | ||
3899 | { | ||
3900 | if (!AuthorizeUser(agent, out reason)) | ||
3901 | return false; | ||
3902 | } | ||
3723 | } | 3903 | } |
3724 | catch (Exception e) | 3904 | catch (Exception e) |
3725 | { | 3905 | { |
3726 | m_log.ErrorFormat( | 3906 | m_log.ErrorFormat( |
3727 | "[SCENE]: Exception authorizing user {0}{1}", e.Message, e.StackTrace); | 3907 | "[SCENE]: Exception authorizing user {0}{1}", e.Message, e.StackTrace); |
3728 | |||
3729 | return false; | 3908 | return false; |
3730 | } | 3909 | } |
3731 | 3910 | ||
3732 | m_log.InfoFormat( | 3911 | m_log.InfoFormat( |
3733 | "[SCENE]: Region {0} authenticated and authorized incoming {1} agent {2} {3} {4} (circuit code {5})", | 3912 | "[SCENE]: Region {0} authenticated and authorized incoming {1} agent {2} {3} {4} (circuit code {5})", |
3734 | RegionInfo.RegionName, (agent.child ? "child" : "root"), agent.firstname, agent.lastname, | 3913 | RegionInfo.RegionName, (agent.child ? "child" : "root"), agent.firstname, agent.lastname, |
3735 | agent.AgentID, agent.circuitcode); | 3914 | agent.AgentID, agent.circuitcode); |
3736 | 3915 | ||
3737 | if (CapsModule != null) | 3916 | if (CapsModule != null) |
3738 | { | 3917 | { |
3739 | CapsModule.SetAgentCapsSeeds(agent); | 3918 | CapsModule.SetAgentCapsSeeds(agent); |
@@ -3745,15 +3924,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
3745 | // Let the SP know how we got here. This has a lot of interesting | 3924 | // Let the SP know how we got here. This has a lot of interesting |
3746 | // uses down the line. | 3925 | // uses down the line. |
3747 | sp.TeleportFlags = (TPFlags)teleportFlags; | 3926 | sp.TeleportFlags = (TPFlags)teleportFlags; |
3748 | 3927 | ||
3749 | if (sp.IsChildAgent) | 3928 | if (sp.IsChildAgent) |
3750 | { | 3929 | { |
3751 | m_log.DebugFormat( | 3930 | m_log.DebugFormat( |
3752 | "[SCENE]: Adjusting known seeds for existing agent {0} in {1}", | 3931 | "[SCENE]: Adjusting known seeds for existing agent {0} in {1}", |
3753 | agent.AgentID, RegionInfo.RegionName); | 3932 | agent.AgentID, RegionInfo.RegionName); |
3754 | 3933 | ||
3755 | sp.AdjustKnownSeeds(); | 3934 | sp.AdjustKnownSeeds(); |
3756 | 3935 | ||
3757 | if (CapsModule != null) | 3936 | if (CapsModule != null) |
3758 | CapsModule.SetAgentCapsSeeds(agent); | 3937 | CapsModule.SetAgentCapsSeeds(agent); |
3759 | } | 3938 | } |
@@ -3855,6 +4034,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
3855 | } | 4034 | } |
3856 | 4035 | ||
3857 | // Honor parcel landing type and position. | 4036 | // Honor parcel landing type and position. |
4037 | /* | ||
4038 | ILandObject land = LandChannel.GetLandObject(agent.startpos.X, agent.startpos.Y); | ||
3858 | if (land != null) | 4039 | if (land != null) |
3859 | { | 4040 | { |
3860 | if (land.LandData.LandingType == (byte)1 && land.LandData.UserLocation != Vector3.Zero) | 4041 | if (land.LandData.LandingType == (byte)1 && land.LandData.UserLocation != Vector3.Zero) |
@@ -3862,25 +4043,43 @@ namespace OpenSim.Region.Framework.Scenes | |||
3862 | agent.startpos = land.LandData.UserLocation; | 4043 | agent.startpos = land.LandData.UserLocation; |
3863 | } | 4044 | } |
3864 | } | 4045 | } |
4046 | */// This is now handled properly in ScenePresence.MakeRootAgent | ||
3865 | } | 4047 | } |
3866 | 4048 | ||
3867 | return true; | 4049 | return true; |
3868 | } | 4050 | } |
3869 | 4051 | ||
3870 | private bool TestLandRestrictions(AgentCircuitData agent, ILandObject land, out string reason) | 4052 | public bool TestLandRestrictions(UUID agentID, out string reason, ref float posX, ref float posY) |
3871 | { | 4053 | { |
3872 | bool banned = land.IsBannedFromLand(agent.AgentID); | 4054 | if (posX < 0) |
3873 | bool restricted = land.IsRestrictedFromLand(agent.AgentID); | 4055 | posX = 0; |
4056 | else if (posX >= 256) | ||
4057 | posX = 255.999f; | ||
4058 | if (posY < 0) | ||
4059 | posY = 0; | ||
4060 | else if (posY >= 256) | ||
4061 | posY = 255.999f; | ||
4062 | |||
4063 | reason = String.Empty; | ||
4064 | if (Permissions.IsGod(agentID)) | ||
4065 | return true; | ||
4066 | |||
4067 | ILandObject land = LandChannel.GetLandObject(posX, posY); | ||
4068 | if (land == null) | ||
4069 | return false; | ||
4070 | |||
4071 | bool banned = land.IsBannedFromLand(agentID); | ||
4072 | bool restricted = land.IsRestrictedFromLand(agentID); | ||
3874 | 4073 | ||
3875 | if (banned || restricted) | 4074 | if (banned || restricted) |
3876 | { | 4075 | { |
3877 | ILandObject nearestParcel = GetNearestAllowedParcel(agent.AgentID, agent.startpos.X, agent.startpos.Y); | 4076 | ILandObject nearestParcel = GetNearestAllowedParcel(agentID, posX, posY); |
3878 | if (nearestParcel != null) | 4077 | if (nearestParcel != null) |
3879 | { | 4078 | { |
3880 | //Move agent to nearest allowed | 4079 | //Move agent to nearest allowed |
3881 | Vector3 newPosition = GetParcelCenterAtGround(nearestParcel); | 4080 | Vector3 newPosition = GetParcelCenterAtGround(nearestParcel); |
3882 | agent.startpos.X = newPosition.X; | 4081 | posX = newPosition.X; |
3883 | agent.startpos.Y = newPosition.Y; | 4082 | posY = newPosition.Y; |
3884 | } | 4083 | } |
3885 | else | 4084 | else |
3886 | { | 4085 | { |
@@ -3942,7 +4141,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3942 | 4141 | ||
3943 | if (!m_strictAccessControl) return true; | 4142 | if (!m_strictAccessControl) return true; |
3944 | if (Permissions.IsGod(agent.AgentID)) return true; | 4143 | if (Permissions.IsGod(agent.AgentID)) return true; |
3945 | 4144 | ||
3946 | if (AuthorizationService != null) | 4145 | if (AuthorizationService != null) |
3947 | { | 4146 | { |
3948 | if (!AuthorizationService.IsAuthorizedForRegion( | 4147 | if (!AuthorizationService.IsAuthorizedForRegion( |
@@ -3957,7 +4156,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3957 | 4156 | ||
3958 | if (RegionInfo.EstateSettings != null) | 4157 | if (RegionInfo.EstateSettings != null) |
3959 | { | 4158 | { |
3960 | if (RegionInfo.EstateSettings.IsBanned(agent.AgentID)) | 4159 | if (RegionInfo.EstateSettings.IsBanned(agent.AgentID, 0)) |
3961 | { | 4160 | { |
3962 | m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the user is on the banlist", | 4161 | m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the user is on the banlist", |
3963 | agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName); | 4162 | agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName); |
@@ -4147,6 +4346,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
4147 | 4346 | ||
4148 | // XPTO: if this agent is not allowed here as root, always return false | 4347 | // XPTO: if this agent is not allowed here as root, always return false |
4149 | 4348 | ||
4349 | // We have to wait until the viewer contacts this region after receiving EAC. | ||
4350 | // That calls AddNewClient, which finally creates the ScenePresence | ||
4351 | int flags = GetUserFlags(cAgentData.AgentID); | ||
4352 | if (RegionInfo.EstateSettings.IsBanned(cAgentData.AgentID, flags)) | ||
4353 | { | ||
4354 | m_log.DebugFormat("[SCENE]: Denying root agent entry to {0}: banned", cAgentData.AgentID); | ||
4355 | return false; | ||
4356 | } | ||
4357 | |||
4150 | // TODO: This check should probably be in QueryAccess(). | 4358 | // TODO: This check should probably be in QueryAccess(). |
4151 | ILandObject nearestParcel = GetNearestAllowedParcel(cAgentData.AgentID, Constants.RegionSize / 2, Constants.RegionSize / 2); | 4359 | ILandObject nearestParcel = GetNearestAllowedParcel(cAgentData.AgentID, Constants.RegionSize / 2, Constants.RegionSize / 2); |
4152 | if (nearestParcel == null) | 4360 | if (nearestParcel == null) |
@@ -4211,7 +4419,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4211 | /// <param name='agentID'></param> | 4419 | /// <param name='agentID'></param> |
4212 | protected virtual ScenePresence WaitGetScenePresence(UUID agentID) | 4420 | protected virtual ScenePresence WaitGetScenePresence(UUID agentID) |
4213 | { | 4421 | { |
4214 | int ntimes = 10; | 4422 | int ntimes = 30; |
4215 | ScenePresence sp = null; | 4423 | ScenePresence sp = null; |
4216 | while ((sp = GetScenePresence(agentID)) == null && (ntimes-- > 0)) | 4424 | while ((sp = GetScenePresence(agentID)) == null && (ntimes-- > 0)) |
4217 | Thread.Sleep(1000); | 4425 | Thread.Sleep(1000); |
@@ -4241,6 +4449,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
4241 | return false; | 4449 | return false; |
4242 | } | 4450 | } |
4243 | 4451 | ||
4452 | public bool IncomingCloseAgent(UUID agentID) | ||
4453 | { | ||
4454 | return IncomingCloseAgent(agentID, false); | ||
4455 | } | ||
4456 | |||
4457 | public bool IncomingCloseChildAgent(UUID agentID) | ||
4458 | { | ||
4459 | return IncomingCloseAgent(agentID, true); | ||
4460 | } | ||
4461 | |||
4244 | /// <summary> | 4462 | /// <summary> |
4245 | /// Tell a single agent to disconnect from the region. | 4463 | /// Tell a single agent to disconnect from the region. |
4246 | /// </summary> | 4464 | /// </summary> |
@@ -4256,7 +4474,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4256 | ScenePresence presence = m_sceneGraph.GetScenePresence(agentID); | 4474 | ScenePresence presence = m_sceneGraph.GetScenePresence(agentID); |
4257 | if (presence != null) | 4475 | if (presence != null) |
4258 | { | 4476 | { |
4259 | presence.ControllingClient.Close(force); | 4477 | presence.ControllingClient.Close(force, force); |
4260 | return true; | 4478 | return true; |
4261 | } | 4479 | } |
4262 | 4480 | ||
@@ -4916,35 +5134,81 @@ namespace OpenSim.Region.Framework.Scenes | |||
4916 | SimulationDataService.RemoveObject(uuid, RegionInfo.RegionID); | 5134 | SimulationDataService.RemoveObject(uuid, RegionInfo.RegionID); |
4917 | } | 5135 | } |
4918 | 5136 | ||
4919 | public int GetHealth() | 5137 | public int GetHealth(out int flags, out string message) |
4920 | { | 5138 | { |
4921 | // Returns: | 5139 | // Returns: |
4922 | // 1 = sim is up and accepting http requests. The heartbeat has | 5140 | // 1 = sim is up and accepting http requests. The heartbeat has |
4923 | // stopped and the sim is probably locked up, but a remote | 5141 | // stopped and the sim is probably locked up, but a remote |
4924 | // admin restart may succeed | 5142 | // admin restart may succeed |
4925 | // | 5143 | // |
4926 | // 2 = Sim is up and the heartbeat is running. The sim is likely | 5144 | // 2 = Sim is up and the heartbeat is running. The sim is likely |
4927 | // usable for people within and logins _may_ work | 5145 | // usable for people within |
5146 | // | ||
5147 | // 3 = Sim is up and one packet thread is running. Sim is | ||
5148 | // unstable and will not accept new logins | ||
4928 | // | 5149 | // |
4929 | // 3 = We have seen a new user enter within the past 4 minutes | 5150 | // 4 = Sim is up and both packet threads are running. Sim is |
5151 | // likely usable | ||
5152 | // | ||
5153 | // 5 = We have seen a new user enter within the past 4 minutes | ||
4930 | // which can be seen as positive confirmation of sim health | 5154 | // which can be seen as positive confirmation of sim health |
4931 | // | 5155 | // |
5156 | |||
5157 | flags = 0; | ||
5158 | message = String.Empty; | ||
5159 | |||
5160 | CheckHeartbeat(); | ||
5161 | |||
5162 | if (m_firstHeartbeat || (m_lastIncoming == 0 && m_lastOutgoing == 0)) | ||
5163 | { | ||
5164 | // We're still starting | ||
5165 | // 0 means "in startup", it can't happen another way, since | ||
5166 | // to get here, we must be able to accept http connections | ||
5167 | return 0; | ||
5168 | } | ||
5169 | |||
4932 | int health=1; // Start at 1, means we're up | 5170 | int health=1; // Start at 1, means we're up |
4933 | 5171 | ||
4934 | if ((Util.EnvironmentTickCountSubtract(m_lastFrameTick)) < 1000) | 5172 | if ((Util.EnvironmentTickCountSubtract(m_lastFrameTick)) < 1000) |
4935 | health += 1; | 5173 | { |
5174 | health+=1; | ||
5175 | flags |= 1; | ||
5176 | } | ||
5177 | |||
5178 | if (Util.EnvironmentTickCountSubtract(m_lastIncoming) < 1000) | ||
5179 | { | ||
5180 | health+=1; | ||
5181 | flags |= 2; | ||
5182 | } | ||
5183 | |||
5184 | if (Util.EnvironmentTickCountSubtract(m_lastOutgoing) < 1000) | ||
5185 | { | ||
5186 | health+=1; | ||
5187 | flags |= 4; | ||
5188 | } | ||
4936 | else | 5189 | else |
5190 | { | ||
5191 | int pid = System.Diagnostics.Process.GetCurrentProcess().Id; | ||
5192 | System.Diagnostics.Process proc = new System.Diagnostics.Process(); | ||
5193 | proc.EnableRaisingEvents=false; | ||
5194 | proc.StartInfo.FileName = "/bin/kill"; | ||
5195 | proc.StartInfo.Arguments = "-QUIT " + pid.ToString(); | ||
5196 | proc.Start(); | ||
5197 | proc.WaitForExit(); | ||
5198 | Thread.Sleep(1000); | ||
5199 | Environment.Exit(1); | ||
5200 | } | ||
5201 | |||
5202 | if (flags != 7) | ||
4937 | return health; | 5203 | return health; |
4938 | 5204 | ||
4939 | // A login in the last 4 mins? We can't be doing too badly | 5205 | // A login in the last 4 mins? We can't be doing too badly |
4940 | // | 5206 | // |
4941 | if ((Util.EnvironmentTickCountSubtract(m_LastLogin)) < 240000) | 5207 | if (Util.EnvironmentTickCountSubtract(m_LastLogin) < 240000) |
4942 | health++; | 5208 | health++; |
4943 | else | 5209 | else |
4944 | return health; | 5210 | return health; |
4945 | 5211 | ||
4946 | // CheckHeartbeat(); | ||
4947 | |||
4948 | return health; | 5212 | return health; |
4949 | } | 5213 | } |
4950 | 5214 | ||
@@ -5032,7 +5296,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
5032 | bool wasUsingPhysics = ((jointProxyObject.Flags & PrimFlags.Physics) != 0); | 5296 | bool wasUsingPhysics = ((jointProxyObject.Flags & PrimFlags.Physics) != 0); |
5033 | if (wasUsingPhysics) | 5297 | if (wasUsingPhysics) |
5034 | { | 5298 | { |
5035 | jointProxyObject.UpdatePrimFlags(false, false, true, false); // FIXME: possible deadlock here; check to make sure all the scene alterations set into motion here won't deadlock | 5299 | jointProxyObject.UpdatePrimFlags(false, false, true, false,false); // FIXME: possible deadlock here; check to make sure all the scene alterations set into motion here won't deadlock |
5036 | } | 5300 | } |
5037 | } | 5301 | } |
5038 | 5302 | ||
@@ -5131,14 +5395,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
5131 | return (((vsn.X * xdiff) + (vsn.Y * ydiff)) / (-1 * vsn.Z)) + p0.Z; | 5395 | return (((vsn.X * xdiff) + (vsn.Y * ydiff)) / (-1 * vsn.Z)) + p0.Z; |
5132 | } | 5396 | } |
5133 | 5397 | ||
5134 | // private void CheckHeartbeat() | 5398 | private void CheckHeartbeat() |
5135 | // { | 5399 | { |
5136 | // if (m_firstHeartbeat) | 5400 | if (m_firstHeartbeat) |
5137 | // return; | 5401 | return; |
5138 | // | 5402 | |
5139 | // if (Util.EnvironmentTickCountSubtract(m_lastFrameTick) > 2000) | 5403 | if ((Util.EnvironmentTickCountSubtract(m_lastFrameTick)) > 5000) |
5140 | // StartTimer(); | 5404 | Start(); |
5141 | // } | 5405 | } |
5142 | 5406 | ||
5143 | public override ISceneObject DeserializeObject(string representation) | 5407 | public override ISceneObject DeserializeObject(string representation) |
5144 | { | 5408 | { |
@@ -5150,9 +5414,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
5150 | get { return m_allowScriptCrossings; } | 5414 | get { return m_allowScriptCrossings; } |
5151 | } | 5415 | } |
5152 | 5416 | ||
5153 | public Vector3? GetNearestAllowedPosition(ScenePresence avatar) | 5417 | public Vector3 GetNearestAllowedPosition(ScenePresence avatar) |
5154 | { | 5418 | { |
5155 | ILandObject nearestParcel = GetNearestAllowedParcel(avatar.UUID, avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y); | 5419 | return GetNearestAllowedPosition(avatar, null); |
5420 | } | ||
5421 | |||
5422 | public Vector3 GetNearestAllowedPosition(ScenePresence avatar, ILandObject excludeParcel) | ||
5423 | { | ||
5424 | ILandObject nearestParcel = GetNearestAllowedParcel(avatar.UUID, avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y, excludeParcel); | ||
5156 | 5425 | ||
5157 | if (nearestParcel != null) | 5426 | if (nearestParcel != null) |
5158 | { | 5427 | { |
@@ -5161,10 +5430,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
5161 | Vector3? nearestPoint = GetNearestPointInParcelAlongDirectionFromPoint(avatar.AbsolutePosition, dir, nearestParcel); | 5430 | Vector3? nearestPoint = GetNearestPointInParcelAlongDirectionFromPoint(avatar.AbsolutePosition, dir, nearestParcel); |
5162 | if (nearestPoint != null) | 5431 | if (nearestPoint != null) |
5163 | { | 5432 | { |
5164 | // m_log.DebugFormat( | 5433 | Debug.WriteLine("Found a sane previous position based on velocity, sending them to: " + nearestPoint.ToString()); |
5165 | // "[SCENE]: Found a sane previous position based on velocity for {0}, sending them to {1} in {2}", | ||
5166 | // avatar.Name, nearestPoint, nearestParcel.LandData.Name); | ||
5167 | |||
5168 | return nearestPoint.Value; | 5434 | return nearestPoint.Value; |
5169 | } | 5435 | } |
5170 | 5436 | ||
@@ -5174,17 +5440,20 @@ namespace OpenSim.Region.Framework.Scenes | |||
5174 | nearestPoint = GetNearestPointInParcelAlongDirectionFromPoint(avatar.AbsolutePosition, dir, nearestParcel); | 5440 | nearestPoint = GetNearestPointInParcelAlongDirectionFromPoint(avatar.AbsolutePosition, dir, nearestParcel); |
5175 | if (nearestPoint != null) | 5441 | if (nearestPoint != null) |
5176 | { | 5442 | { |
5177 | // m_log.DebugFormat( | 5443 | Debug.WriteLine("They had a zero velocity, sending them to: " + nearestPoint.ToString()); |
5178 | // "[SCENE]: {0} had a zero velocity, sending them to {1}", avatar.Name, nearestPoint); | ||
5179 | |||
5180 | return nearestPoint.Value; | 5444 | return nearestPoint.Value; |
5181 | } | 5445 | } |
5182 | 5446 | ||
5183 | //Ultimate backup if we have no idea where they are | 5447 | ILandObject dest = LandChannel.GetLandObject(avatar.lastKnownAllowedPosition.X, avatar.lastKnownAllowedPosition.Y); |
5184 | // m_log.DebugFormat( | 5448 | if (dest != excludeParcel) |
5185 | // "[SCENE]: No idea where {0} is, sending them to {1}", avatar.Name, avatar.lastKnownAllowedPosition); | 5449 | { |
5450 | // Ultimate backup if we have no idea where they are and | ||
5451 | // the last allowed position was in another parcel | ||
5452 | Debug.WriteLine("Have no idea where they are, sending them to: " + avatar.lastKnownAllowedPosition.ToString()); | ||
5453 | return avatar.lastKnownAllowedPosition; | ||
5454 | } | ||
5186 | 5455 | ||
5187 | return avatar.lastKnownAllowedPosition; | 5456 | // else fall through to region edge |
5188 | } | 5457 | } |
5189 | 5458 | ||
5190 | //Go to the edge, this happens in teleporting to a region with no available parcels | 5459 | //Go to the edge, this happens in teleporting to a region with no available parcels |
@@ -5218,13 +5487,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
5218 | 5487 | ||
5219 | public ILandObject GetNearestAllowedParcel(UUID avatarId, float x, float y) | 5488 | public ILandObject GetNearestAllowedParcel(UUID avatarId, float x, float y) |
5220 | { | 5489 | { |
5490 | return GetNearestAllowedParcel(avatarId, x, y, null); | ||
5491 | } | ||
5492 | |||
5493 | public ILandObject GetNearestAllowedParcel(UUID avatarId, float x, float y, ILandObject excludeParcel) | ||
5494 | { | ||
5221 | List<ILandObject> all = AllParcels(); | 5495 | List<ILandObject> all = AllParcels(); |
5222 | float minParcelDistance = float.MaxValue; | 5496 | float minParcelDistance = float.MaxValue; |
5223 | ILandObject nearestParcel = null; | 5497 | ILandObject nearestParcel = null; |
5224 | 5498 | ||
5225 | foreach (var parcel in all) | 5499 | foreach (var parcel in all) |
5226 | { | 5500 | { |
5227 | if (!parcel.IsEitherBannedOrRestricted(avatarId)) | 5501 | if (!parcel.IsEitherBannedOrRestricted(avatarId) && parcel != excludeParcel) |
5228 | { | 5502 | { |
5229 | float parcelDistance = GetParcelDistancefromPoint(parcel, x, y); | 5503 | float parcelDistance = GetParcelDistancefromPoint(parcel, x, y); |
5230 | if (parcelDistance < minParcelDistance) | 5504 | if (parcelDistance < minParcelDistance) |
@@ -5466,7 +5740,55 @@ namespace OpenSim.Region.Framework.Scenes | |||
5466 | mapModule.GenerateMaptile(); | 5740 | mapModule.GenerateMaptile(); |
5467 | } | 5741 | } |
5468 | 5742 | ||
5469 | private void RegenerateMaptileAndReregister(object sender, ElapsedEventArgs e) | 5743 | // public void CleanDroppedAttachments() |
5744 | // { | ||
5745 | // List<SceneObjectGroup> objectsToDelete = | ||
5746 | // new List<SceneObjectGroup>(); | ||
5747 | // | ||
5748 | // lock (m_cleaningAttachments) | ||
5749 | // { | ||
5750 | // ForEachSOG(delegate (SceneObjectGroup grp) | ||
5751 | // { | ||
5752 | // if (grp.RootPart.Shape.PCode == 0 && grp.RootPart.Shape.State != 0 && (!objectsToDelete.Contains(grp))) | ||
5753 | // { | ||
5754 | // UUID agentID = grp.OwnerID; | ||
5755 | // if (agentID == UUID.Zero) | ||
5756 | // { | ||
5757 | // objectsToDelete.Add(grp); | ||
5758 | // return; | ||
5759 | // } | ||
5760 | // | ||
5761 | // ScenePresence sp = GetScenePresence(agentID); | ||
5762 | // if (sp == null) | ||
5763 | // { | ||
5764 | // objectsToDelete.Add(grp); | ||
5765 | // return; | ||
5766 | // } | ||
5767 | // } | ||
5768 | // }); | ||
5769 | // } | ||
5770 | // | ||
5771 | // foreach (SceneObjectGroup grp in objectsToDelete) | ||
5772 | // { | ||
5773 | // m_log.InfoFormat("[SCENE]: Deleting dropped attachment {0} of user {1}", grp.UUID, grp.OwnerID); | ||
5774 | // DeleteSceneObject(grp, true); | ||
5775 | // } | ||
5776 | // } | ||
5777 | |||
5778 | public void ThreadAlive(int threadCode) | ||
5779 | { | ||
5780 | switch(threadCode) | ||
5781 | { | ||
5782 | case 1: // Incoming | ||
5783 | m_lastIncoming = Util.EnvironmentTickCount(); | ||
5784 | break; | ||
5785 | case 2: // Incoming | ||
5786 | m_lastOutgoing = Util.EnvironmentTickCount(); | ||
5787 | break; | ||
5788 | } | ||
5789 | } | ||
5790 | |||
5791 | public void RegenerateMaptileAndReregister(object sender, ElapsedEventArgs e) | ||
5470 | { | 5792 | { |
5471 | RegenerateMaptile(); | 5793 | RegenerateMaptile(); |
5472 | 5794 | ||
@@ -5494,6 +5816,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
5494 | /// <returns></returns> | 5816 | /// <returns></returns> |
5495 | public bool QueryAccess(UUID agentID, Vector3 position, out string reason) | 5817 | public bool QueryAccess(UUID agentID, Vector3 position, out string reason) |
5496 | { | 5818 | { |
5819 | reason = "You are banned from the region"; | ||
5820 | |||
5497 | if (EntityTransferModule.IsInTransit(agentID)) | 5821 | if (EntityTransferModule.IsInTransit(agentID)) |
5498 | { | 5822 | { |
5499 | reason = "Agent is still in transit from this region"; | 5823 | reason = "Agent is still in transit from this region"; |
@@ -5505,6 +5829,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
5505 | return false; | 5829 | return false; |
5506 | } | 5830 | } |
5507 | 5831 | ||
5832 | if (Permissions.IsGod(agentID)) | ||
5833 | { | ||
5834 | reason = String.Empty; | ||
5835 | return true; | ||
5836 | } | ||
5837 | |||
5508 | // FIXME: Root agent count is currently known to be inaccurate. This forces a recount before we check. | 5838 | // FIXME: Root agent count is currently known to be inaccurate. This forces a recount before we check. |
5509 | // However, the long term fix is to make sure root agent count is always accurate. | 5839 | // However, the long term fix is to make sure root agent count is always accurate. |
5510 | m_sceneGraph.RecalculateStats(); | 5840 | m_sceneGraph.RecalculateStats(); |
@@ -5525,6 +5855,41 @@ namespace OpenSim.Region.Framework.Scenes | |||
5525 | } | 5855 | } |
5526 | } | 5856 | } |
5527 | 5857 | ||
5858 | ScenePresence presence = GetScenePresence(agentID); | ||
5859 | IClientAPI client = null; | ||
5860 | AgentCircuitData aCircuit = null; | ||
5861 | |||
5862 | if (presence != null) | ||
5863 | { | ||
5864 | client = presence.ControllingClient; | ||
5865 | if (client != null) | ||
5866 | aCircuit = client.RequestClientInfo(); | ||
5867 | } | ||
5868 | |||
5869 | // We may be called before there is a presence or a client. | ||
5870 | // Fake AgentCircuitData to keep IAuthorizationModule smiling | ||
5871 | if (client == null) | ||
5872 | { | ||
5873 | aCircuit = new AgentCircuitData(); | ||
5874 | aCircuit.AgentID = agentID; | ||
5875 | aCircuit.firstname = String.Empty; | ||
5876 | aCircuit.lastname = String.Empty; | ||
5877 | } | ||
5878 | |||
5879 | try | ||
5880 | { | ||
5881 | if (!AuthorizeUser(aCircuit, out reason)) | ||
5882 | { | ||
5883 | // m_log.DebugFormat("[SCENE]: Denying access for {0}", agentID); | ||
5884 | return false; | ||
5885 | } | ||
5886 | } | ||
5887 | catch (Exception e) | ||
5888 | { | ||
5889 | m_log.DebugFormat("[SCENE]: Exception authorizing agent: {0} "+ e.StackTrace, e.Message); | ||
5890 | return false; | ||
5891 | } | ||
5892 | |||
5528 | if (position == Vector3.Zero) // Teleport | 5893 | if (position == Vector3.Zero) // Teleport |
5529 | { | 5894 | { |
5530 | if (!RegionInfo.EstateSettings.AllowDirectTeleport) | 5895 | if (!RegionInfo.EstateSettings.AllowDirectTeleport) |
@@ -5553,13 +5918,46 @@ namespace OpenSim.Region.Framework.Scenes | |||
5553 | } | 5918 | } |
5554 | } | 5919 | } |
5555 | } | 5920 | } |
5921 | |||
5922 | float posX = 128.0f; | ||
5923 | float posY = 128.0f; | ||
5924 | |||
5925 | if (!TestLandRestrictions(agentID, out reason, ref posX, ref posY)) | ||
5926 | { | ||
5927 | // m_log.DebugFormat("[SCENE]: Denying {0} because they are banned on all parcels", agentID); | ||
5928 | return false; | ||
5929 | } | ||
5930 | } | ||
5931 | else // Walking | ||
5932 | { | ||
5933 | ILandObject land = LandChannel.GetLandObject(position.X, position.Y); | ||
5934 | if (land == null) | ||
5935 | return false; | ||
5936 | |||
5937 | bool banned = land.IsBannedFromLand(agentID); | ||
5938 | bool restricted = land.IsRestrictedFromLand(agentID); | ||
5939 | |||
5940 | if (banned || restricted) | ||
5941 | return false; | ||
5556 | } | 5942 | } |
5557 | 5943 | ||
5558 | reason = String.Empty; | 5944 | reason = String.Empty; |
5559 | return true; | 5945 | return true; |
5560 | } | 5946 | } |
5561 | 5947 | ||
5562 | /// <summary> | 5948 | public void StartTimerWatchdog() |
5949 | { | ||
5950 | m_timerWatchdog.Interval = 1000; | ||
5951 | m_timerWatchdog.Elapsed += TimerWatchdog; | ||
5952 | m_timerWatchdog.AutoReset = true; | ||
5953 | m_timerWatchdog.Start(); | ||
5954 | } | ||
5955 | |||
5956 | public void TimerWatchdog(object sender, ElapsedEventArgs e) | ||
5957 | { | ||
5958 | CheckHeartbeat(); | ||
5959 | } | ||
5960 | |||
5563 | /// This method deals with movement when an avatar is automatically moving (but this is distinct from the | 5961 | /// This method deals with movement when an avatar is automatically moving (but this is distinct from the |
5564 | /// autopilot that moves an avatar to a sit target!. | 5962 | /// autopilot that moves an avatar to a sit target!. |
5565 | /// </summary> | 5963 | /// </summary> |
@@ -5638,6 +6036,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
5638 | return m_SpawnPoint - 1; | 6036 | return m_SpawnPoint - 1; |
5639 | } | 6037 | } |
5640 | 6038 | ||
6039 | private void HandleGcCollect(string module, string[] args) | ||
6040 | { | ||
6041 | GC.Collect(); | ||
6042 | } | ||
6043 | |||
5641 | /// <summary> | 6044 | /// <summary> |
5642 | /// Wrappers to get physics modules retrieve assets. | 6045 | /// Wrappers to get physics modules retrieve assets. |
5643 | /// </summary> | 6046 | /// </summary> |