diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Scene.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.cs | 879 |
1 files changed, 638 insertions, 241 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index f2cb117..f229e33 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -226,8 +226,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
226 | // TODO: need to figure out how allow client agents but deny | 226 | // TODO: need to figure out how allow client agents but deny |
227 | // root agents when ACL denies access to root agent | 227 | // root agents when ACL denies access to root agent |
228 | public bool m_strictAccessControl = true; | 228 | public bool m_strictAccessControl = true; |
229 | 229 | public bool m_seeIntoBannedRegion = false; | |
230 | public int MaxUndoCount { get; set; } | 230 | public int MaxUndoCount = 5; |
231 | 231 | ||
232 | // Using this for RegionReady module to prevent LoginsDisabled from changing under our feet; | 232 | // Using this for RegionReady module to prevent LoginsDisabled from changing under our feet; |
233 | public bool LoginLock = false; | 233 | public bool LoginLock = false; |
@@ -243,11 +243,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
243 | 243 | ||
244 | protected int m_splitRegionID; | 244 | protected int m_splitRegionID; |
245 | protected Timer m_restartWaitTimer = new Timer(); | 245 | protected Timer m_restartWaitTimer = new Timer(); |
246 | protected Timer m_timerWatchdog = new Timer(); | ||
246 | protected List<RegionInfo> m_regionRestartNotifyList = new List<RegionInfo>(); | 247 | protected List<RegionInfo> m_regionRestartNotifyList = new List<RegionInfo>(); |
247 | protected List<RegionInfo> m_neighbours = new List<RegionInfo>(); | 248 | protected List<RegionInfo> m_neighbours = new List<RegionInfo>(); |
248 | protected string m_simulatorVersion = "OpenSimulator Server"; | 249 | protected string m_simulatorVersion = "OpenSimulator Server"; |
249 | protected AgentCircuitManager m_authenticateHandler; | 250 | protected AgentCircuitManager m_authenticateHandler; |
250 | protected SceneCommunicationService m_sceneGridService; | 251 | protected SceneCommunicationService m_sceneGridService; |
252 | protected ISnmpModule m_snmpService = null; | ||
251 | 253 | ||
252 | protected ISimulationDataService m_SimulationDataService; | 254 | protected ISimulationDataService m_SimulationDataService; |
253 | protected IEstateDataService m_EstateDataService; | 255 | protected IEstateDataService m_EstateDataService; |
@@ -310,8 +312,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
310 | private int m_update_presences = 1; // Update scene presence movements | 312 | private int m_update_presences = 1; // Update scene presence movements |
311 | private int m_update_events = 1; | 313 | private int m_update_events = 1; |
312 | private int m_update_backup = 200; | 314 | private int m_update_backup = 200; |
313 | private int m_update_terrain = 50; | 315 | private int m_update_terrain = 1000; |
314 | // private int m_update_land = 1; | 316 | private int m_update_land = 10; |
315 | private int m_update_coarse_locations = 50; | 317 | private int m_update_coarse_locations = 50; |
316 | 318 | ||
317 | private int agentMS; | 319 | private int agentMS; |
@@ -324,13 +326,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
324 | private int backupMS; | 326 | private int backupMS; |
325 | private int terrainMS; | 327 | private int terrainMS; |
326 | private int landMS; | 328 | private int landMS; |
327 | private int spareMS; | ||
328 | 329 | ||
329 | /// <summary> | 330 | /// <summary> |
330 | /// Tick at which the last frame was processed. | 331 | /// Tick at which the last frame was processed. |
331 | /// </summary> | 332 | /// </summary> |
332 | private int m_lastFrameTick; | 333 | private int m_lastFrameTick; |
333 | 334 | ||
335 | public bool CombineRegions = false; | ||
334 | /// <summary> | 336 | /// <summary> |
335 | /// Tick at which the last maintenance run occurred. | 337 | /// Tick at which the last maintenance run occurred. |
336 | /// </summary> | 338 | /// </summary> |
@@ -350,7 +352,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
350 | private readonly Timer m_restartTimer = new Timer(15000); // Wait before firing | 352 | private readonly Timer m_restartTimer = new Timer(15000); // Wait before firing |
351 | private volatile bool m_backingup; | 353 | private volatile bool m_backingup; |
352 | private Dictionary<UUID, ReturnInfo> m_returns = new Dictionary<UUID, ReturnInfo>(); | 354 | private Dictionary<UUID, ReturnInfo> m_returns = new Dictionary<UUID, ReturnInfo>(); |
353 | private Dictionary<UUID, SceneObjectGroup> m_groupsWithTargets = new Dictionary<UUID, SceneObjectGroup>(); | 355 | private Dictionary<UUID, int> m_groupsWithTargets = new Dictionary<UUID, int>(); |
354 | 356 | ||
355 | private string m_defaultScriptEngine; | 357 | private string m_defaultScriptEngine; |
356 | 358 | ||
@@ -359,6 +361,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
359 | /// </summary> | 361 | /// </summary> |
360 | private int m_LastLogin; | 362 | private int m_LastLogin; |
361 | 363 | ||
364 | private int m_lastIncoming; | ||
365 | private int m_lastOutgoing; | ||
366 | private int m_hbRestarts = 0; | ||
367 | |||
368 | |||
362 | /// <summary> | 369 | /// <summary> |
363 | /// Thread that runs the scene loop. | 370 | /// Thread that runs the scene loop. |
364 | /// </summary> | 371 | /// </summary> |
@@ -399,7 +406,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
399 | private volatile bool m_active; | 406 | private volatile bool m_active; |
400 | 407 | ||
401 | // private int m_lastUpdate; | 408 | // private int m_lastUpdate; |
402 | // private bool m_firstHeartbeat = true; | 409 | private bool m_firstHeartbeat = true; |
403 | 410 | ||
404 | private UpdatePrioritizationSchemes m_priorityScheme = UpdatePrioritizationSchemes.Time; | 411 | private UpdatePrioritizationSchemes m_priorityScheme = UpdatePrioritizationSchemes.Time; |
405 | private bool m_reprioritizationEnabled = true; | 412 | private bool m_reprioritizationEnabled = true; |
@@ -443,6 +450,19 @@ namespace OpenSim.Region.Framework.Scenes | |||
443 | get { return m_sceneGridService; } | 450 | get { return m_sceneGridService; } |
444 | } | 451 | } |
445 | 452 | ||
453 | public ISnmpModule SnmpService | ||
454 | { | ||
455 | get | ||
456 | { | ||
457 | if (m_snmpService == null) | ||
458 | { | ||
459 | m_snmpService = RequestModuleInterface<ISnmpModule>(); | ||
460 | } | ||
461 | |||
462 | return m_snmpService; | ||
463 | } | ||
464 | } | ||
465 | |||
446 | public ISimulationDataService SimulationDataService | 466 | public ISimulationDataService SimulationDataService |
447 | { | 467 | { |
448 | get | 468 | get |
@@ -736,6 +756,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
736 | m_SimulationDataService = simDataService; | 756 | m_SimulationDataService = simDataService; |
737 | m_EstateDataService = estateDataService; | 757 | m_EstateDataService = estateDataService; |
738 | m_regionHandle = RegionInfo.RegionHandle; | 758 | m_regionHandle = RegionInfo.RegionHandle; |
759 | m_lastIncoming = 0; | ||
760 | m_lastOutgoing = 0; | ||
739 | 761 | ||
740 | m_asyncSceneObjectDeleter = new AsyncSceneObjectGroupDeleter(this); | 762 | m_asyncSceneObjectDeleter = new AsyncSceneObjectGroupDeleter(this); |
741 | m_asyncSceneObjectDeleter.Enabled = true; | 763 | m_asyncSceneObjectDeleter.Enabled = true; |
@@ -825,132 +847,141 @@ namespace OpenSim.Region.Framework.Scenes | |||
825 | 847 | ||
826 | // Region config overrides global config | 848 | // Region config overrides global config |
827 | // | 849 | // |
828 | if (m_config.Configs["Startup"] != null) | 850 | try |
829 | { | 851 | { |
830 | IConfig startupConfig = m_config.Configs["Startup"]; | 852 | if (m_config.Configs["Startup"] != null) |
831 | |||
832 | StartDisabled = startupConfig.GetBoolean("StartDisabled", false); | ||
833 | |||
834 | m_defaultDrawDistance = startupConfig.GetFloat("DefaultDrawDistance", m_defaultDrawDistance); | ||
835 | UseBackup = startupConfig.GetBoolean("UseSceneBackup", UseBackup); | ||
836 | if (!UseBackup) | ||
837 | m_log.InfoFormat("[SCENE]: Backup has been disabled for {0}", RegionInfo.RegionName); | ||
838 | |||
839 | //Animation states | ||
840 | m_useFlySlow = startupConfig.GetBoolean("enableflyslow", false); | ||
841 | |||
842 | MaxUndoCount = startupConfig.GetInt("MaxPrimUndos", 20); | ||
843 | |||
844 | PhysicalPrims = startupConfig.GetBoolean("physical_prim", PhysicalPrims); | ||
845 | CollidablePrims = startupConfig.GetBoolean("collidable_prim", CollidablePrims); | ||
846 | |||
847 | m_minNonphys = startupConfig.GetFloat("NonPhysicalPrimMin", m_minNonphys); | ||
848 | if (RegionInfo.NonphysPrimMin > 0) | ||
849 | { | 853 | { |
850 | m_minNonphys = RegionInfo.NonphysPrimMin; | 854 | IConfig startupConfig = m_config.Configs["Startup"]; |
851 | } | ||
852 | 855 | ||
853 | m_maxNonphys = startupConfig.GetFloat("NonPhysicalPrimMax", m_maxNonphys); | 856 | StartDisabled = startupConfig.GetBoolean("StartDisabled", false); |
854 | if (RegionInfo.NonphysPrimMax > 0) | ||
855 | { | ||
856 | m_maxNonphys = RegionInfo.NonphysPrimMax; | ||
857 | } | ||
858 | 857 | ||
859 | m_minPhys = startupConfig.GetFloat("PhysicalPrimMin", m_minPhys); | 858 | m_defaultDrawDistance = startupConfig.GetFloat("DefaultDrawDistance",m_defaultDrawDistance); |
860 | if (RegionInfo.PhysPrimMin > 0) | 859 | UseBackup = startupConfig.GetBoolean("UseSceneBackup", UseBackup); |
861 | { | 860 | if (!UseBackup) |
862 | m_minPhys = RegionInfo.PhysPrimMin; | 861 | m_log.InfoFormat("[SCENE]: Backup has been disabled for {0}", RegionInfo.RegionName); |
863 | } | 862 | |
863 | //Animation states | ||
864 | m_useFlySlow = startupConfig.GetBoolean("enableflyslow", false); | ||
864 | 865 | ||
865 | m_maxPhys = startupConfig.GetFloat("PhysicalPrimMax", m_maxPhys); | 866 | PhysicalPrims = startupConfig.GetBoolean("physical_prim", true); |
866 | if (RegionInfo.PhysPrimMax > 0) | 867 | CollidablePrims = startupConfig.GetBoolean("collidable_prim", true); |
867 | { | ||
868 | m_maxPhys = RegionInfo.PhysPrimMax; | ||
869 | } | ||
870 | 868 | ||
871 | // Here, if clamping is requested in either global or | 869 | m_minNonphys = startupConfig.GetFloat("NonPhysicalPrimMin", m_minNonphys); |
872 | // local config, it will be used | 870 | if (RegionInfo.NonphysPrimMin > 0) |
873 | // | 871 | { |
874 | m_clampPrimSize = startupConfig.GetBoolean("ClampPrimSize", m_clampPrimSize); | 872 | m_minNonphys = RegionInfo.NonphysPrimMin; |
875 | if (RegionInfo.ClampPrimSize) | 873 | } |
876 | { | ||
877 | m_clampPrimSize = true; | ||
878 | } | ||
879 | 874 | ||
880 | m_linksetCapacity = startupConfig.GetInt("LinksetPrims", m_linksetCapacity); | 875 | m_maxNonphys = startupConfig.GetFloat("NonPhysicalPrimMax", m_maxNonphys); |
881 | if (RegionInfo.LinksetCapacity > 0) | 876 | if (RegionInfo.NonphysPrimMax > 0) |
882 | { | 877 | { |
883 | m_linksetCapacity = RegionInfo.LinksetCapacity; | 878 | m_maxNonphys = RegionInfo.NonphysPrimMax; |
884 | } | 879 | } |
885 | 880 | ||
886 | m_useTrashOnDelete = startupConfig.GetBoolean("UseTrashOnDelete", m_useTrashOnDelete); | 881 | m_minPhys = startupConfig.GetFloat("PhysicalPrimMin", m_minPhys); |
887 | m_trustBinaries = startupConfig.GetBoolean("TrustBinaries", m_trustBinaries); | 882 | if (RegionInfo.PhysPrimMin > 0) |
888 | m_allowScriptCrossings = startupConfig.GetBoolean("AllowScriptCrossing", m_allowScriptCrossings); | 883 | { |
889 | m_dontPersistBefore = | 884 | m_minPhys = RegionInfo.PhysPrimMin; |
890 | startupConfig.GetLong("MinimumTimeBeforePersistenceConsidered", DEFAULT_MIN_TIME_FOR_PERSISTENCE); | 885 | } |
891 | m_dontPersistBefore *= 10000000; | ||
892 | m_persistAfter = | ||
893 | startupConfig.GetLong("MaximumTimeBeforePersistenceConsidered", DEFAULT_MAX_TIME_FOR_PERSISTENCE); | ||
894 | m_persistAfter *= 10000000; | ||
895 | 886 | ||
896 | m_defaultScriptEngine = startupConfig.GetString("DefaultScriptEngine", "XEngine"); | 887 | m_maxPhys = startupConfig.GetFloat("PhysicalPrimMax", m_maxPhys); |
897 | 888 | ||
898 | SpawnPointRouting = startupConfig.GetString("SpawnPointRouting", "closest"); | 889 | if (RegionInfo.PhysPrimMax > 0) |
899 | TelehubAllowLandmarks = startupConfig.GetBoolean("TelehubAllowLandmark", false); | 890 | { |
891 | m_maxPhys = RegionInfo.PhysPrimMax; | ||
892 | } | ||
900 | 893 | ||
901 | m_strictAccessControl = startupConfig.GetBoolean("StrictAccessControl", m_strictAccessControl); | 894 | m_linksetCapacity = startupConfig.GetInt("LinksetPrims", m_linksetCapacity); |
895 | if (RegionInfo.LinksetCapacity > 0) | ||
896 | { | ||
897 | m_linksetCapacity = RegionInfo.LinksetCapacity; | ||
898 | } | ||
902 | 899 | ||
903 | m_generateMaptiles = startupConfig.GetBoolean("GenerateMaptiles", true); | 900 | SpawnPointRouting = startupConfig.GetString("SpawnPointRouting", "closest"); |
904 | if (m_generateMaptiles) | 901 | TelehubAllowLandmarks = startupConfig.GetBoolean("TelehubAllowLandmark", false); |
905 | { | 902 | |
906 | int maptileRefresh = startupConfig.GetInt("MaptileRefresh", 0); | 903 | // Here, if clamping is requested in either global or |
907 | if (maptileRefresh != 0) | 904 | // local config, it will be used |
905 | // | ||
906 | m_clampPrimSize = startupConfig.GetBoolean("ClampPrimSize", m_clampPrimSize); | ||
907 | if (RegionInfo.ClampPrimSize) | ||
908 | { | 908 | { |
909 | m_mapGenerationTimer.Interval = maptileRefresh * 1000; | 909 | m_clampPrimSize = true; |
910 | m_mapGenerationTimer.Elapsed += RegenerateMaptileAndReregister; | ||
911 | m_mapGenerationTimer.AutoReset = true; | ||
912 | m_mapGenerationTimer.Start(); | ||
913 | } | 910 | } |
914 | } | ||
915 | else | ||
916 | { | ||
917 | string tile = startupConfig.GetString("MaptileStaticUUID", UUID.Zero.ToString()); | ||
918 | UUID tileID; | ||
919 | 911 | ||
920 | if (UUID.TryParse(tile, out tileID)) | 912 | m_useTrashOnDelete = startupConfig.GetBoolean("UseTrashOnDelete",m_useTrashOnDelete); |
913 | m_trustBinaries = startupConfig.GetBoolean("TrustBinaries", m_trustBinaries); | ||
914 | m_allowScriptCrossings = startupConfig.GetBoolean("AllowScriptCrossing", m_allowScriptCrossings); | ||
915 | m_dontPersistBefore = | ||
916 | startupConfig.GetLong("MinimumTimeBeforePersistenceConsidered", DEFAULT_MIN_TIME_FOR_PERSISTENCE); | ||
917 | m_dontPersistBefore *= 10000000; | ||
918 | m_persistAfter = | ||
919 | startupConfig.GetLong("MaximumTimeBeforePersistenceConsidered", DEFAULT_MAX_TIME_FOR_PERSISTENCE); | ||
920 | m_persistAfter *= 10000000; | ||
921 | |||
922 | m_defaultScriptEngine = startupConfig.GetString("DefaultScriptEngine", "XEngine"); | ||
923 | m_log.InfoFormat("[SCENE]: Default script engine {0}", m_defaultScriptEngine); | ||
924 | |||
925 | m_strictAccessControl = startupConfig.GetBoolean("StrictAccessControl", m_strictAccessControl); | ||
926 | m_seeIntoBannedRegion = startupConfig.GetBoolean("SeeIntoBannedRegion", m_seeIntoBannedRegion); | ||
927 | CombineRegions = startupConfig.GetBoolean("CombineContiguousRegions", false); | ||
928 | |||
929 | m_generateMaptiles = startupConfig.GetBoolean("GenerateMaptiles", true); | ||
930 | if (m_generateMaptiles) | ||
921 | { | 931 | { |
922 | RegionInfo.RegionSettings.TerrainImageID = tileID; | 932 | int maptileRefresh = startupConfig.GetInt("MaptileRefresh", 0); |
933 | if (maptileRefresh != 0) | ||
934 | { | ||
935 | m_mapGenerationTimer.Interval = maptileRefresh * 1000; | ||
936 | m_mapGenerationTimer.Elapsed += RegenerateMaptileAndReregister; | ||
937 | m_mapGenerationTimer.AutoReset = true; | ||
938 | m_mapGenerationTimer.Start(); | ||
939 | } | ||
923 | } | 940 | } |
924 | } | 941 | else |
942 | { | ||
943 | string tile = startupConfig.GetString("MaptileStaticUUID", UUID.Zero.ToString()); | ||
944 | UUID tileID; | ||
925 | 945 | ||
926 | string grant = startupConfig.GetString("AllowedClients", String.Empty); | 946 | if (UUID.TryParse(tile, out tileID)) |
927 | if (grant.Length > 0) | 947 | { |
928 | { | 948 | RegionInfo.RegionSettings.TerrainImageID = tileID; |
929 | foreach (string viewer in grant.Split('|')) | 949 | } |
950 | } | ||
951 | |||
952 | string grant = startupConfig.GetString("AllowedClients", String.Empty); | ||
953 | if (grant.Length > 0) | ||
930 | { | 954 | { |
931 | m_AllowedViewers.Add(viewer.Trim().ToLower()); | 955 | foreach (string viewer in grant.Split(',')) |
956 | { | ||
957 | m_AllowedViewers.Add(viewer.Trim().ToLower()); | ||
958 | } | ||
932 | } | 959 | } |
933 | } | ||
934 | 960 | ||
935 | grant = startupConfig.GetString("BannedClients", String.Empty); | 961 | grant = startupConfig.GetString("BannedClients", String.Empty); |
936 | if (grant.Length > 0) | 962 | if (grant.Length > 0) |
937 | { | ||
938 | foreach (string viewer in grant.Split('|')) | ||
939 | { | 963 | { |
940 | m_BannedViewers.Add(viewer.Trim().ToLower()); | 964 | foreach (string viewer in grant.Split(',')) |
965 | { | ||
966 | m_BannedViewers.Add(viewer.Trim().ToLower()); | ||
967 | } | ||
941 | } | 968 | } |
942 | } | ||
943 | 969 | ||
944 | MinFrameTime = startupConfig.GetFloat( "MinFrameTime", MinFrameTime); | 970 | MinFrameTime = startupConfig.GetFloat( "MinFrameTime", MinFrameTime); |
945 | m_update_backup = startupConfig.GetInt( "UpdateStorageEveryNFrames", m_update_backup); | 971 | m_update_backup = startupConfig.GetInt( "UpdateStorageEveryNFrames", m_update_backup); |
946 | m_update_coarse_locations = startupConfig.GetInt( "UpdateCoarseLocationsEveryNFrames", m_update_coarse_locations); | 972 | m_update_coarse_locations = startupConfig.GetInt( "UpdateCoarseLocationsEveryNFrames", m_update_coarse_locations); |
947 | m_update_entitymovement = startupConfig.GetInt( "UpdateEntityMovementEveryNFrames", m_update_entitymovement); | 973 | m_update_entitymovement = startupConfig.GetInt( "UpdateEntityMovementEveryNFrames", m_update_entitymovement); |
948 | m_update_events = startupConfig.GetInt( "UpdateEventsEveryNFrames", m_update_events); | 974 | m_update_events = startupConfig.GetInt( "UpdateEventsEveryNFrames", m_update_events); |
949 | m_update_objects = startupConfig.GetInt( "UpdateObjectsEveryNFrames", m_update_objects); | 975 | m_update_objects = startupConfig.GetInt( "UpdateObjectsEveryNFrames", m_update_objects); |
950 | m_update_physics = startupConfig.GetInt( "UpdatePhysicsEveryNFrames", m_update_physics); | 976 | m_update_physics = startupConfig.GetInt( "UpdatePhysicsEveryNFrames", m_update_physics); |
951 | m_update_presences = startupConfig.GetInt( "UpdateAgentsEveryNFrames", m_update_presences); | 977 | m_update_presences = startupConfig.GetInt( "UpdateAgentsEveryNFrames", m_update_presences); |
952 | m_update_terrain = startupConfig.GetInt( "UpdateTerrainEveryNFrames", m_update_terrain); | 978 | m_update_terrain = startupConfig.GetInt( "UpdateTerrainEveryNFrames", m_update_terrain); |
953 | m_update_temp_cleaning = startupConfig.GetInt( "UpdateTempCleaningEveryNFrames", m_update_temp_cleaning); | 979 | m_update_temp_cleaning = startupConfig.GetInt( "UpdateTempCleaningEveryNFrames", m_update_temp_cleaning); |
980 | } | ||
981 | } | ||
982 | catch (Exception e) | ||
983 | { | ||
984 | m_log.Error("[SCENE]: Failed to load StartupConfig: " + e.ToString()); | ||
954 | } | 985 | } |
955 | 986 | ||
956 | // FIXME: Ultimately this should be in a module. | 987 | // FIXME: Ultimately this should be in a module. |
@@ -995,6 +1026,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
995 | StatsReporter = new SimStatsReporter(this); | 1026 | StatsReporter = new SimStatsReporter(this); |
996 | StatsReporter.OnSendStatsResult += SendSimStatsPackets; | 1027 | StatsReporter.OnSendStatsResult += SendSimStatsPackets; |
997 | StatsReporter.OnStatsIncorrect += m_sceneGraph.RecalculateStats; | 1028 | StatsReporter.OnStatsIncorrect += m_sceneGraph.RecalculateStats; |
1029 | |||
1030 | MainConsole.Instance.Commands.AddCommand("scene", false, "gc collect", "gc collect", "gc collect", "Cause the garbage collector to make a single pass", HandleGcCollect); | ||
998 | } | 1031 | } |
999 | 1032 | ||
1000 | public Scene(RegionInfo regInfo) : base(regInfo) | 1033 | public Scene(RegionInfo regInfo) : base(regInfo) |
@@ -1290,8 +1323,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
1290 | // Stop all client threads. | 1323 | // Stop all client threads. |
1291 | ForEachScenePresence(delegate(ScenePresence avatar) { avatar.ControllingClient.Close(); }); | 1324 | ForEachScenePresence(delegate(ScenePresence avatar) { avatar.ControllingClient.Close(); }); |
1292 | 1325 | ||
1293 | m_log.Debug("[SCENE]: Persisting changed objects"); | 1326 | m_log.Debug("[SCENE]: TriggerSceneShuttingDown"); |
1294 | EventManager.TriggerSceneShuttingDown(this); | 1327 | EventManager.TriggerSceneShuttingDown(this); |
1328 | |||
1329 | m_log.Debug("[SCENE]: Persisting changed objects"); | ||
1330 | |||
1295 | Backup(false); | 1331 | Backup(false); |
1296 | m_sceneGraph.Close(); | 1332 | m_sceneGraph.Close(); |
1297 | 1333 | ||
@@ -1305,6 +1341,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1305 | // attempt to reference a null or disposed physics scene. | 1341 | // attempt to reference a null or disposed physics scene. |
1306 | if (PhysicsScene != null) | 1342 | if (PhysicsScene != null) |
1307 | { | 1343 | { |
1344 | m_log.Debug("[SCENE]: Dispose Physics"); | ||
1308 | PhysicsScene phys = PhysicsScene; | 1345 | PhysicsScene phys = PhysicsScene; |
1309 | // remove the physics engine from both Scene and SceneGraph | 1346 | // remove the physics engine from both Scene and SceneGraph |
1310 | PhysicsScene = null; | 1347 | PhysicsScene = null; |
@@ -1327,11 +1364,29 @@ namespace OpenSim.Region.Framework.Scenes | |||
1327 | //m_heartbeatTimer.Elapsed += new ElapsedEventHandler(Heartbeat); | 1364 | //m_heartbeatTimer.Elapsed += new ElapsedEventHandler(Heartbeat); |
1328 | if (m_heartbeatThread != null) | 1365 | if (m_heartbeatThread != null) |
1329 | { | 1366 | { |
1367 | m_hbRestarts++; | ||
1368 | if(m_hbRestarts > 10) | ||
1369 | Environment.Exit(1); | ||
1370 | m_log.ErrorFormat("[SCENE]: Restarting heartbeat thread because it hasn't reported in in region {0}", RegionInfo.RegionName); | ||
1371 | |||
1372 | //int pid = System.Diagnostics.Process.GetCurrentProcess().Id; | ||
1373 | //System.Diagnostics.Process proc = new System.Diagnostics.Process(); | ||
1374 | //proc.EnableRaisingEvents=false; | ||
1375 | //proc.StartInfo.FileName = "/bin/kill"; | ||
1376 | //proc.StartInfo.Arguments = "-QUIT " + pid.ToString(); | ||
1377 | //proc.Start(); | ||
1378 | //proc.WaitForExit(); | ||
1379 | //Thread.Sleep(1000); | ||
1380 | //Environment.Exit(1); | ||
1330 | m_heartbeatThread.Abort(); | 1381 | m_heartbeatThread.Abort(); |
1382 | Watchdog.AbortThread(m_heartbeatThread.ManagedThreadId); | ||
1331 | m_heartbeatThread = null; | 1383 | m_heartbeatThread = null; |
1332 | } | 1384 | } |
1333 | // m_lastUpdate = Util.EnvironmentTickCount(); | 1385 | // m_lastUpdate = Util.EnvironmentTickCount(); |
1334 | 1386 | ||
1387 | // m_sceneGraph.PreparePhysicsSimulation(); | ||
1388 | |||
1389 | |||
1335 | m_heartbeatThread | 1390 | m_heartbeatThread |
1336 | = Watchdog.StartThread( | 1391 | = Watchdog.StartThread( |
1337 | Heartbeat, string.Format("Heartbeat ({0})", RegionInfo.RegionName), ThreadPriority.Normal, false, false); | 1392 | Heartbeat, string.Format("Heartbeat ({0})", RegionInfo.RegionName), ThreadPriority.Normal, false, false); |
@@ -1474,16 +1529,20 @@ namespace OpenSim.Region.Framework.Scenes | |||
1474 | endFrame = Frame + frames; | 1529 | endFrame = Frame + frames; |
1475 | 1530 | ||
1476 | float physicsFPS = 0f; | 1531 | float physicsFPS = 0f; |
1477 | int previousFrameTick, tmpMS; | 1532 | int tmpMS; |
1478 | int maintc = Util.EnvironmentTickCount(); | 1533 | int previousFrameTick; |
1534 | int maintc; | ||
1535 | int sleepMS; | ||
1536 | int framestart; | ||
1479 | 1537 | ||
1480 | while (!m_shuttingDown && ((endFrame == null && Active) || Frame < endFrame)) | 1538 | while (!m_shuttingDown && ((endFrame == null && Active) || Frame < endFrame)) |
1481 | { | 1539 | { |
1540 | framestart = Util.EnvironmentTickCount(); | ||
1482 | ++Frame; | 1541 | ++Frame; |
1483 | 1542 | ||
1484 | // m_log.DebugFormat("[SCENE]: Processing frame {0} in {1}", Frame, RegionInfo.RegionName); | 1543 | // m_log.DebugFormat("[SCENE]: Processing frame {0} in {1}", Frame, RegionInfo.RegionName); |
1485 | 1544 | ||
1486 | agentMS = tempOnRezMS = eventMS = backupMS = terrainMS = landMS = spareMS = 0; | 1545 | agentMS = tempOnRezMS = eventMS = backupMS = terrainMS = landMS = 0; |
1487 | 1546 | ||
1488 | try | 1547 | try |
1489 | { | 1548 | { |
@@ -1535,6 +1594,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1535 | m_sceneGraph.UpdatePresences(); | 1594 | m_sceneGraph.UpdatePresences(); |
1536 | 1595 | ||
1537 | agentMS += Util.EnvironmentTickCountSubtract(tmpMS); | 1596 | agentMS += Util.EnvironmentTickCountSubtract(tmpMS); |
1597 | |||
1538 | 1598 | ||
1539 | // Delete temp-on-rez stuff | 1599 | // Delete temp-on-rez stuff |
1540 | if (Frame % m_update_temp_cleaning == 0 && !m_cleaningTemps) | 1600 | if (Frame % m_update_temp_cleaning == 0 && !m_cleaningTemps) |
@@ -1616,34 +1676,37 @@ namespace OpenSim.Region.Framework.Scenes | |||
1616 | 1676 | ||
1617 | Watchdog.UpdateThread(); | 1677 | Watchdog.UpdateThread(); |
1618 | 1678 | ||
1679 | otherMS = tempOnRezMS + eventMS + backupMS + terrainMS + landMS; | ||
1680 | |||
1681 | StatsReporter.AddPhysicsFPS(physicsFPS); | ||
1682 | StatsReporter.AddTimeDilation(TimeDilation); | ||
1683 | StatsReporter.AddFPS(1); | ||
1684 | |||
1685 | StatsReporter.addAgentMS(agentMS); | ||
1686 | StatsReporter.addPhysicsMS(physicsMS + physicsMS2); | ||
1687 | StatsReporter.addOtherMS(otherMS); | ||
1688 | StatsReporter.addScriptLines(m_sceneGraph.GetScriptLPS()); | ||
1689 | |||
1619 | previousFrameTick = m_lastFrameTick; | 1690 | previousFrameTick = m_lastFrameTick; |
1620 | m_lastFrameTick = Util.EnvironmentTickCount(); | 1691 | m_lastFrameTick = Util.EnvironmentTickCount(); |
1621 | tmpMS = Util.EnvironmentTickCountSubtract(m_lastFrameTick, maintc); | 1692 | tmpMS = Util.EnvironmentTickCountSubtract(m_lastFrameTick, framestart); |
1622 | tmpMS = (int)(MinFrameTime * 1000) - tmpMS; | 1693 | tmpMS = (int)(MinFrameTime * 1000) - tmpMS; |
1623 | 1694 | ||
1695 | m_firstHeartbeat = false; | ||
1696 | |||
1697 | sleepMS = Util.EnvironmentTickCount(); | ||
1698 | |||
1624 | if (tmpMS > 0) | 1699 | if (tmpMS > 0) |
1625 | { | ||
1626 | Thread.Sleep(tmpMS); | 1700 | Thread.Sleep(tmpMS); |
1627 | spareMS += tmpMS; | ||
1628 | } | ||
1629 | |||
1630 | frameMS = Util.EnvironmentTickCountSubtract(maintc); | ||
1631 | maintc = Util.EnvironmentTickCount(); | ||
1632 | 1701 | ||
1633 | otherMS = tempOnRezMS + eventMS + backupMS + terrainMS + landMS; | 1702 | sleepMS = Util.EnvironmentTickCountSubtract(sleepMS); |
1703 | frameMS = Util.EnvironmentTickCountSubtract(framestart); | ||
1704 | StatsReporter.addSleepMS(sleepMS); | ||
1705 | StatsReporter.addFrameMS(frameMS); | ||
1634 | 1706 | ||
1635 | // if (Frame%m_update_avatars == 0) | 1707 | // if (Frame%m_update_avatars == 0) |
1636 | // UpdateInWorldTime(); | 1708 | // UpdateInWorldTime(); |
1637 | StatsReporter.AddPhysicsFPS(physicsFPS); | ||
1638 | StatsReporter.AddTimeDilation(TimeDilation); | ||
1639 | StatsReporter.AddFPS(1); | ||
1640 | 1709 | ||
1641 | StatsReporter.addFrameMS(frameMS); | ||
1642 | StatsReporter.addAgentMS(agentMS); | ||
1643 | StatsReporter.addPhysicsMS(physicsMS + physicsMS2); | ||
1644 | StatsReporter.addOtherMS(otherMS); | ||
1645 | StatsReporter.AddSpareMS(spareMS); | ||
1646 | StatsReporter.addScriptLines(m_sceneGraph.GetScriptLPS()); | ||
1647 | 1710 | ||
1648 | // Optionally warn if a frame takes double the amount of time that it should. | 1711 | // Optionally warn if a frame takes double the amount of time that it should. |
1649 | if (DebugUpdates | 1712 | if (DebugUpdates |
@@ -1660,7 +1723,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1660 | public void AddGroupTarget(SceneObjectGroup grp) | 1723 | public void AddGroupTarget(SceneObjectGroup grp) |
1661 | { | 1724 | { |
1662 | lock (m_groupsWithTargets) | 1725 | lock (m_groupsWithTargets) |
1663 | m_groupsWithTargets[grp.UUID] = grp; | 1726 | m_groupsWithTargets[grp.UUID] = 0; |
1664 | } | 1727 | } |
1665 | 1728 | ||
1666 | public void RemoveGroupTarget(SceneObjectGroup grp) | 1729 | public void RemoveGroupTarget(SceneObjectGroup grp) |
@@ -1671,18 +1734,24 @@ namespace OpenSim.Region.Framework.Scenes | |||
1671 | 1734 | ||
1672 | private void CheckAtTargets() | 1735 | private void CheckAtTargets() |
1673 | { | 1736 | { |
1674 | List<SceneObjectGroup> objs = null; | 1737 | List<UUID> objs = null; |
1675 | 1738 | ||
1676 | lock (m_groupsWithTargets) | 1739 | lock (m_groupsWithTargets) |
1677 | { | 1740 | { |
1678 | if (m_groupsWithTargets.Count != 0) | 1741 | if (m_groupsWithTargets.Count != 0) |
1679 | objs = new List<SceneObjectGroup>(m_groupsWithTargets.Values); | 1742 | objs = new List<UUID>(m_groupsWithTargets.Keys); |
1680 | } | 1743 | } |
1681 | 1744 | ||
1682 | if (objs != null) | 1745 | if (objs != null) |
1683 | { | 1746 | { |
1684 | foreach (SceneObjectGroup entry in objs) | 1747 | foreach (UUID entry in objs) |
1685 | entry.checkAtTargets(); | 1748 | { |
1749 | SceneObjectGroup grp = GetSceneObjectGroup(entry); | ||
1750 | if (grp == null) | ||
1751 | m_groupsWithTargets.Remove(entry); | ||
1752 | else | ||
1753 | grp.checkAtTargets(); | ||
1754 | } | ||
1686 | } | 1755 | } |
1687 | } | 1756 | } |
1688 | 1757 | ||
@@ -1761,7 +1830,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1761 | msg.fromAgentName = "Server"; | 1830 | msg.fromAgentName = "Server"; |
1762 | msg.dialog = (byte)19; // Object msg | 1831 | msg.dialog = (byte)19; // Object msg |
1763 | msg.fromGroup = false; | 1832 | msg.fromGroup = false; |
1764 | msg.offline = (byte)0; | 1833 | msg.offline = (byte)1; |
1765 | msg.ParentEstateID = RegionInfo.EstateSettings.ParentEstateID; | 1834 | msg.ParentEstateID = RegionInfo.EstateSettings.ParentEstateID; |
1766 | msg.Position = Vector3.Zero; | 1835 | msg.Position = Vector3.Zero; |
1767 | msg.RegionID = RegionInfo.RegionID.Guid; | 1836 | msg.RegionID = RegionInfo.RegionID.Guid; |
@@ -1983,14 +2052,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
1983 | EventManager.TriggerPrimsLoaded(this); | 2052 | EventManager.TriggerPrimsLoaded(this); |
1984 | } | 2053 | } |
1985 | 2054 | ||
1986 | public bool SupportsRayCastFiltered() | 2055 | public bool SuportsRayCastFiltered() |
1987 | { | 2056 | { |
1988 | if (PhysicsScene == null) | 2057 | if (PhysicsScene == null) |
1989 | return false; | 2058 | return false; |
1990 | return PhysicsScene.SupportsRaycastWorldFiltered(); | 2059 | return PhysicsScene.SuportsRaycastWorldFiltered(); |
1991 | } | 2060 | } |
1992 | 2061 | ||
1993 | public object RayCastFiltered(Vector3 position, Vector3 direction, float length, int Count, RayFilterFlags filter) | 2062 | public object RayCastFiltered(Vector3 position, Vector3 direction, float length, int Count, RayFilterFlags filter) |
1994 | { | 2063 | { |
1995 | if (PhysicsScene == null) | 2064 | if (PhysicsScene == null) |
1996 | return null; | 2065 | return null; |
@@ -2012,14 +2081,24 @@ namespace OpenSim.Region.Framework.Scenes | |||
2012 | /// <returns></returns> | 2081 | /// <returns></returns> |
2013 | public Vector3 GetNewRezLocation(Vector3 RayStart, Vector3 RayEnd, UUID RayTargetID, Quaternion rot, byte bypassRayCast, byte RayEndIsIntersection, bool frontFacesOnly, Vector3 scale, bool FaceCenter) | 2082 | public Vector3 GetNewRezLocation(Vector3 RayStart, Vector3 RayEnd, UUID RayTargetID, Quaternion rot, byte bypassRayCast, byte RayEndIsIntersection, bool frontFacesOnly, Vector3 scale, bool FaceCenter) |
2014 | { | 2083 | { |
2084 | |||
2085 | float wheight = (float)RegionInfo.RegionSettings.WaterHeight; | ||
2086 | Vector3 wpos = Vector3.Zero; | ||
2087 | // Check for water surface intersection from above | ||
2088 | if ( (RayStart.Z > wheight) && (RayEnd.Z < wheight) ) | ||
2089 | { | ||
2090 | float ratio = (RayStart.Z - wheight) / (RayStart.Z - RayEnd.Z); | ||
2091 | wpos.X = RayStart.X - (ratio * (RayStart.X - RayEnd.X)); | ||
2092 | wpos.Y = RayStart.Y - (ratio * (RayStart.Y - RayEnd.Y)); | ||
2093 | wpos.Z = wheight; | ||
2094 | } | ||
2095 | |||
2015 | Vector3 pos = Vector3.Zero; | 2096 | Vector3 pos = Vector3.Zero; |
2016 | if (RayEndIsIntersection == (byte)1) | 2097 | if (RayEndIsIntersection == (byte)1) |
2017 | { | 2098 | { |
2018 | pos = RayEnd; | 2099 | pos = RayEnd; |
2019 | return pos; | ||
2020 | } | 2100 | } |
2021 | 2101 | else if (RayTargetID != UUID.Zero) | |
2022 | if (RayTargetID != UUID.Zero) | ||
2023 | { | 2102 | { |
2024 | SceneObjectPart target = GetSceneObjectPart(RayTargetID); | 2103 | SceneObjectPart target = GetSceneObjectPart(RayTargetID); |
2025 | 2104 | ||
@@ -2041,7 +2120,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2041 | EntityIntersection ei = target.TestIntersectionOBB(NewRay, Quaternion.Identity, frontFacesOnly, FaceCenter); | 2120 | EntityIntersection ei = target.TestIntersectionOBB(NewRay, Quaternion.Identity, frontFacesOnly, FaceCenter); |
2042 | 2121 | ||
2043 | // Un-comment out the following line to Get Raytrace results printed to the console. | 2122 | // Un-comment out the following line to Get Raytrace results printed to the console. |
2044 | // m_log.Info("[RAYTRACERESULTS]: Hit:" + ei.HitTF.ToString() + " Point: " + ei.ipoint.ToString() + " Normal: " + ei.normal.ToString()); | 2123 | // m_log.Info("[RAYTRACERESULTS]: Hit:" + ei.HitTF.ToString() + " Point: " + ei.ipoint.ToString() + " Normal: " + ei.normal.ToString()); |
2045 | float ScaleOffset = 0.5f; | 2124 | float ScaleOffset = 0.5f; |
2046 | 2125 | ||
2047 | // If we hit something | 2126 | // If we hit something |
@@ -2064,13 +2143,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
2064 | //pos.Z -= 0.25F; | 2143 | //pos.Z -= 0.25F; |
2065 | 2144 | ||
2066 | } | 2145 | } |
2067 | |||
2068 | return pos; | ||
2069 | } | 2146 | } |
2070 | else | 2147 | else |
2071 | { | 2148 | { |
2072 | // We don't have a target here, so we're going to raytrace all the objects in the scene. | 2149 | // We don't have a target here, so we're going to raytrace all the objects in the scene. |
2073 | |||
2074 | EntityIntersection ei = m_sceneGraph.GetClosestIntersectingPrim(new Ray(AXOrigin, AXdirection), true, false); | 2150 | EntityIntersection ei = m_sceneGraph.GetClosestIntersectingPrim(new Ray(AXOrigin, AXdirection), true, false); |
2075 | 2151 | ||
2076 | // Un-comment the following line to print the raytrace results to the console. | 2152 | // Un-comment the following line to print the raytrace results to the console. |
@@ -2079,13 +2155,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
2079 | if (ei.HitTF) | 2155 | if (ei.HitTF) |
2080 | { | 2156 | { |
2081 | pos = new Vector3(ei.ipoint.X, ei.ipoint.Y, ei.ipoint.Z); | 2157 | pos = new Vector3(ei.ipoint.X, ei.ipoint.Y, ei.ipoint.Z); |
2082 | } else | 2158 | } |
2159 | else | ||
2083 | { | 2160 | { |
2084 | // fall back to our stupid functionality | 2161 | // fall back to our stupid functionality |
2085 | pos = RayEnd; | 2162 | pos = RayEnd; |
2086 | } | 2163 | } |
2087 | |||
2088 | return pos; | ||
2089 | } | 2164 | } |
2090 | } | 2165 | } |
2091 | else | 2166 | else |
@@ -2096,8 +2171,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
2096 | //increase height so its above the ground. | 2171 | //increase height so its above the ground. |
2097 | //should be getting the normal of the ground at the rez point and using that? | 2172 | //should be getting the normal of the ground at the rez point and using that? |
2098 | pos.Z += scale.Z / 2f; | 2173 | pos.Z += scale.Z / 2f; |
2099 | return pos; | 2174 | // return pos; |
2100 | } | 2175 | } |
2176 | |||
2177 | // check against posible water intercept | ||
2178 | if (wpos.Z > pos.Z) pos = wpos; | ||
2179 | return pos; | ||
2101 | } | 2180 | } |
2102 | 2181 | ||
2103 | 2182 | ||
@@ -2188,12 +2267,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
2188 | { | 2267 | { |
2189 | if (m_sceneGraph.AddRestoredSceneObject(sceneObject, attachToBackup, alreadyPersisted, sendClientUpdates)) | 2268 | if (m_sceneGraph.AddRestoredSceneObject(sceneObject, attachToBackup, alreadyPersisted, sendClientUpdates)) |
2190 | { | 2269 | { |
2270 | sceneObject.IsDeleted = false; | ||
2191 | EventManager.TriggerObjectAddedToScene(sceneObject); | 2271 | EventManager.TriggerObjectAddedToScene(sceneObject); |
2192 | return true; | 2272 | return true; |
2193 | } | 2273 | } |
2194 | 2274 | ||
2195 | return false; | 2275 | return false; |
2196 | |||
2197 | } | 2276 | } |
2198 | 2277 | ||
2199 | /// <summary> | 2278 | /// <summary> |
@@ -2285,6 +2364,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
2285 | /// </summary> | 2364 | /// </summary> |
2286 | public void DeleteAllSceneObjects() | 2365 | public void DeleteAllSceneObjects() |
2287 | { | 2366 | { |
2367 | DeleteAllSceneObjects(false); | ||
2368 | } | ||
2369 | |||
2370 | /// <summary> | ||
2371 | /// Delete every object from the scene. This does not include attachments worn by avatars. | ||
2372 | /// </summary> | ||
2373 | public void DeleteAllSceneObjects(bool exceptNoCopy) | ||
2374 | { | ||
2375 | List<SceneObjectGroup> toReturn = new List<SceneObjectGroup>(); | ||
2288 | lock (Entities) | 2376 | lock (Entities) |
2289 | { | 2377 | { |
2290 | EntityBase[] entities = Entities.GetEntities(); | 2378 | EntityBase[] entities = Entities.GetEntities(); |
@@ -2293,11 +2381,24 @@ namespace OpenSim.Region.Framework.Scenes | |||
2293 | if (e is SceneObjectGroup) | 2381 | if (e is SceneObjectGroup) |
2294 | { | 2382 | { |
2295 | SceneObjectGroup sog = (SceneObjectGroup)e; | 2383 | SceneObjectGroup sog = (SceneObjectGroup)e; |
2296 | if (!sog.IsAttachment) | 2384 | if (sog != null && !sog.IsAttachment) |
2297 | DeleteSceneObject((SceneObjectGroup)e, false); | 2385 | { |
2386 | if (!exceptNoCopy || ((sog.GetEffectivePermissions() & (uint)PermissionMask.Copy) != 0)) | ||
2387 | { | ||
2388 | DeleteSceneObject((SceneObjectGroup)e, false); | ||
2389 | } | ||
2390 | else | ||
2391 | { | ||
2392 | toReturn.Add((SceneObjectGroup)e); | ||
2393 | } | ||
2394 | } | ||
2298 | } | 2395 | } |
2299 | } | 2396 | } |
2300 | } | 2397 | } |
2398 | if (toReturn.Count > 0) | ||
2399 | { | ||
2400 | returnObjects(toReturn.ToArray(), UUID.Zero); | ||
2401 | } | ||
2301 | } | 2402 | } |
2302 | 2403 | ||
2303 | /// <summary> | 2404 | /// <summary> |
@@ -2332,6 +2433,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
2332 | 2433 | ||
2333 | foreach (SceneObjectPart part in partList) | 2434 | foreach (SceneObjectPart part in partList) |
2334 | { | 2435 | { |
2436 | if (part.KeyframeMotion != null) | ||
2437 | { | ||
2438 | part.KeyframeMotion.Delete(); | ||
2439 | part.KeyframeMotion = null; | ||
2440 | } | ||
2441 | |||
2335 | if (part.IsJoint() && ((part.Flags & PrimFlags.Physics) != 0)) | 2442 | if (part.IsJoint() && ((part.Flags & PrimFlags.Physics) != 0)) |
2336 | { | 2443 | { |
2337 | PhysicsScene.RequestJointDeletion(part.Name); // FIXME: what if the name changed? | 2444 | PhysicsScene.RequestJointDeletion(part.Name); // FIXME: what if the name changed? |
@@ -2349,6 +2456,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2349 | } | 2456 | } |
2350 | 2457 | ||
2351 | group.DeleteGroupFromScene(silent); | 2458 | group.DeleteGroupFromScene(silent); |
2459 | if (!silent) | ||
2460 | SendKillObject(new List<uint>() { group.LocalId }); | ||
2352 | 2461 | ||
2353 | // m_log.DebugFormat("[SCENE]: Exit DeleteSceneObject() for {0} {1}", group.Name, group.UUID); | 2462 | // m_log.DebugFormat("[SCENE]: Exit DeleteSceneObject() for {0} {1}", group.Name, group.UUID); |
2354 | } | 2463 | } |
@@ -2639,7 +2748,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2639 | // If the user is banned, we won't let any of their objects | 2748 | // If the user is banned, we won't let any of their objects |
2640 | // enter. Period. | 2749 | // enter. Period. |
2641 | // | 2750 | // |
2642 | if (RegionInfo.EstateSettings.IsBanned(newObject.OwnerID)) | 2751 | if (RegionInfo.EstateSettings.IsBanned(newObject.OwnerID, 36)) |
2643 | { | 2752 | { |
2644 | m_log.InfoFormat("[INTERREGION]: Denied prim crossing for banned avatar {0}", newObject.OwnerID); | 2753 | m_log.InfoFormat("[INTERREGION]: Denied prim crossing for banned avatar {0}", newObject.OwnerID); |
2645 | return false; | 2754 | return false; |
@@ -2647,6 +2756,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2647 | 2756 | ||
2648 | if (newPosition != Vector3.Zero) | 2757 | if (newPosition != Vector3.Zero) |
2649 | newObject.RootPart.GroupPosition = newPosition; | 2758 | newObject.RootPart.GroupPosition = newPosition; |
2759 | if (newObject.RootPart.KeyframeMotion != null) | ||
2760 | newObject.RootPart.KeyframeMotion.UpdateSceneObject(newObject); | ||
2650 | 2761 | ||
2651 | if (!AddSceneObject(newObject)) | 2762 | if (!AddSceneObject(newObject)) |
2652 | { | 2763 | { |
@@ -2691,6 +2802,23 @@ namespace OpenSim.Region.Framework.Scenes | |||
2691 | /// <returns>True if the SceneObjectGroup was added, False if it was not</returns> | 2802 | /// <returns>True if the SceneObjectGroup was added, False if it was not</returns> |
2692 | public bool AddSceneObject(SceneObjectGroup sceneObject) | 2803 | public bool AddSceneObject(SceneObjectGroup sceneObject) |
2693 | { | 2804 | { |
2805 | if (sceneObject.OwnerID == UUID.Zero) | ||
2806 | { | ||
2807 | m_log.ErrorFormat("[SCENE]: Owner ID for {0} was zero", sceneObject.UUID); | ||
2808 | return false; | ||
2809 | } | ||
2810 | |||
2811 | // If the user is banned, we won't let any of their objects | ||
2812 | // enter. Period. | ||
2813 | // | ||
2814 | int flags = GetUserFlags(sceneObject.OwnerID); | ||
2815 | if (RegionInfo.EstateSettings.IsBanned(sceneObject.OwnerID, flags)) | ||
2816 | { | ||
2817 | m_log.InfoFormat("[INTERREGION]: Denied prim crossing for banned avatar {0}", sceneObject.OwnerID); | ||
2818 | |||
2819 | return false; | ||
2820 | } | ||
2821 | |||
2694 | // Force allocation of new LocalId | 2822 | // Force allocation of new LocalId |
2695 | // | 2823 | // |
2696 | SceneObjectPart[] parts = sceneObject.Parts; | 2824 | SceneObjectPart[] parts = sceneObject.Parts; |
@@ -2724,16 +2852,27 @@ namespace OpenSim.Region.Framework.Scenes | |||
2724 | RootPrim.RemFlag(PrimFlags.TemporaryOnRez); | 2852 | RootPrim.RemFlag(PrimFlags.TemporaryOnRez); |
2725 | 2853 | ||
2726 | if (AttachmentsModule != null) | 2854 | if (AttachmentsModule != null) |
2727 | AttachmentsModule.AttachObject(sp, grp, 0, false, false); | 2855 | AttachmentsModule.AttachObject(sp, grp, 0, false, false, false); |
2728 | } | 2856 | } |
2729 | else | 2857 | else |
2730 | { | 2858 | { |
2859 | m_log.DebugFormat("[SCENE]: Attachment {0} arrived and scene presence was not found, setting to temp", sceneObject.UUID); | ||
2731 | RootPrim.RemFlag(PrimFlags.TemporaryOnRez); | 2860 | RootPrim.RemFlag(PrimFlags.TemporaryOnRez); |
2732 | RootPrim.AddFlag(PrimFlags.TemporaryOnRez); | 2861 | RootPrim.AddFlag(PrimFlags.TemporaryOnRez); |
2733 | } | 2862 | } |
2863 | if (sceneObject.OwnerID == UUID.Zero) | ||
2864 | { | ||
2865 | m_log.ErrorFormat("[SCENE]: Owner ID for {0} was zero after attachment processing. BUG!", sceneObject.UUID); | ||
2866 | return false; | ||
2867 | } | ||
2734 | } | 2868 | } |
2735 | else | 2869 | else |
2736 | { | 2870 | { |
2871 | if (sceneObject.OwnerID == UUID.Zero) | ||
2872 | { | ||
2873 | m_log.ErrorFormat("[SCENE]: Owner ID for non-attachment {0} was zero", sceneObject.UUID); | ||
2874 | return false; | ||
2875 | } | ||
2737 | AddRestoredSceneObject(sceneObject, true, false); | 2876 | AddRestoredSceneObject(sceneObject, true, false); |
2738 | } | 2877 | } |
2739 | 2878 | ||
@@ -2750,6 +2889,24 @@ namespace OpenSim.Region.Framework.Scenes | |||
2750 | return 2; // StateSource.PrimCrossing | 2889 | return 2; // StateSource.PrimCrossing |
2751 | } | 2890 | } |
2752 | 2891 | ||
2892 | public int GetUserFlags(UUID user) | ||
2893 | { | ||
2894 | //Unfortunately the SP approach means that the value is cached until region is restarted | ||
2895 | /* | ||
2896 | ScenePresence sp; | ||
2897 | if (TryGetScenePresence(user, out sp)) | ||
2898 | { | ||
2899 | return sp.UserFlags; | ||
2900 | } | ||
2901 | else | ||
2902 | { | ||
2903 | */ | ||
2904 | UserAccount uac = UserAccountService.GetUserAccount(RegionInfo.ScopeID, user); | ||
2905 | if (uac == null) | ||
2906 | return 0; | ||
2907 | return uac.UserFlags; | ||
2908 | //} | ||
2909 | } | ||
2753 | #endregion | 2910 | #endregion |
2754 | 2911 | ||
2755 | #region Add/Remove Avatar Methods | 2912 | #region Add/Remove Avatar Methods |
@@ -2782,7 +2939,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2782 | = (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0 | 2939 | = (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0 |
2783 | || (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0; | 2940 | || (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0; |
2784 | 2941 | ||
2785 | // CheckHeartbeat(); | 2942 | CheckHeartbeat(); |
2786 | 2943 | ||
2787 | sp = GetScenePresence(client.AgentId); | 2944 | sp = GetScenePresence(client.AgentId); |
2788 | 2945 | ||
@@ -2813,6 +2970,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2813 | // start the scripts again (since this is done in RezAttachments()). | 2970 | // start the scripts again (since this is done in RezAttachments()). |
2814 | // XXX: This is convoluted. | 2971 | // XXX: This is convoluted. |
2815 | sp.IsChildAgent = false; | 2972 | sp.IsChildAgent = false; |
2973 | sp.IsLoggingIn = true; | ||
2816 | 2974 | ||
2817 | if (AttachmentsModule != null) | 2975 | if (AttachmentsModule != null) |
2818 | Util.FireAndForget(delegate(object o) { AttachmentsModule.RezAttachments(sp); }); | 2976 | Util.FireAndForget(delegate(object o) { AttachmentsModule.RezAttachments(sp); }); |
@@ -2926,19 +3084,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
2926 | // and the scene presence and the client, if they exist | 3084 | // and the scene presence and the client, if they exist |
2927 | try | 3085 | try |
2928 | { | 3086 | { |
2929 | // We need to wait for the client to make UDP contact first. | 3087 | ScenePresence sp = GetScenePresence(agentID); |
2930 | // It's the UDP contact that creates the scene presence | 3088 | |
2931 | ScenePresence sp = WaitGetScenePresence(agentID); | ||
2932 | if (sp != null) | 3089 | if (sp != null) |
2933 | { | 3090 | { |
2934 | PresenceService.LogoutAgent(sp.ControllingClient.SessionId); | 3091 | PresenceService.LogoutAgent(sp.ControllingClient.SessionId); |
2935 | |||
2936 | sp.ControllingClient.Close(); | 3092 | sp.ControllingClient.Close(); |
2937 | } | 3093 | } |
2938 | else | 3094 | |
2939 | { | ||
2940 | m_log.WarnFormat("[SCENE]: Could not find scene presence for {0}", agentID); | ||
2941 | } | ||
2942 | // BANG! SLASH! | 3095 | // BANG! SLASH! |
2943 | m_authenticateHandler.RemoveCircuit(agentID); | 3096 | m_authenticateHandler.RemoveCircuit(agentID); |
2944 | 3097 | ||
@@ -2983,6 +3136,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2983 | client.OnUpdatePrimGroupPosition += m_sceneGraph.UpdatePrimGroupPosition; | 3136 | client.OnUpdatePrimGroupPosition += m_sceneGraph.UpdatePrimGroupPosition; |
2984 | client.OnUpdatePrimSinglePosition += m_sceneGraph.UpdatePrimSinglePosition; | 3137 | client.OnUpdatePrimSinglePosition += m_sceneGraph.UpdatePrimSinglePosition; |
2985 | 3138 | ||
3139 | client.onClientChangeObject += m_sceneGraph.ClientChangeObject; | ||
3140 | |||
2986 | client.OnUpdatePrimGroupRotation += m_sceneGraph.UpdatePrimGroupRotation; | 3141 | client.OnUpdatePrimGroupRotation += m_sceneGraph.UpdatePrimGroupRotation; |
2987 | client.OnUpdatePrimGroupMouseRotation += m_sceneGraph.UpdatePrimGroupRotation; | 3142 | client.OnUpdatePrimGroupMouseRotation += m_sceneGraph.UpdatePrimGroupRotation; |
2988 | client.OnUpdatePrimSingleRotation += m_sceneGraph.UpdatePrimSingleRotation; | 3143 | client.OnUpdatePrimSingleRotation += m_sceneGraph.UpdatePrimSingleRotation; |
@@ -3039,6 +3194,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3039 | client.OnFetchInventory += m_asyncInventorySender.HandleFetchInventory; | 3194 | client.OnFetchInventory += m_asyncInventorySender.HandleFetchInventory; |
3040 | client.OnUpdateInventoryItem += UpdateInventoryItemAsset; | 3195 | client.OnUpdateInventoryItem += UpdateInventoryItemAsset; |
3041 | client.OnCopyInventoryItem += CopyInventoryItem; | 3196 | client.OnCopyInventoryItem += CopyInventoryItem; |
3197 | client.OnMoveItemsAndLeaveCopy += MoveInventoryItemsLeaveCopy; | ||
3042 | client.OnMoveInventoryItem += MoveInventoryItem; | 3198 | client.OnMoveInventoryItem += MoveInventoryItem; |
3043 | client.OnRemoveInventoryItem += RemoveInventoryItem; | 3199 | client.OnRemoveInventoryItem += RemoveInventoryItem; |
3044 | client.OnRemoveInventoryFolder += RemoveInventoryFolder; | 3200 | client.OnRemoveInventoryFolder += RemoveInventoryFolder; |
@@ -3110,6 +3266,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
3110 | client.OnUpdatePrimGroupPosition -= m_sceneGraph.UpdatePrimGroupPosition; | 3266 | client.OnUpdatePrimGroupPosition -= m_sceneGraph.UpdatePrimGroupPosition; |
3111 | client.OnUpdatePrimSinglePosition -= m_sceneGraph.UpdatePrimSinglePosition; | 3267 | client.OnUpdatePrimSinglePosition -= m_sceneGraph.UpdatePrimSinglePosition; |
3112 | 3268 | ||
3269 | client.onClientChangeObject -= m_sceneGraph.ClientChangeObject; | ||
3270 | |||
3113 | client.OnUpdatePrimGroupRotation -= m_sceneGraph.UpdatePrimGroupRotation; | 3271 | client.OnUpdatePrimGroupRotation -= m_sceneGraph.UpdatePrimGroupRotation; |
3114 | client.OnUpdatePrimGroupMouseRotation -= m_sceneGraph.UpdatePrimGroupRotation; | 3272 | client.OnUpdatePrimGroupMouseRotation -= m_sceneGraph.UpdatePrimGroupRotation; |
3115 | client.OnUpdatePrimSingleRotation -= m_sceneGraph.UpdatePrimSingleRotation; | 3273 | client.OnUpdatePrimSingleRotation -= m_sceneGraph.UpdatePrimSingleRotation; |
@@ -3212,7 +3370,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3212 | /// </summary> | 3370 | /// </summary> |
3213 | /// <param name="agentId">The avatar's Unique ID</param> | 3371 | /// <param name="agentId">The avatar's Unique ID</param> |
3214 | /// <param name="client">The IClientAPI for the client</param> | 3372 | /// <param name="client">The IClientAPI for the client</param> |
3215 | public virtual void TeleportClientHome(UUID agentId, IClientAPI client) | 3373 | public virtual bool TeleportClientHome(UUID agentId, IClientAPI client) |
3216 | { | 3374 | { |
3217 | if (EntityTransferModule != null) | 3375 | if (EntityTransferModule != null) |
3218 | { | 3376 | { |
@@ -3223,6 +3381,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3223 | m_log.DebugFormat("[SCENE]: Unable to teleport user home: no AgentTransferModule is active"); | 3381 | m_log.DebugFormat("[SCENE]: Unable to teleport user home: no AgentTransferModule is active"); |
3224 | client.SendTeleportFailed("Unable to perform teleports on this simulator."); | 3382 | client.SendTeleportFailed("Unable to perform teleports on this simulator."); |
3225 | } | 3383 | } |
3384 | return false; | ||
3226 | } | 3385 | } |
3227 | 3386 | ||
3228 | /// <summary> | 3387 | /// <summary> |
@@ -3332,6 +3491,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
3332 | /// <param name="flags"></param> | 3491 | /// <param name="flags"></param> |
3333 | public virtual void SetHomeRezPoint(IClientAPI remoteClient, ulong regionHandle, Vector3 position, Vector3 lookAt, uint flags) | 3492 | public virtual void SetHomeRezPoint(IClientAPI remoteClient, ulong regionHandle, Vector3 position, Vector3 lookAt, uint flags) |
3334 | { | 3493 | { |
3494 | //Add half the avatar's height so that the user doesn't fall through prims | ||
3495 | ScenePresence presence; | ||
3496 | if (TryGetScenePresence(remoteClient.AgentId, out presence)) | ||
3497 | { | ||
3498 | if (presence.Appearance != null) | ||
3499 | { | ||
3500 | position.Z = position.Z + (presence.Appearance.AvatarHeight / 2); | ||
3501 | } | ||
3502 | } | ||
3503 | |||
3335 | if (GridUserService != null && GridUserService.SetHome(remoteClient.AgentId.ToString(), RegionInfo.RegionID, position, lookAt)) | 3504 | if (GridUserService != null && GridUserService.SetHome(remoteClient.AgentId.ToString(), RegionInfo.RegionID, position, lookAt)) |
3336 | // FUBAR ALERT: this needs to be "Home position set." so the viewer saves a home-screenshot. | 3505 | // FUBAR ALERT: this needs to be "Home position set." so the viewer saves a home-screenshot. |
3337 | m_dialogModule.SendAlertToUser(remoteClient, "Home position set."); | 3506 | m_dialogModule.SendAlertToUser(remoteClient, "Home position set."); |
@@ -3469,6 +3638,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3469 | // It's possible for child agents to have transactions if changes are being made cross-border. | 3638 | // It's possible for child agents to have transactions if changes are being made cross-border. |
3470 | if (AgentTransactionsModule != null) | 3639 | if (AgentTransactionsModule != null) |
3471 | AgentTransactionsModule.RemoveAgentAssetTransactions(agentID); | 3640 | AgentTransactionsModule.RemoveAgentAssetTransactions(agentID); |
3641 | m_log.Debug("[Scene] The avatar has left the building"); | ||
3472 | } | 3642 | } |
3473 | catch (Exception e) | 3643 | catch (Exception e) |
3474 | { | 3644 | { |
@@ -3661,38 +3831,39 @@ namespace OpenSim.Region.Framework.Scenes | |||
3661 | agent.firstname, agent.lastname, agent.Viewer); | 3831 | agent.firstname, agent.lastname, agent.Viewer); |
3662 | reason = "Access denied, your viewer is banned by the region owner"; | 3832 | reason = "Access denied, your viewer is banned by the region owner"; |
3663 | return false; | 3833 | return false; |
3664 | } | 3834 | } |
3665 | 3835 | ||
3666 | ILandObject land; | 3836 | |
3837 | ScenePresence sp = GetScenePresence(agent.AgentID); | ||
3838 | |||
3839 | if (sp != null && !sp.IsChildAgent) | ||
3840 | { | ||
3841 | // We have a zombie from a crashed session. | ||
3842 | // Or the same user is trying to be root twice here, won't work. | ||
3843 | // Kill it. | ||
3844 | m_log.WarnFormat( | ||
3845 | "[SCENE]: Existing root scene presence detected for {0} {1} in {2} when connecting. Removing existing presence.", | ||
3846 | sp.Name, sp.UUID, RegionInfo.RegionName); | ||
3847 | |||
3848 | sp.ControllingClient.Close(true, true); | ||
3849 | sp = null; | ||
3850 | } | ||
3667 | 3851 | ||
3668 | lock (agent) | 3852 | lock (agent) |
3669 | { | 3853 | { |
3670 | ScenePresence sp = GetScenePresence(agent.AgentID); | ||
3671 | |||
3672 | if (sp != null && !sp.IsChildAgent) | ||
3673 | { | ||
3674 | // We have a zombie from a crashed session. | ||
3675 | // Or the same user is trying to be root twice here, won't work. | ||
3676 | // Kill it. | ||
3677 | m_log.WarnFormat( | ||
3678 | "[SCENE]: Existing root scene presence detected for {0} {1} in {2} when connecting. Removing existing presence.", | ||
3679 | sp.Name, sp.UUID, RegionInfo.RegionName); | ||
3680 | |||
3681 | sp.ControllingClient.Close(true); | ||
3682 | sp = null; | ||
3683 | } | ||
3684 | |||
3685 | land = LandChannel.GetLandObject(agent.startpos.X, agent.startpos.Y); | ||
3686 | |||
3687 | //On login test land permisions | 3854 | //On login test land permisions |
3688 | if (vialogin) | 3855 | if (vialogin) |
3689 | { | 3856 | { |
3690 | if (land != null && !TestLandRestrictions(agent, land, out reason)) | 3857 | IUserAccountCacheModule cache = RequestModuleInterface<IUserAccountCacheModule>(); |
3858 | if (cache != null) | ||
3859 | cache.Remove(agent.firstname + " " + agent.lastname); | ||
3860 | if (!TestLandRestrictions(agent.AgentID, out reason, ref agent.startpos.X, ref agent.startpos.Y)) | ||
3691 | { | 3861 | { |
3862 | m_log.DebugFormat("[CONNECTION BEGIN]: Denying access to {0} due to no land access", agent.AgentID.ToString()); | ||
3692 | return false; | 3863 | return false; |
3693 | } | 3864 | } |
3694 | } | 3865 | } |
3695 | 3866 | ||
3696 | if (sp == null) // We don't have an [child] agent here already | 3867 | if (sp == null) // We don't have an [child] agent here already |
3697 | { | 3868 | { |
3698 | if (requirePresenceLookup) | 3869 | if (requirePresenceLookup) |
@@ -3701,34 +3872,36 @@ namespace OpenSim.Region.Framework.Scenes | |||
3701 | { | 3872 | { |
3702 | if (!VerifyUserPresence(agent, out reason)) | 3873 | if (!VerifyUserPresence(agent, out reason)) |
3703 | return false; | 3874 | return false; |
3704 | } | 3875 | } catch (Exception e) |
3705 | catch (Exception e) | ||
3706 | { | 3876 | { |
3707 | m_log.ErrorFormat( | 3877 | m_log.ErrorFormat( |
3708 | "[SCENE]: Exception verifying presence {0}{1}", e.Message, e.StackTrace); | 3878 | "[SCENE]: Exception verifying presence {0}{1}", e.Message, e.StackTrace); |
3709 | |||
3710 | return false; | 3879 | return false; |
3711 | } | 3880 | } |
3712 | } | 3881 | } |
3713 | 3882 | ||
3714 | try | 3883 | try |
3715 | { | 3884 | { |
3716 | if (!AuthorizeUser(agent, out reason)) | 3885 | // Always check estate if this is a login. Always |
3717 | return false; | 3886 | // check if banned regions are to be blacked out. |
3887 | if (vialogin || (!m_seeIntoBannedRegion)) | ||
3888 | { | ||
3889 | if (!AuthorizeUser(agent, out reason)) | ||
3890 | return false; | ||
3891 | } | ||
3718 | } | 3892 | } |
3719 | catch (Exception e) | 3893 | catch (Exception e) |
3720 | { | 3894 | { |
3721 | m_log.ErrorFormat( | 3895 | m_log.ErrorFormat( |
3722 | "[SCENE]: Exception authorizing user {0}{1}", e.Message, e.StackTrace); | 3896 | "[SCENE]: Exception authorizing user {0}{1}", e.Message, e.StackTrace); |
3723 | |||
3724 | return false; | 3897 | return false; |
3725 | } | 3898 | } |
3726 | 3899 | ||
3727 | m_log.InfoFormat( | 3900 | m_log.InfoFormat( |
3728 | "[SCENE]: Region {0} authenticated and authorized incoming {1} agent {2} {3} {4} (circuit code {5})", | 3901 | "[SCENE]: Region {0} authenticated and authorized incoming {1} agent {2} {3} {4} (circuit code {5})", |
3729 | RegionInfo.RegionName, (agent.child ? "child" : "root"), agent.firstname, agent.lastname, | 3902 | RegionInfo.RegionName, (agent.child ? "child" : "root"), agent.firstname, agent.lastname, |
3730 | agent.AgentID, agent.circuitcode); | 3903 | agent.AgentID, agent.circuitcode); |
3731 | 3904 | ||
3732 | if (CapsModule != null) | 3905 | if (CapsModule != null) |
3733 | { | 3906 | { |
3734 | CapsModule.SetAgentCapsSeeds(agent); | 3907 | CapsModule.SetAgentCapsSeeds(agent); |
@@ -3740,15 +3913,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
3740 | // Let the SP know how we got here. This has a lot of interesting | 3913 | // Let the SP know how we got here. This has a lot of interesting |
3741 | // uses down the line. | 3914 | // uses down the line. |
3742 | sp.TeleportFlags = (TPFlags)teleportFlags; | 3915 | sp.TeleportFlags = (TPFlags)teleportFlags; |
3743 | 3916 | ||
3744 | if (sp.IsChildAgent) | 3917 | if (sp.IsChildAgent) |
3745 | { | 3918 | { |
3746 | m_log.DebugFormat( | 3919 | m_log.DebugFormat( |
3747 | "[SCENE]: Adjusting known seeds for existing agent {0} in {1}", | 3920 | "[SCENE]: Adjusting known seeds for existing agent {0} in {1}", |
3748 | agent.AgentID, RegionInfo.RegionName); | 3921 | agent.AgentID, RegionInfo.RegionName); |
3749 | 3922 | ||
3750 | sp.AdjustKnownSeeds(); | 3923 | sp.AdjustKnownSeeds(); |
3751 | 3924 | ||
3752 | if (CapsModule != null) | 3925 | if (CapsModule != null) |
3753 | CapsModule.SetAgentCapsSeeds(agent); | 3926 | CapsModule.SetAgentCapsSeeds(agent); |
3754 | } | 3927 | } |
@@ -3850,6 +4023,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
3850 | } | 4023 | } |
3851 | 4024 | ||
3852 | // Honor parcel landing type and position. | 4025 | // Honor parcel landing type and position. |
4026 | /* | ||
4027 | ILandObject land = LandChannel.GetLandObject(agent.startpos.X, agent.startpos.Y); | ||
3853 | if (land != null) | 4028 | if (land != null) |
3854 | { | 4029 | { |
3855 | if (land.LandData.LandingType == (byte)1 && land.LandData.UserLocation != Vector3.Zero) | 4030 | if (land.LandData.LandingType == (byte)1 && land.LandData.UserLocation != Vector3.Zero) |
@@ -3857,25 +4032,43 @@ namespace OpenSim.Region.Framework.Scenes | |||
3857 | agent.startpos = land.LandData.UserLocation; | 4032 | agent.startpos = land.LandData.UserLocation; |
3858 | } | 4033 | } |
3859 | } | 4034 | } |
4035 | */// This is now handled properly in ScenePresence.MakeRootAgent | ||
3860 | } | 4036 | } |
3861 | 4037 | ||
3862 | return true; | 4038 | return true; |
3863 | } | 4039 | } |
3864 | 4040 | ||
3865 | private bool TestLandRestrictions(AgentCircuitData agent, ILandObject land, out string reason) | 4041 | public bool TestLandRestrictions(UUID agentID, out string reason, ref float posX, ref float posY) |
3866 | { | 4042 | { |
3867 | bool banned = land.IsBannedFromLand(agent.AgentID); | 4043 | if (posX < 0) |
3868 | bool restricted = land.IsRestrictedFromLand(agent.AgentID); | 4044 | posX = 0; |
4045 | else if (posX >= 256) | ||
4046 | posX = 255.999f; | ||
4047 | if (posY < 0) | ||
4048 | posY = 0; | ||
4049 | else if (posY >= 256) | ||
4050 | posY = 255.999f; | ||
4051 | |||
4052 | reason = String.Empty; | ||
4053 | if (Permissions.IsGod(agentID)) | ||
4054 | return true; | ||
4055 | |||
4056 | ILandObject land = LandChannel.GetLandObject(posX, posY); | ||
4057 | if (land == null) | ||
4058 | return false; | ||
4059 | |||
4060 | bool banned = land.IsBannedFromLand(agentID); | ||
4061 | bool restricted = land.IsRestrictedFromLand(agentID); | ||
3869 | 4062 | ||
3870 | if (banned || restricted) | 4063 | if (banned || restricted) |
3871 | { | 4064 | { |
3872 | ILandObject nearestParcel = GetNearestAllowedParcel(agent.AgentID, agent.startpos.X, agent.startpos.Y); | 4065 | ILandObject nearestParcel = GetNearestAllowedParcel(agentID, posX, posY); |
3873 | if (nearestParcel != null) | 4066 | if (nearestParcel != null) |
3874 | { | 4067 | { |
3875 | //Move agent to nearest allowed | 4068 | //Move agent to nearest allowed |
3876 | Vector3 newPosition = GetParcelCenterAtGround(nearestParcel); | 4069 | Vector3 newPosition = GetParcelCenterAtGround(nearestParcel); |
3877 | agent.startpos.X = newPosition.X; | 4070 | posX = newPosition.X; |
3878 | agent.startpos.Y = newPosition.Y; | 4071 | posY = newPosition.Y; |
3879 | } | 4072 | } |
3880 | else | 4073 | else |
3881 | { | 4074 | { |
@@ -3937,7 +4130,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3937 | 4130 | ||
3938 | if (!m_strictAccessControl) return true; | 4131 | if (!m_strictAccessControl) return true; |
3939 | if (Permissions.IsGod(agent.AgentID)) return true; | 4132 | if (Permissions.IsGod(agent.AgentID)) return true; |
3940 | 4133 | ||
3941 | if (AuthorizationService != null) | 4134 | if (AuthorizationService != null) |
3942 | { | 4135 | { |
3943 | if (!AuthorizationService.IsAuthorizedForRegion( | 4136 | if (!AuthorizationService.IsAuthorizedForRegion( |
@@ -3952,7 +4145,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3952 | 4145 | ||
3953 | if (RegionInfo.EstateSettings != null) | 4146 | if (RegionInfo.EstateSettings != null) |
3954 | { | 4147 | { |
3955 | if (RegionInfo.EstateSettings.IsBanned(agent.AgentID)) | 4148 | if (RegionInfo.EstateSettings.IsBanned(agent.AgentID, 0)) |
3956 | { | 4149 | { |
3957 | m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the user is on the banlist", | 4150 | m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the user is on the banlist", |
3958 | agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName); | 4151 | agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName); |
@@ -4142,6 +4335,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
4142 | 4335 | ||
4143 | // XPTO: if this agent is not allowed here as root, always return false | 4336 | // XPTO: if this agent is not allowed here as root, always return false |
4144 | 4337 | ||
4338 | // We have to wait until the viewer contacts this region after receiving EAC. | ||
4339 | // That calls AddNewClient, which finally creates the ScenePresence | ||
4340 | int flags = GetUserFlags(cAgentData.AgentID); | ||
4341 | if (RegionInfo.EstateSettings.IsBanned(cAgentData.AgentID, flags)) | ||
4342 | { | ||
4343 | m_log.DebugFormat("[SCENE]: Denying root agent entry to {0}: banned", cAgentData.AgentID); | ||
4344 | return false; | ||
4345 | } | ||
4346 | |||
4145 | // TODO: This check should probably be in QueryAccess(). | 4347 | // TODO: This check should probably be in QueryAccess(). |
4146 | ILandObject nearestParcel = GetNearestAllowedParcel(cAgentData.AgentID, Constants.RegionSize / 2, Constants.RegionSize / 2); | 4348 | ILandObject nearestParcel = GetNearestAllowedParcel(cAgentData.AgentID, Constants.RegionSize / 2, Constants.RegionSize / 2); |
4147 | if (nearestParcel == null) | 4349 | if (nearestParcel == null) |
@@ -4206,7 +4408,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4206 | /// <param name='agentID'></param> | 4408 | /// <param name='agentID'></param> |
4207 | protected virtual ScenePresence WaitGetScenePresence(UUID agentID) | 4409 | protected virtual ScenePresence WaitGetScenePresence(UUID agentID) |
4208 | { | 4410 | { |
4209 | int ntimes = 10; | 4411 | int ntimes = 30; |
4210 | ScenePresence sp = null; | 4412 | ScenePresence sp = null; |
4211 | while ((sp = GetScenePresence(agentID)) == null && (ntimes-- > 0)) | 4413 | while ((sp = GetScenePresence(agentID)) == null && (ntimes-- > 0)) |
4212 | Thread.Sleep(1000); | 4414 | Thread.Sleep(1000); |
@@ -4236,6 +4438,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
4236 | return false; | 4438 | return false; |
4237 | } | 4439 | } |
4238 | 4440 | ||
4441 | public bool IncomingCloseAgent(UUID agentID) | ||
4442 | { | ||
4443 | return IncomingCloseAgent(agentID, false); | ||
4444 | } | ||
4445 | |||
4446 | public bool IncomingCloseChildAgent(UUID agentID) | ||
4447 | { | ||
4448 | return IncomingCloseAgent(agentID, true); | ||
4449 | } | ||
4450 | |||
4239 | /// <summary> | 4451 | /// <summary> |
4240 | /// Tell a single agent to disconnect from the region. | 4452 | /// Tell a single agent to disconnect from the region. |
4241 | /// </summary> | 4453 | /// </summary> |
@@ -4251,7 +4463,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4251 | ScenePresence presence = m_sceneGraph.GetScenePresence(agentID); | 4463 | ScenePresence presence = m_sceneGraph.GetScenePresence(agentID); |
4252 | if (presence != null) | 4464 | if (presence != null) |
4253 | { | 4465 | { |
4254 | presence.ControllingClient.Close(force); | 4466 | presence.ControllingClient.Close(force, force); |
4255 | return true; | 4467 | return true; |
4256 | } | 4468 | } |
4257 | 4469 | ||
@@ -4911,35 +5123,81 @@ namespace OpenSim.Region.Framework.Scenes | |||
4911 | SimulationDataService.RemoveObject(uuid, RegionInfo.RegionID); | 5123 | SimulationDataService.RemoveObject(uuid, RegionInfo.RegionID); |
4912 | } | 5124 | } |
4913 | 5125 | ||
4914 | public int GetHealth() | 5126 | public int GetHealth(out int flags, out string message) |
4915 | { | 5127 | { |
4916 | // Returns: | 5128 | // Returns: |
4917 | // 1 = sim is up and accepting http requests. The heartbeat has | 5129 | // 1 = sim is up and accepting http requests. The heartbeat has |
4918 | // stopped and the sim is probably locked up, but a remote | 5130 | // stopped and the sim is probably locked up, but a remote |
4919 | // admin restart may succeed | 5131 | // admin restart may succeed |
4920 | // | 5132 | // |
4921 | // 2 = Sim is up and the heartbeat is running. The sim is likely | 5133 | // 2 = Sim is up and the heartbeat is running. The sim is likely |
4922 | // usable for people within and logins _may_ work | 5134 | // usable for people within |
4923 | // | 5135 | // |
4924 | // 3 = We have seen a new user enter within the past 4 minutes | 5136 | // 3 = Sim is up and one packet thread is running. Sim is |
5137 | // unstable and will not accept new logins | ||
5138 | // | ||
5139 | // 4 = Sim is up and both packet threads are running. Sim is | ||
5140 | // likely usable | ||
5141 | // | ||
5142 | // 5 = We have seen a new user enter within the past 4 minutes | ||
4925 | // which can be seen as positive confirmation of sim health | 5143 | // which can be seen as positive confirmation of sim health |
4926 | // | 5144 | // |
5145 | |||
5146 | flags = 0; | ||
5147 | message = String.Empty; | ||
5148 | |||
5149 | CheckHeartbeat(); | ||
5150 | |||
5151 | if (m_firstHeartbeat || (m_lastIncoming == 0 && m_lastOutgoing == 0)) | ||
5152 | { | ||
5153 | // We're still starting | ||
5154 | // 0 means "in startup", it can't happen another way, since | ||
5155 | // to get here, we must be able to accept http connections | ||
5156 | return 0; | ||
5157 | } | ||
5158 | |||
4927 | int health=1; // Start at 1, means we're up | 5159 | int health=1; // Start at 1, means we're up |
4928 | 5160 | ||
4929 | if ((Util.EnvironmentTickCountSubtract(m_lastFrameTick)) < 1000) | 5161 | if ((Util.EnvironmentTickCountSubtract(m_lastFrameTick)) < 1000) |
4930 | health += 1; | 5162 | { |
5163 | health+=1; | ||
5164 | flags |= 1; | ||
5165 | } | ||
5166 | |||
5167 | if (Util.EnvironmentTickCountSubtract(m_lastIncoming) < 1000) | ||
5168 | { | ||
5169 | health+=1; | ||
5170 | flags |= 2; | ||
5171 | } | ||
5172 | |||
5173 | if (Util.EnvironmentTickCountSubtract(m_lastOutgoing) < 1000) | ||
5174 | { | ||
5175 | health+=1; | ||
5176 | flags |= 4; | ||
5177 | } | ||
4931 | else | 5178 | else |
5179 | { | ||
5180 | int pid = System.Diagnostics.Process.GetCurrentProcess().Id; | ||
5181 | System.Diagnostics.Process proc = new System.Diagnostics.Process(); | ||
5182 | proc.EnableRaisingEvents=false; | ||
5183 | proc.StartInfo.FileName = "/bin/kill"; | ||
5184 | proc.StartInfo.Arguments = "-QUIT " + pid.ToString(); | ||
5185 | proc.Start(); | ||
5186 | proc.WaitForExit(); | ||
5187 | Thread.Sleep(1000); | ||
5188 | Environment.Exit(1); | ||
5189 | } | ||
5190 | |||
5191 | if (flags != 7) | ||
4932 | return health; | 5192 | return health; |
4933 | 5193 | ||
4934 | // A login in the last 4 mins? We can't be doing too badly | 5194 | // A login in the last 4 mins? We can't be doing too badly |
4935 | // | 5195 | // |
4936 | if ((Util.EnvironmentTickCountSubtract(m_LastLogin)) < 240000) | 5196 | if (Util.EnvironmentTickCountSubtract(m_LastLogin) < 240000) |
4937 | health++; | 5197 | health++; |
4938 | else | 5198 | else |
4939 | return health; | 5199 | return health; |
4940 | 5200 | ||
4941 | // CheckHeartbeat(); | ||
4942 | |||
4943 | return health; | 5201 | return health; |
4944 | } | 5202 | } |
4945 | 5203 | ||
@@ -5027,7 +5285,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
5027 | bool wasUsingPhysics = ((jointProxyObject.Flags & PrimFlags.Physics) != 0); | 5285 | bool wasUsingPhysics = ((jointProxyObject.Flags & PrimFlags.Physics) != 0); |
5028 | if (wasUsingPhysics) | 5286 | if (wasUsingPhysics) |
5029 | { | 5287 | { |
5030 | 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 | 5288 | 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 |
5031 | } | 5289 | } |
5032 | } | 5290 | } |
5033 | 5291 | ||
@@ -5126,14 +5384,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
5126 | return (((vsn.X * xdiff) + (vsn.Y * ydiff)) / (-1 * vsn.Z)) + p0.Z; | 5384 | return (((vsn.X * xdiff) + (vsn.Y * ydiff)) / (-1 * vsn.Z)) + p0.Z; |
5127 | } | 5385 | } |
5128 | 5386 | ||
5129 | // private void CheckHeartbeat() | 5387 | private void CheckHeartbeat() |
5130 | // { | 5388 | { |
5131 | // if (m_firstHeartbeat) | 5389 | if (m_firstHeartbeat) |
5132 | // return; | 5390 | return; |
5133 | // | 5391 | |
5134 | // if (Util.EnvironmentTickCountSubtract(m_lastFrameTick) > 2000) | 5392 | if ((Util.EnvironmentTickCountSubtract(m_lastFrameTick)) > 5000) |
5135 | // StartTimer(); | 5393 | Start(); |
5136 | // } | 5394 | } |
5137 | 5395 | ||
5138 | public override ISceneObject DeserializeObject(string representation) | 5396 | public override ISceneObject DeserializeObject(string representation) |
5139 | { | 5397 | { |
@@ -5145,9 +5403,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
5145 | get { return m_allowScriptCrossings; } | 5403 | get { return m_allowScriptCrossings; } |
5146 | } | 5404 | } |
5147 | 5405 | ||
5148 | public Vector3? GetNearestAllowedPosition(ScenePresence avatar) | 5406 | public Vector3 GetNearestAllowedPosition(ScenePresence avatar) |
5149 | { | 5407 | { |
5150 | ILandObject nearestParcel = GetNearestAllowedParcel(avatar.UUID, avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y); | 5408 | return GetNearestAllowedPosition(avatar, null); |
5409 | } | ||
5410 | |||
5411 | public Vector3 GetNearestAllowedPosition(ScenePresence avatar, ILandObject excludeParcel) | ||
5412 | { | ||
5413 | ILandObject nearestParcel = GetNearestAllowedParcel(avatar.UUID, avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y, excludeParcel); | ||
5151 | 5414 | ||
5152 | if (nearestParcel != null) | 5415 | if (nearestParcel != null) |
5153 | { | 5416 | { |
@@ -5156,10 +5419,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
5156 | Vector3? nearestPoint = GetNearestPointInParcelAlongDirectionFromPoint(avatar.AbsolutePosition, dir, nearestParcel); | 5419 | Vector3? nearestPoint = GetNearestPointInParcelAlongDirectionFromPoint(avatar.AbsolutePosition, dir, nearestParcel); |
5157 | if (nearestPoint != null) | 5420 | if (nearestPoint != null) |
5158 | { | 5421 | { |
5159 | // m_log.DebugFormat( | 5422 | Debug.WriteLine("Found a sane previous position based on velocity, sending them to: " + nearestPoint.ToString()); |
5160 | // "[SCENE]: Found a sane previous position based on velocity for {0}, sending them to {1} in {2}", | ||
5161 | // avatar.Name, nearestPoint, nearestParcel.LandData.Name); | ||
5162 | |||
5163 | return nearestPoint.Value; | 5423 | return nearestPoint.Value; |
5164 | } | 5424 | } |
5165 | 5425 | ||
@@ -5169,17 +5429,20 @@ namespace OpenSim.Region.Framework.Scenes | |||
5169 | nearestPoint = GetNearestPointInParcelAlongDirectionFromPoint(avatar.AbsolutePosition, dir, nearestParcel); | 5429 | nearestPoint = GetNearestPointInParcelAlongDirectionFromPoint(avatar.AbsolutePosition, dir, nearestParcel); |
5170 | if (nearestPoint != null) | 5430 | if (nearestPoint != null) |
5171 | { | 5431 | { |
5172 | // m_log.DebugFormat( | 5432 | Debug.WriteLine("They had a zero velocity, sending them to: " + nearestPoint.ToString()); |
5173 | // "[SCENE]: {0} had a zero velocity, sending them to {1}", avatar.Name, nearestPoint); | ||
5174 | |||
5175 | return nearestPoint.Value; | 5433 | return nearestPoint.Value; |
5176 | } | 5434 | } |
5177 | 5435 | ||
5178 | //Ultimate backup if we have no idea where they are | 5436 | ILandObject dest = LandChannel.GetLandObject(avatar.lastKnownAllowedPosition.X, avatar.lastKnownAllowedPosition.Y); |
5179 | // m_log.DebugFormat( | 5437 | if (dest != excludeParcel) |
5180 | // "[SCENE]: No idea where {0} is, sending them to {1}", avatar.Name, avatar.lastKnownAllowedPosition); | 5438 | { |
5439 | // Ultimate backup if we have no idea where they are and | ||
5440 | // the last allowed position was in another parcel | ||
5441 | Debug.WriteLine("Have no idea where they are, sending them to: " + avatar.lastKnownAllowedPosition.ToString()); | ||
5442 | return avatar.lastKnownAllowedPosition; | ||
5443 | } | ||
5181 | 5444 | ||
5182 | return avatar.lastKnownAllowedPosition; | 5445 | // else fall through to region edge |
5183 | } | 5446 | } |
5184 | 5447 | ||
5185 | //Go to the edge, this happens in teleporting to a region with no available parcels | 5448 | //Go to the edge, this happens in teleporting to a region with no available parcels |
@@ -5213,13 +5476,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
5213 | 5476 | ||
5214 | public ILandObject GetNearestAllowedParcel(UUID avatarId, float x, float y) | 5477 | public ILandObject GetNearestAllowedParcel(UUID avatarId, float x, float y) |
5215 | { | 5478 | { |
5479 | return GetNearestAllowedParcel(avatarId, x, y, null); | ||
5480 | } | ||
5481 | |||
5482 | public ILandObject GetNearestAllowedParcel(UUID avatarId, float x, float y, ILandObject excludeParcel) | ||
5483 | { | ||
5216 | List<ILandObject> all = AllParcels(); | 5484 | List<ILandObject> all = AllParcels(); |
5217 | float minParcelDistance = float.MaxValue; | 5485 | float minParcelDistance = float.MaxValue; |
5218 | ILandObject nearestParcel = null; | 5486 | ILandObject nearestParcel = null; |
5219 | 5487 | ||
5220 | foreach (var parcel in all) | 5488 | foreach (var parcel in all) |
5221 | { | 5489 | { |
5222 | if (!parcel.IsEitherBannedOrRestricted(avatarId)) | 5490 | if (!parcel.IsEitherBannedOrRestricted(avatarId) && parcel != excludeParcel) |
5223 | { | 5491 | { |
5224 | float parcelDistance = GetParcelDistancefromPoint(parcel, x, y); | 5492 | float parcelDistance = GetParcelDistancefromPoint(parcel, x, y); |
5225 | if (parcelDistance < minParcelDistance) | 5493 | if (parcelDistance < minParcelDistance) |
@@ -5435,7 +5703,55 @@ namespace OpenSim.Region.Framework.Scenes | |||
5435 | mapModule.GenerateMaptile(); | 5703 | mapModule.GenerateMaptile(); |
5436 | } | 5704 | } |
5437 | 5705 | ||
5438 | private void RegenerateMaptileAndReregister(object sender, ElapsedEventArgs e) | 5706 | // public void CleanDroppedAttachments() |
5707 | // { | ||
5708 | // List<SceneObjectGroup> objectsToDelete = | ||
5709 | // new List<SceneObjectGroup>(); | ||
5710 | // | ||
5711 | // lock (m_cleaningAttachments) | ||
5712 | // { | ||
5713 | // ForEachSOG(delegate (SceneObjectGroup grp) | ||
5714 | // { | ||
5715 | // if (grp.RootPart.Shape.PCode == 0 && grp.RootPart.Shape.State != 0 && (!objectsToDelete.Contains(grp))) | ||
5716 | // { | ||
5717 | // UUID agentID = grp.OwnerID; | ||
5718 | // if (agentID == UUID.Zero) | ||
5719 | // { | ||
5720 | // objectsToDelete.Add(grp); | ||
5721 | // return; | ||
5722 | // } | ||
5723 | // | ||
5724 | // ScenePresence sp = GetScenePresence(agentID); | ||
5725 | // if (sp == null) | ||
5726 | // { | ||
5727 | // objectsToDelete.Add(grp); | ||
5728 | // return; | ||
5729 | // } | ||
5730 | // } | ||
5731 | // }); | ||
5732 | // } | ||
5733 | // | ||
5734 | // foreach (SceneObjectGroup grp in objectsToDelete) | ||
5735 | // { | ||
5736 | // m_log.InfoFormat("[SCENE]: Deleting dropped attachment {0} of user {1}", grp.UUID, grp.OwnerID); | ||
5737 | // DeleteSceneObject(grp, true); | ||
5738 | // } | ||
5739 | // } | ||
5740 | |||
5741 | public void ThreadAlive(int threadCode) | ||
5742 | { | ||
5743 | switch(threadCode) | ||
5744 | { | ||
5745 | case 1: // Incoming | ||
5746 | m_lastIncoming = Util.EnvironmentTickCount(); | ||
5747 | break; | ||
5748 | case 2: // Incoming | ||
5749 | m_lastOutgoing = Util.EnvironmentTickCount(); | ||
5750 | break; | ||
5751 | } | ||
5752 | } | ||
5753 | |||
5754 | public void RegenerateMaptileAndReregister(object sender, ElapsedEventArgs e) | ||
5439 | { | 5755 | { |
5440 | RegenerateMaptile(); | 5756 | RegenerateMaptile(); |
5441 | 5757 | ||
@@ -5463,6 +5779,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
5463 | /// <returns></returns> | 5779 | /// <returns></returns> |
5464 | public bool QueryAccess(UUID agentID, Vector3 position, out string reason) | 5780 | public bool QueryAccess(UUID agentID, Vector3 position, out string reason) |
5465 | { | 5781 | { |
5782 | reason = "You are banned from the region"; | ||
5783 | |||
5466 | if (EntityTransferModule.IsInTransit(agentID)) | 5784 | if (EntityTransferModule.IsInTransit(agentID)) |
5467 | { | 5785 | { |
5468 | reason = "Agent is still in transit from this region"; | 5786 | reason = "Agent is still in transit from this region"; |
@@ -5474,6 +5792,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
5474 | return false; | 5792 | return false; |
5475 | } | 5793 | } |
5476 | 5794 | ||
5795 | if (Permissions.IsGod(agentID)) | ||
5796 | { | ||
5797 | reason = String.Empty; | ||
5798 | return true; | ||
5799 | } | ||
5800 | |||
5477 | // FIXME: Root agent count is currently known to be inaccurate. This forces a recount before we check. | 5801 | // FIXME: Root agent count is currently known to be inaccurate. This forces a recount before we check. |
5478 | // However, the long term fix is to make sure root agent count is always accurate. | 5802 | // However, the long term fix is to make sure root agent count is always accurate. |
5479 | m_sceneGraph.RecalculateStats(); | 5803 | m_sceneGraph.RecalculateStats(); |
@@ -5494,6 +5818,41 @@ namespace OpenSim.Region.Framework.Scenes | |||
5494 | } | 5818 | } |
5495 | } | 5819 | } |
5496 | 5820 | ||
5821 | ScenePresence presence = GetScenePresence(agentID); | ||
5822 | IClientAPI client = null; | ||
5823 | AgentCircuitData aCircuit = null; | ||
5824 | |||
5825 | if (presence != null) | ||
5826 | { | ||
5827 | client = presence.ControllingClient; | ||
5828 | if (client != null) | ||
5829 | aCircuit = client.RequestClientInfo(); | ||
5830 | } | ||
5831 | |||
5832 | // We may be called before there is a presence or a client. | ||
5833 | // Fake AgentCircuitData to keep IAuthorizationModule smiling | ||
5834 | if (client == null) | ||
5835 | { | ||
5836 | aCircuit = new AgentCircuitData(); | ||
5837 | aCircuit.AgentID = agentID; | ||
5838 | aCircuit.firstname = String.Empty; | ||
5839 | aCircuit.lastname = String.Empty; | ||
5840 | } | ||
5841 | |||
5842 | try | ||
5843 | { | ||
5844 | if (!AuthorizeUser(aCircuit, out reason)) | ||
5845 | { | ||
5846 | // m_log.DebugFormat("[SCENE]: Denying access for {0}", agentID); | ||
5847 | return false; | ||
5848 | } | ||
5849 | } | ||
5850 | catch (Exception e) | ||
5851 | { | ||
5852 | m_log.DebugFormat("[SCENE]: Exception authorizing agent: {0} "+ e.StackTrace, e.Message); | ||
5853 | return false; | ||
5854 | } | ||
5855 | |||
5497 | if (position == Vector3.Zero) // Teleport | 5856 | if (position == Vector3.Zero) // Teleport |
5498 | { | 5857 | { |
5499 | if (!RegionInfo.EstateSettings.AllowDirectTeleport) | 5858 | if (!RegionInfo.EstateSettings.AllowDirectTeleport) |
@@ -5522,13 +5881,46 @@ namespace OpenSim.Region.Framework.Scenes | |||
5522 | } | 5881 | } |
5523 | } | 5882 | } |
5524 | } | 5883 | } |
5884 | |||
5885 | float posX = 128.0f; | ||
5886 | float posY = 128.0f; | ||
5887 | |||
5888 | if (!TestLandRestrictions(agentID, out reason, ref posX, ref posY)) | ||
5889 | { | ||
5890 | // m_log.DebugFormat("[SCENE]: Denying {0} because they are banned on all parcels", agentID); | ||
5891 | return false; | ||
5892 | } | ||
5893 | } | ||
5894 | else // Walking | ||
5895 | { | ||
5896 | ILandObject land = LandChannel.GetLandObject(position.X, position.Y); | ||
5897 | if (land == null) | ||
5898 | return false; | ||
5899 | |||
5900 | bool banned = land.IsBannedFromLand(agentID); | ||
5901 | bool restricted = land.IsRestrictedFromLand(agentID); | ||
5902 | |||
5903 | if (banned || restricted) | ||
5904 | return false; | ||
5525 | } | 5905 | } |
5526 | 5906 | ||
5527 | reason = String.Empty; | 5907 | reason = String.Empty; |
5528 | return true; | 5908 | return true; |
5529 | } | 5909 | } |
5530 | 5910 | ||
5531 | /// <summary> | 5911 | public void StartTimerWatchdog() |
5912 | { | ||
5913 | m_timerWatchdog.Interval = 1000; | ||
5914 | m_timerWatchdog.Elapsed += TimerWatchdog; | ||
5915 | m_timerWatchdog.AutoReset = true; | ||
5916 | m_timerWatchdog.Start(); | ||
5917 | } | ||
5918 | |||
5919 | public void TimerWatchdog(object sender, ElapsedEventArgs e) | ||
5920 | { | ||
5921 | CheckHeartbeat(); | ||
5922 | } | ||
5923 | |||
5532 | /// This method deals with movement when an avatar is automatically moving (but this is distinct from the | 5924 | /// This method deals with movement when an avatar is automatically moving (but this is distinct from the |
5533 | /// autopilot that moves an avatar to a sit target!. | 5925 | /// autopilot that moves an avatar to a sit target!. |
5534 | /// </summary> | 5926 | /// </summary> |
@@ -5607,6 +5999,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
5607 | return m_SpawnPoint - 1; | 5999 | return m_SpawnPoint - 1; |
5608 | } | 6000 | } |
5609 | 6001 | ||
6002 | private void HandleGcCollect(string module, string[] args) | ||
6003 | { | ||
6004 | GC.Collect(); | ||
6005 | } | ||
6006 | |||
5610 | /// <summary> | 6007 | /// <summary> |
5611 | /// Wrappers to get physics modules retrieve assets. | 6008 | /// Wrappers to get physics modules retrieve assets. |
5612 | /// </summary> | 6009 | /// </summary> |