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 69c1027..2543333 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,12 +173,14 @@ 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 ModuleLoader m_moduleLoader; | 180 | protected ModuleLoader m_moduleLoader; |
180 | protected AgentCircuitManager m_authenticateHandler; | 181 | protected AgentCircuitManager m_authenticateHandler; |
181 | protected SceneCommunicationService m_sceneGridService; | 182 | protected SceneCommunicationService m_sceneGridService; |
183 | protected ISnmpModule m_snmpService = null; | ||
182 | 184 | ||
183 | protected ISimulationDataService m_SimulationDataService; | 185 | protected ISimulationDataService m_SimulationDataService; |
184 | protected IEstateDataService m_EstateDataService; | 186 | protected IEstateDataService m_EstateDataService; |
@@ -241,8 +243,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
241 | private int m_update_presences = 1; // Update scene presence movements | 243 | private int m_update_presences = 1; // Update scene presence movements |
242 | private int m_update_events = 1; | 244 | private int m_update_events = 1; |
243 | private int m_update_backup = 200; | 245 | private int m_update_backup = 200; |
244 | private int m_update_terrain = 50; | 246 | private int m_update_terrain = 1000; |
245 | // private int m_update_land = 1; | 247 | private int m_update_land = 10; |
246 | private int m_update_coarse_locations = 50; | 248 | private int m_update_coarse_locations = 50; |
247 | 249 | ||
248 | private int agentMS; | 250 | private int agentMS; |
@@ -255,13 +257,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
255 | private int backupMS; | 257 | private int backupMS; |
256 | private int terrainMS; | 258 | private int terrainMS; |
257 | private int landMS; | 259 | private int landMS; |
258 | private int spareMS; | ||
259 | 260 | ||
260 | /// <summary> | 261 | /// <summary> |
261 | /// Tick at which the last frame was processed. | 262 | /// Tick at which the last frame was processed. |
262 | /// </summary> | 263 | /// </summary> |
263 | private int m_lastFrameTick; | 264 | private int m_lastFrameTick; |
264 | 265 | ||
266 | public bool CombineRegions = false; | ||
265 | /// <summary> | 267 | /// <summary> |
266 | /// Tick at which the last maintenance run occurred. | 268 | /// Tick at which the last maintenance run occurred. |
267 | /// </summary> | 269 | /// </summary> |
@@ -292,6 +294,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
292 | /// </summary> | 294 | /// </summary> |
293 | private int m_LastLogin; | 295 | private int m_LastLogin; |
294 | 296 | ||
297 | private int m_lastIncoming; | ||
298 | private int m_lastOutgoing; | ||
299 | private int m_hbRestarts = 0; | ||
300 | |||
301 | |||
295 | /// <summary> | 302 | /// <summary> |
296 | /// Thread that runs the scene loop. | 303 | /// Thread that runs the scene loop. |
297 | /// </summary> | 304 | /// </summary> |
@@ -332,7 +339,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
332 | private volatile bool m_active; | 339 | private volatile bool m_active; |
333 | 340 | ||
334 | // private int m_lastUpdate; | 341 | // private int m_lastUpdate; |
335 | // private bool m_firstHeartbeat = true; | 342 | private bool m_firstHeartbeat = true; |
336 | 343 | ||
337 | private UpdatePrioritizationSchemes m_priorityScheme = UpdatePrioritizationSchemes.Time; | 344 | private UpdatePrioritizationSchemes m_priorityScheme = UpdatePrioritizationSchemes.Time; |
338 | private bool m_reprioritizationEnabled = true; | 345 | private bool m_reprioritizationEnabled = true; |
@@ -377,6 +384,19 @@ namespace OpenSim.Region.Framework.Scenes | |||
377 | get { return m_sceneGridService; } | 384 | get { return m_sceneGridService; } |
378 | } | 385 | } |
379 | 386 | ||
387 | public ISnmpModule SnmpService | ||
388 | { | ||
389 | get | ||
390 | { | ||
391 | if (m_snmpService == null) | ||
392 | { | ||
393 | m_snmpService = RequestModuleInterface<ISnmpModule>(); | ||
394 | } | ||
395 | |||
396 | return m_snmpService; | ||
397 | } | ||
398 | } | ||
399 | |||
380 | public ISimulationDataService SimulationDataService | 400 | public ISimulationDataService SimulationDataService |
381 | { | 401 | { |
382 | get | 402 | get |
@@ -676,6 +696,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
676 | m_SimulationDataService = simDataService; | 696 | m_SimulationDataService = simDataService; |
677 | m_EstateDataService = estateDataService; | 697 | m_EstateDataService = estateDataService; |
678 | m_regionHandle = RegionInfo.RegionHandle; | 698 | m_regionHandle = RegionInfo.RegionHandle; |
699 | m_lastIncoming = 0; | ||
700 | m_lastOutgoing = 0; | ||
679 | 701 | ||
680 | m_asyncSceneObjectDeleter = new AsyncSceneObjectGroupDeleter(this); | 702 | m_asyncSceneObjectDeleter = new AsyncSceneObjectGroupDeleter(this); |
681 | m_asyncSceneObjectDeleter.Enabled = true; | 703 | m_asyncSceneObjectDeleter.Enabled = true; |
@@ -758,132 +780,141 @@ namespace OpenSim.Region.Framework.Scenes | |||
758 | 780 | ||
759 | // Region config overrides global config | 781 | // Region config overrides global config |
760 | // | 782 | // |
761 | if (m_config.Configs["Startup"] != null) | 783 | try |
762 | { | 784 | { |
763 | IConfig startupConfig = m_config.Configs["Startup"]; | 785 | if (m_config.Configs["Startup"] != null) |
764 | |||
765 | StartDisabled = startupConfig.GetBoolean("StartDisabled", false); | ||
766 | |||
767 | m_defaultDrawDistance = startupConfig.GetFloat("DefaultDrawDistance", m_defaultDrawDistance); | ||
768 | m_useBackup = startupConfig.GetBoolean("UseSceneBackup", m_useBackup); | ||
769 | if (!m_useBackup) | ||
770 | m_log.InfoFormat("[SCENE]: Backup has been disabled for {0}", RegionInfo.RegionName); | ||
771 | |||
772 | //Animation states | ||
773 | m_useFlySlow = startupConfig.GetBoolean("enableflyslow", false); | ||
774 | |||
775 | MaxUndoCount = startupConfig.GetInt("MaxPrimUndos", 20); | ||
776 | |||
777 | PhysicalPrims = startupConfig.GetBoolean("physical_prim", PhysicalPrims); | ||
778 | CollidablePrims = startupConfig.GetBoolean("collidable_prim", CollidablePrims); | ||
779 | |||
780 | m_minNonphys = startupConfig.GetFloat("NonPhysicalPrimMin", m_minNonphys); | ||
781 | if (RegionInfo.NonphysPrimMin > 0) | ||
782 | { | 786 | { |
783 | m_minNonphys = RegionInfo.NonphysPrimMin; | 787 | IConfig startupConfig = m_config.Configs["Startup"]; |
784 | } | ||
785 | 788 | ||
786 | m_maxNonphys = startupConfig.GetFloat("NonPhysicalPrimMax", m_maxNonphys); | 789 | StartDisabled = startupConfig.GetBoolean("StartDisabled", false); |
787 | if (RegionInfo.NonphysPrimMax > 0) | ||
788 | { | ||
789 | m_maxNonphys = RegionInfo.NonphysPrimMax; | ||
790 | } | ||
791 | 790 | ||
792 | m_minPhys = startupConfig.GetFloat("PhysicalPrimMin", m_minPhys); | 791 | m_defaultDrawDistance = startupConfig.GetFloat("DefaultDrawDistance",m_defaultDrawDistance); |
793 | if (RegionInfo.PhysPrimMin > 0) | 792 | m_useBackup = startupConfig.GetBoolean("UseSceneBackup", m_useBackup); |
794 | { | 793 | if (!m_useBackup) |
795 | m_minPhys = RegionInfo.PhysPrimMin; | 794 | m_log.InfoFormat("[SCENE]: Backup has been disabled for {0}", RegionInfo.RegionName); |
796 | } | 795 | |
796 | //Animation states | ||
797 | m_useFlySlow = startupConfig.GetBoolean("enableflyslow", false); | ||
797 | 798 | ||
798 | m_maxPhys = startupConfig.GetFloat("PhysicalPrimMax", m_maxPhys); | 799 | PhysicalPrims = startupConfig.GetBoolean("physical_prim", true); |
799 | if (RegionInfo.PhysPrimMax > 0) | 800 | CollidablePrims = startupConfig.GetBoolean("collidable_prim", true); |
800 | { | ||
801 | m_maxPhys = RegionInfo.PhysPrimMax; | ||
802 | } | ||
803 | 801 | ||
804 | // Here, if clamping is requested in either global or | 802 | m_minNonphys = startupConfig.GetFloat("NonPhysicalPrimMin", m_minNonphys); |
805 | // local config, it will be used | 803 | if (RegionInfo.NonphysPrimMin > 0) |
806 | // | 804 | { |
807 | m_clampPrimSize = startupConfig.GetBoolean("ClampPrimSize", m_clampPrimSize); | 805 | m_minNonphys = RegionInfo.NonphysPrimMin; |
808 | if (RegionInfo.ClampPrimSize) | 806 | } |
809 | { | ||
810 | m_clampPrimSize = true; | ||
811 | } | ||
812 | 807 | ||
813 | m_linksetCapacity = startupConfig.GetInt("LinksetPrims", m_linksetCapacity); | 808 | m_maxNonphys = startupConfig.GetFloat("NonPhysicalPrimMax", m_maxNonphys); |
814 | if (RegionInfo.LinksetCapacity > 0) | 809 | if (RegionInfo.NonphysPrimMax > 0) |
815 | { | 810 | { |
816 | m_linksetCapacity = RegionInfo.LinksetCapacity; | 811 | m_maxNonphys = RegionInfo.NonphysPrimMax; |
817 | } | 812 | } |
818 | 813 | ||
819 | m_useTrashOnDelete = startupConfig.GetBoolean("UseTrashOnDelete", m_useTrashOnDelete); | 814 | m_minPhys = startupConfig.GetFloat("PhysicalPrimMin", m_minPhys); |
820 | m_trustBinaries = startupConfig.GetBoolean("TrustBinaries", m_trustBinaries); | 815 | if (RegionInfo.PhysPrimMin > 0) |
821 | m_allowScriptCrossings = startupConfig.GetBoolean("AllowScriptCrossing", m_allowScriptCrossings); | 816 | { |
822 | m_dontPersistBefore = | 817 | m_minPhys = RegionInfo.PhysPrimMin; |
823 | startupConfig.GetLong("MinimumTimeBeforePersistenceConsidered", DEFAULT_MIN_TIME_FOR_PERSISTENCE); | 818 | } |
824 | m_dontPersistBefore *= 10000000; | ||
825 | m_persistAfter = | ||
826 | startupConfig.GetLong("MaximumTimeBeforePersistenceConsidered", DEFAULT_MAX_TIME_FOR_PERSISTENCE); | ||
827 | m_persistAfter *= 10000000; | ||
828 | 819 | ||
829 | m_defaultScriptEngine = startupConfig.GetString("DefaultScriptEngine", "XEngine"); | 820 | m_maxPhys = startupConfig.GetFloat("PhysicalPrimMax", m_maxPhys); |
830 | 821 | ||
831 | SpawnPointRouting = startupConfig.GetString("SpawnPointRouting", "closest"); | 822 | if (RegionInfo.PhysPrimMax > 0) |
832 | TelehubAllowLandmarks = startupConfig.GetBoolean("TelehubAllowLandmark", false); | 823 | { |
824 | m_maxPhys = RegionInfo.PhysPrimMax; | ||
825 | } | ||
833 | 826 | ||
834 | m_strictAccessControl = startupConfig.GetBoolean("StrictAccessControl", m_strictAccessControl); | 827 | m_linksetCapacity = startupConfig.GetInt("LinksetPrims", m_linksetCapacity); |
828 | if (RegionInfo.LinksetCapacity > 0) | ||
829 | { | ||
830 | m_linksetCapacity = RegionInfo.LinksetCapacity; | ||
831 | } | ||
835 | 832 | ||
836 | m_generateMaptiles = startupConfig.GetBoolean("GenerateMaptiles", true); | 833 | SpawnPointRouting = startupConfig.GetString("SpawnPointRouting", "closest"); |
837 | if (m_generateMaptiles) | 834 | TelehubAllowLandmarks = startupConfig.GetBoolean("TelehubAllowLandmark", false); |
838 | { | 835 | |
839 | int maptileRefresh = startupConfig.GetInt("MaptileRefresh", 0); | 836 | // Here, if clamping is requested in either global or |
840 | if (maptileRefresh != 0) | 837 | // local config, it will be used |
838 | // | ||
839 | m_clampPrimSize = startupConfig.GetBoolean("ClampPrimSize", m_clampPrimSize); | ||
840 | if (RegionInfo.ClampPrimSize) | ||
841 | { | 841 | { |
842 | m_mapGenerationTimer.Interval = maptileRefresh * 1000; | 842 | m_clampPrimSize = true; |
843 | m_mapGenerationTimer.Elapsed += RegenerateMaptileAndReregister; | ||
844 | m_mapGenerationTimer.AutoReset = true; | ||
845 | m_mapGenerationTimer.Start(); | ||
846 | } | 843 | } |
847 | } | ||
848 | else | ||
849 | { | ||
850 | string tile = startupConfig.GetString("MaptileStaticUUID", UUID.Zero.ToString()); | ||
851 | UUID tileID; | ||
852 | 844 | ||
853 | if (UUID.TryParse(tile, out tileID)) | 845 | m_useTrashOnDelete = startupConfig.GetBoolean("UseTrashOnDelete",m_useTrashOnDelete); |
846 | m_trustBinaries = startupConfig.GetBoolean("TrustBinaries", m_trustBinaries); | ||
847 | m_allowScriptCrossings = startupConfig.GetBoolean("AllowScriptCrossing", m_allowScriptCrossings); | ||
848 | m_dontPersistBefore = | ||
849 | startupConfig.GetLong("MinimumTimeBeforePersistenceConsidered", DEFAULT_MIN_TIME_FOR_PERSISTENCE); | ||
850 | m_dontPersistBefore *= 10000000; | ||
851 | m_persistAfter = | ||
852 | startupConfig.GetLong("MaximumTimeBeforePersistenceConsidered", DEFAULT_MAX_TIME_FOR_PERSISTENCE); | ||
853 | m_persistAfter *= 10000000; | ||
854 | |||
855 | m_defaultScriptEngine = startupConfig.GetString("DefaultScriptEngine", "XEngine"); | ||
856 | m_log.InfoFormat("[SCENE]: Default script engine {0}", m_defaultScriptEngine); | ||
857 | |||
858 | m_strictAccessControl = startupConfig.GetBoolean("StrictAccessControl", m_strictAccessControl); | ||
859 | m_seeIntoBannedRegion = startupConfig.GetBoolean("SeeIntoBannedRegion", m_seeIntoBannedRegion); | ||
860 | CombineRegions = startupConfig.GetBoolean("CombineContiguousRegions", false); | ||
861 | |||
862 | m_generateMaptiles = startupConfig.GetBoolean("GenerateMaptiles", true); | ||
863 | if (m_generateMaptiles) | ||
854 | { | 864 | { |
855 | RegionInfo.RegionSettings.TerrainImageID = tileID; | 865 | int maptileRefresh = startupConfig.GetInt("MaptileRefresh", 0); |
866 | if (maptileRefresh != 0) | ||
867 | { | ||
868 | m_mapGenerationTimer.Interval = maptileRefresh * 1000; | ||
869 | m_mapGenerationTimer.Elapsed += RegenerateMaptileAndReregister; | ||
870 | m_mapGenerationTimer.AutoReset = true; | ||
871 | m_mapGenerationTimer.Start(); | ||
872 | } | ||
856 | } | 873 | } |
857 | } | 874 | else |
875 | { | ||
876 | string tile = startupConfig.GetString("MaptileStaticUUID", UUID.Zero.ToString()); | ||
877 | UUID tileID; | ||
858 | 878 | ||
859 | string grant = startupConfig.GetString("AllowedClients", String.Empty); | 879 | if (UUID.TryParse(tile, out tileID)) |
860 | if (grant.Length > 0) | 880 | { |
861 | { | 881 | RegionInfo.RegionSettings.TerrainImageID = tileID; |
862 | foreach (string viewer in grant.Split('|')) | 882 | } |
883 | } | ||
884 | |||
885 | string grant = startupConfig.GetString("AllowedClients", String.Empty); | ||
886 | if (grant.Length > 0) | ||
863 | { | 887 | { |
864 | m_AllowedViewers.Add(viewer.Trim().ToLower()); | 888 | foreach (string viewer in grant.Split(',')) |
889 | { | ||
890 | m_AllowedViewers.Add(viewer.Trim().ToLower()); | ||
891 | } | ||
865 | } | 892 | } |
866 | } | ||
867 | 893 | ||
868 | grant = startupConfig.GetString("BannedClients", String.Empty); | 894 | grant = startupConfig.GetString("BannedClients", String.Empty); |
869 | if (grant.Length > 0) | 895 | if (grant.Length > 0) |
870 | { | ||
871 | foreach (string viewer in grant.Split('|')) | ||
872 | { | 896 | { |
873 | m_BannedViewers.Add(viewer.Trim().ToLower()); | 897 | foreach (string viewer in grant.Split(',')) |
898 | { | ||
899 | m_BannedViewers.Add(viewer.Trim().ToLower()); | ||
900 | } | ||
874 | } | 901 | } |
875 | } | ||
876 | 902 | ||
877 | MinFrameTime = startupConfig.GetFloat( "MinFrameTime", MinFrameTime); | 903 | MinFrameTime = startupConfig.GetFloat( "MinFrameTime", MinFrameTime); |
878 | m_update_backup = startupConfig.GetInt( "UpdateStorageEveryNFrames", m_update_backup); | 904 | m_update_backup = startupConfig.GetInt( "UpdateStorageEveryNFrames", m_update_backup); |
879 | m_update_coarse_locations = startupConfig.GetInt( "UpdateCoarseLocationsEveryNFrames", m_update_coarse_locations); | 905 | m_update_coarse_locations = startupConfig.GetInt( "UpdateCoarseLocationsEveryNFrames", m_update_coarse_locations); |
880 | m_update_entitymovement = startupConfig.GetInt( "UpdateEntityMovementEveryNFrames", m_update_entitymovement); | 906 | m_update_entitymovement = startupConfig.GetInt( "UpdateEntityMovementEveryNFrames", m_update_entitymovement); |
881 | m_update_events = startupConfig.GetInt( "UpdateEventsEveryNFrames", m_update_events); | 907 | m_update_events = startupConfig.GetInt( "UpdateEventsEveryNFrames", m_update_events); |
882 | m_update_objects = startupConfig.GetInt( "UpdateObjectsEveryNFrames", m_update_objects); | 908 | m_update_objects = startupConfig.GetInt( "UpdateObjectsEveryNFrames", m_update_objects); |
883 | m_update_physics = startupConfig.GetInt( "UpdatePhysicsEveryNFrames", m_update_physics); | 909 | m_update_physics = startupConfig.GetInt( "UpdatePhysicsEveryNFrames", m_update_physics); |
884 | m_update_presences = startupConfig.GetInt( "UpdateAgentsEveryNFrames", m_update_presences); | 910 | m_update_presences = startupConfig.GetInt( "UpdateAgentsEveryNFrames", m_update_presences); |
885 | m_update_terrain = startupConfig.GetInt( "UpdateTerrainEveryNFrames", m_update_terrain); | 911 | m_update_terrain = startupConfig.GetInt( "UpdateTerrainEveryNFrames", m_update_terrain); |
886 | m_update_temp_cleaning = startupConfig.GetInt( "UpdateTempCleaningEveryNFrames", m_update_temp_cleaning); | 912 | m_update_temp_cleaning = startupConfig.GetInt( "UpdateTempCleaningEveryNFrames", m_update_temp_cleaning); |
913 | } | ||
914 | } | ||
915 | catch (Exception e) | ||
916 | { | ||
917 | m_log.Error("[SCENE]: Failed to load StartupConfig: " + e.ToString()); | ||
887 | } | 918 | } |
888 | 919 | ||
889 | // FIXME: Ultimately this should be in a module. | 920 | // FIXME: Ultimately this should be in a module. |
@@ -928,6 +959,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
928 | StatsReporter = new SimStatsReporter(this); | 959 | StatsReporter = new SimStatsReporter(this); |
929 | StatsReporter.OnSendStatsResult += SendSimStatsPackets; | 960 | StatsReporter.OnSendStatsResult += SendSimStatsPackets; |
930 | StatsReporter.OnStatsIncorrect += m_sceneGraph.RecalculateStats; | 961 | StatsReporter.OnStatsIncorrect += m_sceneGraph.RecalculateStats; |
962 | |||
963 | MainConsole.Instance.Commands.AddCommand("scene", false, "gc collect", "gc collect", "gc collect", "Cause the garbage collector to make a single pass", HandleGcCollect); | ||
931 | } | 964 | } |
932 | 965 | ||
933 | public Scene(RegionInfo regInfo) : base(regInfo) | 966 | public Scene(RegionInfo regInfo) : base(regInfo) |
@@ -1302,9 +1335,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
1302 | // Stop all client threads. | 1335 | // Stop all client threads. |
1303 | ForEachScenePresence(delegate(ScenePresence avatar) { avatar.ControllingClient.Close(); }); | 1336 | ForEachScenePresence(delegate(ScenePresence avatar) { avatar.ControllingClient.Close(); }); |
1304 | 1337 | ||
1305 | m_log.Debug("[SCENE]: Persisting changed objects"); | 1338 | m_log.Debug("[SCENE]: TriggerSceneShuttingDown"); |
1306 | EventManager.TriggerSceneShuttingDown(this); | 1339 | EventManager.TriggerSceneShuttingDown(this); |
1307 | 1340 | ||
1341 | m_log.Debug("[SCENE]: Persisting changed objects"); | ||
1342 | |||
1308 | EntityBase[] entities = GetEntities(); | 1343 | EntityBase[] entities = GetEntities(); |
1309 | foreach (EntityBase entity in entities) | 1344 | foreach (EntityBase entity in entities) |
1310 | { | 1345 | { |
@@ -1314,6 +1349,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1314 | } | 1349 | } |
1315 | } | 1350 | } |
1316 | 1351 | ||
1352 | m_log.Debug("[SCENE]: Graph close"); | ||
1317 | m_sceneGraph.Close(); | 1353 | m_sceneGraph.Close(); |
1318 | 1354 | ||
1319 | if (!GridService.DeregisterRegion(RegionInfo.RegionID)) | 1355 | if (!GridService.DeregisterRegion(RegionInfo.RegionID)) |
@@ -1326,6 +1362,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1326 | // attempt to reference a null or disposed physics scene. | 1362 | // attempt to reference a null or disposed physics scene. |
1327 | if (PhysicsScene != null) | 1363 | if (PhysicsScene != null) |
1328 | { | 1364 | { |
1365 | m_log.Debug("[SCENE]: Dispose Physics"); | ||
1329 | PhysicsScene phys = PhysicsScene; | 1366 | PhysicsScene phys = PhysicsScene; |
1330 | // remove the physics engine from both Scene and SceneGraph | 1367 | // remove the physics engine from both Scene and SceneGraph |
1331 | PhysicsScene = null; | 1368 | PhysicsScene = null; |
@@ -1348,11 +1385,29 @@ namespace OpenSim.Region.Framework.Scenes | |||
1348 | //m_heartbeatTimer.Elapsed += new ElapsedEventHandler(Heartbeat); | 1385 | //m_heartbeatTimer.Elapsed += new ElapsedEventHandler(Heartbeat); |
1349 | if (m_heartbeatThread != null) | 1386 | if (m_heartbeatThread != null) |
1350 | { | 1387 | { |
1388 | m_hbRestarts++; | ||
1389 | if(m_hbRestarts > 10) | ||
1390 | Environment.Exit(1); | ||
1391 | m_log.ErrorFormat("[SCENE]: Restarting heartbeat thread because it hasn't reported in in region {0}", RegionInfo.RegionName); | ||
1392 | |||
1393 | //int pid = System.Diagnostics.Process.GetCurrentProcess().Id; | ||
1394 | //System.Diagnostics.Process proc = new System.Diagnostics.Process(); | ||
1395 | //proc.EnableRaisingEvents=false; | ||
1396 | //proc.StartInfo.FileName = "/bin/kill"; | ||
1397 | //proc.StartInfo.Arguments = "-QUIT " + pid.ToString(); | ||
1398 | //proc.Start(); | ||
1399 | //proc.WaitForExit(); | ||
1400 | //Thread.Sleep(1000); | ||
1401 | //Environment.Exit(1); | ||
1351 | m_heartbeatThread.Abort(); | 1402 | m_heartbeatThread.Abort(); |
1403 | Watchdog.AbortThread(m_heartbeatThread.ManagedThreadId); | ||
1352 | m_heartbeatThread = null; | 1404 | m_heartbeatThread = null; |
1353 | } | 1405 | } |
1354 | // m_lastUpdate = Util.EnvironmentTickCount(); | 1406 | // m_lastUpdate = Util.EnvironmentTickCount(); |
1355 | 1407 | ||
1408 | // m_sceneGraph.PreparePhysicsSimulation(); | ||
1409 | |||
1410 | |||
1356 | m_heartbeatThread | 1411 | m_heartbeatThread |
1357 | = Watchdog.StartThread( | 1412 | = Watchdog.StartThread( |
1358 | Heartbeat, string.Format("Heartbeat ({0})", RegionInfo.RegionName), ThreadPriority.Normal, false, false); | 1413 | Heartbeat, string.Format("Heartbeat ({0})", RegionInfo.RegionName), ThreadPriority.Normal, false, false); |
@@ -1495,16 +1550,20 @@ namespace OpenSim.Region.Framework.Scenes | |||
1495 | endFrame = Frame + frames; | 1550 | endFrame = Frame + frames; |
1496 | 1551 | ||
1497 | float physicsFPS = 0f; | 1552 | float physicsFPS = 0f; |
1498 | int previousFrameTick, tmpMS; | 1553 | int tmpMS; |
1499 | int maintc = Util.EnvironmentTickCount(); | 1554 | int previousFrameTick; |
1555 | int maintc; | ||
1556 | int sleepMS; | ||
1557 | int framestart; | ||
1500 | 1558 | ||
1501 | while (!m_shuttingDown && ((endFrame == null && Active) || Frame < endFrame)) | 1559 | while (!m_shuttingDown && ((endFrame == null && Active) || Frame < endFrame)) |
1502 | { | 1560 | { |
1561 | framestart = Util.EnvironmentTickCount(); | ||
1503 | ++Frame; | 1562 | ++Frame; |
1504 | 1563 | ||
1505 | // m_log.DebugFormat("[SCENE]: Processing frame {0} in {1}", Frame, RegionInfo.RegionName); | 1564 | // m_log.DebugFormat("[SCENE]: Processing frame {0} in {1}", Frame, RegionInfo.RegionName); |
1506 | 1565 | ||
1507 | agentMS = tempOnRezMS = eventMS = backupMS = terrainMS = landMS = spareMS = 0; | 1566 | agentMS = tempOnRezMS = eventMS = backupMS = terrainMS = landMS = 0; |
1508 | 1567 | ||
1509 | try | 1568 | try |
1510 | { | 1569 | { |
@@ -1556,6 +1615,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1556 | m_sceneGraph.UpdatePresences(); | 1615 | m_sceneGraph.UpdatePresences(); |
1557 | 1616 | ||
1558 | agentMS += Util.EnvironmentTickCountSubtract(tmpMS); | 1617 | agentMS += Util.EnvironmentTickCountSubtract(tmpMS); |
1618 | |||
1559 | 1619 | ||
1560 | // Delete temp-on-rez stuff | 1620 | // Delete temp-on-rez stuff |
1561 | if (Frame % m_update_temp_cleaning == 0 && !m_cleaningTemps) | 1621 | if (Frame % m_update_temp_cleaning == 0 && !m_cleaningTemps) |
@@ -1637,34 +1697,37 @@ namespace OpenSim.Region.Framework.Scenes | |||
1637 | 1697 | ||
1638 | Watchdog.UpdateThread(); | 1698 | Watchdog.UpdateThread(); |
1639 | 1699 | ||
1700 | otherMS = tempOnRezMS + eventMS + backupMS + terrainMS + landMS; | ||
1701 | |||
1702 | StatsReporter.AddPhysicsFPS(physicsFPS); | ||
1703 | StatsReporter.AddTimeDilation(TimeDilation); | ||
1704 | StatsReporter.AddFPS(1); | ||
1705 | |||
1706 | StatsReporter.addAgentMS(agentMS); | ||
1707 | StatsReporter.addPhysicsMS(physicsMS + physicsMS2); | ||
1708 | StatsReporter.addOtherMS(otherMS); | ||
1709 | StatsReporter.addScriptLines(m_sceneGraph.GetScriptLPS()); | ||
1710 | |||
1640 | previousFrameTick = m_lastFrameTick; | 1711 | previousFrameTick = m_lastFrameTick; |
1641 | m_lastFrameTick = Util.EnvironmentTickCount(); | 1712 | m_lastFrameTick = Util.EnvironmentTickCount(); |
1642 | tmpMS = Util.EnvironmentTickCountSubtract(m_lastFrameTick, maintc); | 1713 | tmpMS = Util.EnvironmentTickCountSubtract(m_lastFrameTick, framestart); |
1643 | tmpMS = (int)(MinFrameTime * 1000) - tmpMS; | 1714 | tmpMS = (int)(MinFrameTime * 1000) - tmpMS; |
1644 | 1715 | ||
1716 | m_firstHeartbeat = false; | ||
1717 | |||
1718 | sleepMS = Util.EnvironmentTickCount(); | ||
1719 | |||
1645 | if (tmpMS > 0) | 1720 | if (tmpMS > 0) |
1646 | { | ||
1647 | Thread.Sleep(tmpMS); | 1721 | Thread.Sleep(tmpMS); |
1648 | spareMS += tmpMS; | ||
1649 | } | ||
1650 | 1722 | ||
1651 | frameMS = Util.EnvironmentTickCountSubtract(maintc); | 1723 | sleepMS = Util.EnvironmentTickCountSubtract(sleepMS); |
1652 | maintc = Util.EnvironmentTickCount(); | 1724 | frameMS = Util.EnvironmentTickCountSubtract(framestart); |
1653 | 1725 | StatsReporter.addSleepMS(sleepMS); | |
1654 | otherMS = tempOnRezMS + eventMS + backupMS + terrainMS + landMS; | 1726 | StatsReporter.addFrameMS(frameMS); |
1655 | 1727 | ||
1656 | // if (Frame%m_update_avatars == 0) | 1728 | // if (Frame%m_update_avatars == 0) |
1657 | // UpdateInWorldTime(); | 1729 | // UpdateInWorldTime(); |
1658 | StatsReporter.AddPhysicsFPS(physicsFPS); | ||
1659 | StatsReporter.AddTimeDilation(TimeDilation); | ||
1660 | StatsReporter.AddFPS(1); | ||
1661 | 1730 | ||
1662 | StatsReporter.addFrameMS(frameMS); | ||
1663 | StatsReporter.addAgentMS(agentMS); | ||
1664 | StatsReporter.addPhysicsMS(physicsMS + physicsMS2); | ||
1665 | StatsReporter.addOtherMS(otherMS); | ||
1666 | StatsReporter.AddSpareMS(spareMS); | ||
1667 | StatsReporter.addScriptLines(m_sceneGraph.GetScriptLPS()); | ||
1668 | 1731 | ||
1669 | // Optionally warn if a frame takes double the amount of time that it should. | 1732 | // Optionally warn if a frame takes double the amount of time that it should. |
1670 | if (DebugUpdates | 1733 | if (DebugUpdates |
@@ -1782,7 +1845,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1782 | msg.fromAgentName = "Server"; | 1845 | msg.fromAgentName = "Server"; |
1783 | msg.dialog = (byte)19; // Object msg | 1846 | msg.dialog = (byte)19; // Object msg |
1784 | msg.fromGroup = false; | 1847 | msg.fromGroup = false; |
1785 | msg.offline = (byte)0; | 1848 | msg.offline = (byte)1; |
1786 | msg.ParentEstateID = RegionInfo.EstateSettings.ParentEstateID; | 1849 | msg.ParentEstateID = RegionInfo.EstateSettings.ParentEstateID; |
1787 | msg.Position = Vector3.Zero; | 1850 | msg.Position = Vector3.Zero; |
1788 | msg.RegionID = RegionInfo.RegionID.Guid; | 1851 | msg.RegionID = RegionInfo.RegionID.Guid; |
@@ -2004,6 +2067,19 @@ namespace OpenSim.Region.Framework.Scenes | |||
2004 | EventManager.TriggerPrimsLoaded(this); | 2067 | EventManager.TriggerPrimsLoaded(this); |
2005 | } | 2068 | } |
2006 | 2069 | ||
2070 | public bool SuportsRayCastFiltered() | ||
2071 | { | ||
2072 | if (PhysicsScene == null) | ||
2073 | return false; | ||
2074 | return PhysicsScene.SuportsRaycastWorldFiltered(); | ||
2075 | } | ||
2076 | |||
2077 | public object RayCastFiltered(Vector3 position, Vector3 direction, float length, int Count, RayFilterFlags filter) | ||
2078 | { | ||
2079 | if (PhysicsScene == null) | ||
2080 | return null; | ||
2081 | return PhysicsScene.RaycastWorld(position, direction, length, Count,filter); | ||
2082 | } | ||
2007 | 2083 | ||
2008 | /// <summary> | 2084 | /// <summary> |
2009 | /// Gets a new rez location based on the raycast and the size of the object that is being rezzed. | 2085 | /// Gets a new rez location based on the raycast and the size of the object that is being rezzed. |
@@ -2020,14 +2096,24 @@ namespace OpenSim.Region.Framework.Scenes | |||
2020 | /// <returns></returns> | 2096 | /// <returns></returns> |
2021 | public Vector3 GetNewRezLocation(Vector3 RayStart, Vector3 RayEnd, UUID RayTargetID, Quaternion rot, byte bypassRayCast, byte RayEndIsIntersection, bool frontFacesOnly, Vector3 scale, bool FaceCenter) | 2097 | public Vector3 GetNewRezLocation(Vector3 RayStart, Vector3 RayEnd, UUID RayTargetID, Quaternion rot, byte bypassRayCast, byte RayEndIsIntersection, bool frontFacesOnly, Vector3 scale, bool FaceCenter) |
2022 | { | 2098 | { |
2099 | |||
2100 | float wheight = (float)RegionInfo.RegionSettings.WaterHeight; | ||
2101 | Vector3 wpos = Vector3.Zero; | ||
2102 | // Check for water surface intersection from above | ||
2103 | if ( (RayStart.Z > wheight) && (RayEnd.Z < wheight) ) | ||
2104 | { | ||
2105 | float ratio = (RayStart.Z - wheight) / (RayStart.Z - RayEnd.Z); | ||
2106 | wpos.X = RayStart.X - (ratio * (RayStart.X - RayEnd.X)); | ||
2107 | wpos.Y = RayStart.Y - (ratio * (RayStart.Y - RayEnd.Y)); | ||
2108 | wpos.Z = wheight; | ||
2109 | } | ||
2110 | |||
2023 | Vector3 pos = Vector3.Zero; | 2111 | Vector3 pos = Vector3.Zero; |
2024 | if (RayEndIsIntersection == (byte)1) | 2112 | if (RayEndIsIntersection == (byte)1) |
2025 | { | 2113 | { |
2026 | pos = RayEnd; | 2114 | pos = RayEnd; |
2027 | return pos; | ||
2028 | } | 2115 | } |
2029 | 2116 | else if (RayTargetID != UUID.Zero) | |
2030 | if (RayTargetID != UUID.Zero) | ||
2031 | { | 2117 | { |
2032 | SceneObjectPart target = GetSceneObjectPart(RayTargetID); | 2118 | SceneObjectPart target = GetSceneObjectPart(RayTargetID); |
2033 | 2119 | ||
@@ -2049,7 +2135,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2049 | EntityIntersection ei = target.TestIntersectionOBB(NewRay, Quaternion.Identity, frontFacesOnly, FaceCenter); | 2135 | EntityIntersection ei = target.TestIntersectionOBB(NewRay, Quaternion.Identity, frontFacesOnly, FaceCenter); |
2050 | 2136 | ||
2051 | // Un-comment out the following line to Get Raytrace results printed to the console. | 2137 | // Un-comment out the following line to Get Raytrace results printed to the console. |
2052 | // m_log.Info("[RAYTRACERESULTS]: Hit:" + ei.HitTF.ToString() + " Point: " + ei.ipoint.ToString() + " Normal: " + ei.normal.ToString()); | 2138 | // m_log.Info("[RAYTRACERESULTS]: Hit:" + ei.HitTF.ToString() + " Point: " + ei.ipoint.ToString() + " Normal: " + ei.normal.ToString()); |
2053 | float ScaleOffset = 0.5f; | 2139 | float ScaleOffset = 0.5f; |
2054 | 2140 | ||
2055 | // If we hit something | 2141 | // If we hit something |
@@ -2072,13 +2158,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
2072 | //pos.Z -= 0.25F; | 2158 | //pos.Z -= 0.25F; |
2073 | 2159 | ||
2074 | } | 2160 | } |
2075 | |||
2076 | return pos; | ||
2077 | } | 2161 | } |
2078 | else | 2162 | else |
2079 | { | 2163 | { |
2080 | // We don't have a target here, so we're going to raytrace all the objects in the scene. | 2164 | // We don't have a target here, so we're going to raytrace all the objects in the scene. |
2081 | |||
2082 | EntityIntersection ei = m_sceneGraph.GetClosestIntersectingPrim(new Ray(AXOrigin, AXdirection), true, false); | 2165 | EntityIntersection ei = m_sceneGraph.GetClosestIntersectingPrim(new Ray(AXOrigin, AXdirection), true, false); |
2083 | 2166 | ||
2084 | // Un-comment the following line to print the raytrace results to the console. | 2167 | // Un-comment the following line to print the raytrace results to the console. |
@@ -2087,13 +2170,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
2087 | if (ei.HitTF) | 2170 | if (ei.HitTF) |
2088 | { | 2171 | { |
2089 | pos = new Vector3(ei.ipoint.X, ei.ipoint.Y, ei.ipoint.Z); | 2172 | pos = new Vector3(ei.ipoint.X, ei.ipoint.Y, ei.ipoint.Z); |
2090 | } else | 2173 | } |
2174 | else | ||
2091 | { | 2175 | { |
2092 | // fall back to our stupid functionality | 2176 | // fall back to our stupid functionality |
2093 | pos = RayEnd; | 2177 | pos = RayEnd; |
2094 | } | 2178 | } |
2095 | |||
2096 | return pos; | ||
2097 | } | 2179 | } |
2098 | } | 2180 | } |
2099 | else | 2181 | else |
@@ -2104,8 +2186,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
2104 | //increase height so its above the ground. | 2186 | //increase height so its above the ground. |
2105 | //should be getting the normal of the ground at the rez point and using that? | 2187 | //should be getting the normal of the ground at the rez point and using that? |
2106 | pos.Z += scale.Z / 2f; | 2188 | pos.Z += scale.Z / 2f; |
2107 | return pos; | 2189 | // return pos; |
2108 | } | 2190 | } |
2191 | |||
2192 | // check against posible water intercept | ||
2193 | if (wpos.Z > pos.Z) pos = wpos; | ||
2194 | return pos; | ||
2109 | } | 2195 | } |
2110 | 2196 | ||
2111 | 2197 | ||
@@ -2196,12 +2282,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
2196 | { | 2282 | { |
2197 | if (m_sceneGraph.AddRestoredSceneObject(sceneObject, attachToBackup, alreadyPersisted, sendClientUpdates)) | 2283 | if (m_sceneGraph.AddRestoredSceneObject(sceneObject, attachToBackup, alreadyPersisted, sendClientUpdates)) |
2198 | { | 2284 | { |
2285 | sceneObject.IsDeleted = false; | ||
2199 | EventManager.TriggerObjectAddedToScene(sceneObject); | 2286 | EventManager.TriggerObjectAddedToScene(sceneObject); |
2200 | return true; | 2287 | return true; |
2201 | } | 2288 | } |
2202 | 2289 | ||
2203 | return false; | 2290 | return false; |
2204 | |||
2205 | } | 2291 | } |
2206 | 2292 | ||
2207 | /// <summary> | 2293 | /// <summary> |
@@ -2293,6 +2379,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
2293 | /// </summary> | 2379 | /// </summary> |
2294 | public void DeleteAllSceneObjects() | 2380 | public void DeleteAllSceneObjects() |
2295 | { | 2381 | { |
2382 | DeleteAllSceneObjects(false); | ||
2383 | } | ||
2384 | |||
2385 | /// <summary> | ||
2386 | /// Delete every object from the scene. This does not include attachments worn by avatars. | ||
2387 | /// </summary> | ||
2388 | public void DeleteAllSceneObjects(bool exceptNoCopy) | ||
2389 | { | ||
2390 | List<SceneObjectGroup> toReturn = new List<SceneObjectGroup>(); | ||
2296 | lock (Entities) | 2391 | lock (Entities) |
2297 | { | 2392 | { |
2298 | EntityBase[] entities = Entities.GetEntities(); | 2393 | EntityBase[] entities = Entities.GetEntities(); |
@@ -2301,11 +2396,24 @@ namespace OpenSim.Region.Framework.Scenes | |||
2301 | if (e is SceneObjectGroup) | 2396 | if (e is SceneObjectGroup) |
2302 | { | 2397 | { |
2303 | SceneObjectGroup sog = (SceneObjectGroup)e; | 2398 | SceneObjectGroup sog = (SceneObjectGroup)e; |
2304 | if (!sog.IsAttachment) | 2399 | if (sog != null && !sog.IsAttachment) |
2305 | DeleteSceneObject((SceneObjectGroup)e, false); | 2400 | { |
2401 | if (!exceptNoCopy || ((sog.GetEffectivePermissions() & (uint)PermissionMask.Copy) != 0)) | ||
2402 | { | ||
2403 | DeleteSceneObject((SceneObjectGroup)e, false); | ||
2404 | } | ||
2405 | else | ||
2406 | { | ||
2407 | toReturn.Add((SceneObjectGroup)e); | ||
2408 | } | ||
2409 | } | ||
2306 | } | 2410 | } |
2307 | } | 2411 | } |
2308 | } | 2412 | } |
2413 | if (toReturn.Count > 0) | ||
2414 | { | ||
2415 | returnObjects(toReturn.ToArray(), UUID.Zero); | ||
2416 | } | ||
2309 | } | 2417 | } |
2310 | 2418 | ||
2311 | /// <summary> | 2419 | /// <summary> |
@@ -2340,6 +2448,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
2340 | 2448 | ||
2341 | foreach (SceneObjectPart part in partList) | 2449 | foreach (SceneObjectPart part in partList) |
2342 | { | 2450 | { |
2451 | if (part.KeyframeMotion != null) | ||
2452 | { | ||
2453 | part.KeyframeMotion.Delete(); | ||
2454 | part.KeyframeMotion = null; | ||
2455 | } | ||
2456 | |||
2343 | if (part.IsJoint() && ((part.Flags & PrimFlags.Physics) != 0)) | 2457 | if (part.IsJoint() && ((part.Flags & PrimFlags.Physics) != 0)) |
2344 | { | 2458 | { |
2345 | PhysicsScene.RequestJointDeletion(part.Name); // FIXME: what if the name changed? | 2459 | PhysicsScene.RequestJointDeletion(part.Name); // FIXME: what if the name changed? |
@@ -2357,6 +2471,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2357 | } | 2471 | } |
2358 | 2472 | ||
2359 | group.DeleteGroupFromScene(silent); | 2473 | group.DeleteGroupFromScene(silent); |
2474 | if (!silent) | ||
2475 | SendKillObject(new List<uint>() { group.LocalId }); | ||
2360 | 2476 | ||
2361 | // m_log.DebugFormat("[SCENE]: Exit DeleteSceneObject() for {0} {1}", group.Name, group.UUID); | 2477 | // m_log.DebugFormat("[SCENE]: Exit DeleteSceneObject() for {0} {1}", group.Name, group.UUID); |
2362 | } | 2478 | } |
@@ -2647,7 +2763,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2647 | // If the user is banned, we won't let any of their objects | 2763 | // If the user is banned, we won't let any of their objects |
2648 | // enter. Period. | 2764 | // enter. Period. |
2649 | // | 2765 | // |
2650 | if (RegionInfo.EstateSettings.IsBanned(newObject.OwnerID)) | 2766 | if (RegionInfo.EstateSettings.IsBanned(newObject.OwnerID, 36)) |
2651 | { | 2767 | { |
2652 | m_log.InfoFormat("[INTERREGION]: Denied prim crossing for banned avatar {0}", newObject.OwnerID); | 2768 | m_log.InfoFormat("[INTERREGION]: Denied prim crossing for banned avatar {0}", newObject.OwnerID); |
2653 | return false; | 2769 | return false; |
@@ -2655,6 +2771,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2655 | 2771 | ||
2656 | if (newPosition != Vector3.Zero) | 2772 | if (newPosition != Vector3.Zero) |
2657 | newObject.RootPart.GroupPosition = newPosition; | 2773 | newObject.RootPart.GroupPosition = newPosition; |
2774 | if (newObject.RootPart.KeyframeMotion != null) | ||
2775 | newObject.RootPart.KeyframeMotion.UpdateSceneObject(newObject); | ||
2658 | 2776 | ||
2659 | if (!AddSceneObject(newObject)) | 2777 | if (!AddSceneObject(newObject)) |
2660 | { | 2778 | { |
@@ -2699,6 +2817,23 @@ namespace OpenSim.Region.Framework.Scenes | |||
2699 | /// <returns>True if the SceneObjectGroup was added, False if it was not</returns> | 2817 | /// <returns>True if the SceneObjectGroup was added, False if it was not</returns> |
2700 | public bool AddSceneObject(SceneObjectGroup sceneObject) | 2818 | public bool AddSceneObject(SceneObjectGroup sceneObject) |
2701 | { | 2819 | { |
2820 | if (sceneObject.OwnerID == UUID.Zero) | ||
2821 | { | ||
2822 | m_log.ErrorFormat("[SCENE]: Owner ID for {0} was zero", sceneObject.UUID); | ||
2823 | return false; | ||
2824 | } | ||
2825 | |||
2826 | // If the user is banned, we won't let any of their objects | ||
2827 | // enter. Period. | ||
2828 | // | ||
2829 | int flags = GetUserFlags(sceneObject.OwnerID); | ||
2830 | if (RegionInfo.EstateSettings.IsBanned(sceneObject.OwnerID, flags)) | ||
2831 | { | ||
2832 | m_log.InfoFormat("[INTERREGION]: Denied prim crossing for banned avatar {0}", sceneObject.OwnerID); | ||
2833 | |||
2834 | return false; | ||
2835 | } | ||
2836 | |||
2702 | // Force allocation of new LocalId | 2837 | // Force allocation of new LocalId |
2703 | // | 2838 | // |
2704 | SceneObjectPart[] parts = sceneObject.Parts; | 2839 | SceneObjectPart[] parts = sceneObject.Parts; |
@@ -2732,16 +2867,27 @@ namespace OpenSim.Region.Framework.Scenes | |||
2732 | RootPrim.RemFlag(PrimFlags.TemporaryOnRez); | 2867 | RootPrim.RemFlag(PrimFlags.TemporaryOnRez); |
2733 | 2868 | ||
2734 | if (AttachmentsModule != null) | 2869 | if (AttachmentsModule != null) |
2735 | AttachmentsModule.AttachObject(sp, grp, 0, false, false); | 2870 | AttachmentsModule.AttachObject(sp, grp, 0, false, false, false); |
2736 | } | 2871 | } |
2737 | else | 2872 | else |
2738 | { | 2873 | { |
2874 | m_log.DebugFormat("[SCENE]: Attachment {0} arrived and scene presence was not found, setting to temp", sceneObject.UUID); | ||
2739 | RootPrim.RemFlag(PrimFlags.TemporaryOnRez); | 2875 | RootPrim.RemFlag(PrimFlags.TemporaryOnRez); |
2740 | RootPrim.AddFlag(PrimFlags.TemporaryOnRez); | 2876 | RootPrim.AddFlag(PrimFlags.TemporaryOnRez); |
2741 | } | 2877 | } |
2878 | if (sceneObject.OwnerID == UUID.Zero) | ||
2879 | { | ||
2880 | m_log.ErrorFormat("[SCENE]: Owner ID for {0} was zero after attachment processing. BUG!", sceneObject.UUID); | ||
2881 | return false; | ||
2882 | } | ||
2742 | } | 2883 | } |
2743 | else | 2884 | else |
2744 | { | 2885 | { |
2886 | if (sceneObject.OwnerID == UUID.Zero) | ||
2887 | { | ||
2888 | m_log.ErrorFormat("[SCENE]: Owner ID for non-attachment {0} was zero", sceneObject.UUID); | ||
2889 | return false; | ||
2890 | } | ||
2745 | AddRestoredSceneObject(sceneObject, true, false); | 2891 | AddRestoredSceneObject(sceneObject, true, false); |
2746 | } | 2892 | } |
2747 | 2893 | ||
@@ -2758,6 +2904,24 @@ namespace OpenSim.Region.Framework.Scenes | |||
2758 | return 2; // StateSource.PrimCrossing | 2904 | return 2; // StateSource.PrimCrossing |
2759 | } | 2905 | } |
2760 | 2906 | ||
2907 | public int GetUserFlags(UUID user) | ||
2908 | { | ||
2909 | //Unfortunately the SP approach means that the value is cached until region is restarted | ||
2910 | /* | ||
2911 | ScenePresence sp; | ||
2912 | if (TryGetScenePresence(user, out sp)) | ||
2913 | { | ||
2914 | return sp.UserFlags; | ||
2915 | } | ||
2916 | else | ||
2917 | { | ||
2918 | */ | ||
2919 | UserAccount uac = UserAccountService.GetUserAccount(RegionInfo.ScopeID, user); | ||
2920 | if (uac == null) | ||
2921 | return 0; | ||
2922 | return uac.UserFlags; | ||
2923 | //} | ||
2924 | } | ||
2761 | #endregion | 2925 | #endregion |
2762 | 2926 | ||
2763 | #region Add/Remove Avatar Methods | 2927 | #region Add/Remove Avatar Methods |
@@ -2790,7 +2954,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2790 | = (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0 | 2954 | = (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0 |
2791 | || (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0; | 2955 | || (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0; |
2792 | 2956 | ||
2793 | // CheckHeartbeat(); | 2957 | CheckHeartbeat(); |
2794 | 2958 | ||
2795 | sp = GetScenePresence(client.AgentId); | 2959 | sp = GetScenePresence(client.AgentId); |
2796 | 2960 | ||
@@ -2934,19 +3098,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
2934 | // and the scene presence and the client, if they exist | 3098 | // and the scene presence and the client, if they exist |
2935 | try | 3099 | try |
2936 | { | 3100 | { |
2937 | // We need to wait for the client to make UDP contact first. | 3101 | ScenePresence sp = GetScenePresence(agentID); |
2938 | // It's the UDP contact that creates the scene presence | 3102 | |
2939 | ScenePresence sp = WaitGetScenePresence(agentID); | ||
2940 | if (sp != null) | 3103 | if (sp != null) |
2941 | { | 3104 | { |
2942 | PresenceService.LogoutAgent(sp.ControllingClient.SessionId); | 3105 | PresenceService.LogoutAgent(sp.ControllingClient.SessionId); |
2943 | |||
2944 | sp.ControllingClient.Close(); | 3106 | sp.ControllingClient.Close(); |
2945 | } | 3107 | } |
2946 | else | 3108 | |
2947 | { | ||
2948 | m_log.WarnFormat("[SCENE]: Could not find scene presence for {0}", agentID); | ||
2949 | } | ||
2950 | // BANG! SLASH! | 3109 | // BANG! SLASH! |
2951 | m_authenticateHandler.RemoveCircuit(agentID); | 3110 | m_authenticateHandler.RemoveCircuit(agentID); |
2952 | 3111 | ||
@@ -2991,6 +3150,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2991 | client.OnUpdatePrimGroupPosition += m_sceneGraph.UpdatePrimGroupPosition; | 3150 | client.OnUpdatePrimGroupPosition += m_sceneGraph.UpdatePrimGroupPosition; |
2992 | client.OnUpdatePrimSinglePosition += m_sceneGraph.UpdatePrimSinglePosition; | 3151 | client.OnUpdatePrimSinglePosition += m_sceneGraph.UpdatePrimSinglePosition; |
2993 | 3152 | ||
3153 | client.onClientChangeObject += m_sceneGraph.ClientChangeObject; | ||
3154 | |||
2994 | client.OnUpdatePrimGroupRotation += m_sceneGraph.UpdatePrimGroupRotation; | 3155 | client.OnUpdatePrimGroupRotation += m_sceneGraph.UpdatePrimGroupRotation; |
2995 | client.OnUpdatePrimGroupMouseRotation += m_sceneGraph.UpdatePrimGroupRotation; | 3156 | client.OnUpdatePrimGroupMouseRotation += m_sceneGraph.UpdatePrimGroupRotation; |
2996 | client.OnUpdatePrimSingleRotation += m_sceneGraph.UpdatePrimSingleRotation; | 3157 | client.OnUpdatePrimSingleRotation += m_sceneGraph.UpdatePrimSingleRotation; |
@@ -3047,6 +3208,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3047 | client.OnFetchInventory += m_asyncInventorySender.HandleFetchInventory; | 3208 | client.OnFetchInventory += m_asyncInventorySender.HandleFetchInventory; |
3048 | client.OnUpdateInventoryItem += UpdateInventoryItemAsset; | 3209 | client.OnUpdateInventoryItem += UpdateInventoryItemAsset; |
3049 | client.OnCopyInventoryItem += CopyInventoryItem; | 3210 | client.OnCopyInventoryItem += CopyInventoryItem; |
3211 | client.OnMoveItemsAndLeaveCopy += MoveInventoryItemsLeaveCopy; | ||
3050 | client.OnMoveInventoryItem += MoveInventoryItem; | 3212 | client.OnMoveInventoryItem += MoveInventoryItem; |
3051 | client.OnRemoveInventoryItem += RemoveInventoryItem; | 3213 | client.OnRemoveInventoryItem += RemoveInventoryItem; |
3052 | client.OnRemoveInventoryFolder += RemoveInventoryFolder; | 3214 | client.OnRemoveInventoryFolder += RemoveInventoryFolder; |
@@ -3118,6 +3280,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
3118 | client.OnUpdatePrimGroupPosition -= m_sceneGraph.UpdatePrimGroupPosition; | 3280 | client.OnUpdatePrimGroupPosition -= m_sceneGraph.UpdatePrimGroupPosition; |
3119 | client.OnUpdatePrimSinglePosition -= m_sceneGraph.UpdatePrimSinglePosition; | 3281 | client.OnUpdatePrimSinglePosition -= m_sceneGraph.UpdatePrimSinglePosition; |
3120 | 3282 | ||
3283 | client.onClientChangeObject -= m_sceneGraph.ClientChangeObject; | ||
3284 | |||
3121 | client.OnUpdatePrimGroupRotation -= m_sceneGraph.UpdatePrimGroupRotation; | 3285 | client.OnUpdatePrimGroupRotation -= m_sceneGraph.UpdatePrimGroupRotation; |
3122 | client.OnUpdatePrimGroupMouseRotation -= m_sceneGraph.UpdatePrimGroupRotation; | 3286 | client.OnUpdatePrimGroupMouseRotation -= m_sceneGraph.UpdatePrimGroupRotation; |
3123 | client.OnUpdatePrimSingleRotation -= m_sceneGraph.UpdatePrimSingleRotation; | 3287 | client.OnUpdatePrimSingleRotation -= m_sceneGraph.UpdatePrimSingleRotation; |
@@ -3220,7 +3384,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3220 | /// </summary> | 3384 | /// </summary> |
3221 | /// <param name="agentId">The avatar's Unique ID</param> | 3385 | /// <param name="agentId">The avatar's Unique ID</param> |
3222 | /// <param name="client">The IClientAPI for the client</param> | 3386 | /// <param name="client">The IClientAPI for the client</param> |
3223 | public virtual void TeleportClientHome(UUID agentId, IClientAPI client) | 3387 | public virtual bool TeleportClientHome(UUID agentId, IClientAPI client) |
3224 | { | 3388 | { |
3225 | if (EntityTransferModule != null) | 3389 | if (EntityTransferModule != null) |
3226 | { | 3390 | { |
@@ -3231,6 +3395,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3231 | m_log.DebugFormat("[SCENE]: Unable to teleport user home: no AgentTransferModule is active"); | 3395 | m_log.DebugFormat("[SCENE]: Unable to teleport user home: no AgentTransferModule is active"); |
3232 | client.SendTeleportFailed("Unable to perform teleports on this simulator."); | 3396 | client.SendTeleportFailed("Unable to perform teleports on this simulator."); |
3233 | } | 3397 | } |
3398 | return false; | ||
3234 | } | 3399 | } |
3235 | 3400 | ||
3236 | /// <summary> | 3401 | /// <summary> |
@@ -3340,6 +3505,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
3340 | /// <param name="flags"></param> | 3505 | /// <param name="flags"></param> |
3341 | public virtual void SetHomeRezPoint(IClientAPI remoteClient, ulong regionHandle, Vector3 position, Vector3 lookAt, uint flags) | 3506 | public virtual void SetHomeRezPoint(IClientAPI remoteClient, ulong regionHandle, Vector3 position, Vector3 lookAt, uint flags) |
3342 | { | 3507 | { |
3508 | //Add half the avatar's height so that the user doesn't fall through prims | ||
3509 | ScenePresence presence; | ||
3510 | if (TryGetScenePresence(remoteClient.AgentId, out presence)) | ||
3511 | { | ||
3512 | if (presence.Appearance != null) | ||
3513 | { | ||
3514 | position.Z = position.Z + (presence.Appearance.AvatarHeight / 2); | ||
3515 | } | ||
3516 | } | ||
3517 | |||
3343 | if (GridUserService != null && GridUserService.SetHome(remoteClient.AgentId.ToString(), RegionInfo.RegionID, position, lookAt)) | 3518 | if (GridUserService != null && GridUserService.SetHome(remoteClient.AgentId.ToString(), RegionInfo.RegionID, position, lookAt)) |
3344 | // FUBAR ALERT: this needs to be "Home position set." so the viewer saves a home-screenshot. | 3519 | // FUBAR ALERT: this needs to be "Home position set." so the viewer saves a home-screenshot. |
3345 | m_dialogModule.SendAlertToUser(remoteClient, "Home position set."); | 3520 | m_dialogModule.SendAlertToUser(remoteClient, "Home position set."); |
@@ -3477,6 +3652,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3477 | // It's possible for child agents to have transactions if changes are being made cross-border. | 3652 | // It's possible for child agents to have transactions if changes are being made cross-border. |
3478 | if (AgentTransactionsModule != null) | 3653 | if (AgentTransactionsModule != null) |
3479 | AgentTransactionsModule.RemoveAgentAssetTransactions(agentID); | 3654 | AgentTransactionsModule.RemoveAgentAssetTransactions(agentID); |
3655 | m_log.Debug("[Scene] The avatar has left the building"); | ||
3480 | } | 3656 | } |
3481 | catch (Exception e) | 3657 | catch (Exception e) |
3482 | { | 3658 | { |
@@ -3669,38 +3845,39 @@ namespace OpenSim.Region.Framework.Scenes | |||
3669 | agent.firstname, agent.lastname, agent.Viewer); | 3845 | agent.firstname, agent.lastname, agent.Viewer); |
3670 | reason = "Access denied, your viewer is banned by the region owner"; | 3846 | reason = "Access denied, your viewer is banned by the region owner"; |
3671 | return false; | 3847 | return false; |
3672 | } | 3848 | } |
3849 | |||
3850 | |||
3851 | ScenePresence sp = GetScenePresence(agent.AgentID); | ||
3673 | 3852 | ||
3674 | ILandObject land; | 3853 | if (sp != null && !sp.IsChildAgent) |
3854 | { | ||
3855 | // We have a zombie from a crashed session. | ||
3856 | // Or the same user is trying to be root twice here, won't work. | ||
3857 | // Kill it. | ||
3858 | m_log.WarnFormat( | ||
3859 | "[SCENE]: Existing root scene presence detected for {0} {1} in {2} when connecting. Removing existing presence.", | ||
3860 | sp.Name, sp.UUID, RegionInfo.RegionName); | ||
3861 | |||
3862 | sp.ControllingClient.Close(true, true); | ||
3863 | sp = null; | ||
3864 | } | ||
3675 | 3865 | ||
3676 | lock (agent) | 3866 | lock (agent) |
3677 | { | 3867 | { |
3678 | ScenePresence sp = GetScenePresence(agent.AgentID); | ||
3679 | |||
3680 | if (sp != null && !sp.IsChildAgent) | ||
3681 | { | ||
3682 | // We have a zombie from a crashed session. | ||
3683 | // Or the same user is trying to be root twice here, won't work. | ||
3684 | // Kill it. | ||
3685 | m_log.WarnFormat( | ||
3686 | "[SCENE]: Existing root scene presence detected for {0} {1} in {2} when connecting. Removing existing presence.", | ||
3687 | sp.Name, sp.UUID, RegionInfo.RegionName); | ||
3688 | |||
3689 | sp.ControllingClient.Close(true); | ||
3690 | sp = null; | ||
3691 | } | ||
3692 | |||
3693 | land = LandChannel.GetLandObject(agent.startpos.X, agent.startpos.Y); | ||
3694 | |||
3695 | //On login test land permisions | 3868 | //On login test land permisions |
3696 | if (vialogin) | 3869 | if (vialogin) |
3697 | { | 3870 | { |
3698 | if (land != null && !TestLandRestrictions(agent, land, out reason)) | 3871 | IUserAccountCacheModule cache = RequestModuleInterface<IUserAccountCacheModule>(); |
3872 | if (cache != null) | ||
3873 | cache.Remove(agent.firstname + " " + agent.lastname); | ||
3874 | if (!TestLandRestrictions(agent.AgentID, out reason, ref agent.startpos.X, ref agent.startpos.Y)) | ||
3699 | { | 3875 | { |
3876 | m_log.DebugFormat("[CONNECTION BEGIN]: Denying access to {0} due to no land access", agent.AgentID.ToString()); | ||
3700 | return false; | 3877 | return false; |
3701 | } | 3878 | } |
3702 | } | 3879 | } |
3703 | 3880 | ||
3704 | if (sp == null) // We don't have an [child] agent here already | 3881 | if (sp == null) // We don't have an [child] agent here already |
3705 | { | 3882 | { |
3706 | if (requirePresenceLookup) | 3883 | if (requirePresenceLookup) |
@@ -3709,34 +3886,36 @@ namespace OpenSim.Region.Framework.Scenes | |||
3709 | { | 3886 | { |
3710 | if (!VerifyUserPresence(agent, out reason)) | 3887 | if (!VerifyUserPresence(agent, out reason)) |
3711 | return false; | 3888 | return false; |
3712 | } | 3889 | } catch (Exception e) |
3713 | catch (Exception e) | ||
3714 | { | 3890 | { |
3715 | m_log.ErrorFormat( | 3891 | m_log.ErrorFormat( |
3716 | "[SCENE]: Exception verifying presence {0}{1}", e.Message, e.StackTrace); | 3892 | "[SCENE]: Exception verifying presence {0}{1}", e.Message, e.StackTrace); |
3717 | |||
3718 | return false; | 3893 | return false; |
3719 | } | 3894 | } |
3720 | } | 3895 | } |
3721 | 3896 | ||
3722 | try | 3897 | try |
3723 | { | 3898 | { |
3724 | if (!AuthorizeUser(agent, out reason)) | 3899 | // Always check estate if this is a login. Always |
3725 | return false; | 3900 | // check if banned regions are to be blacked out. |
3901 | if (vialogin || (!m_seeIntoBannedRegion)) | ||
3902 | { | ||
3903 | if (!AuthorizeUser(agent, out reason)) | ||
3904 | return false; | ||
3905 | } | ||
3726 | } | 3906 | } |
3727 | catch (Exception e) | 3907 | catch (Exception e) |
3728 | { | 3908 | { |
3729 | m_log.ErrorFormat( | 3909 | m_log.ErrorFormat( |
3730 | "[SCENE]: Exception authorizing user {0}{1}", e.Message, e.StackTrace); | 3910 | "[SCENE]: Exception authorizing user {0}{1}", e.Message, e.StackTrace); |
3731 | |||
3732 | return false; | 3911 | return false; |
3733 | } | 3912 | } |
3734 | 3913 | ||
3735 | m_log.InfoFormat( | 3914 | m_log.InfoFormat( |
3736 | "[SCENE]: Region {0} authenticated and authorized incoming {1} agent {2} {3} {4} (circuit code {5})", | 3915 | "[SCENE]: Region {0} authenticated and authorized incoming {1} agent {2} {3} {4} (circuit code {5})", |
3737 | RegionInfo.RegionName, (agent.child ? "child" : "root"), agent.firstname, agent.lastname, | 3916 | RegionInfo.RegionName, (agent.child ? "child" : "root"), agent.firstname, agent.lastname, |
3738 | agent.AgentID, agent.circuitcode); | 3917 | agent.AgentID, agent.circuitcode); |
3739 | 3918 | ||
3740 | if (CapsModule != null) | 3919 | if (CapsModule != null) |
3741 | { | 3920 | { |
3742 | CapsModule.SetAgentCapsSeeds(agent); | 3921 | CapsModule.SetAgentCapsSeeds(agent); |
@@ -3748,15 +3927,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
3748 | // Let the SP know how we got here. This has a lot of interesting | 3927 | // Let the SP know how we got here. This has a lot of interesting |
3749 | // uses down the line. | 3928 | // uses down the line. |
3750 | sp.TeleportFlags = (TPFlags)teleportFlags; | 3929 | sp.TeleportFlags = (TPFlags)teleportFlags; |
3751 | 3930 | ||
3752 | if (sp.IsChildAgent) | 3931 | if (sp.IsChildAgent) |
3753 | { | 3932 | { |
3754 | m_log.DebugFormat( | 3933 | m_log.DebugFormat( |
3755 | "[SCENE]: Adjusting known seeds for existing agent {0} in {1}", | 3934 | "[SCENE]: Adjusting known seeds for existing agent {0} in {1}", |
3756 | agent.AgentID, RegionInfo.RegionName); | 3935 | agent.AgentID, RegionInfo.RegionName); |
3757 | 3936 | ||
3758 | sp.AdjustKnownSeeds(); | 3937 | sp.AdjustKnownSeeds(); |
3759 | 3938 | ||
3760 | if (CapsModule != null) | 3939 | if (CapsModule != null) |
3761 | CapsModule.SetAgentCapsSeeds(agent); | 3940 | CapsModule.SetAgentCapsSeeds(agent); |
3762 | } | 3941 | } |
@@ -3858,6 +4037,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
3858 | } | 4037 | } |
3859 | 4038 | ||
3860 | // Honor parcel landing type and position. | 4039 | // Honor parcel landing type and position. |
4040 | /* | ||
4041 | ILandObject land = LandChannel.GetLandObject(agent.startpos.X, agent.startpos.Y); | ||
3861 | if (land != null) | 4042 | if (land != null) |
3862 | { | 4043 | { |
3863 | if (land.LandData.LandingType == (byte)1 && land.LandData.UserLocation != Vector3.Zero) | 4044 | if (land.LandData.LandingType == (byte)1 && land.LandData.UserLocation != Vector3.Zero) |
@@ -3865,25 +4046,43 @@ namespace OpenSim.Region.Framework.Scenes | |||
3865 | agent.startpos = land.LandData.UserLocation; | 4046 | agent.startpos = land.LandData.UserLocation; |
3866 | } | 4047 | } |
3867 | } | 4048 | } |
4049 | */// This is now handled properly in ScenePresence.MakeRootAgent | ||
3868 | } | 4050 | } |
3869 | 4051 | ||
3870 | return true; | 4052 | return true; |
3871 | } | 4053 | } |
3872 | 4054 | ||
3873 | private bool TestLandRestrictions(AgentCircuitData agent, ILandObject land, out string reason) | 4055 | public bool TestLandRestrictions(UUID agentID, out string reason, ref float posX, ref float posY) |
3874 | { | 4056 | { |
3875 | bool banned = land.IsBannedFromLand(agent.AgentID); | 4057 | if (posX < 0) |
3876 | bool restricted = land.IsRestrictedFromLand(agent.AgentID); | 4058 | posX = 0; |
4059 | else if (posX >= 256) | ||
4060 | posX = 255.999f; | ||
4061 | if (posY < 0) | ||
4062 | posY = 0; | ||
4063 | else if (posY >= 256) | ||
4064 | posY = 255.999f; | ||
4065 | |||
4066 | reason = String.Empty; | ||
4067 | if (Permissions.IsGod(agentID)) | ||
4068 | return true; | ||
4069 | |||
4070 | ILandObject land = LandChannel.GetLandObject(posX, posY); | ||
4071 | if (land == null) | ||
4072 | return false; | ||
4073 | |||
4074 | bool banned = land.IsBannedFromLand(agentID); | ||
4075 | bool restricted = land.IsRestrictedFromLand(agentID); | ||
3877 | 4076 | ||
3878 | if (banned || restricted) | 4077 | if (banned || restricted) |
3879 | { | 4078 | { |
3880 | ILandObject nearestParcel = GetNearestAllowedParcel(agent.AgentID, agent.startpos.X, agent.startpos.Y); | 4079 | ILandObject nearestParcel = GetNearestAllowedParcel(agentID, posX, posY); |
3881 | if (nearestParcel != null) | 4080 | if (nearestParcel != null) |
3882 | { | 4081 | { |
3883 | //Move agent to nearest allowed | 4082 | //Move agent to nearest allowed |
3884 | Vector3 newPosition = GetParcelCenterAtGround(nearestParcel); | 4083 | Vector3 newPosition = GetParcelCenterAtGround(nearestParcel); |
3885 | agent.startpos.X = newPosition.X; | 4084 | posX = newPosition.X; |
3886 | agent.startpos.Y = newPosition.Y; | 4085 | posY = newPosition.Y; |
3887 | } | 4086 | } |
3888 | else | 4087 | else |
3889 | { | 4088 | { |
@@ -3945,7 +4144,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3945 | 4144 | ||
3946 | if (!m_strictAccessControl) return true; | 4145 | if (!m_strictAccessControl) return true; |
3947 | if (Permissions.IsGod(agent.AgentID)) return true; | 4146 | if (Permissions.IsGod(agent.AgentID)) return true; |
3948 | 4147 | ||
3949 | if (AuthorizationService != null) | 4148 | if (AuthorizationService != null) |
3950 | { | 4149 | { |
3951 | if (!AuthorizationService.IsAuthorizedForRegion( | 4150 | if (!AuthorizationService.IsAuthorizedForRegion( |
@@ -3960,7 +4159,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3960 | 4159 | ||
3961 | if (RegionInfo.EstateSettings != null) | 4160 | if (RegionInfo.EstateSettings != null) |
3962 | { | 4161 | { |
3963 | if (RegionInfo.EstateSettings.IsBanned(agent.AgentID)) | 4162 | if (RegionInfo.EstateSettings.IsBanned(agent.AgentID, 0)) |
3964 | { | 4163 | { |
3965 | m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the user is on the banlist", | 4164 | m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the user is on the banlist", |
3966 | agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName); | 4165 | agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName); |
@@ -4150,6 +4349,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
4150 | 4349 | ||
4151 | // XPTO: if this agent is not allowed here as root, always return false | 4350 | // XPTO: if this agent is not allowed here as root, always return false |
4152 | 4351 | ||
4352 | // We have to wait until the viewer contacts this region after receiving EAC. | ||
4353 | // That calls AddNewClient, which finally creates the ScenePresence | ||
4354 | int flags = GetUserFlags(cAgentData.AgentID); | ||
4355 | if (RegionInfo.EstateSettings.IsBanned(cAgentData.AgentID, flags)) | ||
4356 | { | ||
4357 | m_log.DebugFormat("[SCENE]: Denying root agent entry to {0}: banned", cAgentData.AgentID); | ||
4358 | return false; | ||
4359 | } | ||
4360 | |||
4153 | // TODO: This check should probably be in QueryAccess(). | 4361 | // TODO: This check should probably be in QueryAccess(). |
4154 | ILandObject nearestParcel = GetNearestAllowedParcel(cAgentData.AgentID, Constants.RegionSize / 2, Constants.RegionSize / 2); | 4362 | ILandObject nearestParcel = GetNearestAllowedParcel(cAgentData.AgentID, Constants.RegionSize / 2, Constants.RegionSize / 2); |
4155 | if (nearestParcel == null) | 4363 | if (nearestParcel == null) |
@@ -4214,7 +4422,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4214 | /// <param name='agentID'></param> | 4422 | /// <param name='agentID'></param> |
4215 | protected virtual ScenePresence WaitGetScenePresence(UUID agentID) | 4423 | protected virtual ScenePresence WaitGetScenePresence(UUID agentID) |
4216 | { | 4424 | { |
4217 | int ntimes = 10; | 4425 | int ntimes = 30; |
4218 | ScenePresence sp = null; | 4426 | ScenePresence sp = null; |
4219 | while ((sp = GetScenePresence(agentID)) == null && (ntimes-- > 0)) | 4427 | while ((sp = GetScenePresence(agentID)) == null && (ntimes-- > 0)) |
4220 | Thread.Sleep(1000); | 4428 | Thread.Sleep(1000); |
@@ -4244,6 +4452,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
4244 | return false; | 4452 | return false; |
4245 | } | 4453 | } |
4246 | 4454 | ||
4455 | public bool IncomingCloseAgent(UUID agentID) | ||
4456 | { | ||
4457 | return IncomingCloseAgent(agentID, false); | ||
4458 | } | ||
4459 | |||
4460 | public bool IncomingCloseChildAgent(UUID agentID) | ||
4461 | { | ||
4462 | return IncomingCloseAgent(agentID, true); | ||
4463 | } | ||
4464 | |||
4247 | /// <summary> | 4465 | /// <summary> |
4248 | /// Tell a single agent to disconnect from the region. | 4466 | /// Tell a single agent to disconnect from the region. |
4249 | /// </summary> | 4467 | /// </summary> |
@@ -4259,7 +4477,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4259 | ScenePresence presence = m_sceneGraph.GetScenePresence(agentID); | 4477 | ScenePresence presence = m_sceneGraph.GetScenePresence(agentID); |
4260 | if (presence != null) | 4478 | if (presence != null) |
4261 | { | 4479 | { |
4262 | presence.ControllingClient.Close(force); | 4480 | presence.ControllingClient.Close(force, force); |
4263 | return true; | 4481 | return true; |
4264 | } | 4482 | } |
4265 | 4483 | ||
@@ -4919,35 +5137,81 @@ namespace OpenSim.Region.Framework.Scenes | |||
4919 | SimulationDataService.RemoveObject(uuid, RegionInfo.RegionID); | 5137 | SimulationDataService.RemoveObject(uuid, RegionInfo.RegionID); |
4920 | } | 5138 | } |
4921 | 5139 | ||
4922 | public int GetHealth() | 5140 | public int GetHealth(out int flags, out string message) |
4923 | { | 5141 | { |
4924 | // Returns: | 5142 | // Returns: |
4925 | // 1 = sim is up and accepting http requests. The heartbeat has | 5143 | // 1 = sim is up and accepting http requests. The heartbeat has |
4926 | // stopped and the sim is probably locked up, but a remote | 5144 | // stopped and the sim is probably locked up, but a remote |
4927 | // admin restart may succeed | 5145 | // admin restart may succeed |
4928 | // | 5146 | // |
4929 | // 2 = Sim is up and the heartbeat is running. The sim is likely | 5147 | // 2 = Sim is up and the heartbeat is running. The sim is likely |
4930 | // usable for people within and logins _may_ work | 5148 | // usable for people within |
5149 | // | ||
5150 | // 3 = Sim is up and one packet thread is running. Sim is | ||
5151 | // unstable and will not accept new logins | ||
4931 | // | 5152 | // |
4932 | // 3 = We have seen a new user enter within the past 4 minutes | 5153 | // 4 = Sim is up and both packet threads are running. Sim is |
5154 | // likely usable | ||
5155 | // | ||
5156 | // 5 = We have seen a new user enter within the past 4 minutes | ||
4933 | // which can be seen as positive confirmation of sim health | 5157 | // which can be seen as positive confirmation of sim health |
4934 | // | 5158 | // |
5159 | |||
5160 | flags = 0; | ||
5161 | message = String.Empty; | ||
5162 | |||
5163 | CheckHeartbeat(); | ||
5164 | |||
5165 | if (m_firstHeartbeat || (m_lastIncoming == 0 && m_lastOutgoing == 0)) | ||
5166 | { | ||
5167 | // We're still starting | ||
5168 | // 0 means "in startup", it can't happen another way, since | ||
5169 | // to get here, we must be able to accept http connections | ||
5170 | return 0; | ||
5171 | } | ||
5172 | |||
4935 | int health=1; // Start at 1, means we're up | 5173 | int health=1; // Start at 1, means we're up |
4936 | 5174 | ||
4937 | if ((Util.EnvironmentTickCountSubtract(m_lastFrameTick)) < 1000) | 5175 | if ((Util.EnvironmentTickCountSubtract(m_lastFrameTick)) < 1000) |
4938 | health += 1; | 5176 | { |
5177 | health+=1; | ||
5178 | flags |= 1; | ||
5179 | } | ||
5180 | |||
5181 | if (Util.EnvironmentTickCountSubtract(m_lastIncoming) < 1000) | ||
5182 | { | ||
5183 | health+=1; | ||
5184 | flags |= 2; | ||
5185 | } | ||
5186 | |||
5187 | if (Util.EnvironmentTickCountSubtract(m_lastOutgoing) < 1000) | ||
5188 | { | ||
5189 | health+=1; | ||
5190 | flags |= 4; | ||
5191 | } | ||
4939 | else | 5192 | else |
5193 | { | ||
5194 | int pid = System.Diagnostics.Process.GetCurrentProcess().Id; | ||
5195 | System.Diagnostics.Process proc = new System.Diagnostics.Process(); | ||
5196 | proc.EnableRaisingEvents=false; | ||
5197 | proc.StartInfo.FileName = "/bin/kill"; | ||
5198 | proc.StartInfo.Arguments = "-QUIT " + pid.ToString(); | ||
5199 | proc.Start(); | ||
5200 | proc.WaitForExit(); | ||
5201 | Thread.Sleep(1000); | ||
5202 | Environment.Exit(1); | ||
5203 | } | ||
5204 | |||
5205 | if (flags != 7) | ||
4940 | return health; | 5206 | return health; |
4941 | 5207 | ||
4942 | // A login in the last 4 mins? We can't be doing too badly | 5208 | // A login in the last 4 mins? We can't be doing too badly |
4943 | // | 5209 | // |
4944 | if ((Util.EnvironmentTickCountSubtract(m_LastLogin)) < 240000) | 5210 | if (Util.EnvironmentTickCountSubtract(m_LastLogin) < 240000) |
4945 | health++; | 5211 | health++; |
4946 | else | 5212 | else |
4947 | return health; | 5213 | return health; |
4948 | 5214 | ||
4949 | // CheckHeartbeat(); | ||
4950 | |||
4951 | return health; | 5215 | return health; |
4952 | } | 5216 | } |
4953 | 5217 | ||
@@ -5035,7 +5299,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
5035 | bool wasUsingPhysics = ((jointProxyObject.Flags & PrimFlags.Physics) != 0); | 5299 | bool wasUsingPhysics = ((jointProxyObject.Flags & PrimFlags.Physics) != 0); |
5036 | if (wasUsingPhysics) | 5300 | if (wasUsingPhysics) |
5037 | { | 5301 | { |
5038 | 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 | 5302 | 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 |
5039 | } | 5303 | } |
5040 | } | 5304 | } |
5041 | 5305 | ||
@@ -5134,14 +5398,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
5134 | return (((vsn.X * xdiff) + (vsn.Y * ydiff)) / (-1 * vsn.Z)) + p0.Z; | 5398 | return (((vsn.X * xdiff) + (vsn.Y * ydiff)) / (-1 * vsn.Z)) + p0.Z; |
5135 | } | 5399 | } |
5136 | 5400 | ||
5137 | // private void CheckHeartbeat() | 5401 | private void CheckHeartbeat() |
5138 | // { | 5402 | { |
5139 | // if (m_firstHeartbeat) | 5403 | if (m_firstHeartbeat) |
5140 | // return; | 5404 | return; |
5141 | // | 5405 | |
5142 | // if (Util.EnvironmentTickCountSubtract(m_lastFrameTick) > 2000) | 5406 | if ((Util.EnvironmentTickCountSubtract(m_lastFrameTick)) > 5000) |
5143 | // StartTimer(); | 5407 | Start(); |
5144 | // } | 5408 | } |
5145 | 5409 | ||
5146 | public override ISceneObject DeserializeObject(string representation) | 5410 | public override ISceneObject DeserializeObject(string representation) |
5147 | { | 5411 | { |
@@ -5153,9 +5417,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
5153 | get { return m_allowScriptCrossings; } | 5417 | get { return m_allowScriptCrossings; } |
5154 | } | 5418 | } |
5155 | 5419 | ||
5156 | public Vector3? GetNearestAllowedPosition(ScenePresence avatar) | 5420 | public Vector3 GetNearestAllowedPosition(ScenePresence avatar) |
5157 | { | 5421 | { |
5158 | ILandObject nearestParcel = GetNearestAllowedParcel(avatar.UUID, avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y); | 5422 | return GetNearestAllowedPosition(avatar, null); |
5423 | } | ||
5424 | |||
5425 | public Vector3 GetNearestAllowedPosition(ScenePresence avatar, ILandObject excludeParcel) | ||
5426 | { | ||
5427 | ILandObject nearestParcel = GetNearestAllowedParcel(avatar.UUID, avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y, excludeParcel); | ||
5159 | 5428 | ||
5160 | if (nearestParcel != null) | 5429 | if (nearestParcel != null) |
5161 | { | 5430 | { |
@@ -5164,10 +5433,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
5164 | Vector3? nearestPoint = GetNearestPointInParcelAlongDirectionFromPoint(avatar.AbsolutePosition, dir, nearestParcel); | 5433 | Vector3? nearestPoint = GetNearestPointInParcelAlongDirectionFromPoint(avatar.AbsolutePosition, dir, nearestParcel); |
5165 | if (nearestPoint != null) | 5434 | if (nearestPoint != null) |
5166 | { | 5435 | { |
5167 | // m_log.DebugFormat( | 5436 | Debug.WriteLine("Found a sane previous position based on velocity, sending them to: " + nearestPoint.ToString()); |
5168 | // "[SCENE]: Found a sane previous position based on velocity for {0}, sending them to {1} in {2}", | ||
5169 | // avatar.Name, nearestPoint, nearestParcel.LandData.Name); | ||
5170 | |||
5171 | return nearestPoint.Value; | 5437 | return nearestPoint.Value; |
5172 | } | 5438 | } |
5173 | 5439 | ||
@@ -5177,17 +5443,20 @@ namespace OpenSim.Region.Framework.Scenes | |||
5177 | nearestPoint = GetNearestPointInParcelAlongDirectionFromPoint(avatar.AbsolutePosition, dir, nearestParcel); | 5443 | nearestPoint = GetNearestPointInParcelAlongDirectionFromPoint(avatar.AbsolutePosition, dir, nearestParcel); |
5178 | if (nearestPoint != null) | 5444 | if (nearestPoint != null) |
5179 | { | 5445 | { |
5180 | // m_log.DebugFormat( | 5446 | Debug.WriteLine("They had a zero velocity, sending them to: " + nearestPoint.ToString()); |
5181 | // "[SCENE]: {0} had a zero velocity, sending them to {1}", avatar.Name, nearestPoint); | ||
5182 | |||
5183 | return nearestPoint.Value; | 5447 | return nearestPoint.Value; |
5184 | } | 5448 | } |
5185 | 5449 | ||
5186 | //Ultimate backup if we have no idea where they are | 5450 | ILandObject dest = LandChannel.GetLandObject(avatar.lastKnownAllowedPosition.X, avatar.lastKnownAllowedPosition.Y); |
5187 | // m_log.DebugFormat( | 5451 | if (dest != excludeParcel) |
5188 | // "[SCENE]: No idea where {0} is, sending them to {1}", avatar.Name, avatar.lastKnownAllowedPosition); | 5452 | { |
5453 | // Ultimate backup if we have no idea where they are and | ||
5454 | // the last allowed position was in another parcel | ||
5455 | Debug.WriteLine("Have no idea where they are, sending them to: " + avatar.lastKnownAllowedPosition.ToString()); | ||
5456 | return avatar.lastKnownAllowedPosition; | ||
5457 | } | ||
5189 | 5458 | ||
5190 | return avatar.lastKnownAllowedPosition; | 5459 | // else fall through to region edge |
5191 | } | 5460 | } |
5192 | 5461 | ||
5193 | //Go to the edge, this happens in teleporting to a region with no available parcels | 5462 | //Go to the edge, this happens in teleporting to a region with no available parcels |
@@ -5221,13 +5490,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
5221 | 5490 | ||
5222 | public ILandObject GetNearestAllowedParcel(UUID avatarId, float x, float y) | 5491 | public ILandObject GetNearestAllowedParcel(UUID avatarId, float x, float y) |
5223 | { | 5492 | { |
5493 | return GetNearestAllowedParcel(avatarId, x, y, null); | ||
5494 | } | ||
5495 | |||
5496 | public ILandObject GetNearestAllowedParcel(UUID avatarId, float x, float y, ILandObject excludeParcel) | ||
5497 | { | ||
5224 | List<ILandObject> all = AllParcels(); | 5498 | List<ILandObject> all = AllParcels(); |
5225 | float minParcelDistance = float.MaxValue; | 5499 | float minParcelDistance = float.MaxValue; |
5226 | ILandObject nearestParcel = null; | 5500 | ILandObject nearestParcel = null; |
5227 | 5501 | ||
5228 | foreach (var parcel in all) | 5502 | foreach (var parcel in all) |
5229 | { | 5503 | { |
5230 | if (!parcel.IsEitherBannedOrRestricted(avatarId)) | 5504 | if (!parcel.IsEitherBannedOrRestricted(avatarId) && parcel != excludeParcel) |
5231 | { | 5505 | { |
5232 | float parcelDistance = GetParcelDistancefromPoint(parcel, x, y); | 5506 | float parcelDistance = GetParcelDistancefromPoint(parcel, x, y); |
5233 | if (parcelDistance < minParcelDistance) | 5507 | if (parcelDistance < minParcelDistance) |
@@ -5469,7 +5743,55 @@ namespace OpenSim.Region.Framework.Scenes | |||
5469 | mapModule.GenerateMaptile(); | 5743 | mapModule.GenerateMaptile(); |
5470 | } | 5744 | } |
5471 | 5745 | ||
5472 | private void RegenerateMaptileAndReregister(object sender, ElapsedEventArgs e) | 5746 | // public void CleanDroppedAttachments() |
5747 | // { | ||
5748 | // List<SceneObjectGroup> objectsToDelete = | ||
5749 | // new List<SceneObjectGroup>(); | ||
5750 | // | ||
5751 | // lock (m_cleaningAttachments) | ||
5752 | // { | ||
5753 | // ForEachSOG(delegate (SceneObjectGroup grp) | ||
5754 | // { | ||
5755 | // if (grp.RootPart.Shape.PCode == 0 && grp.RootPart.Shape.State != 0 && (!objectsToDelete.Contains(grp))) | ||
5756 | // { | ||
5757 | // UUID agentID = grp.OwnerID; | ||
5758 | // if (agentID == UUID.Zero) | ||
5759 | // { | ||
5760 | // objectsToDelete.Add(grp); | ||
5761 | // return; | ||
5762 | // } | ||
5763 | // | ||
5764 | // ScenePresence sp = GetScenePresence(agentID); | ||
5765 | // if (sp == null) | ||
5766 | // { | ||
5767 | // objectsToDelete.Add(grp); | ||
5768 | // return; | ||
5769 | // } | ||
5770 | // } | ||
5771 | // }); | ||
5772 | // } | ||
5773 | // | ||
5774 | // foreach (SceneObjectGroup grp in objectsToDelete) | ||
5775 | // { | ||
5776 | // m_log.InfoFormat("[SCENE]: Deleting dropped attachment {0} of user {1}", grp.UUID, grp.OwnerID); | ||
5777 | // DeleteSceneObject(grp, true); | ||
5778 | // } | ||
5779 | // } | ||
5780 | |||
5781 | public void ThreadAlive(int threadCode) | ||
5782 | { | ||
5783 | switch(threadCode) | ||
5784 | { | ||
5785 | case 1: // Incoming | ||
5786 | m_lastIncoming = Util.EnvironmentTickCount(); | ||
5787 | break; | ||
5788 | case 2: // Incoming | ||
5789 | m_lastOutgoing = Util.EnvironmentTickCount(); | ||
5790 | break; | ||
5791 | } | ||
5792 | } | ||
5793 | |||
5794 | public void RegenerateMaptileAndReregister(object sender, ElapsedEventArgs e) | ||
5473 | { | 5795 | { |
5474 | RegenerateMaptile(); | 5796 | RegenerateMaptile(); |
5475 | 5797 | ||
@@ -5497,6 +5819,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
5497 | /// <returns></returns> | 5819 | /// <returns></returns> |
5498 | public bool QueryAccess(UUID agentID, Vector3 position, out string reason) | 5820 | public bool QueryAccess(UUID agentID, Vector3 position, out string reason) |
5499 | { | 5821 | { |
5822 | reason = "You are banned from the region"; | ||
5823 | |||
5500 | if (EntityTransferModule.IsInTransit(agentID)) | 5824 | if (EntityTransferModule.IsInTransit(agentID)) |
5501 | { | 5825 | { |
5502 | reason = "Agent is still in transit from this region"; | 5826 | reason = "Agent is still in transit from this region"; |
@@ -5508,6 +5832,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
5508 | return false; | 5832 | return false; |
5509 | } | 5833 | } |
5510 | 5834 | ||
5835 | if (Permissions.IsGod(agentID)) | ||
5836 | { | ||
5837 | reason = String.Empty; | ||
5838 | return true; | ||
5839 | } | ||
5840 | |||
5511 | // FIXME: Root agent count is currently known to be inaccurate. This forces a recount before we check. | 5841 | // FIXME: Root agent count is currently known to be inaccurate. This forces a recount before we check. |
5512 | // However, the long term fix is to make sure root agent count is always accurate. | 5842 | // However, the long term fix is to make sure root agent count is always accurate. |
5513 | m_sceneGraph.RecalculateStats(); | 5843 | m_sceneGraph.RecalculateStats(); |
@@ -5528,6 +5858,41 @@ namespace OpenSim.Region.Framework.Scenes | |||
5528 | } | 5858 | } |
5529 | } | 5859 | } |
5530 | 5860 | ||
5861 | ScenePresence presence = GetScenePresence(agentID); | ||
5862 | IClientAPI client = null; | ||
5863 | AgentCircuitData aCircuit = null; | ||
5864 | |||
5865 | if (presence != null) | ||
5866 | { | ||
5867 | client = presence.ControllingClient; | ||
5868 | if (client != null) | ||
5869 | aCircuit = client.RequestClientInfo(); | ||
5870 | } | ||
5871 | |||
5872 | // We may be called before there is a presence or a client. | ||
5873 | // Fake AgentCircuitData to keep IAuthorizationModule smiling | ||
5874 | if (client == null) | ||
5875 | { | ||
5876 | aCircuit = new AgentCircuitData(); | ||
5877 | aCircuit.AgentID = agentID; | ||
5878 | aCircuit.firstname = String.Empty; | ||
5879 | aCircuit.lastname = String.Empty; | ||
5880 | } | ||
5881 | |||
5882 | try | ||
5883 | { | ||
5884 | if (!AuthorizeUser(aCircuit, out reason)) | ||
5885 | { | ||
5886 | // m_log.DebugFormat("[SCENE]: Denying access for {0}", agentID); | ||
5887 | return false; | ||
5888 | } | ||
5889 | } | ||
5890 | catch (Exception e) | ||
5891 | { | ||
5892 | m_log.DebugFormat("[SCENE]: Exception authorizing agent: {0} "+ e.StackTrace, e.Message); | ||
5893 | return false; | ||
5894 | } | ||
5895 | |||
5531 | if (position == Vector3.Zero) // Teleport | 5896 | if (position == Vector3.Zero) // Teleport |
5532 | { | 5897 | { |
5533 | if (!RegionInfo.EstateSettings.AllowDirectTeleport) | 5898 | if (!RegionInfo.EstateSettings.AllowDirectTeleport) |
@@ -5556,13 +5921,46 @@ namespace OpenSim.Region.Framework.Scenes | |||
5556 | } | 5921 | } |
5557 | } | 5922 | } |
5558 | } | 5923 | } |
5924 | |||
5925 | float posX = 128.0f; | ||
5926 | float posY = 128.0f; | ||
5927 | |||
5928 | if (!TestLandRestrictions(agentID, out reason, ref posX, ref posY)) | ||
5929 | { | ||
5930 | // m_log.DebugFormat("[SCENE]: Denying {0} because they are banned on all parcels", agentID); | ||
5931 | return false; | ||
5932 | } | ||
5933 | } | ||
5934 | else // Walking | ||
5935 | { | ||
5936 | ILandObject land = LandChannel.GetLandObject(position.X, position.Y); | ||
5937 | if (land == null) | ||
5938 | return false; | ||
5939 | |||
5940 | bool banned = land.IsBannedFromLand(agentID); | ||
5941 | bool restricted = land.IsRestrictedFromLand(agentID); | ||
5942 | |||
5943 | if (banned || restricted) | ||
5944 | return false; | ||
5559 | } | 5945 | } |
5560 | 5946 | ||
5561 | reason = String.Empty; | 5947 | reason = String.Empty; |
5562 | return true; | 5948 | return true; |
5563 | } | 5949 | } |
5564 | 5950 | ||
5565 | /// <summary> | 5951 | public void StartTimerWatchdog() |
5952 | { | ||
5953 | m_timerWatchdog.Interval = 1000; | ||
5954 | m_timerWatchdog.Elapsed += TimerWatchdog; | ||
5955 | m_timerWatchdog.AutoReset = true; | ||
5956 | m_timerWatchdog.Start(); | ||
5957 | } | ||
5958 | |||
5959 | public void TimerWatchdog(object sender, ElapsedEventArgs e) | ||
5960 | { | ||
5961 | CheckHeartbeat(); | ||
5962 | } | ||
5963 | |||
5566 | /// This method deals with movement when an avatar is automatically moving (but this is distinct from the | 5964 | /// This method deals with movement when an avatar is automatically moving (but this is distinct from the |
5567 | /// autopilot that moves an avatar to a sit target!. | 5965 | /// autopilot that moves an avatar to a sit target!. |
5568 | /// </summary> | 5966 | /// </summary> |
@@ -5641,6 +6039,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
5641 | return m_SpawnPoint - 1; | 6039 | return m_SpawnPoint - 1; |
5642 | } | 6040 | } |
5643 | 6041 | ||
6042 | private void HandleGcCollect(string module, string[] args) | ||
6043 | { | ||
6044 | GC.Collect(); | ||
6045 | } | ||
6046 | |||
5644 | // Wrappers to get physics modules retrieve assets. Has to be done this way | 6047 | // Wrappers to get physics modules retrieve assets. Has to be done this way |
5645 | // because we can't assign the asset service to physics directly - at the | 6048 | // because we can't assign the asset service to physics directly - at the |
5646 | // time physics are instantiated it's not registered but it will be by | 6049 | // time physics are instantiated it's not registered but it will be by |