diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Scene.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.cs | 868 |
1 files changed, 636 insertions, 232 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 4859dff..784fc91 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -221,8 +221,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
221 | // TODO: need to figure out how allow client agents but deny | 221 | // TODO: need to figure out how allow client agents but deny |
222 | // root agents when ACL denies access to root agent | 222 | // root agents when ACL denies access to root agent |
223 | public bool m_strictAccessControl = true; | 223 | public bool m_strictAccessControl = true; |
224 | 224 | public bool m_seeIntoBannedRegion = false; | |
225 | public int MaxUndoCount { get; set; } | 225 | public int MaxUndoCount = 5; |
226 | 226 | ||
227 | // Using this for RegionReady module to prevent LoginsDisabled from changing under our feet; | 227 | // Using this for RegionReady module to prevent LoginsDisabled from changing under our feet; |
228 | public bool LoginLock = false; | 228 | public bool LoginLock = false; |
@@ -238,11 +238,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
238 | 238 | ||
239 | protected int m_splitRegionID; | 239 | protected int m_splitRegionID; |
240 | protected Timer m_restartWaitTimer = new Timer(); | 240 | protected Timer m_restartWaitTimer = new Timer(); |
241 | protected Timer m_timerWatchdog = new Timer(); | ||
241 | protected List<RegionInfo> m_regionRestartNotifyList = new List<RegionInfo>(); | 242 | protected List<RegionInfo> m_regionRestartNotifyList = new List<RegionInfo>(); |
242 | protected List<RegionInfo> m_neighbours = new List<RegionInfo>(); | 243 | protected List<RegionInfo> m_neighbours = new List<RegionInfo>(); |
243 | protected string m_simulatorVersion = "OpenSimulator Server"; | 244 | protected string m_simulatorVersion = "OpenSimulator Server"; |
244 | protected AgentCircuitManager m_authenticateHandler; | 245 | protected AgentCircuitManager m_authenticateHandler; |
245 | protected SceneCommunicationService m_sceneGridService; | 246 | protected SceneCommunicationService m_sceneGridService; |
247 | protected ISnmpModule m_snmpService = null; | ||
246 | 248 | ||
247 | protected ISimulationDataService m_SimulationDataService; | 249 | protected ISimulationDataService m_SimulationDataService; |
248 | protected IEstateDataService m_EstateDataService; | 250 | protected IEstateDataService m_EstateDataService; |
@@ -305,8 +307,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
305 | private int m_update_presences = 1; // Update scene presence movements | 307 | private int m_update_presences = 1; // Update scene presence movements |
306 | private int m_update_events = 1; | 308 | private int m_update_events = 1; |
307 | private int m_update_backup = 200; | 309 | private int m_update_backup = 200; |
308 | private int m_update_terrain = 50; | 310 | private int m_update_terrain = 1000; |
309 | // private int m_update_land = 1; | 311 | private int m_update_land = 10; |
310 | private int m_update_coarse_locations = 50; | 312 | private int m_update_coarse_locations = 50; |
311 | 313 | ||
312 | private int agentMS; | 314 | private int agentMS; |
@@ -319,13 +321,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
319 | private int backupMS; | 321 | private int backupMS; |
320 | private int terrainMS; | 322 | private int terrainMS; |
321 | private int landMS; | 323 | private int landMS; |
322 | private int spareMS; | ||
323 | 324 | ||
324 | /// <summary> | 325 | /// <summary> |
325 | /// Tick at which the last frame was processed. | 326 | /// Tick at which the last frame was processed. |
326 | /// </summary> | 327 | /// </summary> |
327 | private int m_lastFrameTick; | 328 | private int m_lastFrameTick; |
328 | 329 | ||
330 | public bool CombineRegions = false; | ||
329 | /// <summary> | 331 | /// <summary> |
330 | /// Tick at which the last maintenance run occurred. | 332 | /// Tick at which the last maintenance run occurred. |
331 | /// </summary> | 333 | /// </summary> |
@@ -354,6 +356,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
354 | /// </summary> | 356 | /// </summary> |
355 | private int m_LastLogin; | 357 | private int m_LastLogin; |
356 | 358 | ||
359 | private int m_lastIncoming; | ||
360 | private int m_lastOutgoing; | ||
361 | private int m_hbRestarts = 0; | ||
362 | |||
363 | |||
357 | /// <summary> | 364 | /// <summary> |
358 | /// Thread that runs the scene loop. | 365 | /// Thread that runs the scene loop. |
359 | /// </summary> | 366 | /// </summary> |
@@ -394,7 +401,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
394 | private volatile bool m_active; | 401 | private volatile bool m_active; |
395 | 402 | ||
396 | // private int m_lastUpdate; | 403 | // private int m_lastUpdate; |
397 | // private bool m_firstHeartbeat = true; | 404 | private bool m_firstHeartbeat = true; |
398 | 405 | ||
399 | private UpdatePrioritizationSchemes m_priorityScheme = UpdatePrioritizationSchemes.Time; | 406 | private UpdatePrioritizationSchemes m_priorityScheme = UpdatePrioritizationSchemes.Time; |
400 | private bool m_reprioritizationEnabled = true; | 407 | private bool m_reprioritizationEnabled = true; |
@@ -438,6 +445,19 @@ namespace OpenSim.Region.Framework.Scenes | |||
438 | get { return m_sceneGridService; } | 445 | get { return m_sceneGridService; } |
439 | } | 446 | } |
440 | 447 | ||
448 | public ISnmpModule SnmpService | ||
449 | { | ||
450 | get | ||
451 | { | ||
452 | if (m_snmpService == null) | ||
453 | { | ||
454 | m_snmpService = RequestModuleInterface<ISnmpModule>(); | ||
455 | } | ||
456 | |||
457 | return m_snmpService; | ||
458 | } | ||
459 | } | ||
460 | |||
441 | public ISimulationDataService SimulationDataService | 461 | public ISimulationDataService SimulationDataService |
442 | { | 462 | { |
443 | get | 463 | get |
@@ -731,6 +751,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
731 | m_SimulationDataService = simDataService; | 751 | m_SimulationDataService = simDataService; |
732 | m_EstateDataService = estateDataService; | 752 | m_EstateDataService = estateDataService; |
733 | m_regionHandle = RegionInfo.RegionHandle; | 753 | m_regionHandle = RegionInfo.RegionHandle; |
754 | m_lastIncoming = 0; | ||
755 | m_lastOutgoing = 0; | ||
734 | 756 | ||
735 | m_asyncSceneObjectDeleter = new AsyncSceneObjectGroupDeleter(this); | 757 | m_asyncSceneObjectDeleter = new AsyncSceneObjectGroupDeleter(this); |
736 | m_asyncSceneObjectDeleter.Enabled = true; | 758 | m_asyncSceneObjectDeleter.Enabled = true; |
@@ -820,132 +842,141 @@ namespace OpenSim.Region.Framework.Scenes | |||
820 | 842 | ||
821 | // Region config overrides global config | 843 | // Region config overrides global config |
822 | // | 844 | // |
823 | if (m_config.Configs["Startup"] != null) | 845 | try |
824 | { | 846 | { |
825 | IConfig startupConfig = m_config.Configs["Startup"]; | 847 | if (m_config.Configs["Startup"] != null) |
826 | |||
827 | StartDisabled = startupConfig.GetBoolean("StartDisabled", false); | ||
828 | |||
829 | m_defaultDrawDistance = startupConfig.GetFloat("DefaultDrawDistance", m_defaultDrawDistance); | ||
830 | UseBackup = startupConfig.GetBoolean("UseSceneBackup", UseBackup); | ||
831 | if (!UseBackup) | ||
832 | m_log.InfoFormat("[SCENE]: Backup has been disabled for {0}", RegionInfo.RegionName); | ||
833 | |||
834 | //Animation states | ||
835 | m_useFlySlow = startupConfig.GetBoolean("enableflyslow", false); | ||
836 | |||
837 | MaxUndoCount = startupConfig.GetInt("MaxPrimUndos", 20); | ||
838 | |||
839 | PhysicalPrims = startupConfig.GetBoolean("physical_prim", PhysicalPrims); | ||
840 | CollidablePrims = startupConfig.GetBoolean("collidable_prim", CollidablePrims); | ||
841 | |||
842 | m_minNonphys = startupConfig.GetFloat("NonPhysicalPrimMin", m_minNonphys); | ||
843 | if (RegionInfo.NonphysPrimMin > 0) | ||
844 | { | 848 | { |
845 | m_minNonphys = RegionInfo.NonphysPrimMin; | 849 | IConfig startupConfig = m_config.Configs["Startup"]; |
846 | } | ||
847 | 850 | ||
848 | m_maxNonphys = startupConfig.GetFloat("NonPhysicalPrimMax", m_maxNonphys); | 851 | StartDisabled = startupConfig.GetBoolean("StartDisabled", false); |
849 | if (RegionInfo.NonphysPrimMax > 0) | ||
850 | { | ||
851 | m_maxNonphys = RegionInfo.NonphysPrimMax; | ||
852 | } | ||
853 | 852 | ||
854 | m_minPhys = startupConfig.GetFloat("PhysicalPrimMin", m_minPhys); | 853 | m_defaultDrawDistance = startupConfig.GetFloat("DefaultDrawDistance",m_defaultDrawDistance); |
855 | if (RegionInfo.PhysPrimMin > 0) | 854 | UseBackup = startupConfig.GetBoolean("UseSceneBackup", UseBackup); |
856 | { | 855 | if (!UseBackup) |
857 | m_minPhys = RegionInfo.PhysPrimMin; | 856 | m_log.InfoFormat("[SCENE]: Backup has been disabled for {0}", RegionInfo.RegionName); |
858 | } | 857 | |
858 | //Animation states | ||
859 | m_useFlySlow = startupConfig.GetBoolean("enableflyslow", false); | ||
859 | 860 | ||
860 | m_maxPhys = startupConfig.GetFloat("PhysicalPrimMax", m_maxPhys); | 861 | PhysicalPrims = startupConfig.GetBoolean("physical_prim", true); |
861 | if (RegionInfo.PhysPrimMax > 0) | 862 | CollidablePrims = startupConfig.GetBoolean("collidable_prim", true); |
862 | { | ||
863 | m_maxPhys = RegionInfo.PhysPrimMax; | ||
864 | } | ||
865 | 863 | ||
866 | // Here, if clamping is requested in either global or | 864 | m_minNonphys = startupConfig.GetFloat("NonPhysicalPrimMin", m_minNonphys); |
867 | // local config, it will be used | 865 | if (RegionInfo.NonphysPrimMin > 0) |
868 | // | 866 | { |
869 | m_clampPrimSize = startupConfig.GetBoolean("ClampPrimSize", m_clampPrimSize); | 867 | m_minNonphys = RegionInfo.NonphysPrimMin; |
870 | if (RegionInfo.ClampPrimSize) | 868 | } |
871 | { | ||
872 | m_clampPrimSize = true; | ||
873 | } | ||
874 | 869 | ||
875 | m_linksetCapacity = startupConfig.GetInt("LinksetPrims", m_linksetCapacity); | 870 | m_maxNonphys = startupConfig.GetFloat("NonPhysicalPrimMax", m_maxNonphys); |
876 | if (RegionInfo.LinksetCapacity > 0) | 871 | if (RegionInfo.NonphysPrimMax > 0) |
877 | { | 872 | { |
878 | m_linksetCapacity = RegionInfo.LinksetCapacity; | 873 | m_maxNonphys = RegionInfo.NonphysPrimMax; |
879 | } | 874 | } |
880 | 875 | ||
881 | m_useTrashOnDelete = startupConfig.GetBoolean("UseTrashOnDelete", m_useTrashOnDelete); | 876 | m_minPhys = startupConfig.GetFloat("PhysicalPrimMin", m_minPhys); |
882 | m_trustBinaries = startupConfig.GetBoolean("TrustBinaries", m_trustBinaries); | 877 | if (RegionInfo.PhysPrimMin > 0) |
883 | m_allowScriptCrossings = startupConfig.GetBoolean("AllowScriptCrossing", m_allowScriptCrossings); | 878 | { |
884 | m_dontPersistBefore = | 879 | m_minPhys = RegionInfo.PhysPrimMin; |
885 | startupConfig.GetLong("MinimumTimeBeforePersistenceConsidered", DEFAULT_MIN_TIME_FOR_PERSISTENCE); | 880 | } |
886 | m_dontPersistBefore *= 10000000; | ||
887 | m_persistAfter = | ||
888 | startupConfig.GetLong("MaximumTimeBeforePersistenceConsidered", DEFAULT_MAX_TIME_FOR_PERSISTENCE); | ||
889 | m_persistAfter *= 10000000; | ||
890 | 881 | ||
891 | m_defaultScriptEngine = startupConfig.GetString("DefaultScriptEngine", "XEngine"); | 882 | m_maxPhys = startupConfig.GetFloat("PhysicalPrimMax", m_maxPhys); |
892 | 883 | ||
893 | SpawnPointRouting = startupConfig.GetString("SpawnPointRouting", "closest"); | 884 | if (RegionInfo.PhysPrimMax > 0) |
894 | TelehubAllowLandmarks = startupConfig.GetBoolean("TelehubAllowLandmark", false); | 885 | { |
886 | m_maxPhys = RegionInfo.PhysPrimMax; | ||
887 | } | ||
895 | 888 | ||
896 | m_strictAccessControl = startupConfig.GetBoolean("StrictAccessControl", m_strictAccessControl); | 889 | m_linksetCapacity = startupConfig.GetInt("LinksetPrims", m_linksetCapacity); |
890 | if (RegionInfo.LinksetCapacity > 0) | ||
891 | { | ||
892 | m_linksetCapacity = RegionInfo.LinksetCapacity; | ||
893 | } | ||
897 | 894 | ||
898 | m_generateMaptiles = startupConfig.GetBoolean("GenerateMaptiles", true); | 895 | SpawnPointRouting = startupConfig.GetString("SpawnPointRouting", "closest"); |
899 | if (m_generateMaptiles) | 896 | TelehubAllowLandmarks = startupConfig.GetBoolean("TelehubAllowLandmark", false); |
900 | { | 897 | |
901 | int maptileRefresh = startupConfig.GetInt("MaptileRefresh", 0); | 898 | // Here, if clamping is requested in either global or |
902 | if (maptileRefresh != 0) | 899 | // local config, it will be used |
900 | // | ||
901 | m_clampPrimSize = startupConfig.GetBoolean("ClampPrimSize", m_clampPrimSize); | ||
902 | if (RegionInfo.ClampPrimSize) | ||
903 | { | 903 | { |
904 | m_mapGenerationTimer.Interval = maptileRefresh * 1000; | 904 | m_clampPrimSize = true; |
905 | m_mapGenerationTimer.Elapsed += RegenerateMaptileAndReregister; | ||
906 | m_mapGenerationTimer.AutoReset = true; | ||
907 | m_mapGenerationTimer.Start(); | ||
908 | } | 905 | } |
909 | } | ||
910 | else | ||
911 | { | ||
912 | string tile = startupConfig.GetString("MaptileStaticUUID", UUID.Zero.ToString()); | ||
913 | UUID tileID; | ||
914 | 906 | ||
915 | if (UUID.TryParse(tile, out tileID)) | 907 | m_useTrashOnDelete = startupConfig.GetBoolean("UseTrashOnDelete",m_useTrashOnDelete); |
908 | m_trustBinaries = startupConfig.GetBoolean("TrustBinaries", m_trustBinaries); | ||
909 | m_allowScriptCrossings = startupConfig.GetBoolean("AllowScriptCrossing", m_allowScriptCrossings); | ||
910 | m_dontPersistBefore = | ||
911 | startupConfig.GetLong("MinimumTimeBeforePersistenceConsidered", DEFAULT_MIN_TIME_FOR_PERSISTENCE); | ||
912 | m_dontPersistBefore *= 10000000; | ||
913 | m_persistAfter = | ||
914 | startupConfig.GetLong("MaximumTimeBeforePersistenceConsidered", DEFAULT_MAX_TIME_FOR_PERSISTENCE); | ||
915 | m_persistAfter *= 10000000; | ||
916 | |||
917 | m_defaultScriptEngine = startupConfig.GetString("DefaultScriptEngine", "XEngine"); | ||
918 | m_log.InfoFormat("[SCENE]: Default script engine {0}", m_defaultScriptEngine); | ||
919 | |||
920 | m_strictAccessControl = startupConfig.GetBoolean("StrictAccessControl", m_strictAccessControl); | ||
921 | m_seeIntoBannedRegion = startupConfig.GetBoolean("SeeIntoBannedRegion", m_seeIntoBannedRegion); | ||
922 | CombineRegions = startupConfig.GetBoolean("CombineContiguousRegions", false); | ||
923 | |||
924 | m_generateMaptiles = startupConfig.GetBoolean("GenerateMaptiles", true); | ||
925 | if (m_generateMaptiles) | ||
916 | { | 926 | { |
917 | RegionInfo.RegionSettings.TerrainImageID = tileID; | 927 | int maptileRefresh = startupConfig.GetInt("MaptileRefresh", 0); |
928 | if (maptileRefresh != 0) | ||
929 | { | ||
930 | m_mapGenerationTimer.Interval = maptileRefresh * 1000; | ||
931 | m_mapGenerationTimer.Elapsed += RegenerateMaptileAndReregister; | ||
932 | m_mapGenerationTimer.AutoReset = true; | ||
933 | m_mapGenerationTimer.Start(); | ||
934 | } | ||
918 | } | 935 | } |
919 | } | 936 | else |
937 | { | ||
938 | string tile = startupConfig.GetString("MaptileStaticUUID", UUID.Zero.ToString()); | ||
939 | UUID tileID; | ||
920 | 940 | ||
921 | string grant = startupConfig.GetString("AllowedClients", String.Empty); | 941 | if (UUID.TryParse(tile, out tileID)) |
922 | if (grant.Length > 0) | 942 | { |
923 | { | 943 | RegionInfo.RegionSettings.TerrainImageID = tileID; |
924 | foreach (string viewer in grant.Split('|')) | 944 | } |
945 | } | ||
946 | |||
947 | string grant = startupConfig.GetString("AllowedClients", String.Empty); | ||
948 | if (grant.Length > 0) | ||
925 | { | 949 | { |
926 | m_AllowedViewers.Add(viewer.Trim().ToLower()); | 950 | foreach (string viewer in grant.Split(',')) |
951 | { | ||
952 | m_AllowedViewers.Add(viewer.Trim().ToLower()); | ||
953 | } | ||
927 | } | 954 | } |
928 | } | ||
929 | 955 | ||
930 | grant = startupConfig.GetString("BannedClients", String.Empty); | 956 | grant = startupConfig.GetString("BannedClients", String.Empty); |
931 | if (grant.Length > 0) | 957 | if (grant.Length > 0) |
932 | { | ||
933 | foreach (string viewer in grant.Split('|')) | ||
934 | { | 958 | { |
935 | m_BannedViewers.Add(viewer.Trim().ToLower()); | 959 | foreach (string viewer in grant.Split(',')) |
960 | { | ||
961 | m_BannedViewers.Add(viewer.Trim().ToLower()); | ||
962 | } | ||
936 | } | 963 | } |
937 | } | ||
938 | 964 | ||
939 | MinFrameTime = startupConfig.GetFloat( "MinFrameTime", MinFrameTime); | 965 | MinFrameTime = startupConfig.GetFloat( "MinFrameTime", MinFrameTime); |
940 | m_update_backup = startupConfig.GetInt( "UpdateStorageEveryNFrames", m_update_backup); | 966 | m_update_backup = startupConfig.GetInt( "UpdateStorageEveryNFrames", m_update_backup); |
941 | m_update_coarse_locations = startupConfig.GetInt( "UpdateCoarseLocationsEveryNFrames", m_update_coarse_locations); | 967 | m_update_coarse_locations = startupConfig.GetInt( "UpdateCoarseLocationsEveryNFrames", m_update_coarse_locations); |
942 | m_update_entitymovement = startupConfig.GetInt( "UpdateEntityMovementEveryNFrames", m_update_entitymovement); | 968 | m_update_entitymovement = startupConfig.GetInt( "UpdateEntityMovementEveryNFrames", m_update_entitymovement); |
943 | m_update_events = startupConfig.GetInt( "UpdateEventsEveryNFrames", m_update_events); | 969 | m_update_events = startupConfig.GetInt( "UpdateEventsEveryNFrames", m_update_events); |
944 | m_update_objects = startupConfig.GetInt( "UpdateObjectsEveryNFrames", m_update_objects); | 970 | m_update_objects = startupConfig.GetInt( "UpdateObjectsEveryNFrames", m_update_objects); |
945 | m_update_physics = startupConfig.GetInt( "UpdatePhysicsEveryNFrames", m_update_physics); | 971 | m_update_physics = startupConfig.GetInt( "UpdatePhysicsEveryNFrames", m_update_physics); |
946 | m_update_presences = startupConfig.GetInt( "UpdateAgentsEveryNFrames", m_update_presences); | 972 | m_update_presences = startupConfig.GetInt( "UpdateAgentsEveryNFrames", m_update_presences); |
947 | m_update_terrain = startupConfig.GetInt( "UpdateTerrainEveryNFrames", m_update_terrain); | 973 | m_update_terrain = startupConfig.GetInt( "UpdateTerrainEveryNFrames", m_update_terrain); |
948 | m_update_temp_cleaning = startupConfig.GetInt( "UpdateTempCleaningEveryNFrames", m_update_temp_cleaning); | 974 | m_update_temp_cleaning = startupConfig.GetInt( "UpdateTempCleaningEveryNFrames", m_update_temp_cleaning); |
975 | } | ||
976 | } | ||
977 | catch (Exception e) | ||
978 | { | ||
979 | m_log.Error("[SCENE]: Failed to load StartupConfig: " + e.ToString()); | ||
949 | } | 980 | } |
950 | 981 | ||
951 | // FIXME: Ultimately this should be in a module. | 982 | // FIXME: Ultimately this should be in a module. |
@@ -990,6 +1021,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
990 | StatsReporter = new SimStatsReporter(this); | 1021 | StatsReporter = new SimStatsReporter(this); |
991 | StatsReporter.OnSendStatsResult += SendSimStatsPackets; | 1022 | StatsReporter.OnSendStatsResult += SendSimStatsPackets; |
992 | StatsReporter.OnStatsIncorrect += m_sceneGraph.RecalculateStats; | 1023 | StatsReporter.OnStatsIncorrect += m_sceneGraph.RecalculateStats; |
1024 | |||
1025 | MainConsole.Instance.Commands.AddCommand("scene", false, "gc collect", "gc collect", "gc collect", "Cause the garbage collector to make a single pass", HandleGcCollect); | ||
993 | } | 1026 | } |
994 | 1027 | ||
995 | public Scene(RegionInfo regInfo) : base(regInfo) | 1028 | public Scene(RegionInfo regInfo) : base(regInfo) |
@@ -1285,8 +1318,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
1285 | // Stop all client threads. | 1318 | // Stop all client threads. |
1286 | ForEachScenePresence(delegate(ScenePresence avatar) { avatar.ControllingClient.Close(); }); | 1319 | ForEachScenePresence(delegate(ScenePresence avatar) { avatar.ControllingClient.Close(); }); |
1287 | 1320 | ||
1288 | m_log.Debug("[SCENE]: Persisting changed objects"); | 1321 | m_log.Debug("[SCENE]: TriggerSceneShuttingDown"); |
1289 | EventManager.TriggerSceneShuttingDown(this); | 1322 | EventManager.TriggerSceneShuttingDown(this); |
1323 | |||
1324 | m_log.Debug("[SCENE]: Persisting changed objects"); | ||
1325 | |||
1290 | Backup(false); | 1326 | Backup(false); |
1291 | m_sceneGraph.Close(); | 1327 | m_sceneGraph.Close(); |
1292 | 1328 | ||
@@ -1300,6 +1336,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1300 | // attempt to reference a null or disposed physics scene. | 1336 | // attempt to reference a null or disposed physics scene. |
1301 | if (PhysicsScene != null) | 1337 | if (PhysicsScene != null) |
1302 | { | 1338 | { |
1339 | m_log.Debug("[SCENE]: Dispose Physics"); | ||
1303 | PhysicsScene phys = PhysicsScene; | 1340 | PhysicsScene phys = PhysicsScene; |
1304 | // remove the physics engine from both Scene and SceneGraph | 1341 | // remove the physics engine from both Scene and SceneGraph |
1305 | PhysicsScene = null; | 1342 | PhysicsScene = null; |
@@ -1322,11 +1359,29 @@ namespace OpenSim.Region.Framework.Scenes | |||
1322 | //m_heartbeatTimer.Elapsed += new ElapsedEventHandler(Heartbeat); | 1359 | //m_heartbeatTimer.Elapsed += new ElapsedEventHandler(Heartbeat); |
1323 | if (m_heartbeatThread != null) | 1360 | if (m_heartbeatThread != null) |
1324 | { | 1361 | { |
1362 | m_hbRestarts++; | ||
1363 | if(m_hbRestarts > 10) | ||
1364 | Environment.Exit(1); | ||
1365 | m_log.ErrorFormat("[SCENE]: Restarting heartbeat thread because it hasn't reported in in region {0}", RegionInfo.RegionName); | ||
1366 | |||
1367 | //int pid = System.Diagnostics.Process.GetCurrentProcess().Id; | ||
1368 | //System.Diagnostics.Process proc = new System.Diagnostics.Process(); | ||
1369 | //proc.EnableRaisingEvents=false; | ||
1370 | //proc.StartInfo.FileName = "/bin/kill"; | ||
1371 | //proc.StartInfo.Arguments = "-QUIT " + pid.ToString(); | ||
1372 | //proc.Start(); | ||
1373 | //proc.WaitForExit(); | ||
1374 | //Thread.Sleep(1000); | ||
1375 | //Environment.Exit(1); | ||
1325 | m_heartbeatThread.Abort(); | 1376 | m_heartbeatThread.Abort(); |
1377 | Watchdog.AbortThread(m_heartbeatThread.ManagedThreadId); | ||
1326 | m_heartbeatThread = null; | 1378 | m_heartbeatThread = null; |
1327 | } | 1379 | } |
1328 | // m_lastUpdate = Util.EnvironmentTickCount(); | 1380 | // m_lastUpdate = Util.EnvironmentTickCount(); |
1329 | 1381 | ||
1382 | // m_sceneGraph.PreparePhysicsSimulation(); | ||
1383 | |||
1384 | |||
1330 | m_heartbeatThread | 1385 | m_heartbeatThread |
1331 | = Watchdog.StartThread( | 1386 | = Watchdog.StartThread( |
1332 | Heartbeat, string.Format("Heartbeat ({0})", RegionInfo.RegionName), ThreadPriority.Normal, false, false); | 1387 | Heartbeat, string.Format("Heartbeat ({0})", RegionInfo.RegionName), ThreadPriority.Normal, false, false); |
@@ -1469,16 +1524,20 @@ namespace OpenSim.Region.Framework.Scenes | |||
1469 | endFrame = Frame + frames; | 1524 | endFrame = Frame + frames; |
1470 | 1525 | ||
1471 | float physicsFPS = 0f; | 1526 | float physicsFPS = 0f; |
1472 | int previousFrameTick, tmpMS; | 1527 | int tmpMS; |
1473 | int maintc = Util.EnvironmentTickCount(); | 1528 | int previousFrameTick; |
1529 | int maintc; | ||
1530 | int sleepMS; | ||
1531 | int framestart; | ||
1474 | 1532 | ||
1475 | while (!m_shuttingDown && ((endFrame == null && Active) || Frame < endFrame)) | 1533 | while (!m_shuttingDown && ((endFrame == null && Active) || Frame < endFrame)) |
1476 | { | 1534 | { |
1535 | framestart = Util.EnvironmentTickCount(); | ||
1477 | ++Frame; | 1536 | ++Frame; |
1478 | 1537 | ||
1479 | // m_log.DebugFormat("[SCENE]: Processing frame {0} in {1}", Frame, RegionInfo.RegionName); | 1538 | // m_log.DebugFormat("[SCENE]: Processing frame {0} in {1}", Frame, RegionInfo.RegionName); |
1480 | 1539 | ||
1481 | agentMS = tempOnRezMS = eventMS = backupMS = terrainMS = landMS = spareMS = 0; | 1540 | agentMS = tempOnRezMS = eventMS = backupMS = terrainMS = landMS = 0; |
1482 | 1541 | ||
1483 | try | 1542 | try |
1484 | { | 1543 | { |
@@ -1530,6 +1589,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1530 | m_sceneGraph.UpdatePresences(); | 1589 | m_sceneGraph.UpdatePresences(); |
1531 | 1590 | ||
1532 | agentMS += Util.EnvironmentTickCountSubtract(tmpMS); | 1591 | agentMS += Util.EnvironmentTickCountSubtract(tmpMS); |
1592 | |||
1533 | 1593 | ||
1534 | // Delete temp-on-rez stuff | 1594 | // Delete temp-on-rez stuff |
1535 | if (Frame % m_update_temp_cleaning == 0 && !m_cleaningTemps) | 1595 | if (Frame % m_update_temp_cleaning == 0 && !m_cleaningTemps) |
@@ -1611,34 +1671,37 @@ namespace OpenSim.Region.Framework.Scenes | |||
1611 | 1671 | ||
1612 | Watchdog.UpdateThread(); | 1672 | Watchdog.UpdateThread(); |
1613 | 1673 | ||
1674 | otherMS = tempOnRezMS + eventMS + backupMS + terrainMS + landMS; | ||
1675 | |||
1676 | StatsReporter.AddPhysicsFPS(physicsFPS); | ||
1677 | StatsReporter.AddTimeDilation(TimeDilation); | ||
1678 | StatsReporter.AddFPS(1); | ||
1679 | |||
1680 | StatsReporter.addAgentMS(agentMS); | ||
1681 | StatsReporter.addPhysicsMS(physicsMS + physicsMS2); | ||
1682 | StatsReporter.addOtherMS(otherMS); | ||
1683 | StatsReporter.addScriptLines(m_sceneGraph.GetScriptLPS()); | ||
1684 | |||
1614 | previousFrameTick = m_lastFrameTick; | 1685 | previousFrameTick = m_lastFrameTick; |
1615 | m_lastFrameTick = Util.EnvironmentTickCount(); | 1686 | m_lastFrameTick = Util.EnvironmentTickCount(); |
1616 | tmpMS = Util.EnvironmentTickCountSubtract(m_lastFrameTick, maintc); | 1687 | tmpMS = Util.EnvironmentTickCountSubtract(m_lastFrameTick, framestart); |
1617 | tmpMS = (int)(MinFrameTime * 1000) - tmpMS; | 1688 | tmpMS = (int)(MinFrameTime * 1000) - tmpMS; |
1618 | 1689 | ||
1690 | m_firstHeartbeat = false; | ||
1691 | |||
1692 | sleepMS = Util.EnvironmentTickCount(); | ||
1693 | |||
1619 | if (tmpMS > 0) | 1694 | if (tmpMS > 0) |
1620 | { | ||
1621 | Thread.Sleep(tmpMS); | 1695 | Thread.Sleep(tmpMS); |
1622 | spareMS += tmpMS; | ||
1623 | } | ||
1624 | |||
1625 | frameMS = Util.EnvironmentTickCountSubtract(maintc); | ||
1626 | maintc = Util.EnvironmentTickCount(); | ||
1627 | 1696 | ||
1628 | otherMS = tempOnRezMS + eventMS + backupMS + terrainMS + landMS; | 1697 | sleepMS = Util.EnvironmentTickCountSubtract(sleepMS); |
1698 | frameMS = Util.EnvironmentTickCountSubtract(framestart); | ||
1699 | StatsReporter.addSleepMS(sleepMS); | ||
1700 | StatsReporter.addFrameMS(frameMS); | ||
1629 | 1701 | ||
1630 | // if (Frame%m_update_avatars == 0) | 1702 | // if (Frame%m_update_avatars == 0) |
1631 | // UpdateInWorldTime(); | 1703 | // UpdateInWorldTime(); |
1632 | StatsReporter.AddPhysicsFPS(physicsFPS); | ||
1633 | StatsReporter.AddTimeDilation(TimeDilation); | ||
1634 | StatsReporter.AddFPS(1); | ||
1635 | 1704 | ||
1636 | StatsReporter.addFrameMS(frameMS); | ||
1637 | StatsReporter.addAgentMS(agentMS); | ||
1638 | StatsReporter.addPhysicsMS(physicsMS + physicsMS2); | ||
1639 | StatsReporter.addOtherMS(otherMS); | ||
1640 | StatsReporter.AddSpareMS(spareMS); | ||
1641 | StatsReporter.addScriptLines(m_sceneGraph.GetScriptLPS()); | ||
1642 | 1705 | ||
1643 | // Optionally warn if a frame takes double the amount of time that it should. | 1706 | // Optionally warn if a frame takes double the amount of time that it should. |
1644 | if (DebugUpdates | 1707 | if (DebugUpdates |
@@ -1756,7 +1819,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1756 | msg.fromAgentName = "Server"; | 1819 | msg.fromAgentName = "Server"; |
1757 | msg.dialog = (byte)19; // Object msg | 1820 | msg.dialog = (byte)19; // Object msg |
1758 | msg.fromGroup = false; | 1821 | msg.fromGroup = false; |
1759 | msg.offline = (byte)0; | 1822 | msg.offline = (byte)1; |
1760 | msg.ParentEstateID = RegionInfo.EstateSettings.ParentEstateID; | 1823 | msg.ParentEstateID = RegionInfo.EstateSettings.ParentEstateID; |
1761 | msg.Position = Vector3.Zero; | 1824 | msg.Position = Vector3.Zero; |
1762 | msg.RegionID = RegionInfo.RegionID.Guid; | 1825 | msg.RegionID = RegionInfo.RegionID.Guid; |
@@ -1978,6 +2041,19 @@ namespace OpenSim.Region.Framework.Scenes | |||
1978 | EventManager.TriggerPrimsLoaded(this); | 2041 | EventManager.TriggerPrimsLoaded(this); |
1979 | } | 2042 | } |
1980 | 2043 | ||
2044 | public bool SuportsRayCastFiltered() | ||
2045 | { | ||
2046 | if (PhysicsScene == null) | ||
2047 | return false; | ||
2048 | return PhysicsScene.SuportsRaycastWorldFiltered(); | ||
2049 | } | ||
2050 | |||
2051 | public object RayCastFiltered(Vector3 position, Vector3 direction, float length, int Count, RayFilterFlags filter) | ||
2052 | { | ||
2053 | if (PhysicsScene == null) | ||
2054 | return null; | ||
2055 | return PhysicsScene.RaycastWorld(position, direction, length, Count,filter); | ||
2056 | } | ||
1981 | 2057 | ||
1982 | /// <summary> | 2058 | /// <summary> |
1983 | /// Gets a new rez location based on the raycast and the size of the object that is being rezzed. | 2059 | /// Gets a new rez location based on the raycast and the size of the object that is being rezzed. |
@@ -1994,14 +2070,24 @@ namespace OpenSim.Region.Framework.Scenes | |||
1994 | /// <returns></returns> | 2070 | /// <returns></returns> |
1995 | public Vector3 GetNewRezLocation(Vector3 RayStart, Vector3 RayEnd, UUID RayTargetID, Quaternion rot, byte bypassRayCast, byte RayEndIsIntersection, bool frontFacesOnly, Vector3 scale, bool FaceCenter) | 2071 | public Vector3 GetNewRezLocation(Vector3 RayStart, Vector3 RayEnd, UUID RayTargetID, Quaternion rot, byte bypassRayCast, byte RayEndIsIntersection, bool frontFacesOnly, Vector3 scale, bool FaceCenter) |
1996 | { | 2072 | { |
2073 | |||
2074 | float wheight = (float)RegionInfo.RegionSettings.WaterHeight; | ||
2075 | Vector3 wpos = Vector3.Zero; | ||
2076 | // Check for water surface intersection from above | ||
2077 | if ( (RayStart.Z > wheight) && (RayEnd.Z < wheight) ) | ||
2078 | { | ||
2079 | float ratio = (RayStart.Z - wheight) / (RayStart.Z - RayEnd.Z); | ||
2080 | wpos.X = RayStart.X - (ratio * (RayStart.X - RayEnd.X)); | ||
2081 | wpos.Y = RayStart.Y - (ratio * (RayStart.Y - RayEnd.Y)); | ||
2082 | wpos.Z = wheight; | ||
2083 | } | ||
2084 | |||
1997 | Vector3 pos = Vector3.Zero; | 2085 | Vector3 pos = Vector3.Zero; |
1998 | if (RayEndIsIntersection == (byte)1) | 2086 | if (RayEndIsIntersection == (byte)1) |
1999 | { | 2087 | { |
2000 | pos = RayEnd; | 2088 | pos = RayEnd; |
2001 | return pos; | ||
2002 | } | 2089 | } |
2003 | 2090 | else if (RayTargetID != UUID.Zero) | |
2004 | if (RayTargetID != UUID.Zero) | ||
2005 | { | 2091 | { |
2006 | SceneObjectPart target = GetSceneObjectPart(RayTargetID); | 2092 | SceneObjectPart target = GetSceneObjectPart(RayTargetID); |
2007 | 2093 | ||
@@ -2023,7 +2109,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2023 | EntityIntersection ei = target.TestIntersectionOBB(NewRay, Quaternion.Identity, frontFacesOnly, FaceCenter); | 2109 | EntityIntersection ei = target.TestIntersectionOBB(NewRay, Quaternion.Identity, frontFacesOnly, FaceCenter); |
2024 | 2110 | ||
2025 | // Un-comment out the following line to Get Raytrace results printed to the console. | 2111 | // Un-comment out the following line to Get Raytrace results printed to the console. |
2026 | // m_log.Info("[RAYTRACERESULTS]: Hit:" + ei.HitTF.ToString() + " Point: " + ei.ipoint.ToString() + " Normal: " + ei.normal.ToString()); | 2112 | // m_log.Info("[RAYTRACERESULTS]: Hit:" + ei.HitTF.ToString() + " Point: " + ei.ipoint.ToString() + " Normal: " + ei.normal.ToString()); |
2027 | float ScaleOffset = 0.5f; | 2113 | float ScaleOffset = 0.5f; |
2028 | 2114 | ||
2029 | // If we hit something | 2115 | // If we hit something |
@@ -2046,13 +2132,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
2046 | //pos.Z -= 0.25F; | 2132 | //pos.Z -= 0.25F; |
2047 | 2133 | ||
2048 | } | 2134 | } |
2049 | |||
2050 | return pos; | ||
2051 | } | 2135 | } |
2052 | else | 2136 | else |
2053 | { | 2137 | { |
2054 | // We don't have a target here, so we're going to raytrace all the objects in the scene. | 2138 | // We don't have a target here, so we're going to raytrace all the objects in the scene. |
2055 | |||
2056 | EntityIntersection ei = m_sceneGraph.GetClosestIntersectingPrim(new Ray(AXOrigin, AXdirection), true, false); | 2139 | EntityIntersection ei = m_sceneGraph.GetClosestIntersectingPrim(new Ray(AXOrigin, AXdirection), true, false); |
2057 | 2140 | ||
2058 | // Un-comment the following line to print the raytrace results to the console. | 2141 | // Un-comment the following line to print the raytrace results to the console. |
@@ -2061,13 +2144,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
2061 | if (ei.HitTF) | 2144 | if (ei.HitTF) |
2062 | { | 2145 | { |
2063 | pos = new Vector3(ei.ipoint.X, ei.ipoint.Y, ei.ipoint.Z); | 2146 | pos = new Vector3(ei.ipoint.X, ei.ipoint.Y, ei.ipoint.Z); |
2064 | } else | 2147 | } |
2148 | else | ||
2065 | { | 2149 | { |
2066 | // fall back to our stupid functionality | 2150 | // fall back to our stupid functionality |
2067 | pos = RayEnd; | 2151 | pos = RayEnd; |
2068 | } | 2152 | } |
2069 | |||
2070 | return pos; | ||
2071 | } | 2153 | } |
2072 | } | 2154 | } |
2073 | else | 2155 | else |
@@ -2078,8 +2160,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
2078 | //increase height so its above the ground. | 2160 | //increase height so its above the ground. |
2079 | //should be getting the normal of the ground at the rez point and using that? | 2161 | //should be getting the normal of the ground at the rez point and using that? |
2080 | pos.Z += scale.Z / 2f; | 2162 | pos.Z += scale.Z / 2f; |
2081 | return pos; | 2163 | // return pos; |
2082 | } | 2164 | } |
2165 | |||
2166 | // check against posible water intercept | ||
2167 | if (wpos.Z > pos.Z) pos = wpos; | ||
2168 | return pos; | ||
2083 | } | 2169 | } |
2084 | 2170 | ||
2085 | 2171 | ||
@@ -2170,12 +2256,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
2170 | { | 2256 | { |
2171 | if (m_sceneGraph.AddRestoredSceneObject(sceneObject, attachToBackup, alreadyPersisted, sendClientUpdates)) | 2257 | if (m_sceneGraph.AddRestoredSceneObject(sceneObject, attachToBackup, alreadyPersisted, sendClientUpdates)) |
2172 | { | 2258 | { |
2259 | sceneObject.IsDeleted = false; | ||
2173 | EventManager.TriggerObjectAddedToScene(sceneObject); | 2260 | EventManager.TriggerObjectAddedToScene(sceneObject); |
2174 | return true; | 2261 | return true; |
2175 | } | 2262 | } |
2176 | 2263 | ||
2177 | return false; | 2264 | return false; |
2178 | |||
2179 | } | 2265 | } |
2180 | 2266 | ||
2181 | /// <summary> | 2267 | /// <summary> |
@@ -2267,6 +2353,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
2267 | /// </summary> | 2353 | /// </summary> |
2268 | public void DeleteAllSceneObjects() | 2354 | public void DeleteAllSceneObjects() |
2269 | { | 2355 | { |
2356 | DeleteAllSceneObjects(false); | ||
2357 | } | ||
2358 | |||
2359 | /// <summary> | ||
2360 | /// Delete every object from the scene. This does not include attachments worn by avatars. | ||
2361 | /// </summary> | ||
2362 | public void DeleteAllSceneObjects(bool exceptNoCopy) | ||
2363 | { | ||
2364 | List<SceneObjectGroup> toReturn = new List<SceneObjectGroup>(); | ||
2270 | lock (Entities) | 2365 | lock (Entities) |
2271 | { | 2366 | { |
2272 | EntityBase[] entities = Entities.GetEntities(); | 2367 | EntityBase[] entities = Entities.GetEntities(); |
@@ -2275,11 +2370,24 @@ namespace OpenSim.Region.Framework.Scenes | |||
2275 | if (e is SceneObjectGroup) | 2370 | if (e is SceneObjectGroup) |
2276 | { | 2371 | { |
2277 | SceneObjectGroup sog = (SceneObjectGroup)e; | 2372 | SceneObjectGroup sog = (SceneObjectGroup)e; |
2278 | if (!sog.IsAttachment) | 2373 | if (sog != null && !sog.IsAttachment) |
2279 | DeleteSceneObject((SceneObjectGroup)e, false); | 2374 | { |
2375 | if (!exceptNoCopy || ((sog.GetEffectivePermissions() & (uint)PermissionMask.Copy) != 0)) | ||
2376 | { | ||
2377 | DeleteSceneObject((SceneObjectGroup)e, false); | ||
2378 | } | ||
2379 | else | ||
2380 | { | ||
2381 | toReturn.Add((SceneObjectGroup)e); | ||
2382 | } | ||
2383 | } | ||
2280 | } | 2384 | } |
2281 | } | 2385 | } |
2282 | } | 2386 | } |
2387 | if (toReturn.Count > 0) | ||
2388 | { | ||
2389 | returnObjects(toReturn.ToArray(), UUID.Zero); | ||
2390 | } | ||
2283 | } | 2391 | } |
2284 | 2392 | ||
2285 | /// <summary> | 2393 | /// <summary> |
@@ -2314,6 +2422,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
2314 | 2422 | ||
2315 | foreach (SceneObjectPart part in partList) | 2423 | foreach (SceneObjectPart part in partList) |
2316 | { | 2424 | { |
2425 | if (part.KeyframeMotion != null) | ||
2426 | { | ||
2427 | part.KeyframeMotion.Delete(); | ||
2428 | part.KeyframeMotion = null; | ||
2429 | } | ||
2430 | |||
2317 | if (part.IsJoint() && ((part.Flags & PrimFlags.Physics) != 0)) | 2431 | if (part.IsJoint() && ((part.Flags & PrimFlags.Physics) != 0)) |
2318 | { | 2432 | { |
2319 | PhysicsScene.RequestJointDeletion(part.Name); // FIXME: what if the name changed? | 2433 | PhysicsScene.RequestJointDeletion(part.Name); // FIXME: what if the name changed? |
@@ -2331,6 +2445,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2331 | } | 2445 | } |
2332 | 2446 | ||
2333 | group.DeleteGroupFromScene(silent); | 2447 | group.DeleteGroupFromScene(silent); |
2448 | if (!silent) | ||
2449 | SendKillObject(new List<uint>() { group.LocalId }); | ||
2334 | 2450 | ||
2335 | // m_log.DebugFormat("[SCENE]: Exit DeleteSceneObject() for {0} {1}", group.Name, group.UUID); | 2451 | // m_log.DebugFormat("[SCENE]: Exit DeleteSceneObject() for {0} {1}", group.Name, group.UUID); |
2336 | } | 2452 | } |
@@ -2621,7 +2737,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2621 | // If the user is banned, we won't let any of their objects | 2737 | // If the user is banned, we won't let any of their objects |
2622 | // enter. Period. | 2738 | // enter. Period. |
2623 | // | 2739 | // |
2624 | if (RegionInfo.EstateSettings.IsBanned(newObject.OwnerID)) | 2740 | if (RegionInfo.EstateSettings.IsBanned(newObject.OwnerID, 36)) |
2625 | { | 2741 | { |
2626 | m_log.InfoFormat("[INTERREGION]: Denied prim crossing for banned avatar {0}", newObject.OwnerID); | 2742 | m_log.InfoFormat("[INTERREGION]: Denied prim crossing for banned avatar {0}", newObject.OwnerID); |
2627 | return false; | 2743 | return false; |
@@ -2629,6 +2745,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2629 | 2745 | ||
2630 | if (newPosition != Vector3.Zero) | 2746 | if (newPosition != Vector3.Zero) |
2631 | newObject.RootPart.GroupPosition = newPosition; | 2747 | newObject.RootPart.GroupPosition = newPosition; |
2748 | if (newObject.RootPart.KeyframeMotion != null) | ||
2749 | newObject.RootPart.KeyframeMotion.UpdateSceneObject(newObject); | ||
2632 | 2750 | ||
2633 | if (!AddSceneObject(newObject)) | 2751 | if (!AddSceneObject(newObject)) |
2634 | { | 2752 | { |
@@ -2673,6 +2791,23 @@ namespace OpenSim.Region.Framework.Scenes | |||
2673 | /// <returns>True if the SceneObjectGroup was added, False if it was not</returns> | 2791 | /// <returns>True if the SceneObjectGroup was added, False if it was not</returns> |
2674 | public bool AddSceneObject(SceneObjectGroup sceneObject) | 2792 | public bool AddSceneObject(SceneObjectGroup sceneObject) |
2675 | { | 2793 | { |
2794 | if (sceneObject.OwnerID == UUID.Zero) | ||
2795 | { | ||
2796 | m_log.ErrorFormat("[SCENE]: Owner ID for {0} was zero", sceneObject.UUID); | ||
2797 | return false; | ||
2798 | } | ||
2799 | |||
2800 | // If the user is banned, we won't let any of their objects | ||
2801 | // enter. Period. | ||
2802 | // | ||
2803 | int flags = GetUserFlags(sceneObject.OwnerID); | ||
2804 | if (RegionInfo.EstateSettings.IsBanned(sceneObject.OwnerID, flags)) | ||
2805 | { | ||
2806 | m_log.InfoFormat("[INTERREGION]: Denied prim crossing for banned avatar {0}", sceneObject.OwnerID); | ||
2807 | |||
2808 | return false; | ||
2809 | } | ||
2810 | |||
2676 | // Force allocation of new LocalId | 2811 | // Force allocation of new LocalId |
2677 | // | 2812 | // |
2678 | SceneObjectPart[] parts = sceneObject.Parts; | 2813 | SceneObjectPart[] parts = sceneObject.Parts; |
@@ -2706,16 +2841,27 @@ namespace OpenSim.Region.Framework.Scenes | |||
2706 | RootPrim.RemFlag(PrimFlags.TemporaryOnRez); | 2841 | RootPrim.RemFlag(PrimFlags.TemporaryOnRez); |
2707 | 2842 | ||
2708 | if (AttachmentsModule != null) | 2843 | if (AttachmentsModule != null) |
2709 | AttachmentsModule.AttachObject(sp, grp, 0, false, false); | 2844 | AttachmentsModule.AttachObject(sp, grp, 0, false, false, false); |
2710 | } | 2845 | } |
2711 | else | 2846 | else |
2712 | { | 2847 | { |
2848 | m_log.DebugFormat("[SCENE]: Attachment {0} arrived and scene presence was not found, setting to temp", sceneObject.UUID); | ||
2713 | RootPrim.RemFlag(PrimFlags.TemporaryOnRez); | 2849 | RootPrim.RemFlag(PrimFlags.TemporaryOnRez); |
2714 | RootPrim.AddFlag(PrimFlags.TemporaryOnRez); | 2850 | RootPrim.AddFlag(PrimFlags.TemporaryOnRez); |
2715 | } | 2851 | } |
2852 | if (sceneObject.OwnerID == UUID.Zero) | ||
2853 | { | ||
2854 | m_log.ErrorFormat("[SCENE]: Owner ID for {0} was zero after attachment processing. BUG!", sceneObject.UUID); | ||
2855 | return false; | ||
2856 | } | ||
2716 | } | 2857 | } |
2717 | else | 2858 | else |
2718 | { | 2859 | { |
2860 | if (sceneObject.OwnerID == UUID.Zero) | ||
2861 | { | ||
2862 | m_log.ErrorFormat("[SCENE]: Owner ID for non-attachment {0} was zero", sceneObject.UUID); | ||
2863 | return false; | ||
2864 | } | ||
2719 | AddRestoredSceneObject(sceneObject, true, false); | 2865 | AddRestoredSceneObject(sceneObject, true, false); |
2720 | } | 2866 | } |
2721 | 2867 | ||
@@ -2732,6 +2878,24 @@ namespace OpenSim.Region.Framework.Scenes | |||
2732 | return 2; // StateSource.PrimCrossing | 2878 | return 2; // StateSource.PrimCrossing |
2733 | } | 2879 | } |
2734 | 2880 | ||
2881 | public int GetUserFlags(UUID user) | ||
2882 | { | ||
2883 | //Unfortunately the SP approach means that the value is cached until region is restarted | ||
2884 | /* | ||
2885 | ScenePresence sp; | ||
2886 | if (TryGetScenePresence(user, out sp)) | ||
2887 | { | ||
2888 | return sp.UserFlags; | ||
2889 | } | ||
2890 | else | ||
2891 | { | ||
2892 | */ | ||
2893 | UserAccount uac = UserAccountService.GetUserAccount(RegionInfo.ScopeID, user); | ||
2894 | if (uac == null) | ||
2895 | return 0; | ||
2896 | return uac.UserFlags; | ||
2897 | //} | ||
2898 | } | ||
2735 | #endregion | 2899 | #endregion |
2736 | 2900 | ||
2737 | #region Add/Remove Avatar Methods | 2901 | #region Add/Remove Avatar Methods |
@@ -2764,7 +2928,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2764 | = (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0 | 2928 | = (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0 |
2765 | || (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0; | 2929 | || (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0; |
2766 | 2930 | ||
2767 | // CheckHeartbeat(); | 2931 | CheckHeartbeat(); |
2768 | 2932 | ||
2769 | sp = GetScenePresence(client.AgentId); | 2933 | sp = GetScenePresence(client.AgentId); |
2770 | 2934 | ||
@@ -2795,6 +2959,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2795 | // start the scripts again (since this is done in RezAttachments()). | 2959 | // start the scripts again (since this is done in RezAttachments()). |
2796 | // XXX: This is convoluted. | 2960 | // XXX: This is convoluted. |
2797 | sp.IsChildAgent = false; | 2961 | sp.IsChildAgent = false; |
2962 | sp.IsLoggingIn = true; | ||
2798 | 2963 | ||
2799 | if (AttachmentsModule != null) | 2964 | if (AttachmentsModule != null) |
2800 | Util.FireAndForget(delegate(object o) { AttachmentsModule.RezAttachments(sp); }); | 2965 | Util.FireAndForget(delegate(object o) { AttachmentsModule.RezAttachments(sp); }); |
@@ -2908,19 +3073,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
2908 | // and the scene presence and the client, if they exist | 3073 | // and the scene presence and the client, if they exist |
2909 | try | 3074 | try |
2910 | { | 3075 | { |
2911 | // We need to wait for the client to make UDP contact first. | 3076 | ScenePresence sp = GetScenePresence(agentID); |
2912 | // It's the UDP contact that creates the scene presence | 3077 | |
2913 | ScenePresence sp = WaitGetScenePresence(agentID); | ||
2914 | if (sp != null) | 3078 | if (sp != null) |
2915 | { | 3079 | { |
2916 | PresenceService.LogoutAgent(sp.ControllingClient.SessionId); | 3080 | PresenceService.LogoutAgent(sp.ControllingClient.SessionId); |
2917 | |||
2918 | sp.ControllingClient.Close(); | 3081 | sp.ControllingClient.Close(); |
2919 | } | 3082 | } |
2920 | else | 3083 | |
2921 | { | ||
2922 | m_log.WarnFormat("[SCENE]: Could not find scene presence for {0}", agentID); | ||
2923 | } | ||
2924 | // BANG! SLASH! | 3084 | // BANG! SLASH! |
2925 | m_authenticateHandler.RemoveCircuit(agentID); | 3085 | m_authenticateHandler.RemoveCircuit(agentID); |
2926 | 3086 | ||
@@ -2965,6 +3125,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2965 | client.OnUpdatePrimGroupPosition += m_sceneGraph.UpdatePrimGroupPosition; | 3125 | client.OnUpdatePrimGroupPosition += m_sceneGraph.UpdatePrimGroupPosition; |
2966 | client.OnUpdatePrimSinglePosition += m_sceneGraph.UpdatePrimSinglePosition; | 3126 | client.OnUpdatePrimSinglePosition += m_sceneGraph.UpdatePrimSinglePosition; |
2967 | 3127 | ||
3128 | client.onClientChangeObject += m_sceneGraph.ClientChangeObject; | ||
3129 | |||
2968 | client.OnUpdatePrimGroupRotation += m_sceneGraph.UpdatePrimGroupRotation; | 3130 | client.OnUpdatePrimGroupRotation += m_sceneGraph.UpdatePrimGroupRotation; |
2969 | client.OnUpdatePrimGroupMouseRotation += m_sceneGraph.UpdatePrimGroupRotation; | 3131 | client.OnUpdatePrimGroupMouseRotation += m_sceneGraph.UpdatePrimGroupRotation; |
2970 | client.OnUpdatePrimSingleRotation += m_sceneGraph.UpdatePrimSingleRotation; | 3132 | client.OnUpdatePrimSingleRotation += m_sceneGraph.UpdatePrimSingleRotation; |
@@ -3021,6 +3183,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3021 | client.OnFetchInventory += m_asyncInventorySender.HandleFetchInventory; | 3183 | client.OnFetchInventory += m_asyncInventorySender.HandleFetchInventory; |
3022 | client.OnUpdateInventoryItem += UpdateInventoryItemAsset; | 3184 | client.OnUpdateInventoryItem += UpdateInventoryItemAsset; |
3023 | client.OnCopyInventoryItem += CopyInventoryItem; | 3185 | client.OnCopyInventoryItem += CopyInventoryItem; |
3186 | client.OnMoveItemsAndLeaveCopy += MoveInventoryItemsLeaveCopy; | ||
3024 | client.OnMoveInventoryItem += MoveInventoryItem; | 3187 | client.OnMoveInventoryItem += MoveInventoryItem; |
3025 | client.OnRemoveInventoryItem += RemoveInventoryItem; | 3188 | client.OnRemoveInventoryItem += RemoveInventoryItem; |
3026 | client.OnRemoveInventoryFolder += RemoveInventoryFolder; | 3189 | client.OnRemoveInventoryFolder += RemoveInventoryFolder; |
@@ -3092,6 +3255,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
3092 | client.OnUpdatePrimGroupPosition -= m_sceneGraph.UpdatePrimGroupPosition; | 3255 | client.OnUpdatePrimGroupPosition -= m_sceneGraph.UpdatePrimGroupPosition; |
3093 | client.OnUpdatePrimSinglePosition -= m_sceneGraph.UpdatePrimSinglePosition; | 3256 | client.OnUpdatePrimSinglePosition -= m_sceneGraph.UpdatePrimSinglePosition; |
3094 | 3257 | ||
3258 | client.onClientChangeObject -= m_sceneGraph.ClientChangeObject; | ||
3259 | |||
3095 | client.OnUpdatePrimGroupRotation -= m_sceneGraph.UpdatePrimGroupRotation; | 3260 | client.OnUpdatePrimGroupRotation -= m_sceneGraph.UpdatePrimGroupRotation; |
3096 | client.OnUpdatePrimGroupMouseRotation -= m_sceneGraph.UpdatePrimGroupRotation; | 3261 | client.OnUpdatePrimGroupMouseRotation -= m_sceneGraph.UpdatePrimGroupRotation; |
3097 | client.OnUpdatePrimSingleRotation -= m_sceneGraph.UpdatePrimSingleRotation; | 3262 | client.OnUpdatePrimSingleRotation -= m_sceneGraph.UpdatePrimSingleRotation; |
@@ -3194,7 +3359,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3194 | /// </summary> | 3359 | /// </summary> |
3195 | /// <param name="agentId">The avatar's Unique ID</param> | 3360 | /// <param name="agentId">The avatar's Unique ID</param> |
3196 | /// <param name="client">The IClientAPI for the client</param> | 3361 | /// <param name="client">The IClientAPI for the client</param> |
3197 | public virtual void TeleportClientHome(UUID agentId, IClientAPI client) | 3362 | public virtual bool TeleportClientHome(UUID agentId, IClientAPI client) |
3198 | { | 3363 | { |
3199 | if (EntityTransferModule != null) | 3364 | if (EntityTransferModule != null) |
3200 | { | 3365 | { |
@@ -3205,6 +3370,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3205 | m_log.DebugFormat("[SCENE]: Unable to teleport user home: no AgentTransferModule is active"); | 3370 | m_log.DebugFormat("[SCENE]: Unable to teleport user home: no AgentTransferModule is active"); |
3206 | client.SendTeleportFailed("Unable to perform teleports on this simulator."); | 3371 | client.SendTeleportFailed("Unable to perform teleports on this simulator."); |
3207 | } | 3372 | } |
3373 | return false; | ||
3208 | } | 3374 | } |
3209 | 3375 | ||
3210 | /// <summary> | 3376 | /// <summary> |
@@ -3314,6 +3480,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
3314 | /// <param name="flags"></param> | 3480 | /// <param name="flags"></param> |
3315 | public virtual void SetHomeRezPoint(IClientAPI remoteClient, ulong regionHandle, Vector3 position, Vector3 lookAt, uint flags) | 3481 | public virtual void SetHomeRezPoint(IClientAPI remoteClient, ulong regionHandle, Vector3 position, Vector3 lookAt, uint flags) |
3316 | { | 3482 | { |
3483 | //Add half the avatar's height so that the user doesn't fall through prims | ||
3484 | ScenePresence presence; | ||
3485 | if (TryGetScenePresence(remoteClient.AgentId, out presence)) | ||
3486 | { | ||
3487 | if (presence.Appearance != null) | ||
3488 | { | ||
3489 | position.Z = position.Z + (presence.Appearance.AvatarHeight / 2); | ||
3490 | } | ||
3491 | } | ||
3492 | |||
3317 | if (GridUserService != null && GridUserService.SetHome(remoteClient.AgentId.ToString(), RegionInfo.RegionID, position, lookAt)) | 3493 | if (GridUserService != null && GridUserService.SetHome(remoteClient.AgentId.ToString(), RegionInfo.RegionID, position, lookAt)) |
3318 | // FUBAR ALERT: this needs to be "Home position set." so the viewer saves a home-screenshot. | 3494 | // FUBAR ALERT: this needs to be "Home position set." so the viewer saves a home-screenshot. |
3319 | m_dialogModule.SendAlertToUser(remoteClient, "Home position set."); | 3495 | m_dialogModule.SendAlertToUser(remoteClient, "Home position set."); |
@@ -3451,6 +3627,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3451 | // It's possible for child agents to have transactions if changes are being made cross-border. | 3627 | // It's possible for child agents to have transactions if changes are being made cross-border. |
3452 | if (AgentTransactionsModule != null) | 3628 | if (AgentTransactionsModule != null) |
3453 | AgentTransactionsModule.RemoveAgentAssetTransactions(agentID); | 3629 | AgentTransactionsModule.RemoveAgentAssetTransactions(agentID); |
3630 | m_log.Debug("[Scene] The avatar has left the building"); | ||
3454 | } | 3631 | } |
3455 | catch (Exception e) | 3632 | catch (Exception e) |
3456 | { | 3633 | { |
@@ -3643,38 +3820,39 @@ namespace OpenSim.Region.Framework.Scenes | |||
3643 | agent.firstname, agent.lastname, agent.Viewer); | 3820 | agent.firstname, agent.lastname, agent.Viewer); |
3644 | reason = "Access denied, your viewer is banned by the region owner"; | 3821 | reason = "Access denied, your viewer is banned by the region owner"; |
3645 | return false; | 3822 | return false; |
3646 | } | 3823 | } |
3824 | |||
3647 | 3825 | ||
3648 | ILandObject land; | 3826 | ScenePresence sp = GetScenePresence(agent.AgentID); |
3827 | |||
3828 | if (sp != null && !sp.IsChildAgent) | ||
3829 | { | ||
3830 | // We have a zombie from a crashed session. | ||
3831 | // Or the same user is trying to be root twice here, won't work. | ||
3832 | // Kill it. | ||
3833 | m_log.WarnFormat( | ||
3834 | "[SCENE]: Existing root scene presence detected for {0} {1} in {2} when connecting. Removing existing presence.", | ||
3835 | sp.Name, sp.UUID, RegionInfo.RegionName); | ||
3836 | |||
3837 | sp.ControllingClient.Close(true, true); | ||
3838 | sp = null; | ||
3839 | } | ||
3649 | 3840 | ||
3650 | lock (agent) | 3841 | lock (agent) |
3651 | { | 3842 | { |
3652 | ScenePresence sp = GetScenePresence(agent.AgentID); | ||
3653 | |||
3654 | if (sp != null && !sp.IsChildAgent) | ||
3655 | { | ||
3656 | // We have a zombie from a crashed session. | ||
3657 | // Or the same user is trying to be root twice here, won't work. | ||
3658 | // Kill it. | ||
3659 | m_log.WarnFormat( | ||
3660 | "[SCENE]: Existing root scene presence detected for {0} {1} in {2} when connecting. Removing existing presence.", | ||
3661 | sp.Name, sp.UUID, RegionInfo.RegionName); | ||
3662 | |||
3663 | sp.ControllingClient.Close(true); | ||
3664 | sp = null; | ||
3665 | } | ||
3666 | |||
3667 | land = LandChannel.GetLandObject(agent.startpos.X, agent.startpos.Y); | ||
3668 | |||
3669 | //On login test land permisions | 3843 | //On login test land permisions |
3670 | if (vialogin) | 3844 | if (vialogin) |
3671 | { | 3845 | { |
3672 | if (land != null && !TestLandRestrictions(agent, land, out reason)) | 3846 | IUserAccountCacheModule cache = RequestModuleInterface<IUserAccountCacheModule>(); |
3847 | if (cache != null) | ||
3848 | cache.Remove(agent.firstname + " " + agent.lastname); | ||
3849 | if (!TestLandRestrictions(agent.AgentID, out reason, ref agent.startpos.X, ref agent.startpos.Y)) | ||
3673 | { | 3850 | { |
3851 | m_log.DebugFormat("[CONNECTION BEGIN]: Denying access to {0} due to no land access", agent.AgentID.ToString()); | ||
3674 | return false; | 3852 | return false; |
3675 | } | 3853 | } |
3676 | } | 3854 | } |
3677 | 3855 | ||
3678 | if (sp == null) // We don't have an [child] agent here already | 3856 | if (sp == null) // We don't have an [child] agent here already |
3679 | { | 3857 | { |
3680 | if (requirePresenceLookup) | 3858 | if (requirePresenceLookup) |
@@ -3683,34 +3861,36 @@ namespace OpenSim.Region.Framework.Scenes | |||
3683 | { | 3861 | { |
3684 | if (!VerifyUserPresence(agent, out reason)) | 3862 | if (!VerifyUserPresence(agent, out reason)) |
3685 | return false; | 3863 | return false; |
3686 | } | 3864 | } catch (Exception e) |
3687 | catch (Exception e) | ||
3688 | { | 3865 | { |
3689 | m_log.ErrorFormat( | 3866 | m_log.ErrorFormat( |
3690 | "[SCENE]: Exception verifying presence {0}{1}", e.Message, e.StackTrace); | 3867 | "[SCENE]: Exception verifying presence {0}{1}", e.Message, e.StackTrace); |
3691 | |||
3692 | return false; | 3868 | return false; |
3693 | } | 3869 | } |
3694 | } | 3870 | } |
3695 | 3871 | ||
3696 | try | 3872 | try |
3697 | { | 3873 | { |
3698 | if (!AuthorizeUser(agent, out reason)) | 3874 | // Always check estate if this is a login. Always |
3699 | return false; | 3875 | // check if banned regions are to be blacked out. |
3876 | if (vialogin || (!m_seeIntoBannedRegion)) | ||
3877 | { | ||
3878 | if (!AuthorizeUser(agent, out reason)) | ||
3879 | return false; | ||
3880 | } | ||
3700 | } | 3881 | } |
3701 | catch (Exception e) | 3882 | catch (Exception e) |
3702 | { | 3883 | { |
3703 | m_log.ErrorFormat( | 3884 | m_log.ErrorFormat( |
3704 | "[SCENE]: Exception authorizing user {0}{1}", e.Message, e.StackTrace); | 3885 | "[SCENE]: Exception authorizing user {0}{1}", e.Message, e.StackTrace); |
3705 | |||
3706 | return false; | 3886 | return false; |
3707 | } | 3887 | } |
3708 | 3888 | ||
3709 | m_log.InfoFormat( | 3889 | m_log.InfoFormat( |
3710 | "[SCENE]: Region {0} authenticated and authorized incoming {1} agent {2} {3} {4} (circuit code {5})", | 3890 | "[SCENE]: Region {0} authenticated and authorized incoming {1} agent {2} {3} {4} (circuit code {5})", |
3711 | RegionInfo.RegionName, (agent.child ? "child" : "root"), agent.firstname, agent.lastname, | 3891 | RegionInfo.RegionName, (agent.child ? "child" : "root"), agent.firstname, agent.lastname, |
3712 | agent.AgentID, agent.circuitcode); | 3892 | agent.AgentID, agent.circuitcode); |
3713 | 3893 | ||
3714 | if (CapsModule != null) | 3894 | if (CapsModule != null) |
3715 | { | 3895 | { |
3716 | CapsModule.SetAgentCapsSeeds(agent); | 3896 | CapsModule.SetAgentCapsSeeds(agent); |
@@ -3722,15 +3902,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
3722 | // Let the SP know how we got here. This has a lot of interesting | 3902 | // Let the SP know how we got here. This has a lot of interesting |
3723 | // uses down the line. | 3903 | // uses down the line. |
3724 | sp.TeleportFlags = (TPFlags)teleportFlags; | 3904 | sp.TeleportFlags = (TPFlags)teleportFlags; |
3725 | 3905 | ||
3726 | if (sp.IsChildAgent) | 3906 | if (sp.IsChildAgent) |
3727 | { | 3907 | { |
3728 | m_log.DebugFormat( | 3908 | m_log.DebugFormat( |
3729 | "[SCENE]: Adjusting known seeds for existing agent {0} in {1}", | 3909 | "[SCENE]: Adjusting known seeds for existing agent {0} in {1}", |
3730 | agent.AgentID, RegionInfo.RegionName); | 3910 | agent.AgentID, RegionInfo.RegionName); |
3731 | 3911 | ||
3732 | sp.AdjustKnownSeeds(); | 3912 | sp.AdjustKnownSeeds(); |
3733 | 3913 | ||
3734 | if (CapsModule != null) | 3914 | if (CapsModule != null) |
3735 | CapsModule.SetAgentCapsSeeds(agent); | 3915 | CapsModule.SetAgentCapsSeeds(agent); |
3736 | } | 3916 | } |
@@ -3832,6 +4012,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
3832 | } | 4012 | } |
3833 | 4013 | ||
3834 | // Honor parcel landing type and position. | 4014 | // Honor parcel landing type and position. |
4015 | /* | ||
4016 | ILandObject land = LandChannel.GetLandObject(agent.startpos.X, agent.startpos.Y); | ||
3835 | if (land != null) | 4017 | if (land != null) |
3836 | { | 4018 | { |
3837 | if (land.LandData.LandingType == (byte)1 && land.LandData.UserLocation != Vector3.Zero) | 4019 | if (land.LandData.LandingType == (byte)1 && land.LandData.UserLocation != Vector3.Zero) |
@@ -3839,25 +4021,43 @@ namespace OpenSim.Region.Framework.Scenes | |||
3839 | agent.startpos = land.LandData.UserLocation; | 4021 | agent.startpos = land.LandData.UserLocation; |
3840 | } | 4022 | } |
3841 | } | 4023 | } |
4024 | */// This is now handled properly in ScenePresence.MakeRootAgent | ||
3842 | } | 4025 | } |
3843 | 4026 | ||
3844 | return true; | 4027 | return true; |
3845 | } | 4028 | } |
3846 | 4029 | ||
3847 | private bool TestLandRestrictions(AgentCircuitData agent, ILandObject land, out string reason) | 4030 | public bool TestLandRestrictions(UUID agentID, out string reason, ref float posX, ref float posY) |
3848 | { | 4031 | { |
3849 | bool banned = land.IsBannedFromLand(agent.AgentID); | 4032 | if (posX < 0) |
3850 | bool restricted = land.IsRestrictedFromLand(agent.AgentID); | 4033 | posX = 0; |
4034 | else if (posX >= 256) | ||
4035 | posX = 255.999f; | ||
4036 | if (posY < 0) | ||
4037 | posY = 0; | ||
4038 | else if (posY >= 256) | ||
4039 | posY = 255.999f; | ||
4040 | |||
4041 | reason = String.Empty; | ||
4042 | if (Permissions.IsGod(agentID)) | ||
4043 | return true; | ||
4044 | |||
4045 | ILandObject land = LandChannel.GetLandObject(posX, posY); | ||
4046 | if (land == null) | ||
4047 | return false; | ||
4048 | |||
4049 | bool banned = land.IsBannedFromLand(agentID); | ||
4050 | bool restricted = land.IsRestrictedFromLand(agentID); | ||
3851 | 4051 | ||
3852 | if (banned || restricted) | 4052 | if (banned || restricted) |
3853 | { | 4053 | { |
3854 | ILandObject nearestParcel = GetNearestAllowedParcel(agent.AgentID, agent.startpos.X, agent.startpos.Y); | 4054 | ILandObject nearestParcel = GetNearestAllowedParcel(agentID, posX, posY); |
3855 | if (nearestParcel != null) | 4055 | if (nearestParcel != null) |
3856 | { | 4056 | { |
3857 | //Move agent to nearest allowed | 4057 | //Move agent to nearest allowed |
3858 | Vector3 newPosition = GetParcelCenterAtGround(nearestParcel); | 4058 | Vector3 newPosition = GetParcelCenterAtGround(nearestParcel); |
3859 | agent.startpos.X = newPosition.X; | 4059 | posX = newPosition.X; |
3860 | agent.startpos.Y = newPosition.Y; | 4060 | posY = newPosition.Y; |
3861 | } | 4061 | } |
3862 | else | 4062 | else |
3863 | { | 4063 | { |
@@ -3919,7 +4119,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3919 | 4119 | ||
3920 | if (!m_strictAccessControl) return true; | 4120 | if (!m_strictAccessControl) return true; |
3921 | if (Permissions.IsGod(agent.AgentID)) return true; | 4121 | if (Permissions.IsGod(agent.AgentID)) return true; |
3922 | 4122 | ||
3923 | if (AuthorizationService != null) | 4123 | if (AuthorizationService != null) |
3924 | { | 4124 | { |
3925 | if (!AuthorizationService.IsAuthorizedForRegion( | 4125 | if (!AuthorizationService.IsAuthorizedForRegion( |
@@ -3934,7 +4134,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3934 | 4134 | ||
3935 | if (RegionInfo.EstateSettings != null) | 4135 | if (RegionInfo.EstateSettings != null) |
3936 | { | 4136 | { |
3937 | if (RegionInfo.EstateSettings.IsBanned(agent.AgentID)) | 4137 | if (RegionInfo.EstateSettings.IsBanned(agent.AgentID, 0)) |
3938 | { | 4138 | { |
3939 | m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the user is on the banlist", | 4139 | m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the user is on the banlist", |
3940 | agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName); | 4140 | agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName); |
@@ -4124,6 +4324,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
4124 | 4324 | ||
4125 | // XPTO: if this agent is not allowed here as root, always return false | 4325 | // XPTO: if this agent is not allowed here as root, always return false |
4126 | 4326 | ||
4327 | // We have to wait until the viewer contacts this region after receiving EAC. | ||
4328 | // That calls AddNewClient, which finally creates the ScenePresence | ||
4329 | int flags = GetUserFlags(cAgentData.AgentID); | ||
4330 | if (RegionInfo.EstateSettings.IsBanned(cAgentData.AgentID, flags)) | ||
4331 | { | ||
4332 | m_log.DebugFormat("[SCENE]: Denying root agent entry to {0}: banned", cAgentData.AgentID); | ||
4333 | return false; | ||
4334 | } | ||
4335 | |||
4127 | // TODO: This check should probably be in QueryAccess(). | 4336 | // TODO: This check should probably be in QueryAccess(). |
4128 | ILandObject nearestParcel = GetNearestAllowedParcel(cAgentData.AgentID, Constants.RegionSize / 2, Constants.RegionSize / 2); | 4337 | ILandObject nearestParcel = GetNearestAllowedParcel(cAgentData.AgentID, Constants.RegionSize / 2, Constants.RegionSize / 2); |
4129 | if (nearestParcel == null) | 4338 | if (nearestParcel == null) |
@@ -4188,7 +4397,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4188 | /// <param name='agentID'></param> | 4397 | /// <param name='agentID'></param> |
4189 | protected virtual ScenePresence WaitGetScenePresence(UUID agentID) | 4398 | protected virtual ScenePresence WaitGetScenePresence(UUID agentID) |
4190 | { | 4399 | { |
4191 | int ntimes = 10; | 4400 | int ntimes = 30; |
4192 | ScenePresence sp = null; | 4401 | ScenePresence sp = null; |
4193 | while ((sp = GetScenePresence(agentID)) == null && (ntimes-- > 0)) | 4402 | while ((sp = GetScenePresence(agentID)) == null && (ntimes-- > 0)) |
4194 | Thread.Sleep(1000); | 4403 | Thread.Sleep(1000); |
@@ -4218,6 +4427,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
4218 | return false; | 4427 | return false; |
4219 | } | 4428 | } |
4220 | 4429 | ||
4430 | public bool IncomingCloseAgent(UUID agentID) | ||
4431 | { | ||
4432 | return IncomingCloseAgent(agentID, false); | ||
4433 | } | ||
4434 | |||
4435 | public bool IncomingCloseChildAgent(UUID agentID) | ||
4436 | { | ||
4437 | return IncomingCloseAgent(agentID, true); | ||
4438 | } | ||
4439 | |||
4221 | /// <summary> | 4440 | /// <summary> |
4222 | /// Tell a single agent to disconnect from the region. | 4441 | /// Tell a single agent to disconnect from the region. |
4223 | /// </summary> | 4442 | /// </summary> |
@@ -4233,7 +4452,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4233 | ScenePresence presence = m_sceneGraph.GetScenePresence(agentID); | 4452 | ScenePresence presence = m_sceneGraph.GetScenePresence(agentID); |
4234 | if (presence != null) | 4453 | if (presence != null) |
4235 | { | 4454 | { |
4236 | presence.ControllingClient.Close(force); | 4455 | presence.ControllingClient.Close(force, force); |
4237 | return true; | 4456 | return true; |
4238 | } | 4457 | } |
4239 | 4458 | ||
@@ -4893,35 +5112,81 @@ namespace OpenSim.Region.Framework.Scenes | |||
4893 | SimulationDataService.RemoveObject(uuid, RegionInfo.RegionID); | 5112 | SimulationDataService.RemoveObject(uuid, RegionInfo.RegionID); |
4894 | } | 5113 | } |
4895 | 5114 | ||
4896 | public int GetHealth() | 5115 | public int GetHealth(out int flags, out string message) |
4897 | { | 5116 | { |
4898 | // Returns: | 5117 | // Returns: |
4899 | // 1 = sim is up and accepting http requests. The heartbeat has | 5118 | // 1 = sim is up and accepting http requests. The heartbeat has |
4900 | // stopped and the sim is probably locked up, but a remote | 5119 | // stopped and the sim is probably locked up, but a remote |
4901 | // admin restart may succeed | 5120 | // admin restart may succeed |
4902 | // | 5121 | // |
4903 | // 2 = Sim is up and the heartbeat is running. The sim is likely | 5122 | // 2 = Sim is up and the heartbeat is running. The sim is likely |
4904 | // usable for people within and logins _may_ work | 5123 | // usable for people within |
5124 | // | ||
5125 | // 3 = Sim is up and one packet thread is running. Sim is | ||
5126 | // unstable and will not accept new logins | ||
4905 | // | 5127 | // |
4906 | // 3 = We have seen a new user enter within the past 4 minutes | 5128 | // 4 = Sim is up and both packet threads are running. Sim is |
5129 | // likely usable | ||
5130 | // | ||
5131 | // 5 = We have seen a new user enter within the past 4 minutes | ||
4907 | // which can be seen as positive confirmation of sim health | 5132 | // which can be seen as positive confirmation of sim health |
4908 | // | 5133 | // |
5134 | |||
5135 | flags = 0; | ||
5136 | message = String.Empty; | ||
5137 | |||
5138 | CheckHeartbeat(); | ||
5139 | |||
5140 | if (m_firstHeartbeat || (m_lastIncoming == 0 && m_lastOutgoing == 0)) | ||
5141 | { | ||
5142 | // We're still starting | ||
5143 | // 0 means "in startup", it can't happen another way, since | ||
5144 | // to get here, we must be able to accept http connections | ||
5145 | return 0; | ||
5146 | } | ||
5147 | |||
4909 | int health=1; // Start at 1, means we're up | 5148 | int health=1; // Start at 1, means we're up |
4910 | 5149 | ||
4911 | if ((Util.EnvironmentTickCountSubtract(m_lastFrameTick)) < 1000) | 5150 | if ((Util.EnvironmentTickCountSubtract(m_lastFrameTick)) < 1000) |
4912 | health += 1; | 5151 | { |
5152 | health+=1; | ||
5153 | flags |= 1; | ||
5154 | } | ||
5155 | |||
5156 | if (Util.EnvironmentTickCountSubtract(m_lastIncoming) < 1000) | ||
5157 | { | ||
5158 | health+=1; | ||
5159 | flags |= 2; | ||
5160 | } | ||
5161 | |||
5162 | if (Util.EnvironmentTickCountSubtract(m_lastOutgoing) < 1000) | ||
5163 | { | ||
5164 | health+=1; | ||
5165 | flags |= 4; | ||
5166 | } | ||
4913 | else | 5167 | else |
5168 | { | ||
5169 | int pid = System.Diagnostics.Process.GetCurrentProcess().Id; | ||
5170 | System.Diagnostics.Process proc = new System.Diagnostics.Process(); | ||
5171 | proc.EnableRaisingEvents=false; | ||
5172 | proc.StartInfo.FileName = "/bin/kill"; | ||
5173 | proc.StartInfo.Arguments = "-QUIT " + pid.ToString(); | ||
5174 | proc.Start(); | ||
5175 | proc.WaitForExit(); | ||
5176 | Thread.Sleep(1000); | ||
5177 | Environment.Exit(1); | ||
5178 | } | ||
5179 | |||
5180 | if (flags != 7) | ||
4914 | return health; | 5181 | return health; |
4915 | 5182 | ||
4916 | // A login in the last 4 mins? We can't be doing too badly | 5183 | // A login in the last 4 mins? We can't be doing too badly |
4917 | // | 5184 | // |
4918 | if ((Util.EnvironmentTickCountSubtract(m_LastLogin)) < 240000) | 5185 | if (Util.EnvironmentTickCountSubtract(m_LastLogin) < 240000) |
4919 | health++; | 5186 | health++; |
4920 | else | 5187 | else |
4921 | return health; | 5188 | return health; |
4922 | 5189 | ||
4923 | // CheckHeartbeat(); | ||
4924 | |||
4925 | return health; | 5190 | return health; |
4926 | } | 5191 | } |
4927 | 5192 | ||
@@ -5009,7 +5274,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
5009 | bool wasUsingPhysics = ((jointProxyObject.Flags & PrimFlags.Physics) != 0); | 5274 | bool wasUsingPhysics = ((jointProxyObject.Flags & PrimFlags.Physics) != 0); |
5010 | if (wasUsingPhysics) | 5275 | if (wasUsingPhysics) |
5011 | { | 5276 | { |
5012 | 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 | 5277 | 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 |
5013 | } | 5278 | } |
5014 | } | 5279 | } |
5015 | 5280 | ||
@@ -5108,14 +5373,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
5108 | return (((vsn.X * xdiff) + (vsn.Y * ydiff)) / (-1 * vsn.Z)) + p0.Z; | 5373 | return (((vsn.X * xdiff) + (vsn.Y * ydiff)) / (-1 * vsn.Z)) + p0.Z; |
5109 | } | 5374 | } |
5110 | 5375 | ||
5111 | // private void CheckHeartbeat() | 5376 | private void CheckHeartbeat() |
5112 | // { | 5377 | { |
5113 | // if (m_firstHeartbeat) | 5378 | if (m_firstHeartbeat) |
5114 | // return; | 5379 | return; |
5115 | // | 5380 | |
5116 | // if (Util.EnvironmentTickCountSubtract(m_lastFrameTick) > 2000) | 5381 | if ((Util.EnvironmentTickCountSubtract(m_lastFrameTick)) > 5000) |
5117 | // StartTimer(); | 5382 | Start(); |
5118 | // } | 5383 | } |
5119 | 5384 | ||
5120 | public override ISceneObject DeserializeObject(string representation) | 5385 | public override ISceneObject DeserializeObject(string representation) |
5121 | { | 5386 | { |
@@ -5127,9 +5392,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
5127 | get { return m_allowScriptCrossings; } | 5392 | get { return m_allowScriptCrossings; } |
5128 | } | 5393 | } |
5129 | 5394 | ||
5130 | public Vector3? GetNearestAllowedPosition(ScenePresence avatar) | 5395 | public Vector3 GetNearestAllowedPosition(ScenePresence avatar) |
5131 | { | 5396 | { |
5132 | ILandObject nearestParcel = GetNearestAllowedParcel(avatar.UUID, avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y); | 5397 | return GetNearestAllowedPosition(avatar, null); |
5398 | } | ||
5399 | |||
5400 | public Vector3 GetNearestAllowedPosition(ScenePresence avatar, ILandObject excludeParcel) | ||
5401 | { | ||
5402 | ILandObject nearestParcel = GetNearestAllowedParcel(avatar.UUID, avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y, excludeParcel); | ||
5133 | 5403 | ||
5134 | if (nearestParcel != null) | 5404 | if (nearestParcel != null) |
5135 | { | 5405 | { |
@@ -5138,10 +5408,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
5138 | Vector3? nearestPoint = GetNearestPointInParcelAlongDirectionFromPoint(avatar.AbsolutePosition, dir, nearestParcel); | 5408 | Vector3? nearestPoint = GetNearestPointInParcelAlongDirectionFromPoint(avatar.AbsolutePosition, dir, nearestParcel); |
5139 | if (nearestPoint != null) | 5409 | if (nearestPoint != null) |
5140 | { | 5410 | { |
5141 | // m_log.DebugFormat( | 5411 | Debug.WriteLine("Found a sane previous position based on velocity, sending them to: " + nearestPoint.ToString()); |
5142 | // "[SCENE]: Found a sane previous position based on velocity for {0}, sending them to {1} in {2}", | ||
5143 | // avatar.Name, nearestPoint, nearestParcel.LandData.Name); | ||
5144 | |||
5145 | return nearestPoint.Value; | 5412 | return nearestPoint.Value; |
5146 | } | 5413 | } |
5147 | 5414 | ||
@@ -5151,17 +5418,20 @@ namespace OpenSim.Region.Framework.Scenes | |||
5151 | nearestPoint = GetNearestPointInParcelAlongDirectionFromPoint(avatar.AbsolutePosition, dir, nearestParcel); | 5418 | nearestPoint = GetNearestPointInParcelAlongDirectionFromPoint(avatar.AbsolutePosition, dir, nearestParcel); |
5152 | if (nearestPoint != null) | 5419 | if (nearestPoint != null) |
5153 | { | 5420 | { |
5154 | // m_log.DebugFormat( | 5421 | Debug.WriteLine("They had a zero velocity, sending them to: " + nearestPoint.ToString()); |
5155 | // "[SCENE]: {0} had a zero velocity, sending them to {1}", avatar.Name, nearestPoint); | ||
5156 | |||
5157 | return nearestPoint.Value; | 5422 | return nearestPoint.Value; |
5158 | } | 5423 | } |
5159 | 5424 | ||
5160 | //Ultimate backup if we have no idea where they are | 5425 | ILandObject dest = LandChannel.GetLandObject(avatar.lastKnownAllowedPosition.X, avatar.lastKnownAllowedPosition.Y); |
5161 | // m_log.DebugFormat( | 5426 | if (dest != excludeParcel) |
5162 | // "[SCENE]: No idea where {0} is, sending them to {1}", avatar.Name, avatar.lastKnownAllowedPosition); | 5427 | { |
5428 | // Ultimate backup if we have no idea where they are and | ||
5429 | // the last allowed position was in another parcel | ||
5430 | Debug.WriteLine("Have no idea where they are, sending them to: " + avatar.lastKnownAllowedPosition.ToString()); | ||
5431 | return avatar.lastKnownAllowedPosition; | ||
5432 | } | ||
5163 | 5433 | ||
5164 | return avatar.lastKnownAllowedPosition; | 5434 | // else fall through to region edge |
5165 | } | 5435 | } |
5166 | 5436 | ||
5167 | //Go to the edge, this happens in teleporting to a region with no available parcels | 5437 | //Go to the edge, this happens in teleporting to a region with no available parcels |
@@ -5195,13 +5465,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
5195 | 5465 | ||
5196 | public ILandObject GetNearestAllowedParcel(UUID avatarId, float x, float y) | 5466 | public ILandObject GetNearestAllowedParcel(UUID avatarId, float x, float y) |
5197 | { | 5467 | { |
5468 | return GetNearestAllowedParcel(avatarId, x, y, null); | ||
5469 | } | ||
5470 | |||
5471 | public ILandObject GetNearestAllowedParcel(UUID avatarId, float x, float y, ILandObject excludeParcel) | ||
5472 | { | ||
5198 | List<ILandObject> all = AllParcels(); | 5473 | List<ILandObject> all = AllParcels(); |
5199 | float minParcelDistance = float.MaxValue; | 5474 | float minParcelDistance = float.MaxValue; |
5200 | ILandObject nearestParcel = null; | 5475 | ILandObject nearestParcel = null; |
5201 | 5476 | ||
5202 | foreach (var parcel in all) | 5477 | foreach (var parcel in all) |
5203 | { | 5478 | { |
5204 | if (!parcel.IsEitherBannedOrRestricted(avatarId)) | 5479 | if (!parcel.IsEitherBannedOrRestricted(avatarId) && parcel != excludeParcel) |
5205 | { | 5480 | { |
5206 | float parcelDistance = GetParcelDistancefromPoint(parcel, x, y); | 5481 | float parcelDistance = GetParcelDistancefromPoint(parcel, x, y); |
5207 | if (parcelDistance < minParcelDistance) | 5482 | if (parcelDistance < minParcelDistance) |
@@ -5417,7 +5692,55 @@ namespace OpenSim.Region.Framework.Scenes | |||
5417 | mapModule.GenerateMaptile(); | 5692 | mapModule.GenerateMaptile(); |
5418 | } | 5693 | } |
5419 | 5694 | ||
5420 | private void RegenerateMaptileAndReregister(object sender, ElapsedEventArgs e) | 5695 | // public void CleanDroppedAttachments() |
5696 | // { | ||
5697 | // List<SceneObjectGroup> objectsToDelete = | ||
5698 | // new List<SceneObjectGroup>(); | ||
5699 | // | ||
5700 | // lock (m_cleaningAttachments) | ||
5701 | // { | ||
5702 | // ForEachSOG(delegate (SceneObjectGroup grp) | ||
5703 | // { | ||
5704 | // if (grp.RootPart.Shape.PCode == 0 && grp.RootPart.Shape.State != 0 && (!objectsToDelete.Contains(grp))) | ||
5705 | // { | ||
5706 | // UUID agentID = grp.OwnerID; | ||
5707 | // if (agentID == UUID.Zero) | ||
5708 | // { | ||
5709 | // objectsToDelete.Add(grp); | ||
5710 | // return; | ||
5711 | // } | ||
5712 | // | ||
5713 | // ScenePresence sp = GetScenePresence(agentID); | ||
5714 | // if (sp == null) | ||
5715 | // { | ||
5716 | // objectsToDelete.Add(grp); | ||
5717 | // return; | ||
5718 | // } | ||
5719 | // } | ||
5720 | // }); | ||
5721 | // } | ||
5722 | // | ||
5723 | // foreach (SceneObjectGroup grp in objectsToDelete) | ||
5724 | // { | ||
5725 | // m_log.InfoFormat("[SCENE]: Deleting dropped attachment {0} of user {1}", grp.UUID, grp.OwnerID); | ||
5726 | // DeleteSceneObject(grp, true); | ||
5727 | // } | ||
5728 | // } | ||
5729 | |||
5730 | public void ThreadAlive(int threadCode) | ||
5731 | { | ||
5732 | switch(threadCode) | ||
5733 | { | ||
5734 | case 1: // Incoming | ||
5735 | m_lastIncoming = Util.EnvironmentTickCount(); | ||
5736 | break; | ||
5737 | case 2: // Incoming | ||
5738 | m_lastOutgoing = Util.EnvironmentTickCount(); | ||
5739 | break; | ||
5740 | } | ||
5741 | } | ||
5742 | |||
5743 | public void RegenerateMaptileAndReregister(object sender, ElapsedEventArgs e) | ||
5421 | { | 5744 | { |
5422 | RegenerateMaptile(); | 5745 | RegenerateMaptile(); |
5423 | 5746 | ||
@@ -5445,6 +5768,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
5445 | /// <returns></returns> | 5768 | /// <returns></returns> |
5446 | public bool QueryAccess(UUID agentID, Vector3 position, out string reason) | 5769 | public bool QueryAccess(UUID agentID, Vector3 position, out string reason) |
5447 | { | 5770 | { |
5771 | reason = "You are banned from the region"; | ||
5772 | |||
5448 | if (EntityTransferModule.IsInTransit(agentID)) | 5773 | if (EntityTransferModule.IsInTransit(agentID)) |
5449 | { | 5774 | { |
5450 | reason = "Agent is still in transit from this region"; | 5775 | reason = "Agent is still in transit from this region"; |
@@ -5456,6 +5781,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
5456 | return false; | 5781 | return false; |
5457 | } | 5782 | } |
5458 | 5783 | ||
5784 | if (Permissions.IsGod(agentID)) | ||
5785 | { | ||
5786 | reason = String.Empty; | ||
5787 | return true; | ||
5788 | } | ||
5789 | |||
5459 | // FIXME: Root agent count is currently known to be inaccurate. This forces a recount before we check. | 5790 | // FIXME: Root agent count is currently known to be inaccurate. This forces a recount before we check. |
5460 | // However, the long term fix is to make sure root agent count is always accurate. | 5791 | // However, the long term fix is to make sure root agent count is always accurate. |
5461 | m_sceneGraph.RecalculateStats(); | 5792 | m_sceneGraph.RecalculateStats(); |
@@ -5476,6 +5807,41 @@ namespace OpenSim.Region.Framework.Scenes | |||
5476 | } | 5807 | } |
5477 | } | 5808 | } |
5478 | 5809 | ||
5810 | ScenePresence presence = GetScenePresence(agentID); | ||
5811 | IClientAPI client = null; | ||
5812 | AgentCircuitData aCircuit = null; | ||
5813 | |||
5814 | if (presence != null) | ||
5815 | { | ||
5816 | client = presence.ControllingClient; | ||
5817 | if (client != null) | ||
5818 | aCircuit = client.RequestClientInfo(); | ||
5819 | } | ||
5820 | |||
5821 | // We may be called before there is a presence or a client. | ||
5822 | // Fake AgentCircuitData to keep IAuthorizationModule smiling | ||
5823 | if (client == null) | ||
5824 | { | ||
5825 | aCircuit = new AgentCircuitData(); | ||
5826 | aCircuit.AgentID = agentID; | ||
5827 | aCircuit.firstname = String.Empty; | ||
5828 | aCircuit.lastname = String.Empty; | ||
5829 | } | ||
5830 | |||
5831 | try | ||
5832 | { | ||
5833 | if (!AuthorizeUser(aCircuit, out reason)) | ||
5834 | { | ||
5835 | // m_log.DebugFormat("[SCENE]: Denying access for {0}", agentID); | ||
5836 | return false; | ||
5837 | } | ||
5838 | } | ||
5839 | catch (Exception e) | ||
5840 | { | ||
5841 | m_log.DebugFormat("[SCENE]: Exception authorizing agent: {0} "+ e.StackTrace, e.Message); | ||
5842 | return false; | ||
5843 | } | ||
5844 | |||
5479 | if (position == Vector3.Zero) // Teleport | 5845 | if (position == Vector3.Zero) // Teleport |
5480 | { | 5846 | { |
5481 | if (!RegionInfo.EstateSettings.AllowDirectTeleport) | 5847 | if (!RegionInfo.EstateSettings.AllowDirectTeleport) |
@@ -5504,13 +5870,46 @@ namespace OpenSim.Region.Framework.Scenes | |||
5504 | } | 5870 | } |
5505 | } | 5871 | } |
5506 | } | 5872 | } |
5873 | |||
5874 | float posX = 128.0f; | ||
5875 | float posY = 128.0f; | ||
5876 | |||
5877 | if (!TestLandRestrictions(agentID, out reason, ref posX, ref posY)) | ||
5878 | { | ||
5879 | // m_log.DebugFormat("[SCENE]: Denying {0} because they are banned on all parcels", agentID); | ||
5880 | return false; | ||
5881 | } | ||
5882 | } | ||
5883 | else // Walking | ||
5884 | { | ||
5885 | ILandObject land = LandChannel.GetLandObject(position.X, position.Y); | ||
5886 | if (land == null) | ||
5887 | return false; | ||
5888 | |||
5889 | bool banned = land.IsBannedFromLand(agentID); | ||
5890 | bool restricted = land.IsRestrictedFromLand(agentID); | ||
5891 | |||
5892 | if (banned || restricted) | ||
5893 | return false; | ||
5507 | } | 5894 | } |
5508 | 5895 | ||
5509 | reason = String.Empty; | 5896 | reason = String.Empty; |
5510 | return true; | 5897 | return true; |
5511 | } | 5898 | } |
5512 | 5899 | ||
5513 | /// <summary> | 5900 | public void StartTimerWatchdog() |
5901 | { | ||
5902 | m_timerWatchdog.Interval = 1000; | ||
5903 | m_timerWatchdog.Elapsed += TimerWatchdog; | ||
5904 | m_timerWatchdog.AutoReset = true; | ||
5905 | m_timerWatchdog.Start(); | ||
5906 | } | ||
5907 | |||
5908 | public void TimerWatchdog(object sender, ElapsedEventArgs e) | ||
5909 | { | ||
5910 | CheckHeartbeat(); | ||
5911 | } | ||
5912 | |||
5514 | /// This method deals with movement when an avatar is automatically moving (but this is distinct from the | 5913 | /// This method deals with movement when an avatar is automatically moving (but this is distinct from the |
5515 | /// autopilot that moves an avatar to a sit target!. | 5914 | /// autopilot that moves an avatar to a sit target!. |
5516 | /// </summary> | 5915 | /// </summary> |
@@ -5589,6 +5988,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
5589 | return m_SpawnPoint - 1; | 5988 | return m_SpawnPoint - 1; |
5590 | } | 5989 | } |
5591 | 5990 | ||
5991 | private void HandleGcCollect(string module, string[] args) | ||
5992 | { | ||
5993 | GC.Collect(); | ||
5994 | } | ||
5995 | |||
5592 | /// <summary> | 5996 | /// <summary> |
5593 | /// Wrappers to get physics modules retrieve assets. | 5997 | /// Wrappers to get physics modules retrieve assets. |
5594 | /// </summary> | 5998 | /// </summary> |