diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Scene.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.cs | 862 |
1 files changed, 629 insertions, 233 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 5f45529..45d512b 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -156,8 +156,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
156 | // TODO: need to figure out how allow client agents but deny | 156 | // TODO: need to figure out how allow client agents but deny |
157 | // root agents when ACL denies access to root agent | 157 | // root agents when ACL denies access to root agent |
158 | public bool m_strictAccessControl = true; | 158 | public bool m_strictAccessControl = true; |
159 | 159 | public bool m_seeIntoBannedRegion = false; | |
160 | public int MaxUndoCount { get; set; } | 160 | public int MaxUndoCount = 5; |
161 | 161 | ||
162 | // Using this for RegionReady module to prevent LoginsDisabled from changing under our feet; | 162 | // Using this for RegionReady module to prevent LoginsDisabled from changing under our feet; |
163 | public bool LoginLock = false; | 163 | public bool LoginLock = false; |
@@ -173,12 +173,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
173 | 173 | ||
174 | protected int m_splitRegionID; | 174 | protected int m_splitRegionID; |
175 | protected Timer m_restartWaitTimer = new Timer(); | 175 | protected Timer m_restartWaitTimer = new Timer(); |
176 | protected Timer m_timerWatchdog = new Timer(); | ||
176 | protected List<RegionInfo> m_regionRestartNotifyList = new List<RegionInfo>(); | 177 | protected List<RegionInfo> m_regionRestartNotifyList = new List<RegionInfo>(); |
177 | protected List<RegionInfo> m_neighbours = new List<RegionInfo>(); | 178 | protected List<RegionInfo> m_neighbours = new List<RegionInfo>(); |
178 | protected string m_simulatorVersion = "OpenSimulator Server"; | 179 | protected string m_simulatorVersion = "OpenSimulator Server"; |
179 | protected ModuleLoader m_moduleLoader; | 180 | protected ModuleLoader m_moduleLoader; |
180 | protected AgentCircuitManager m_authenticateHandler; | 181 | protected AgentCircuitManager m_authenticateHandler; |
181 | protected SceneCommunicationService m_sceneGridService; | 182 | protected SceneCommunicationService m_sceneGridService; |
183 | protected ISnmpModule m_snmpService = null; | ||
182 | 184 | ||
183 | protected ISimulationDataService m_SimulationDataService; | 185 | protected ISimulationDataService m_SimulationDataService; |
184 | protected IEstateDataService m_EstateDataService; | 186 | protected IEstateDataService m_EstateDataService; |
@@ -241,8 +243,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
241 | private int m_update_presences = 1; // Update scene presence movements | 243 | private int m_update_presences = 1; // Update scene presence movements |
242 | private int m_update_events = 1; | 244 | private int m_update_events = 1; |
243 | private int m_update_backup = 200; | 245 | private int m_update_backup = 200; |
244 | private int m_update_terrain = 50; | 246 | private int m_update_terrain = 1000; |
245 | // private int m_update_land = 1; | 247 | private int m_update_land = 10; |
246 | private int m_update_coarse_locations = 50; | 248 | private int m_update_coarse_locations = 50; |
247 | 249 | ||
248 | private int agentMS; | 250 | private int agentMS; |
@@ -255,13 +257,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
255 | private int backupMS; | 257 | private int backupMS; |
256 | private int terrainMS; | 258 | private int terrainMS; |
257 | private int landMS; | 259 | private int landMS; |
258 | private int spareMS; | ||
259 | 260 | ||
260 | /// <summary> | 261 | /// <summary> |
261 | /// Tick at which the last frame was processed. | 262 | /// Tick at which the last frame was processed. |
262 | /// </summary> | 263 | /// </summary> |
263 | private int m_lastFrameTick; | 264 | private int m_lastFrameTick; |
264 | 265 | ||
266 | public bool CombineRegions = false; | ||
265 | /// <summary> | 267 | /// <summary> |
266 | /// Tick at which the last maintenance run occurred. | 268 | /// Tick at which the last maintenance run occurred. |
267 | /// </summary> | 269 | /// </summary> |
@@ -292,6 +294,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
292 | /// </summary> | 294 | /// </summary> |
293 | private int m_LastLogin; | 295 | private int m_LastLogin; |
294 | 296 | ||
297 | private int m_lastIncoming; | ||
298 | private int m_lastOutgoing; | ||
299 | private int m_hbRestarts = 0; | ||
300 | |||
301 | |||
295 | /// <summary> | 302 | /// <summary> |
296 | /// Thread that runs the scene loop. | 303 | /// Thread that runs the scene loop. |
297 | /// </summary> | 304 | /// </summary> |
@@ -332,7 +339,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
332 | private volatile bool m_active; | 339 | private volatile bool m_active; |
333 | 340 | ||
334 | // private int m_lastUpdate; | 341 | // private int m_lastUpdate; |
335 | // private bool m_firstHeartbeat = true; | 342 | private bool m_firstHeartbeat = true; |
336 | 343 | ||
337 | private UpdatePrioritizationSchemes m_priorityScheme = UpdatePrioritizationSchemes.Time; | 344 | private UpdatePrioritizationSchemes m_priorityScheme = UpdatePrioritizationSchemes.Time; |
338 | private bool m_reprioritizationEnabled = true; | 345 | private bool m_reprioritizationEnabled = true; |
@@ -377,6 +384,19 @@ namespace OpenSim.Region.Framework.Scenes | |||
377 | get { return m_sceneGridService; } | 384 | get { return m_sceneGridService; } |
378 | } | 385 | } |
379 | 386 | ||
387 | public ISnmpModule SnmpService | ||
388 | { | ||
389 | get | ||
390 | { | ||
391 | if (m_snmpService == null) | ||
392 | { | ||
393 | m_snmpService = RequestModuleInterface<ISnmpModule>(); | ||
394 | } | ||
395 | |||
396 | return m_snmpService; | ||
397 | } | ||
398 | } | ||
399 | |||
380 | public ISimulationDataService SimulationDataService | 400 | public ISimulationDataService SimulationDataService |
381 | { | 401 | { |
382 | get | 402 | get |
@@ -676,6 +696,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
676 | m_SimulationDataService = simDataService; | 696 | m_SimulationDataService = simDataService; |
677 | m_EstateDataService = estateDataService; | 697 | m_EstateDataService = estateDataService; |
678 | m_regionHandle = RegionInfo.RegionHandle; | 698 | m_regionHandle = RegionInfo.RegionHandle; |
699 | m_lastIncoming = 0; | ||
700 | m_lastOutgoing = 0; | ||
679 | 701 | ||
680 | m_asyncSceneObjectDeleter = new AsyncSceneObjectGroupDeleter(this); | 702 | m_asyncSceneObjectDeleter = new AsyncSceneObjectGroupDeleter(this); |
681 | m_asyncSceneObjectDeleter.Enabled = true; | 703 | m_asyncSceneObjectDeleter.Enabled = true; |
@@ -758,132 +780,141 @@ namespace OpenSim.Region.Framework.Scenes | |||
758 | 780 | ||
759 | // Region config overrides global config | 781 | // Region config overrides global config |
760 | // | 782 | // |
761 | if (m_config.Configs["Startup"] != null) | 783 | try |
762 | { | 784 | { |
763 | IConfig startupConfig = m_config.Configs["Startup"]; | 785 | if (m_config.Configs["Startup"] != null) |
764 | |||
765 | StartDisabled = startupConfig.GetBoolean("StartDisabled", false); | ||
766 | |||
767 | m_defaultDrawDistance = startupConfig.GetFloat("DefaultDrawDistance", m_defaultDrawDistance); | ||
768 | m_useBackup = startupConfig.GetBoolean("UseSceneBackup", m_useBackup); | ||
769 | if (!m_useBackup) | ||
770 | m_log.InfoFormat("[SCENE]: Backup has been disabled for {0}", RegionInfo.RegionName); | ||
771 | |||
772 | //Animation states | ||
773 | m_useFlySlow = startupConfig.GetBoolean("enableflyslow", false); | ||
774 | |||
775 | MaxUndoCount = startupConfig.GetInt("MaxPrimUndos", 20); | ||
776 | |||
777 | PhysicalPrims = startupConfig.GetBoolean("physical_prim", PhysicalPrims); | ||
778 | CollidablePrims = startupConfig.GetBoolean("collidable_prim", CollidablePrims); | ||
779 | |||
780 | m_minNonphys = startupConfig.GetFloat("NonPhysicalPrimMin", m_minNonphys); | ||
781 | if (RegionInfo.NonphysPrimMin > 0) | ||
782 | { | 786 | { |
783 | m_minNonphys = RegionInfo.NonphysPrimMin; | 787 | IConfig startupConfig = m_config.Configs["Startup"]; |
784 | } | ||
785 | 788 | ||
786 | m_maxNonphys = startupConfig.GetFloat("NonPhysicalPrimMax", m_maxNonphys); | 789 | StartDisabled = startupConfig.GetBoolean("StartDisabled", false); |
787 | if (RegionInfo.NonphysPrimMax > 0) | ||
788 | { | ||
789 | m_maxNonphys = RegionInfo.NonphysPrimMax; | ||
790 | } | ||
791 | 790 | ||
792 | m_minPhys = startupConfig.GetFloat("PhysicalPrimMin", m_minPhys); | 791 | m_defaultDrawDistance = startupConfig.GetFloat("DefaultDrawDistance",m_defaultDrawDistance); |
793 | if (RegionInfo.PhysPrimMin > 0) | 792 | m_useBackup = startupConfig.GetBoolean("UseSceneBackup", m_useBackup); |
794 | { | 793 | if (!m_useBackup) |
795 | m_minPhys = RegionInfo.PhysPrimMin; | 794 | m_log.InfoFormat("[SCENE]: Backup has been disabled for {0}", RegionInfo.RegionName); |
796 | } | 795 | |
796 | //Animation states | ||
797 | m_useFlySlow = startupConfig.GetBoolean("enableflyslow", false); | ||
797 | 798 | ||
798 | m_maxPhys = startupConfig.GetFloat("PhysicalPrimMax", m_maxPhys); | 799 | PhysicalPrims = startupConfig.GetBoolean("physical_prim", true); |
799 | if (RegionInfo.PhysPrimMax > 0) | 800 | CollidablePrims = startupConfig.GetBoolean("collidable_prim", true); |
800 | { | ||
801 | m_maxPhys = RegionInfo.PhysPrimMax; | ||
802 | } | ||
803 | 801 | ||
804 | // Here, if clamping is requested in either global or | 802 | m_minNonphys = startupConfig.GetFloat("NonPhysicalPrimMin", m_minNonphys); |
805 | // local config, it will be used | 803 | if (RegionInfo.NonphysPrimMin > 0) |
806 | // | 804 | { |
807 | m_clampPrimSize = startupConfig.GetBoolean("ClampPrimSize", m_clampPrimSize); | 805 | m_minNonphys = RegionInfo.NonphysPrimMin; |
808 | if (RegionInfo.ClampPrimSize) | 806 | } |
809 | { | ||
810 | m_clampPrimSize = true; | ||
811 | } | ||
812 | 807 | ||
813 | m_linksetCapacity = startupConfig.GetInt("LinksetPrims", m_linksetCapacity); | 808 | m_maxNonphys = startupConfig.GetFloat("NonPhysicalPrimMax", m_maxNonphys); |
814 | if (RegionInfo.LinksetCapacity > 0) | 809 | if (RegionInfo.NonphysPrimMax > 0) |
815 | { | 810 | { |
816 | m_linksetCapacity = RegionInfo.LinksetCapacity; | 811 | m_maxNonphys = RegionInfo.NonphysPrimMax; |
817 | } | 812 | } |
818 | 813 | ||
819 | m_useTrashOnDelete = startupConfig.GetBoolean("UseTrashOnDelete", m_useTrashOnDelete); | 814 | m_minPhys = startupConfig.GetFloat("PhysicalPrimMin", m_minPhys); |
820 | m_trustBinaries = startupConfig.GetBoolean("TrustBinaries", m_trustBinaries); | 815 | if (RegionInfo.PhysPrimMin > 0) |
821 | m_allowScriptCrossings = startupConfig.GetBoolean("AllowScriptCrossing", m_allowScriptCrossings); | 816 | { |
822 | m_dontPersistBefore = | 817 | m_minPhys = RegionInfo.PhysPrimMin; |
823 | startupConfig.GetLong("MinimumTimeBeforePersistenceConsidered", DEFAULT_MIN_TIME_FOR_PERSISTENCE); | 818 | } |
824 | m_dontPersistBefore *= 10000000; | ||
825 | m_persistAfter = | ||
826 | startupConfig.GetLong("MaximumTimeBeforePersistenceConsidered", DEFAULT_MAX_TIME_FOR_PERSISTENCE); | ||
827 | m_persistAfter *= 10000000; | ||
828 | 819 | ||
829 | m_defaultScriptEngine = startupConfig.GetString("DefaultScriptEngine", "XEngine"); | 820 | m_maxPhys = startupConfig.GetFloat("PhysicalPrimMax", m_maxPhys); |
830 | 821 | ||
831 | SpawnPointRouting = startupConfig.GetString("SpawnPointRouting", "closest"); | 822 | if (RegionInfo.PhysPrimMax > 0) |
832 | TelehubAllowLandmarks = startupConfig.GetBoolean("TelehubAllowLandmark", false); | 823 | { |
824 | m_maxPhys = RegionInfo.PhysPrimMax; | ||
825 | } | ||
833 | 826 | ||
834 | m_strictAccessControl = startupConfig.GetBoolean("StrictAccessControl", m_strictAccessControl); | 827 | m_linksetCapacity = startupConfig.GetInt("LinksetPrims", m_linksetCapacity); |
828 | if (RegionInfo.LinksetCapacity > 0) | ||
829 | { | ||
830 | m_linksetCapacity = RegionInfo.LinksetCapacity; | ||
831 | } | ||
835 | 832 | ||
836 | m_generateMaptiles = startupConfig.GetBoolean("GenerateMaptiles", true); | 833 | SpawnPointRouting = startupConfig.GetString("SpawnPointRouting", "closest"); |
837 | if (m_generateMaptiles) | 834 | TelehubAllowLandmarks = startupConfig.GetBoolean("TelehubAllowLandmark", false); |
838 | { | 835 | |
839 | int maptileRefresh = startupConfig.GetInt("MaptileRefresh", 0); | 836 | // Here, if clamping is requested in either global or |
840 | if (maptileRefresh != 0) | 837 | // local config, it will be used |
838 | // | ||
839 | m_clampPrimSize = startupConfig.GetBoolean("ClampPrimSize", m_clampPrimSize); | ||
840 | if (RegionInfo.ClampPrimSize) | ||
841 | { | 841 | { |
842 | m_mapGenerationTimer.Interval = maptileRefresh * 1000; | 842 | m_clampPrimSize = true; |
843 | m_mapGenerationTimer.Elapsed += RegenerateMaptileAndReregister; | ||
844 | m_mapGenerationTimer.AutoReset = true; | ||
845 | m_mapGenerationTimer.Start(); | ||
846 | } | 843 | } |
847 | } | ||
848 | else | ||
849 | { | ||
850 | string tile = startupConfig.GetString("MaptileStaticUUID", UUID.Zero.ToString()); | ||
851 | UUID tileID; | ||
852 | 844 | ||
853 | if (UUID.TryParse(tile, out tileID)) | 845 | m_useTrashOnDelete = startupConfig.GetBoolean("UseTrashOnDelete",m_useTrashOnDelete); |
846 | m_trustBinaries = startupConfig.GetBoolean("TrustBinaries", m_trustBinaries); | ||
847 | m_allowScriptCrossings = startupConfig.GetBoolean("AllowScriptCrossing", m_allowScriptCrossings); | ||
848 | m_dontPersistBefore = | ||
849 | startupConfig.GetLong("MinimumTimeBeforePersistenceConsidered", DEFAULT_MIN_TIME_FOR_PERSISTENCE); | ||
850 | m_dontPersistBefore *= 10000000; | ||
851 | m_persistAfter = | ||
852 | startupConfig.GetLong("MaximumTimeBeforePersistenceConsidered", DEFAULT_MAX_TIME_FOR_PERSISTENCE); | ||
853 | m_persistAfter *= 10000000; | ||
854 | |||
855 | m_defaultScriptEngine = startupConfig.GetString("DefaultScriptEngine", "XEngine"); | ||
856 | m_log.InfoFormat("[SCENE]: Default script engine {0}", m_defaultScriptEngine); | ||
857 | |||
858 | m_strictAccessControl = startupConfig.GetBoolean("StrictAccessControl", m_strictAccessControl); | ||
859 | m_seeIntoBannedRegion = startupConfig.GetBoolean("SeeIntoBannedRegion", m_seeIntoBannedRegion); | ||
860 | CombineRegions = startupConfig.GetBoolean("CombineContiguousRegions", false); | ||
861 | |||
862 | m_generateMaptiles = startupConfig.GetBoolean("GenerateMaptiles", true); | ||
863 | if (m_generateMaptiles) | ||
854 | { | 864 | { |
855 | RegionInfo.RegionSettings.TerrainImageID = tileID; | 865 | int maptileRefresh = startupConfig.GetInt("MaptileRefresh", 0); |
866 | if (maptileRefresh != 0) | ||
867 | { | ||
868 | m_mapGenerationTimer.Interval = maptileRefresh * 1000; | ||
869 | m_mapGenerationTimer.Elapsed += RegenerateMaptileAndReregister; | ||
870 | m_mapGenerationTimer.AutoReset = true; | ||
871 | m_mapGenerationTimer.Start(); | ||
872 | } | ||
856 | } | 873 | } |
857 | } | 874 | else |
875 | { | ||
876 | string tile = startupConfig.GetString("MaptileStaticUUID", UUID.Zero.ToString()); | ||
877 | UUID tileID; | ||
858 | 878 | ||
859 | string grant = startupConfig.GetString("AllowedClients", String.Empty); | 879 | if (UUID.TryParse(tile, out tileID)) |
860 | if (grant.Length > 0) | 880 | { |
861 | { | 881 | RegionInfo.RegionSettings.TerrainImageID = tileID; |
862 | foreach (string viewer in grant.Split('|')) | 882 | } |
883 | } | ||
884 | |||
885 | string grant = startupConfig.GetString("AllowedClients", String.Empty); | ||
886 | if (grant.Length > 0) | ||
863 | { | 887 | { |
864 | m_AllowedViewers.Add(viewer.Trim().ToLower()); | 888 | foreach (string viewer in grant.Split(',')) |
889 | { | ||
890 | m_AllowedViewers.Add(viewer.Trim().ToLower()); | ||
891 | } | ||
865 | } | 892 | } |
866 | } | ||
867 | 893 | ||
868 | grant = startupConfig.GetString("BannedClients", String.Empty); | 894 | grant = startupConfig.GetString("BannedClients", String.Empty); |
869 | if (grant.Length > 0) | 895 | if (grant.Length > 0) |
870 | { | ||
871 | foreach (string viewer in grant.Split('|')) | ||
872 | { | 896 | { |
873 | m_BannedViewers.Add(viewer.Trim().ToLower()); | 897 | foreach (string viewer in grant.Split(',')) |
898 | { | ||
899 | m_BannedViewers.Add(viewer.Trim().ToLower()); | ||
900 | } | ||
874 | } | 901 | } |
875 | } | ||
876 | 902 | ||
877 | MinFrameTime = startupConfig.GetFloat( "MinFrameTime", MinFrameTime); | 903 | MinFrameTime = startupConfig.GetFloat( "MinFrameTime", MinFrameTime); |
878 | m_update_backup = startupConfig.GetInt( "UpdateStorageEveryNFrames", m_update_backup); | 904 | m_update_backup = startupConfig.GetInt( "UpdateStorageEveryNFrames", m_update_backup); |
879 | m_update_coarse_locations = startupConfig.GetInt( "UpdateCoarseLocationsEveryNFrames", m_update_coarse_locations); | 905 | m_update_coarse_locations = startupConfig.GetInt( "UpdateCoarseLocationsEveryNFrames", m_update_coarse_locations); |
880 | m_update_entitymovement = startupConfig.GetInt( "UpdateEntityMovementEveryNFrames", m_update_entitymovement); | 906 | m_update_entitymovement = startupConfig.GetInt( "UpdateEntityMovementEveryNFrames", m_update_entitymovement); |
881 | m_update_events = startupConfig.GetInt( "UpdateEventsEveryNFrames", m_update_events); | 907 | m_update_events = startupConfig.GetInt( "UpdateEventsEveryNFrames", m_update_events); |
882 | m_update_objects = startupConfig.GetInt( "UpdateObjectsEveryNFrames", m_update_objects); | 908 | m_update_objects = startupConfig.GetInt( "UpdateObjectsEveryNFrames", m_update_objects); |
883 | m_update_physics = startupConfig.GetInt( "UpdatePhysicsEveryNFrames", m_update_physics); | 909 | m_update_physics = startupConfig.GetInt( "UpdatePhysicsEveryNFrames", m_update_physics); |
884 | m_update_presences = startupConfig.GetInt( "UpdateAgentsEveryNFrames", m_update_presences); | 910 | m_update_presences = startupConfig.GetInt( "UpdateAgentsEveryNFrames", m_update_presences); |
885 | m_update_terrain = startupConfig.GetInt( "UpdateTerrainEveryNFrames", m_update_terrain); | 911 | m_update_terrain = startupConfig.GetInt( "UpdateTerrainEveryNFrames", m_update_terrain); |
886 | m_update_temp_cleaning = startupConfig.GetInt( "UpdateTempCleaningEveryNFrames", m_update_temp_cleaning); | 912 | m_update_temp_cleaning = startupConfig.GetInt( "UpdateTempCleaningEveryNFrames", m_update_temp_cleaning); |
913 | } | ||
914 | } | ||
915 | catch (Exception e) | ||
916 | { | ||
917 | m_log.Error("[SCENE]: Failed to load StartupConfig: " + e.ToString()); | ||
887 | } | 918 | } |
888 | 919 | ||
889 | // FIXME: Ultimately this should be in a module. | 920 | // FIXME: Ultimately this should be in a module. |
@@ -928,6 +959,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
928 | StatsReporter = new SimStatsReporter(this); | 959 | StatsReporter = new SimStatsReporter(this); |
929 | StatsReporter.OnSendStatsResult += SendSimStatsPackets; | 960 | StatsReporter.OnSendStatsResult += SendSimStatsPackets; |
930 | StatsReporter.OnStatsIncorrect += m_sceneGraph.RecalculateStats; | 961 | StatsReporter.OnStatsIncorrect += m_sceneGraph.RecalculateStats; |
962 | |||
963 | MainConsole.Instance.Commands.AddCommand("scene", false, "gc collect", "gc collect", "gc collect", "Cause the garbage collector to make a single pass", HandleGcCollect); | ||
931 | } | 964 | } |
932 | 965 | ||
933 | public Scene(RegionInfo regInfo) : base(regInfo) | 966 | public Scene(RegionInfo regInfo) : base(regInfo) |
@@ -1340,7 +1373,22 @@ namespace OpenSim.Region.Framework.Scenes | |||
1340 | //m_heartbeatTimer.Elapsed += new ElapsedEventHandler(Heartbeat); | 1373 | //m_heartbeatTimer.Elapsed += new ElapsedEventHandler(Heartbeat); |
1341 | if (m_heartbeatThread != null) | 1374 | if (m_heartbeatThread != null) |
1342 | { | 1375 | { |
1376 | m_hbRestarts++; | ||
1377 | if(m_hbRestarts > 10) | ||
1378 | Environment.Exit(1); | ||
1379 | m_log.ErrorFormat("[SCENE]: Restarting heartbeat thread because it hasn't reported in in region {0}", RegionInfo.RegionName); | ||
1380 | |||
1381 | //int pid = System.Diagnostics.Process.GetCurrentProcess().Id; | ||
1382 | //System.Diagnostics.Process proc = new System.Diagnostics.Process(); | ||
1383 | //proc.EnableRaisingEvents=false; | ||
1384 | //proc.StartInfo.FileName = "/bin/kill"; | ||
1385 | //proc.StartInfo.Arguments = "-QUIT " + pid.ToString(); | ||
1386 | //proc.Start(); | ||
1387 | //proc.WaitForExit(); | ||
1388 | //Thread.Sleep(1000); | ||
1389 | //Environment.Exit(1); | ||
1343 | m_heartbeatThread.Abort(); | 1390 | m_heartbeatThread.Abort(); |
1391 | Watchdog.AbortThread(m_heartbeatThread.ManagedThreadId); | ||
1344 | m_heartbeatThread = null; | 1392 | m_heartbeatThread = null; |
1345 | } | 1393 | } |
1346 | // m_lastUpdate = Util.EnvironmentTickCount(); | 1394 | // m_lastUpdate = Util.EnvironmentTickCount(); |
@@ -1487,16 +1535,20 @@ namespace OpenSim.Region.Framework.Scenes | |||
1487 | endFrame = Frame + frames; | 1535 | endFrame = Frame + frames; |
1488 | 1536 | ||
1489 | float physicsFPS = 0f; | 1537 | float physicsFPS = 0f; |
1490 | int previousFrameTick, tmpMS; | 1538 | int tmpMS; |
1491 | int maintc = Util.EnvironmentTickCount(); | 1539 | int previousFrameTick; |
1540 | int maintc; | ||
1541 | int sleepMS; | ||
1542 | int framestart; | ||
1492 | 1543 | ||
1493 | while (!m_shuttingDown && ((endFrame == null && Active) || Frame < endFrame)) | 1544 | while (!m_shuttingDown && ((endFrame == null && Active) || Frame < endFrame)) |
1494 | { | 1545 | { |
1546 | framestart = Util.EnvironmentTickCount(); | ||
1495 | ++Frame; | 1547 | ++Frame; |
1496 | 1548 | ||
1497 | // m_log.DebugFormat("[SCENE]: Processing frame {0} in {1}", Frame, RegionInfo.RegionName); | 1549 | // m_log.DebugFormat("[SCENE]: Processing frame {0} in {1}", Frame, RegionInfo.RegionName); |
1498 | 1550 | ||
1499 | agentMS = tempOnRezMS = eventMS = backupMS = terrainMS = landMS = spareMS = 0; | 1551 | agentMS = tempOnRezMS = eventMS = backupMS = terrainMS = landMS = 0; |
1500 | 1552 | ||
1501 | try | 1553 | try |
1502 | { | 1554 | { |
@@ -1548,6 +1600,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1548 | m_sceneGraph.UpdatePresences(); | 1600 | m_sceneGraph.UpdatePresences(); |
1549 | 1601 | ||
1550 | agentMS += Util.EnvironmentTickCountSubtract(tmpMS); | 1602 | agentMS += Util.EnvironmentTickCountSubtract(tmpMS); |
1603 | |||
1551 | 1604 | ||
1552 | // Delete temp-on-rez stuff | 1605 | // Delete temp-on-rez stuff |
1553 | if (Frame % m_update_temp_cleaning == 0 && !m_cleaningTemps) | 1606 | if (Frame % m_update_temp_cleaning == 0 && !m_cleaningTemps) |
@@ -1629,34 +1682,37 @@ namespace OpenSim.Region.Framework.Scenes | |||
1629 | 1682 | ||
1630 | Watchdog.UpdateThread(); | 1683 | Watchdog.UpdateThread(); |
1631 | 1684 | ||
1685 | otherMS = tempOnRezMS + eventMS + backupMS + terrainMS + landMS; | ||
1686 | |||
1687 | StatsReporter.AddPhysicsFPS(physicsFPS); | ||
1688 | StatsReporter.AddTimeDilation(TimeDilation); | ||
1689 | StatsReporter.AddFPS(1); | ||
1690 | |||
1691 | StatsReporter.addAgentMS(agentMS); | ||
1692 | StatsReporter.addPhysicsMS(physicsMS + physicsMS2); | ||
1693 | StatsReporter.addOtherMS(otherMS); | ||
1694 | StatsReporter.addScriptLines(m_sceneGraph.GetScriptLPS()); | ||
1695 | |||
1632 | previousFrameTick = m_lastFrameTick; | 1696 | previousFrameTick = m_lastFrameTick; |
1633 | m_lastFrameTick = Util.EnvironmentTickCount(); | 1697 | m_lastFrameTick = Util.EnvironmentTickCount(); |
1634 | tmpMS = Util.EnvironmentTickCountSubtract(m_lastFrameTick, maintc); | 1698 | tmpMS = Util.EnvironmentTickCountSubtract(m_lastFrameTick, framestart); |
1635 | tmpMS = (int)(MinFrameTime * 1000) - tmpMS; | 1699 | tmpMS = (int)(MinFrameTime * 1000) - tmpMS; |
1636 | 1700 | ||
1701 | m_firstHeartbeat = false; | ||
1702 | |||
1703 | sleepMS = Util.EnvironmentTickCount(); | ||
1704 | |||
1637 | if (tmpMS > 0) | 1705 | if (tmpMS > 0) |
1638 | { | ||
1639 | Thread.Sleep(tmpMS); | 1706 | Thread.Sleep(tmpMS); |
1640 | spareMS += tmpMS; | ||
1641 | } | ||
1642 | |||
1643 | frameMS = Util.EnvironmentTickCountSubtract(maintc); | ||
1644 | maintc = Util.EnvironmentTickCount(); | ||
1645 | 1707 | ||
1646 | otherMS = tempOnRezMS + eventMS + backupMS + terrainMS + landMS; | 1708 | sleepMS = Util.EnvironmentTickCountSubtract(sleepMS); |
1709 | frameMS = Util.EnvironmentTickCountSubtract(framestart); | ||
1710 | StatsReporter.addSleepMS(sleepMS); | ||
1711 | StatsReporter.addFrameMS(frameMS); | ||
1647 | 1712 | ||
1648 | // if (Frame%m_update_avatars == 0) | 1713 | // if (Frame%m_update_avatars == 0) |
1649 | // UpdateInWorldTime(); | 1714 | // UpdateInWorldTime(); |
1650 | StatsReporter.AddPhysicsFPS(physicsFPS); | ||
1651 | StatsReporter.AddTimeDilation(TimeDilation); | ||
1652 | StatsReporter.AddFPS(1); | ||
1653 | 1715 | ||
1654 | StatsReporter.addFrameMS(frameMS); | ||
1655 | StatsReporter.addAgentMS(agentMS); | ||
1656 | StatsReporter.addPhysicsMS(physicsMS + physicsMS2); | ||
1657 | StatsReporter.addOtherMS(otherMS); | ||
1658 | StatsReporter.AddSpareMS(spareMS); | ||
1659 | StatsReporter.addScriptLines(m_sceneGraph.GetScriptLPS()); | ||
1660 | 1716 | ||
1661 | // Optionally warn if a frame takes double the amount of time that it should. | 1717 | // Optionally warn if a frame takes double the amount of time that it should. |
1662 | if (DebugUpdates | 1718 | if (DebugUpdates |
@@ -1684,9 +1740,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
1684 | 1740 | ||
1685 | private void CheckAtTargets() | 1741 | private void CheckAtTargets() |
1686 | { | 1742 | { |
1687 | Dictionary<UUID, SceneObjectGroup>.ValueCollection objs; | 1743 | List<SceneObjectGroup> objs = new List<SceneObjectGroup>(); |
1688 | lock (m_groupsWithTargets) | 1744 | lock (m_groupsWithTargets) |
1689 | objs = m_groupsWithTargets.Values; | 1745 | objs = new List<SceneObjectGroup>(m_groupsWithTargets.Values); |
1690 | 1746 | ||
1691 | foreach (SceneObjectGroup entry in objs) | 1747 | foreach (SceneObjectGroup entry in objs) |
1692 | entry.checkAtTargets(); | 1748 | entry.checkAtTargets(); |
@@ -1767,7 +1823,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1767 | msg.fromAgentName = "Server"; | 1823 | msg.fromAgentName = "Server"; |
1768 | msg.dialog = (byte)19; // Object msg | 1824 | msg.dialog = (byte)19; // Object msg |
1769 | msg.fromGroup = false; | 1825 | msg.fromGroup = false; |
1770 | msg.offline = (byte)0; | 1826 | msg.offline = (byte)1; |
1771 | msg.ParentEstateID = RegionInfo.EstateSettings.ParentEstateID; | 1827 | msg.ParentEstateID = RegionInfo.EstateSettings.ParentEstateID; |
1772 | msg.Position = Vector3.Zero; | 1828 | msg.Position = Vector3.Zero; |
1773 | msg.RegionID = RegionInfo.RegionID.Guid; | 1829 | msg.RegionID = RegionInfo.RegionID.Guid; |
@@ -1989,6 +2045,19 @@ namespace OpenSim.Region.Framework.Scenes | |||
1989 | EventManager.TriggerPrimsLoaded(this); | 2045 | EventManager.TriggerPrimsLoaded(this); |
1990 | } | 2046 | } |
1991 | 2047 | ||
2048 | public bool SuportsRayCastFiltered() | ||
2049 | { | ||
2050 | if (PhysicsScene == null) | ||
2051 | return false; | ||
2052 | return PhysicsScene.SuportsRaycastWorldFiltered(); | ||
2053 | } | ||
2054 | |||
2055 | public object RayCastFiltered(Vector3 position, Vector3 direction, float length, int Count, RayFilterFlags filter) | ||
2056 | { | ||
2057 | if (PhysicsScene == null) | ||
2058 | return null; | ||
2059 | return PhysicsScene.RaycastWorld(position, direction, length, Count,filter); | ||
2060 | } | ||
1992 | 2061 | ||
1993 | /// <summary> | 2062 | /// <summary> |
1994 | /// Gets a new rez location based on the raycast and the size of the object that is being rezzed. | 2063 | /// Gets a new rez location based on the raycast and the size of the object that is being rezzed. |
@@ -2005,14 +2074,24 @@ namespace OpenSim.Region.Framework.Scenes | |||
2005 | /// <returns></returns> | 2074 | /// <returns></returns> |
2006 | public Vector3 GetNewRezLocation(Vector3 RayStart, Vector3 RayEnd, UUID RayTargetID, Quaternion rot, byte bypassRayCast, byte RayEndIsIntersection, bool frontFacesOnly, Vector3 scale, bool FaceCenter) | 2075 | public Vector3 GetNewRezLocation(Vector3 RayStart, Vector3 RayEnd, UUID RayTargetID, Quaternion rot, byte bypassRayCast, byte RayEndIsIntersection, bool frontFacesOnly, Vector3 scale, bool FaceCenter) |
2007 | { | 2076 | { |
2077 | |||
2078 | float wheight = (float)RegionInfo.RegionSettings.WaterHeight; | ||
2079 | Vector3 wpos = Vector3.Zero; | ||
2080 | // Check for water surface intersection from above | ||
2081 | if ( (RayStart.Z > wheight) && (RayEnd.Z < wheight) ) | ||
2082 | { | ||
2083 | float ratio = (RayStart.Z - wheight) / (RayStart.Z - RayEnd.Z); | ||
2084 | wpos.X = RayStart.X - (ratio * (RayStart.X - RayEnd.X)); | ||
2085 | wpos.Y = RayStart.Y - (ratio * (RayStart.Y - RayEnd.Y)); | ||
2086 | wpos.Z = wheight; | ||
2087 | } | ||
2088 | |||
2008 | Vector3 pos = Vector3.Zero; | 2089 | Vector3 pos = Vector3.Zero; |
2009 | if (RayEndIsIntersection == (byte)1) | 2090 | if (RayEndIsIntersection == (byte)1) |
2010 | { | 2091 | { |
2011 | pos = RayEnd; | 2092 | pos = RayEnd; |
2012 | return pos; | ||
2013 | } | 2093 | } |
2014 | 2094 | else if (RayTargetID != UUID.Zero) | |
2015 | if (RayTargetID != UUID.Zero) | ||
2016 | { | 2095 | { |
2017 | SceneObjectPart target = GetSceneObjectPart(RayTargetID); | 2096 | SceneObjectPart target = GetSceneObjectPart(RayTargetID); |
2018 | 2097 | ||
@@ -2034,7 +2113,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2034 | EntityIntersection ei = target.TestIntersectionOBB(NewRay, Quaternion.Identity, frontFacesOnly, FaceCenter); | 2113 | EntityIntersection ei = target.TestIntersectionOBB(NewRay, Quaternion.Identity, frontFacesOnly, FaceCenter); |
2035 | 2114 | ||
2036 | // Un-comment out the following line to Get Raytrace results printed to the console. | 2115 | // Un-comment out the following line to Get Raytrace results printed to the console. |
2037 | // m_log.Info("[RAYTRACERESULTS]: Hit:" + ei.HitTF.ToString() + " Point: " + ei.ipoint.ToString() + " Normal: " + ei.normal.ToString()); | 2116 | // m_log.Info("[RAYTRACERESULTS]: Hit:" + ei.HitTF.ToString() + " Point: " + ei.ipoint.ToString() + " Normal: " + ei.normal.ToString()); |
2038 | float ScaleOffset = 0.5f; | 2117 | float ScaleOffset = 0.5f; |
2039 | 2118 | ||
2040 | // If we hit something | 2119 | // If we hit something |
@@ -2057,13 +2136,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
2057 | //pos.Z -= 0.25F; | 2136 | //pos.Z -= 0.25F; |
2058 | 2137 | ||
2059 | } | 2138 | } |
2060 | |||
2061 | return pos; | ||
2062 | } | 2139 | } |
2063 | else | 2140 | else |
2064 | { | 2141 | { |
2065 | // We don't have a target here, so we're going to raytrace all the objects in the scene. | 2142 | // We don't have a target here, so we're going to raytrace all the objects in the scene. |
2066 | |||
2067 | EntityIntersection ei = m_sceneGraph.GetClosestIntersectingPrim(new Ray(AXOrigin, AXdirection), true, false); | 2143 | EntityIntersection ei = m_sceneGraph.GetClosestIntersectingPrim(new Ray(AXOrigin, AXdirection), true, false); |
2068 | 2144 | ||
2069 | // Un-comment the following line to print the raytrace results to the console. | 2145 | // Un-comment the following line to print the raytrace results to the console. |
@@ -2072,13 +2148,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
2072 | if (ei.HitTF) | 2148 | if (ei.HitTF) |
2073 | { | 2149 | { |
2074 | pos = new Vector3(ei.ipoint.X, ei.ipoint.Y, ei.ipoint.Z); | 2150 | pos = new Vector3(ei.ipoint.X, ei.ipoint.Y, ei.ipoint.Z); |
2075 | } else | 2151 | } |
2152 | else | ||
2076 | { | 2153 | { |
2077 | // fall back to our stupid functionality | 2154 | // fall back to our stupid functionality |
2078 | pos = RayEnd; | 2155 | pos = RayEnd; |
2079 | } | 2156 | } |
2080 | |||
2081 | return pos; | ||
2082 | } | 2157 | } |
2083 | } | 2158 | } |
2084 | else | 2159 | else |
@@ -2089,8 +2164,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
2089 | //increase height so its above the ground. | 2164 | //increase height so its above the ground. |
2090 | //should be getting the normal of the ground at the rez point and using that? | 2165 | //should be getting the normal of the ground at the rez point and using that? |
2091 | pos.Z += scale.Z / 2f; | 2166 | pos.Z += scale.Z / 2f; |
2092 | return pos; | 2167 | // return pos; |
2093 | } | 2168 | } |
2169 | |||
2170 | // check against posible water intercept | ||
2171 | if (wpos.Z > pos.Z) pos = wpos; | ||
2172 | return pos; | ||
2094 | } | 2173 | } |
2095 | 2174 | ||
2096 | 2175 | ||
@@ -2181,12 +2260,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
2181 | { | 2260 | { |
2182 | if (m_sceneGraph.AddRestoredSceneObject(sceneObject, attachToBackup, alreadyPersisted, sendClientUpdates)) | 2261 | if (m_sceneGraph.AddRestoredSceneObject(sceneObject, attachToBackup, alreadyPersisted, sendClientUpdates)) |
2183 | { | 2262 | { |
2263 | sceneObject.IsDeleted = false; | ||
2184 | EventManager.TriggerObjectAddedToScene(sceneObject); | 2264 | EventManager.TriggerObjectAddedToScene(sceneObject); |
2185 | return true; | 2265 | return true; |
2186 | } | 2266 | } |
2187 | 2267 | ||
2188 | return false; | 2268 | return false; |
2189 | |||
2190 | } | 2269 | } |
2191 | 2270 | ||
2192 | /// <summary> | 2271 | /// <summary> |
@@ -2278,6 +2357,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
2278 | /// </summary> | 2357 | /// </summary> |
2279 | public void DeleteAllSceneObjects() | 2358 | public void DeleteAllSceneObjects() |
2280 | { | 2359 | { |
2360 | DeleteAllSceneObjects(false); | ||
2361 | } | ||
2362 | |||
2363 | /// <summary> | ||
2364 | /// Delete every object from the scene. This does not include attachments worn by avatars. | ||
2365 | /// </summary> | ||
2366 | public void DeleteAllSceneObjects(bool exceptNoCopy) | ||
2367 | { | ||
2368 | List<SceneObjectGroup> toReturn = new List<SceneObjectGroup>(); | ||
2281 | lock (Entities) | 2369 | lock (Entities) |
2282 | { | 2370 | { |
2283 | EntityBase[] entities = Entities.GetEntities(); | 2371 | EntityBase[] entities = Entities.GetEntities(); |
@@ -2286,11 +2374,24 @@ namespace OpenSim.Region.Framework.Scenes | |||
2286 | if (e is SceneObjectGroup) | 2374 | if (e is SceneObjectGroup) |
2287 | { | 2375 | { |
2288 | SceneObjectGroup sog = (SceneObjectGroup)e; | 2376 | SceneObjectGroup sog = (SceneObjectGroup)e; |
2289 | if (!sog.IsAttachment) | 2377 | if (sog != null && !sog.IsAttachment) |
2290 | DeleteSceneObject((SceneObjectGroup)e, false); | 2378 | { |
2379 | if (!exceptNoCopy || ((sog.GetEffectivePermissions() & (uint)PermissionMask.Copy) != 0)) | ||
2380 | { | ||
2381 | DeleteSceneObject((SceneObjectGroup)e, false); | ||
2382 | } | ||
2383 | else | ||
2384 | { | ||
2385 | toReturn.Add((SceneObjectGroup)e); | ||
2386 | } | ||
2387 | } | ||
2291 | } | 2388 | } |
2292 | } | 2389 | } |
2293 | } | 2390 | } |
2391 | if (toReturn.Count > 0) | ||
2392 | { | ||
2393 | returnObjects(toReturn.ToArray(), UUID.Zero); | ||
2394 | } | ||
2294 | } | 2395 | } |
2295 | 2396 | ||
2296 | /// <summary> | 2397 | /// <summary> |
@@ -2325,6 +2426,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
2325 | 2426 | ||
2326 | foreach (SceneObjectPart part in partList) | 2427 | foreach (SceneObjectPart part in partList) |
2327 | { | 2428 | { |
2429 | if (part.KeyframeMotion != null) | ||
2430 | { | ||
2431 | part.KeyframeMotion.Delete(); | ||
2432 | part.KeyframeMotion = null; | ||
2433 | } | ||
2434 | |||
2328 | if (part.IsJoint() && ((part.Flags & PrimFlags.Physics) != 0)) | 2435 | if (part.IsJoint() && ((part.Flags & PrimFlags.Physics) != 0)) |
2329 | { | 2436 | { |
2330 | PhysicsScene.RequestJointDeletion(part.Name); // FIXME: what if the name changed? | 2437 | PhysicsScene.RequestJointDeletion(part.Name); // FIXME: what if the name changed? |
@@ -2342,6 +2449,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2342 | } | 2449 | } |
2343 | 2450 | ||
2344 | group.DeleteGroupFromScene(silent); | 2451 | group.DeleteGroupFromScene(silent); |
2452 | if (!silent) | ||
2453 | SendKillObject(new List<uint>() { group.LocalId }); | ||
2345 | 2454 | ||
2346 | // m_log.DebugFormat("[SCENE]: Exit DeleteSceneObject() for {0} {1}", group.Name, group.UUID); | 2455 | // m_log.DebugFormat("[SCENE]: Exit DeleteSceneObject() for {0} {1}", group.Name, group.UUID); |
2347 | } | 2456 | } |
@@ -2632,7 +2741,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2632 | // If the user is banned, we won't let any of their objects | 2741 | // If the user is banned, we won't let any of their objects |
2633 | // enter. Period. | 2742 | // enter. Period. |
2634 | // | 2743 | // |
2635 | if (RegionInfo.EstateSettings.IsBanned(newObject.OwnerID)) | 2744 | if (RegionInfo.EstateSettings.IsBanned(newObject.OwnerID, 36)) |
2636 | { | 2745 | { |
2637 | m_log.InfoFormat("[INTERREGION]: Denied prim crossing for banned avatar {0}", newObject.OwnerID); | 2746 | m_log.InfoFormat("[INTERREGION]: Denied prim crossing for banned avatar {0}", newObject.OwnerID); |
2638 | return false; | 2747 | return false; |
@@ -2640,6 +2749,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2640 | 2749 | ||
2641 | if (newPosition != Vector3.Zero) | 2750 | if (newPosition != Vector3.Zero) |
2642 | newObject.RootPart.GroupPosition = newPosition; | 2751 | newObject.RootPart.GroupPosition = newPosition; |
2752 | if (newObject.RootPart.KeyframeMotion != null) | ||
2753 | newObject.RootPart.KeyframeMotion.UpdateSceneObject(newObject); | ||
2643 | 2754 | ||
2644 | if (!AddSceneObject(newObject)) | 2755 | if (!AddSceneObject(newObject)) |
2645 | { | 2756 | { |
@@ -2684,6 +2795,23 @@ namespace OpenSim.Region.Framework.Scenes | |||
2684 | /// <returns>True if the SceneObjectGroup was added, False if it was not</returns> | 2795 | /// <returns>True if the SceneObjectGroup was added, False if it was not</returns> |
2685 | public bool AddSceneObject(SceneObjectGroup sceneObject) | 2796 | public bool AddSceneObject(SceneObjectGroup sceneObject) |
2686 | { | 2797 | { |
2798 | if (sceneObject.OwnerID == UUID.Zero) | ||
2799 | { | ||
2800 | m_log.ErrorFormat("[SCENE]: Owner ID for {0} was zero", sceneObject.UUID); | ||
2801 | return false; | ||
2802 | } | ||
2803 | |||
2804 | // If the user is banned, we won't let any of their objects | ||
2805 | // enter. Period. | ||
2806 | // | ||
2807 | int flags = GetUserFlags(sceneObject.OwnerID); | ||
2808 | if (RegionInfo.EstateSettings.IsBanned(sceneObject.OwnerID, flags)) | ||
2809 | { | ||
2810 | m_log.InfoFormat("[INTERREGION]: Denied prim crossing for banned avatar {0}", sceneObject.OwnerID); | ||
2811 | |||
2812 | return false; | ||
2813 | } | ||
2814 | |||
2687 | // Force allocation of new LocalId | 2815 | // Force allocation of new LocalId |
2688 | // | 2816 | // |
2689 | SceneObjectPart[] parts = sceneObject.Parts; | 2817 | SceneObjectPart[] parts = sceneObject.Parts; |
@@ -2717,16 +2845,27 @@ namespace OpenSim.Region.Framework.Scenes | |||
2717 | RootPrim.RemFlag(PrimFlags.TemporaryOnRez); | 2845 | RootPrim.RemFlag(PrimFlags.TemporaryOnRez); |
2718 | 2846 | ||
2719 | if (AttachmentsModule != null) | 2847 | if (AttachmentsModule != null) |
2720 | AttachmentsModule.AttachObject(sp, grp, 0, false, false); | 2848 | AttachmentsModule.AttachObject(sp, grp, 0, false, false, false); |
2721 | } | 2849 | } |
2722 | else | 2850 | else |
2723 | { | 2851 | { |
2852 | m_log.DebugFormat("[SCENE]: Attachment {0} arrived and scene presence was not found, setting to temp", sceneObject.UUID); | ||
2724 | RootPrim.RemFlag(PrimFlags.TemporaryOnRez); | 2853 | RootPrim.RemFlag(PrimFlags.TemporaryOnRez); |
2725 | RootPrim.AddFlag(PrimFlags.TemporaryOnRez); | 2854 | RootPrim.AddFlag(PrimFlags.TemporaryOnRez); |
2726 | } | 2855 | } |
2856 | if (sceneObject.OwnerID == UUID.Zero) | ||
2857 | { | ||
2858 | m_log.ErrorFormat("[SCENE]: Owner ID for {0} was zero after attachment processing. BUG!", sceneObject.UUID); | ||
2859 | return false; | ||
2860 | } | ||
2727 | } | 2861 | } |
2728 | else | 2862 | else |
2729 | { | 2863 | { |
2864 | if (sceneObject.OwnerID == UUID.Zero) | ||
2865 | { | ||
2866 | m_log.ErrorFormat("[SCENE]: Owner ID for non-attachment {0} was zero", sceneObject.UUID); | ||
2867 | return false; | ||
2868 | } | ||
2730 | AddRestoredSceneObject(sceneObject, true, false); | 2869 | AddRestoredSceneObject(sceneObject, true, false); |
2731 | } | 2870 | } |
2732 | 2871 | ||
@@ -2743,6 +2882,24 @@ namespace OpenSim.Region.Framework.Scenes | |||
2743 | return 2; // StateSource.PrimCrossing | 2882 | return 2; // StateSource.PrimCrossing |
2744 | } | 2883 | } |
2745 | 2884 | ||
2885 | public int GetUserFlags(UUID user) | ||
2886 | { | ||
2887 | //Unfortunately the SP approach means that the value is cached until region is restarted | ||
2888 | /* | ||
2889 | ScenePresence sp; | ||
2890 | if (TryGetScenePresence(user, out sp)) | ||
2891 | { | ||
2892 | return sp.UserFlags; | ||
2893 | } | ||
2894 | else | ||
2895 | { | ||
2896 | */ | ||
2897 | UserAccount uac = UserAccountService.GetUserAccount(RegionInfo.ScopeID, user); | ||
2898 | if (uac == null) | ||
2899 | return 0; | ||
2900 | return uac.UserFlags; | ||
2901 | //} | ||
2902 | } | ||
2746 | #endregion | 2903 | #endregion |
2747 | 2904 | ||
2748 | #region Add/Remove Avatar Methods | 2905 | #region Add/Remove Avatar Methods |
@@ -2775,7 +2932,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2775 | = (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0 | 2932 | = (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0 |
2776 | || (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0; | 2933 | || (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0; |
2777 | 2934 | ||
2778 | // CheckHeartbeat(); | 2935 | CheckHeartbeat(); |
2779 | 2936 | ||
2780 | sp = GetScenePresence(client.AgentId); | 2937 | sp = GetScenePresence(client.AgentId); |
2781 | 2938 | ||
@@ -2919,19 +3076,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
2919 | // and the scene presence and the client, if they exist | 3076 | // and the scene presence and the client, if they exist |
2920 | try | 3077 | try |
2921 | { | 3078 | { |
2922 | // We need to wait for the client to make UDP contact first. | 3079 | ScenePresence sp = GetScenePresence(agentID); |
2923 | // It's the UDP contact that creates the scene presence | 3080 | |
2924 | ScenePresence sp = WaitGetScenePresence(agentID); | ||
2925 | if (sp != null) | 3081 | if (sp != null) |
2926 | { | 3082 | { |
2927 | PresenceService.LogoutAgent(sp.ControllingClient.SessionId); | 3083 | PresenceService.LogoutAgent(sp.ControllingClient.SessionId); |
2928 | |||
2929 | sp.ControllingClient.Close(); | 3084 | sp.ControllingClient.Close(); |
2930 | } | 3085 | } |
2931 | else | 3086 | |
2932 | { | ||
2933 | m_log.WarnFormat("[SCENE]: Could not find scene presence for {0}", agentID); | ||
2934 | } | ||
2935 | // BANG! SLASH! | 3087 | // BANG! SLASH! |
2936 | m_authenticateHandler.RemoveCircuit(agentID); | 3088 | m_authenticateHandler.RemoveCircuit(agentID); |
2937 | 3089 | ||
@@ -2976,6 +3128,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2976 | client.OnUpdatePrimGroupPosition += m_sceneGraph.UpdatePrimGroupPosition; | 3128 | client.OnUpdatePrimGroupPosition += m_sceneGraph.UpdatePrimGroupPosition; |
2977 | client.OnUpdatePrimSinglePosition += m_sceneGraph.UpdatePrimSinglePosition; | 3129 | client.OnUpdatePrimSinglePosition += m_sceneGraph.UpdatePrimSinglePosition; |
2978 | 3130 | ||
3131 | client.onClientChangeObject += m_sceneGraph.ClientChangeObject; | ||
3132 | |||
2979 | client.OnUpdatePrimGroupRotation += m_sceneGraph.UpdatePrimGroupRotation; | 3133 | client.OnUpdatePrimGroupRotation += m_sceneGraph.UpdatePrimGroupRotation; |
2980 | client.OnUpdatePrimGroupMouseRotation += m_sceneGraph.UpdatePrimGroupRotation; | 3134 | client.OnUpdatePrimGroupMouseRotation += m_sceneGraph.UpdatePrimGroupRotation; |
2981 | client.OnUpdatePrimSingleRotation += m_sceneGraph.UpdatePrimSingleRotation; | 3135 | client.OnUpdatePrimSingleRotation += m_sceneGraph.UpdatePrimSingleRotation; |
@@ -3032,6 +3186,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3032 | client.OnFetchInventory += m_asyncInventorySender.HandleFetchInventory; | 3186 | client.OnFetchInventory += m_asyncInventorySender.HandleFetchInventory; |
3033 | client.OnUpdateInventoryItem += UpdateInventoryItemAsset; | 3187 | client.OnUpdateInventoryItem += UpdateInventoryItemAsset; |
3034 | client.OnCopyInventoryItem += CopyInventoryItem; | 3188 | client.OnCopyInventoryItem += CopyInventoryItem; |
3189 | client.OnMoveItemsAndLeaveCopy += MoveInventoryItemsLeaveCopy; | ||
3035 | client.OnMoveInventoryItem += MoveInventoryItem; | 3190 | client.OnMoveInventoryItem += MoveInventoryItem; |
3036 | client.OnRemoveInventoryItem += RemoveInventoryItem; | 3191 | client.OnRemoveInventoryItem += RemoveInventoryItem; |
3037 | client.OnRemoveInventoryFolder += RemoveInventoryFolder; | 3192 | client.OnRemoveInventoryFolder += RemoveInventoryFolder; |
@@ -3103,6 +3258,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
3103 | client.OnUpdatePrimGroupPosition -= m_sceneGraph.UpdatePrimGroupPosition; | 3258 | client.OnUpdatePrimGroupPosition -= m_sceneGraph.UpdatePrimGroupPosition; |
3104 | client.OnUpdatePrimSinglePosition -= m_sceneGraph.UpdatePrimSinglePosition; | 3259 | client.OnUpdatePrimSinglePosition -= m_sceneGraph.UpdatePrimSinglePosition; |
3105 | 3260 | ||
3261 | client.onClientChangeObject -= m_sceneGraph.ClientChangeObject; | ||
3262 | |||
3106 | client.OnUpdatePrimGroupRotation -= m_sceneGraph.UpdatePrimGroupRotation; | 3263 | client.OnUpdatePrimGroupRotation -= m_sceneGraph.UpdatePrimGroupRotation; |
3107 | client.OnUpdatePrimGroupMouseRotation -= m_sceneGraph.UpdatePrimGroupRotation; | 3264 | client.OnUpdatePrimGroupMouseRotation -= m_sceneGraph.UpdatePrimGroupRotation; |
3108 | client.OnUpdatePrimSingleRotation -= m_sceneGraph.UpdatePrimSingleRotation; | 3265 | client.OnUpdatePrimSingleRotation -= m_sceneGraph.UpdatePrimSingleRotation; |
@@ -3205,7 +3362,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3205 | /// </summary> | 3362 | /// </summary> |
3206 | /// <param name="agentId">The avatar's Unique ID</param> | 3363 | /// <param name="agentId">The avatar's Unique ID</param> |
3207 | /// <param name="client">The IClientAPI for the client</param> | 3364 | /// <param name="client">The IClientAPI for the client</param> |
3208 | public virtual void TeleportClientHome(UUID agentId, IClientAPI client) | 3365 | public virtual bool TeleportClientHome(UUID agentId, IClientAPI client) |
3209 | { | 3366 | { |
3210 | if (EntityTransferModule != null) | 3367 | if (EntityTransferModule != null) |
3211 | { | 3368 | { |
@@ -3216,6 +3373,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3216 | m_log.DebugFormat("[SCENE]: Unable to teleport user home: no AgentTransferModule is active"); | 3373 | m_log.DebugFormat("[SCENE]: Unable to teleport user home: no AgentTransferModule is active"); |
3217 | client.SendTeleportFailed("Unable to perform teleports on this simulator."); | 3374 | client.SendTeleportFailed("Unable to perform teleports on this simulator."); |
3218 | } | 3375 | } |
3376 | return false; | ||
3219 | } | 3377 | } |
3220 | 3378 | ||
3221 | /// <summary> | 3379 | /// <summary> |
@@ -3325,6 +3483,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
3325 | /// <param name="flags"></param> | 3483 | /// <param name="flags"></param> |
3326 | public virtual void SetHomeRezPoint(IClientAPI remoteClient, ulong regionHandle, Vector3 position, Vector3 lookAt, uint flags) | 3484 | public virtual void SetHomeRezPoint(IClientAPI remoteClient, ulong regionHandle, Vector3 position, Vector3 lookAt, uint flags) |
3327 | { | 3485 | { |
3486 | //Add half the avatar's height so that the user doesn't fall through prims | ||
3487 | ScenePresence presence; | ||
3488 | if (TryGetScenePresence(remoteClient.AgentId, out presence)) | ||
3489 | { | ||
3490 | if (presence.Appearance != null) | ||
3491 | { | ||
3492 | position.Z = position.Z + (presence.Appearance.AvatarHeight / 2); | ||
3493 | } | ||
3494 | } | ||
3495 | |||
3328 | if (GridUserService != null && GridUserService.SetHome(remoteClient.AgentId.ToString(), RegionInfo.RegionID, position, lookAt)) | 3496 | if (GridUserService != null && GridUserService.SetHome(remoteClient.AgentId.ToString(), RegionInfo.RegionID, position, lookAt)) |
3329 | // FUBAR ALERT: this needs to be "Home position set." so the viewer saves a home-screenshot. | 3497 | // FUBAR ALERT: this needs to be "Home position set." so the viewer saves a home-screenshot. |
3330 | m_dialogModule.SendAlertToUser(remoteClient, "Home position set."); | 3498 | m_dialogModule.SendAlertToUser(remoteClient, "Home position set."); |
@@ -3460,6 +3628,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3460 | // It's possible for child agents to have transactions if changes are being made cross-border. | 3628 | // It's possible for child agents to have transactions if changes are being made cross-border. |
3461 | if (AgentTransactionsModule != null) | 3629 | if (AgentTransactionsModule != null) |
3462 | AgentTransactionsModule.RemoveAgentAssetTransactions(agentID); | 3630 | AgentTransactionsModule.RemoveAgentAssetTransactions(agentID); |
3631 | m_log.Debug("[Scene] The avatar has left the building"); | ||
3463 | } | 3632 | } |
3464 | catch (Exception e) | 3633 | catch (Exception e) |
3465 | { | 3634 | { |
@@ -3652,38 +3821,39 @@ namespace OpenSim.Region.Framework.Scenes | |||
3652 | agent.firstname, agent.lastname, agent.Viewer); | 3821 | agent.firstname, agent.lastname, agent.Viewer); |
3653 | reason = "Access denied, your viewer is banned by the region owner"; | 3822 | reason = "Access denied, your viewer is banned by the region owner"; |
3654 | return false; | 3823 | return false; |
3655 | } | 3824 | } |
3825 | |||
3656 | 3826 | ||
3657 | ILandObject land; | 3827 | ScenePresence sp = GetScenePresence(agent.AgentID); |
3828 | |||
3829 | if (sp != null && !sp.IsChildAgent) | ||
3830 | { | ||
3831 | // We have a zombie from a crashed session. | ||
3832 | // Or the same user is trying to be root twice here, won't work. | ||
3833 | // Kill it. | ||
3834 | m_log.WarnFormat( | ||
3835 | "[SCENE]: Existing root scene presence detected for {0} {1} in {2} when connecting. Removing existing presence.", | ||
3836 | sp.Name, sp.UUID, RegionInfo.RegionName); | ||
3837 | |||
3838 | sp.ControllingClient.Close(true, true); | ||
3839 | sp = null; | ||
3840 | } | ||
3658 | 3841 | ||
3659 | lock (agent) | 3842 | lock (agent) |
3660 | { | 3843 | { |
3661 | ScenePresence sp = GetScenePresence(agent.AgentID); | ||
3662 | |||
3663 | if (sp != null && !sp.IsChildAgent) | ||
3664 | { | ||
3665 | // We have a zombie from a crashed session. | ||
3666 | // Or the same user is trying to be root twice here, won't work. | ||
3667 | // Kill it. | ||
3668 | m_log.WarnFormat( | ||
3669 | "[SCENE]: Existing root scene presence detected for {0} {1} in {2} when connecting. Removing existing presence.", | ||
3670 | sp.Name, sp.UUID, RegionInfo.RegionName); | ||
3671 | |||
3672 | sp.ControllingClient.Close(true); | ||
3673 | sp = null; | ||
3674 | } | ||
3675 | |||
3676 | land = LandChannel.GetLandObject(agent.startpos.X, agent.startpos.Y); | ||
3677 | |||
3678 | //On login test land permisions | 3844 | //On login test land permisions |
3679 | if (vialogin) | 3845 | if (vialogin) |
3680 | { | 3846 | { |
3681 | if (land != null && !TestLandRestrictions(agent, land, out reason)) | 3847 | IUserAccountCacheModule cache = RequestModuleInterface<IUserAccountCacheModule>(); |
3848 | if (cache != null) | ||
3849 | cache.Remove(agent.firstname + " " + agent.lastname); | ||
3850 | if (!TestLandRestrictions(agent.AgentID, out reason, ref agent.startpos.X, ref agent.startpos.Y)) | ||
3682 | { | 3851 | { |
3852 | m_log.DebugFormat("[CONNECTION BEGIN]: Denying access to {0} due to no land access", agent.AgentID.ToString()); | ||
3683 | return false; | 3853 | return false; |
3684 | } | 3854 | } |
3685 | } | 3855 | } |
3686 | 3856 | ||
3687 | if (sp == null) // We don't have an [child] agent here already | 3857 | if (sp == null) // We don't have an [child] agent here already |
3688 | { | 3858 | { |
3689 | if (requirePresenceLookup) | 3859 | if (requirePresenceLookup) |
@@ -3692,34 +3862,36 @@ namespace OpenSim.Region.Framework.Scenes | |||
3692 | { | 3862 | { |
3693 | if (!VerifyUserPresence(agent, out reason)) | 3863 | if (!VerifyUserPresence(agent, out reason)) |
3694 | return false; | 3864 | return false; |
3695 | } | 3865 | } catch (Exception e) |
3696 | catch (Exception e) | ||
3697 | { | 3866 | { |
3698 | m_log.ErrorFormat( | 3867 | m_log.ErrorFormat( |
3699 | "[SCENE]: Exception verifying presence {0}{1}", e.Message, e.StackTrace); | 3868 | "[SCENE]: Exception verifying presence {0}{1}", e.Message, e.StackTrace); |
3700 | |||
3701 | return false; | 3869 | return false; |
3702 | } | 3870 | } |
3703 | } | 3871 | } |
3704 | 3872 | ||
3705 | try | 3873 | try |
3706 | { | 3874 | { |
3707 | if (!AuthorizeUser(agent, out reason)) | 3875 | // Always check estate if this is a login. Always |
3708 | return false; | 3876 | // check if banned regions are to be blacked out. |
3877 | if (vialogin || (!m_seeIntoBannedRegion)) | ||
3878 | { | ||
3879 | if (!AuthorizeUser(agent, out reason)) | ||
3880 | return false; | ||
3881 | } | ||
3709 | } | 3882 | } |
3710 | catch (Exception e) | 3883 | catch (Exception e) |
3711 | { | 3884 | { |
3712 | m_log.ErrorFormat( | 3885 | m_log.ErrorFormat( |
3713 | "[SCENE]: Exception authorizing user {0}{1}", e.Message, e.StackTrace); | 3886 | "[SCENE]: Exception authorizing user {0}{1}", e.Message, e.StackTrace); |
3714 | |||
3715 | return false; | 3887 | return false; |
3716 | } | 3888 | } |
3717 | 3889 | ||
3718 | m_log.InfoFormat( | 3890 | m_log.InfoFormat( |
3719 | "[SCENE]: Region {0} authenticated and authorized incoming {1} agent {2} {3} {4} (circuit code {5})", | 3891 | "[SCENE]: Region {0} authenticated and authorized incoming {1} agent {2} {3} {4} (circuit code {5})", |
3720 | RegionInfo.RegionName, (agent.child ? "child" : "root"), agent.firstname, agent.lastname, | 3892 | RegionInfo.RegionName, (agent.child ? "child" : "root"), agent.firstname, agent.lastname, |
3721 | agent.AgentID, agent.circuitcode); | 3893 | agent.AgentID, agent.circuitcode); |
3722 | 3894 | ||
3723 | if (CapsModule != null) | 3895 | if (CapsModule != null) |
3724 | { | 3896 | { |
3725 | CapsModule.SetAgentCapsSeeds(agent); | 3897 | CapsModule.SetAgentCapsSeeds(agent); |
@@ -3731,15 +3903,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
3731 | // Let the SP know how we got here. This has a lot of interesting | 3903 | // Let the SP know how we got here. This has a lot of interesting |
3732 | // uses down the line. | 3904 | // uses down the line. |
3733 | sp.TeleportFlags = (TPFlags)teleportFlags; | 3905 | sp.TeleportFlags = (TPFlags)teleportFlags; |
3734 | 3906 | ||
3735 | if (sp.IsChildAgent) | 3907 | if (sp.IsChildAgent) |
3736 | { | 3908 | { |
3737 | m_log.DebugFormat( | 3909 | m_log.DebugFormat( |
3738 | "[SCENE]: Adjusting known seeds for existing agent {0} in {1}", | 3910 | "[SCENE]: Adjusting known seeds for existing agent {0} in {1}", |
3739 | agent.AgentID, RegionInfo.RegionName); | 3911 | agent.AgentID, RegionInfo.RegionName); |
3740 | 3912 | ||
3741 | sp.AdjustKnownSeeds(); | 3913 | sp.AdjustKnownSeeds(); |
3742 | 3914 | ||
3743 | if (CapsModule != null) | 3915 | if (CapsModule != null) |
3744 | CapsModule.SetAgentCapsSeeds(agent); | 3916 | CapsModule.SetAgentCapsSeeds(agent); |
3745 | } | 3917 | } |
@@ -3841,6 +4013,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
3841 | } | 4013 | } |
3842 | 4014 | ||
3843 | // Honor parcel landing type and position. | 4015 | // Honor parcel landing type and position. |
4016 | /* | ||
4017 | ILandObject land = LandChannel.GetLandObject(agent.startpos.X, agent.startpos.Y); | ||
3844 | if (land != null) | 4018 | if (land != null) |
3845 | { | 4019 | { |
3846 | if (land.LandData.LandingType == (byte)1 && land.LandData.UserLocation != Vector3.Zero) | 4020 | if (land.LandData.LandingType == (byte)1 && land.LandData.UserLocation != Vector3.Zero) |
@@ -3848,25 +4022,43 @@ namespace OpenSim.Region.Framework.Scenes | |||
3848 | agent.startpos = land.LandData.UserLocation; | 4022 | agent.startpos = land.LandData.UserLocation; |
3849 | } | 4023 | } |
3850 | } | 4024 | } |
4025 | */// This is now handled properly in ScenePresence.MakeRootAgent | ||
3851 | } | 4026 | } |
3852 | 4027 | ||
3853 | return true; | 4028 | return true; |
3854 | } | 4029 | } |
3855 | 4030 | ||
3856 | private bool TestLandRestrictions(AgentCircuitData agent, ILandObject land, out string reason) | 4031 | public bool TestLandRestrictions(UUID agentID, out string reason, ref float posX, ref float posY) |
3857 | { | 4032 | { |
3858 | bool banned = land.IsBannedFromLand(agent.AgentID); | 4033 | if (posX < 0) |
3859 | bool restricted = land.IsRestrictedFromLand(agent.AgentID); | 4034 | posX = 0; |
4035 | else if (posX >= 256) | ||
4036 | posX = 255.999f; | ||
4037 | if (posY < 0) | ||
4038 | posY = 0; | ||
4039 | else if (posY >= 256) | ||
4040 | posY = 255.999f; | ||
4041 | |||
4042 | reason = String.Empty; | ||
4043 | if (Permissions.IsGod(agentID)) | ||
4044 | return true; | ||
4045 | |||
4046 | ILandObject land = LandChannel.GetLandObject(posX, posY); | ||
4047 | if (land == null) | ||
4048 | return false; | ||
4049 | |||
4050 | bool banned = land.IsBannedFromLand(agentID); | ||
4051 | bool restricted = land.IsRestrictedFromLand(agentID); | ||
3860 | 4052 | ||
3861 | if (banned || restricted) | 4053 | if (banned || restricted) |
3862 | { | 4054 | { |
3863 | ILandObject nearestParcel = GetNearestAllowedParcel(agent.AgentID, agent.startpos.X, agent.startpos.Y); | 4055 | ILandObject nearestParcel = GetNearestAllowedParcel(agentID, posX, posY); |
3864 | if (nearestParcel != null) | 4056 | if (nearestParcel != null) |
3865 | { | 4057 | { |
3866 | //Move agent to nearest allowed | 4058 | //Move agent to nearest allowed |
3867 | Vector3 newPosition = GetParcelCenterAtGround(nearestParcel); | 4059 | Vector3 newPosition = GetParcelCenterAtGround(nearestParcel); |
3868 | agent.startpos.X = newPosition.X; | 4060 | posX = newPosition.X; |
3869 | agent.startpos.Y = newPosition.Y; | 4061 | posY = newPosition.Y; |
3870 | } | 4062 | } |
3871 | else | 4063 | else |
3872 | { | 4064 | { |
@@ -3928,7 +4120,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3928 | 4120 | ||
3929 | if (!m_strictAccessControl) return true; | 4121 | if (!m_strictAccessControl) return true; |
3930 | if (Permissions.IsGod(agent.AgentID)) return true; | 4122 | if (Permissions.IsGod(agent.AgentID)) return true; |
3931 | 4123 | ||
3932 | if (AuthorizationService != null) | 4124 | if (AuthorizationService != null) |
3933 | { | 4125 | { |
3934 | if (!AuthorizationService.IsAuthorizedForRegion( | 4126 | if (!AuthorizationService.IsAuthorizedForRegion( |
@@ -3943,7 +4135,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3943 | 4135 | ||
3944 | if (RegionInfo.EstateSettings != null) | 4136 | if (RegionInfo.EstateSettings != null) |
3945 | { | 4137 | { |
3946 | if (RegionInfo.EstateSettings.IsBanned(agent.AgentID)) | 4138 | if (RegionInfo.EstateSettings.IsBanned(agent.AgentID, 0)) |
3947 | { | 4139 | { |
3948 | m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the user is on the banlist", | 4140 | m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the user is on the banlist", |
3949 | agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName); | 4141 | agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName); |
@@ -4133,6 +4325,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
4133 | 4325 | ||
4134 | // XPTO: if this agent is not allowed here as root, always return false | 4326 | // XPTO: if this agent is not allowed here as root, always return false |
4135 | 4327 | ||
4328 | // We have to wait until the viewer contacts this region after receiving EAC. | ||
4329 | // That calls AddNewClient, which finally creates the ScenePresence | ||
4330 | int flags = GetUserFlags(cAgentData.AgentID); | ||
4331 | if (RegionInfo.EstateSettings.IsBanned(cAgentData.AgentID, flags)) | ||
4332 | { | ||
4333 | m_log.DebugFormat("[SCENE]: Denying root agent entry to {0}: banned", cAgentData.AgentID); | ||
4334 | return false; | ||
4335 | } | ||
4336 | |||
4136 | // TODO: This check should probably be in QueryAccess(). | 4337 | // TODO: This check should probably be in QueryAccess(). |
4137 | ILandObject nearestParcel = GetNearestAllowedParcel(cAgentData.AgentID, Constants.RegionSize / 2, Constants.RegionSize / 2); | 4338 | ILandObject nearestParcel = GetNearestAllowedParcel(cAgentData.AgentID, Constants.RegionSize / 2, Constants.RegionSize / 2); |
4138 | if (nearestParcel == null) | 4339 | if (nearestParcel == null) |
@@ -4197,7 +4398,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4197 | /// <param name='agentID'></param> | 4398 | /// <param name='agentID'></param> |
4198 | protected virtual ScenePresence WaitGetScenePresence(UUID agentID) | 4399 | protected virtual ScenePresence WaitGetScenePresence(UUID agentID) |
4199 | { | 4400 | { |
4200 | int ntimes = 10; | 4401 | int ntimes = 30; |
4201 | ScenePresence sp = null; | 4402 | ScenePresence sp = null; |
4202 | while ((sp = GetScenePresence(agentID)) == null && (ntimes-- > 0)) | 4403 | while ((sp = GetScenePresence(agentID)) == null && (ntimes-- > 0)) |
4203 | Thread.Sleep(1000); | 4404 | Thread.Sleep(1000); |
@@ -4227,6 +4428,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
4227 | return false; | 4428 | return false; |
4228 | } | 4429 | } |
4229 | 4430 | ||
4431 | public bool IncomingCloseAgent(UUID agentID) | ||
4432 | { | ||
4433 | return IncomingCloseAgent(agentID, false); | ||
4434 | } | ||
4435 | |||
4436 | public bool IncomingCloseChildAgent(UUID agentID) | ||
4437 | { | ||
4438 | return IncomingCloseAgent(agentID, true); | ||
4439 | } | ||
4440 | |||
4230 | /// <summary> | 4441 | /// <summary> |
4231 | /// Tell a single agent to disconnect from the region. | 4442 | /// Tell a single agent to disconnect from the region. |
4232 | /// </summary> | 4443 | /// </summary> |
@@ -4242,7 +4453,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4242 | ScenePresence presence = m_sceneGraph.GetScenePresence(agentID); | 4453 | ScenePresence presence = m_sceneGraph.GetScenePresence(agentID); |
4243 | if (presence != null) | 4454 | if (presence != null) |
4244 | { | 4455 | { |
4245 | presence.ControllingClient.Close(force); | 4456 | presence.ControllingClient.Close(force, force); |
4246 | return true; | 4457 | return true; |
4247 | } | 4458 | } |
4248 | 4459 | ||
@@ -4890,35 +5101,81 @@ namespace OpenSim.Region.Framework.Scenes | |||
4890 | SimulationDataService.RemoveObject(uuid, RegionInfo.RegionID); | 5101 | SimulationDataService.RemoveObject(uuid, RegionInfo.RegionID); |
4891 | } | 5102 | } |
4892 | 5103 | ||
4893 | public int GetHealth() | 5104 | public int GetHealth(out int flags, out string message) |
4894 | { | 5105 | { |
4895 | // Returns: | 5106 | // Returns: |
4896 | // 1 = sim is up and accepting http requests. The heartbeat has | 5107 | // 1 = sim is up and accepting http requests. The heartbeat has |
4897 | // stopped and the sim is probably locked up, but a remote | 5108 | // stopped and the sim is probably locked up, but a remote |
4898 | // admin restart may succeed | 5109 | // admin restart may succeed |
4899 | // | 5110 | // |
4900 | // 2 = Sim is up and the heartbeat is running. The sim is likely | 5111 | // 2 = Sim is up and the heartbeat is running. The sim is likely |
4901 | // usable for people within and logins _may_ work | 5112 | // usable for people within |
4902 | // | 5113 | // |
4903 | // 3 = We have seen a new user enter within the past 4 minutes | 5114 | // 3 = Sim is up and one packet thread is running. Sim is |
5115 | // unstable and will not accept new logins | ||
5116 | // | ||
5117 | // 4 = Sim is up and both packet threads are running. Sim is | ||
5118 | // likely usable | ||
5119 | // | ||
5120 | // 5 = We have seen a new user enter within the past 4 minutes | ||
4904 | // which can be seen as positive confirmation of sim health | 5121 | // which can be seen as positive confirmation of sim health |
4905 | // | 5122 | // |
5123 | |||
5124 | flags = 0; | ||
5125 | message = String.Empty; | ||
5126 | |||
5127 | CheckHeartbeat(); | ||
5128 | |||
5129 | if (m_firstHeartbeat || (m_lastIncoming == 0 && m_lastOutgoing == 0)) | ||
5130 | { | ||
5131 | // We're still starting | ||
5132 | // 0 means "in startup", it can't happen another way, since | ||
5133 | // to get here, we must be able to accept http connections | ||
5134 | return 0; | ||
5135 | } | ||
5136 | |||
4906 | int health=1; // Start at 1, means we're up | 5137 | int health=1; // Start at 1, means we're up |
4907 | 5138 | ||
4908 | if ((Util.EnvironmentTickCountSubtract(m_lastFrameTick)) < 1000) | 5139 | if ((Util.EnvironmentTickCountSubtract(m_lastFrameTick)) < 1000) |
4909 | health += 1; | 5140 | { |
5141 | health+=1; | ||
5142 | flags |= 1; | ||
5143 | } | ||
5144 | |||
5145 | if (Util.EnvironmentTickCountSubtract(m_lastIncoming) < 1000) | ||
5146 | { | ||
5147 | health+=1; | ||
5148 | flags |= 2; | ||
5149 | } | ||
5150 | |||
5151 | if (Util.EnvironmentTickCountSubtract(m_lastOutgoing) < 1000) | ||
5152 | { | ||
5153 | health+=1; | ||
5154 | flags |= 4; | ||
5155 | } | ||
4910 | else | 5156 | else |
5157 | { | ||
5158 | int pid = System.Diagnostics.Process.GetCurrentProcess().Id; | ||
5159 | System.Diagnostics.Process proc = new System.Diagnostics.Process(); | ||
5160 | proc.EnableRaisingEvents=false; | ||
5161 | proc.StartInfo.FileName = "/bin/kill"; | ||
5162 | proc.StartInfo.Arguments = "-QUIT " + pid.ToString(); | ||
5163 | proc.Start(); | ||
5164 | proc.WaitForExit(); | ||
5165 | Thread.Sleep(1000); | ||
5166 | Environment.Exit(1); | ||
5167 | } | ||
5168 | |||
5169 | if (flags != 7) | ||
4911 | return health; | 5170 | return health; |
4912 | 5171 | ||
4913 | // A login in the last 4 mins? We can't be doing too badly | 5172 | // A login in the last 4 mins? We can't be doing too badly |
4914 | // | 5173 | // |
4915 | if ((Util.EnvironmentTickCountSubtract(m_LastLogin)) < 240000) | 5174 | if (Util.EnvironmentTickCountSubtract(m_LastLogin) < 240000) |
4916 | health++; | 5175 | health++; |
4917 | else | 5176 | else |
4918 | return health; | 5177 | return health; |
4919 | 5178 | ||
4920 | // CheckHeartbeat(); | ||
4921 | |||
4922 | return health; | 5179 | return health; |
4923 | } | 5180 | } |
4924 | 5181 | ||
@@ -5006,7 +5263,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
5006 | bool wasUsingPhysics = ((jointProxyObject.Flags & PrimFlags.Physics) != 0); | 5263 | bool wasUsingPhysics = ((jointProxyObject.Flags & PrimFlags.Physics) != 0); |
5007 | if (wasUsingPhysics) | 5264 | if (wasUsingPhysics) |
5008 | { | 5265 | { |
5009 | 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 | 5266 | 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 |
5010 | } | 5267 | } |
5011 | } | 5268 | } |
5012 | 5269 | ||
@@ -5105,14 +5362,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
5105 | return (((vsn.X * xdiff) + (vsn.Y * ydiff)) / (-1 * vsn.Z)) + p0.Z; | 5362 | return (((vsn.X * xdiff) + (vsn.Y * ydiff)) / (-1 * vsn.Z)) + p0.Z; |
5106 | } | 5363 | } |
5107 | 5364 | ||
5108 | // private void CheckHeartbeat() | 5365 | private void CheckHeartbeat() |
5109 | // { | 5366 | { |
5110 | // if (m_firstHeartbeat) | 5367 | if (m_firstHeartbeat) |
5111 | // return; | 5368 | return; |
5112 | // | 5369 | |
5113 | // if (Util.EnvironmentTickCountSubtract(m_lastFrameTick) > 2000) | 5370 | if ((Util.EnvironmentTickCountSubtract(m_lastFrameTick)) > 5000) |
5114 | // StartTimer(); | 5371 | Start(); |
5115 | // } | 5372 | } |
5116 | 5373 | ||
5117 | public override ISceneObject DeserializeObject(string representation) | 5374 | public override ISceneObject DeserializeObject(string representation) |
5118 | { | 5375 | { |
@@ -5124,9 +5381,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
5124 | get { return m_allowScriptCrossings; } | 5381 | get { return m_allowScriptCrossings; } |
5125 | } | 5382 | } |
5126 | 5383 | ||
5127 | public Vector3? GetNearestAllowedPosition(ScenePresence avatar) | 5384 | public Vector3 GetNearestAllowedPosition(ScenePresence avatar) |
5128 | { | 5385 | { |
5129 | ILandObject nearestParcel = GetNearestAllowedParcel(avatar.UUID, avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y); | 5386 | return GetNearestAllowedPosition(avatar, null); |
5387 | } | ||
5388 | |||
5389 | public Vector3 GetNearestAllowedPosition(ScenePresence avatar, ILandObject excludeParcel) | ||
5390 | { | ||
5391 | ILandObject nearestParcel = GetNearestAllowedParcel(avatar.UUID, avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y, excludeParcel); | ||
5130 | 5392 | ||
5131 | if (nearestParcel != null) | 5393 | if (nearestParcel != null) |
5132 | { | 5394 | { |
@@ -5135,10 +5397,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
5135 | Vector3? nearestPoint = GetNearestPointInParcelAlongDirectionFromPoint(avatar.AbsolutePosition, dir, nearestParcel); | 5397 | Vector3? nearestPoint = GetNearestPointInParcelAlongDirectionFromPoint(avatar.AbsolutePosition, dir, nearestParcel); |
5136 | if (nearestPoint != null) | 5398 | if (nearestPoint != null) |
5137 | { | 5399 | { |
5138 | // m_log.DebugFormat( | 5400 | Debug.WriteLine("Found a sane previous position based on velocity, sending them to: " + nearestPoint.ToString()); |
5139 | // "[SCENE]: Found a sane previous position based on velocity for {0}, sending them to {1} in {2}", | ||
5140 | // avatar.Name, nearestPoint, nearestParcel.LandData.Name); | ||
5141 | |||
5142 | return nearestPoint.Value; | 5401 | return nearestPoint.Value; |
5143 | } | 5402 | } |
5144 | 5403 | ||
@@ -5148,17 +5407,20 @@ namespace OpenSim.Region.Framework.Scenes | |||
5148 | nearestPoint = GetNearestPointInParcelAlongDirectionFromPoint(avatar.AbsolutePosition, dir, nearestParcel); | 5407 | nearestPoint = GetNearestPointInParcelAlongDirectionFromPoint(avatar.AbsolutePosition, dir, nearestParcel); |
5149 | if (nearestPoint != null) | 5408 | if (nearestPoint != null) |
5150 | { | 5409 | { |
5151 | // m_log.DebugFormat( | 5410 | Debug.WriteLine("They had a zero velocity, sending them to: " + nearestPoint.ToString()); |
5152 | // "[SCENE]: {0} had a zero velocity, sending them to {1}", avatar.Name, nearestPoint); | ||
5153 | |||
5154 | return nearestPoint.Value; | 5411 | return nearestPoint.Value; |
5155 | } | 5412 | } |
5156 | 5413 | ||
5157 | //Ultimate backup if we have no idea where they are | 5414 | ILandObject dest = LandChannel.GetLandObject(avatar.lastKnownAllowedPosition.X, avatar.lastKnownAllowedPosition.Y); |
5158 | // m_log.DebugFormat( | 5415 | if (dest != excludeParcel) |
5159 | // "[SCENE]: No idea where {0} is, sending them to {1}", avatar.Name, avatar.lastKnownAllowedPosition); | 5416 | { |
5417 | // Ultimate backup if we have no idea where they are and | ||
5418 | // the last allowed position was in another parcel | ||
5419 | Debug.WriteLine("Have no idea where they are, sending them to: " + avatar.lastKnownAllowedPosition.ToString()); | ||
5420 | return avatar.lastKnownAllowedPosition; | ||
5421 | } | ||
5160 | 5422 | ||
5161 | return avatar.lastKnownAllowedPosition; | 5423 | // else fall through to region edge |
5162 | } | 5424 | } |
5163 | 5425 | ||
5164 | //Go to the edge, this happens in teleporting to a region with no available parcels | 5426 | //Go to the edge, this happens in teleporting to a region with no available parcels |
@@ -5192,13 +5454,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
5192 | 5454 | ||
5193 | public ILandObject GetNearestAllowedParcel(UUID avatarId, float x, float y) | 5455 | public ILandObject GetNearestAllowedParcel(UUID avatarId, float x, float y) |
5194 | { | 5456 | { |
5457 | return GetNearestAllowedParcel(avatarId, x, y, null); | ||
5458 | } | ||
5459 | |||
5460 | public ILandObject GetNearestAllowedParcel(UUID avatarId, float x, float y, ILandObject excludeParcel) | ||
5461 | { | ||
5195 | List<ILandObject> all = AllParcels(); | 5462 | List<ILandObject> all = AllParcels(); |
5196 | float minParcelDistance = float.MaxValue; | 5463 | float minParcelDistance = float.MaxValue; |
5197 | ILandObject nearestParcel = null; | 5464 | ILandObject nearestParcel = null; |
5198 | 5465 | ||
5199 | foreach (var parcel in all) | 5466 | foreach (var parcel in all) |
5200 | { | 5467 | { |
5201 | if (!parcel.IsEitherBannedOrRestricted(avatarId)) | 5468 | if (!parcel.IsEitherBannedOrRestricted(avatarId) && parcel != excludeParcel) |
5202 | { | 5469 | { |
5203 | float parcelDistance = GetParcelDistancefromPoint(parcel, x, y); | 5470 | float parcelDistance = GetParcelDistancefromPoint(parcel, x, y); |
5204 | if (parcelDistance < minParcelDistance) | 5471 | if (parcelDistance < minParcelDistance) |
@@ -5440,7 +5707,55 @@ namespace OpenSim.Region.Framework.Scenes | |||
5440 | mapModule.GenerateMaptile(); | 5707 | mapModule.GenerateMaptile(); |
5441 | } | 5708 | } |
5442 | 5709 | ||
5443 | private void RegenerateMaptileAndReregister(object sender, ElapsedEventArgs e) | 5710 | // public void CleanDroppedAttachments() |
5711 | // { | ||
5712 | // List<SceneObjectGroup> objectsToDelete = | ||
5713 | // new List<SceneObjectGroup>(); | ||
5714 | // | ||
5715 | // lock (m_cleaningAttachments) | ||
5716 | // { | ||
5717 | // ForEachSOG(delegate (SceneObjectGroup grp) | ||
5718 | // { | ||
5719 | // if (grp.RootPart.Shape.PCode == 0 && grp.RootPart.Shape.State != 0 && (!objectsToDelete.Contains(grp))) | ||
5720 | // { | ||
5721 | // UUID agentID = grp.OwnerID; | ||
5722 | // if (agentID == UUID.Zero) | ||
5723 | // { | ||
5724 | // objectsToDelete.Add(grp); | ||
5725 | // return; | ||
5726 | // } | ||
5727 | // | ||
5728 | // ScenePresence sp = GetScenePresence(agentID); | ||
5729 | // if (sp == null) | ||
5730 | // { | ||
5731 | // objectsToDelete.Add(grp); | ||
5732 | // return; | ||
5733 | // } | ||
5734 | // } | ||
5735 | // }); | ||
5736 | // } | ||
5737 | // | ||
5738 | // foreach (SceneObjectGroup grp in objectsToDelete) | ||
5739 | // { | ||
5740 | // m_log.InfoFormat("[SCENE]: Deleting dropped attachment {0} of user {1}", grp.UUID, grp.OwnerID); | ||
5741 | // DeleteSceneObject(grp, true); | ||
5742 | // } | ||
5743 | // } | ||
5744 | |||
5745 | public void ThreadAlive(int threadCode) | ||
5746 | { | ||
5747 | switch(threadCode) | ||
5748 | { | ||
5749 | case 1: // Incoming | ||
5750 | m_lastIncoming = Util.EnvironmentTickCount(); | ||
5751 | break; | ||
5752 | case 2: // Incoming | ||
5753 | m_lastOutgoing = Util.EnvironmentTickCount(); | ||
5754 | break; | ||
5755 | } | ||
5756 | } | ||
5757 | |||
5758 | public void RegenerateMaptileAndReregister(object sender, ElapsedEventArgs e) | ||
5444 | { | 5759 | { |
5445 | RegenerateMaptile(); | 5760 | RegenerateMaptile(); |
5446 | 5761 | ||
@@ -5468,6 +5783,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
5468 | /// <returns></returns> | 5783 | /// <returns></returns> |
5469 | public bool QueryAccess(UUID agentID, Vector3 position, out string reason) | 5784 | public bool QueryAccess(UUID agentID, Vector3 position, out string reason) |
5470 | { | 5785 | { |
5786 | reason = "You are banned from the region"; | ||
5787 | |||
5471 | if (EntityTransferModule.IsInTransit(agentID)) | 5788 | if (EntityTransferModule.IsInTransit(agentID)) |
5472 | { | 5789 | { |
5473 | reason = "Agent is still in transit from this region"; | 5790 | reason = "Agent is still in transit from this region"; |
@@ -5479,6 +5796,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
5479 | return false; | 5796 | return false; |
5480 | } | 5797 | } |
5481 | 5798 | ||
5799 | if (Permissions.IsGod(agentID)) | ||
5800 | { | ||
5801 | reason = String.Empty; | ||
5802 | return true; | ||
5803 | } | ||
5804 | |||
5482 | // FIXME: Root agent count is currently known to be inaccurate. This forces a recount before we check. | 5805 | // FIXME: Root agent count is currently known to be inaccurate. This forces a recount before we check. |
5483 | // However, the long term fix is to make sure root agent count is always accurate. | 5806 | // However, the long term fix is to make sure root agent count is always accurate. |
5484 | m_sceneGraph.RecalculateStats(); | 5807 | m_sceneGraph.RecalculateStats(); |
@@ -5499,6 +5822,41 @@ namespace OpenSim.Region.Framework.Scenes | |||
5499 | } | 5822 | } |
5500 | } | 5823 | } |
5501 | 5824 | ||
5825 | ScenePresence presence = GetScenePresence(agentID); | ||
5826 | IClientAPI client = null; | ||
5827 | AgentCircuitData aCircuit = null; | ||
5828 | |||
5829 | if (presence != null) | ||
5830 | { | ||
5831 | client = presence.ControllingClient; | ||
5832 | if (client != null) | ||
5833 | aCircuit = client.RequestClientInfo(); | ||
5834 | } | ||
5835 | |||
5836 | // We may be called before there is a presence or a client. | ||
5837 | // Fake AgentCircuitData to keep IAuthorizationModule smiling | ||
5838 | if (client == null) | ||
5839 | { | ||
5840 | aCircuit = new AgentCircuitData(); | ||
5841 | aCircuit.AgentID = agentID; | ||
5842 | aCircuit.firstname = String.Empty; | ||
5843 | aCircuit.lastname = String.Empty; | ||
5844 | } | ||
5845 | |||
5846 | try | ||
5847 | { | ||
5848 | if (!AuthorizeUser(aCircuit, out reason)) | ||
5849 | { | ||
5850 | // m_log.DebugFormat("[SCENE]: Denying access for {0}", agentID); | ||
5851 | return false; | ||
5852 | } | ||
5853 | } | ||
5854 | catch (Exception e) | ||
5855 | { | ||
5856 | m_log.DebugFormat("[SCENE]: Exception authorizing agent: {0} "+ e.StackTrace, e.Message); | ||
5857 | return false; | ||
5858 | } | ||
5859 | |||
5502 | if (position == Vector3.Zero) // Teleport | 5860 | if (position == Vector3.Zero) // Teleport |
5503 | { | 5861 | { |
5504 | if (!RegionInfo.EstateSettings.AllowDirectTeleport) | 5862 | if (!RegionInfo.EstateSettings.AllowDirectTeleport) |
@@ -5527,13 +5885,46 @@ namespace OpenSim.Region.Framework.Scenes | |||
5527 | } | 5885 | } |
5528 | } | 5886 | } |
5529 | } | 5887 | } |
5888 | |||
5889 | float posX = 128.0f; | ||
5890 | float posY = 128.0f; | ||
5891 | |||
5892 | if (!TestLandRestrictions(agentID, out reason, ref posX, ref posY)) | ||
5893 | { | ||
5894 | // m_log.DebugFormat("[SCENE]: Denying {0} because they are banned on all parcels", agentID); | ||
5895 | return false; | ||
5896 | } | ||
5897 | } | ||
5898 | else // Walking | ||
5899 | { | ||
5900 | ILandObject land = LandChannel.GetLandObject(position.X, position.Y); | ||
5901 | if (land == null) | ||
5902 | return false; | ||
5903 | |||
5904 | bool banned = land.IsBannedFromLand(agentID); | ||
5905 | bool restricted = land.IsRestrictedFromLand(agentID); | ||
5906 | |||
5907 | if (banned || restricted) | ||
5908 | return false; | ||
5530 | } | 5909 | } |
5531 | 5910 | ||
5532 | reason = String.Empty; | 5911 | reason = String.Empty; |
5533 | return true; | 5912 | return true; |
5534 | } | 5913 | } |
5535 | 5914 | ||
5536 | /// <summary> | 5915 | public void StartTimerWatchdog() |
5916 | { | ||
5917 | m_timerWatchdog.Interval = 1000; | ||
5918 | m_timerWatchdog.Elapsed += TimerWatchdog; | ||
5919 | m_timerWatchdog.AutoReset = true; | ||
5920 | m_timerWatchdog.Start(); | ||
5921 | } | ||
5922 | |||
5923 | public void TimerWatchdog(object sender, ElapsedEventArgs e) | ||
5924 | { | ||
5925 | CheckHeartbeat(); | ||
5926 | } | ||
5927 | |||
5537 | /// This method deals with movement when an avatar is automatically moving (but this is distinct from the | 5928 | /// This method deals with movement when an avatar is automatically moving (but this is distinct from the |
5538 | /// autopilot that moves an avatar to a sit target!. | 5929 | /// autopilot that moves an avatar to a sit target!. |
5539 | /// </summary> | 5930 | /// </summary> |
@@ -5612,6 +6003,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
5612 | return m_SpawnPoint - 1; | 6003 | return m_SpawnPoint - 1; |
5613 | } | 6004 | } |
5614 | 6005 | ||
6006 | private void HandleGcCollect(string module, string[] args) | ||
6007 | { | ||
6008 | GC.Collect(); | ||
6009 | } | ||
6010 | |||
5615 | // Wrappers to get physics modules retrieve assets. Has to be done this way | 6011 | // Wrappers to get physics modules retrieve assets. Has to be done this way |
5616 | // because we can't assign the asset service to physics directly - at the | 6012 | // because we can't assign the asset service to physics directly - at the |
5617 | // time physics are instantiated it's not registered but it will be by | 6013 | // time physics are instantiated it's not registered but it will be by |