diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Scene.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.cs | 520 |
1 files changed, 412 insertions, 108 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 610bcd6..3fd7485 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -227,8 +227,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
227 | // TODO: need to figure out how allow client agents but deny | 227 | // TODO: need to figure out how allow client agents but deny |
228 | // root agents when ACL denies access to root agent | 228 | // root agents when ACL denies access to root agent |
229 | public bool m_strictAccessControl = true; | 229 | public bool m_strictAccessControl = true; |
230 | 230 | public bool m_seeIntoBannedRegion = false; | |
231 | public int MaxUndoCount { get; set; } | 231 | public int MaxUndoCount = 5; |
232 | 232 | ||
233 | public bool SeeIntoRegion { get; set; } | 233 | public bool SeeIntoRegion { get; set; } |
234 | 234 | ||
@@ -246,11 +246,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
246 | 246 | ||
247 | protected int m_splitRegionID; | 247 | protected int m_splitRegionID; |
248 | protected Timer m_restartWaitTimer = new Timer(); | 248 | protected Timer m_restartWaitTimer = new Timer(); |
249 | protected Timer m_timerWatchdog = new Timer(); | ||
249 | protected List<RegionInfo> m_regionRestartNotifyList = new List<RegionInfo>(); | 250 | protected List<RegionInfo> m_regionRestartNotifyList = new List<RegionInfo>(); |
250 | protected List<RegionInfo> m_neighbours = new List<RegionInfo>(); | 251 | protected List<RegionInfo> m_neighbours = new List<RegionInfo>(); |
251 | protected string m_simulatorVersion = "OpenSimulator Server"; | 252 | protected string m_simulatorVersion = "OpenSimulator Server"; |
252 | protected AgentCircuitManager m_authenticateHandler; | 253 | protected AgentCircuitManager m_authenticateHandler; |
253 | protected SceneCommunicationService m_sceneGridService; | 254 | protected SceneCommunicationService m_sceneGridService; |
255 | protected ISnmpModule m_snmpService = null; | ||
254 | 256 | ||
255 | protected ISimulationDataService m_SimulationDataService; | 257 | protected ISimulationDataService m_SimulationDataService; |
256 | protected IEstateDataService m_EstateDataService; | 258 | protected IEstateDataService m_EstateDataService; |
@@ -313,8 +315,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
313 | private int m_update_presences = 1; // Update scene presence movements | 315 | private int m_update_presences = 1; // Update scene presence movements |
314 | private int m_update_events = 1; | 316 | private int m_update_events = 1; |
315 | private int m_update_backup = 200; | 317 | private int m_update_backup = 200; |
316 | private int m_update_terrain = 50; | 318 | private int m_update_terrain = 1000; |
317 | // private int m_update_land = 1; | 319 | private int m_update_land = 10; |
318 | private int m_update_coarse_locations = 50; | 320 | private int m_update_coarse_locations = 50; |
319 | 321 | ||
320 | private int agentMS; | 322 | private int agentMS; |
@@ -327,13 +329,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
327 | private int backupMS; | 329 | private int backupMS; |
328 | private int terrainMS; | 330 | private int terrainMS; |
329 | private int landMS; | 331 | private int landMS; |
330 | private int spareMS; | ||
331 | 332 | ||
332 | /// <summary> | 333 | /// <summary> |
333 | /// Tick at which the last frame was processed. | 334 | /// Tick at which the last frame was processed. |
334 | /// </summary> | 335 | /// </summary> |
335 | private int m_lastFrameTick; | 336 | private int m_lastFrameTick; |
336 | 337 | ||
338 | public bool CombineRegions = false; | ||
337 | /// <summary> | 339 | /// <summary> |
338 | /// Tick at which the last maintenance run occurred. | 340 | /// Tick at which the last maintenance run occurred. |
339 | /// </summary> | 341 | /// </summary> |
@@ -353,7 +355,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
353 | private readonly Timer m_restartTimer = new Timer(15000); // Wait before firing | 355 | private readonly Timer m_restartTimer = new Timer(15000); // Wait before firing |
354 | private volatile bool m_backingup; | 356 | private volatile bool m_backingup; |
355 | private Dictionary<UUID, ReturnInfo> m_returns = new Dictionary<UUID, ReturnInfo>(); | 357 | private Dictionary<UUID, ReturnInfo> m_returns = new Dictionary<UUID, ReturnInfo>(); |
356 | private Dictionary<UUID, SceneObjectGroup> m_groupsWithTargets = new Dictionary<UUID, SceneObjectGroup>(); | 358 | private Dictionary<UUID, int> m_groupsWithTargets = new Dictionary<UUID, int>(); |
357 | 359 | ||
358 | private string m_defaultScriptEngine; | 360 | private string m_defaultScriptEngine; |
359 | 361 | ||
@@ -362,6 +364,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
362 | /// </summary> | 364 | /// </summary> |
363 | private int m_LastLogin; | 365 | private int m_LastLogin; |
364 | 366 | ||
367 | private int m_lastIncoming; | ||
368 | private int m_lastOutgoing; | ||
369 | private int m_hbRestarts = 0; | ||
370 | |||
371 | |||
365 | /// <summary> | 372 | /// <summary> |
366 | /// Thread that runs the scene loop. | 373 | /// Thread that runs the scene loop. |
367 | /// </summary> | 374 | /// </summary> |
@@ -404,7 +411,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
404 | private volatile bool m_active; | 411 | private volatile bool m_active; |
405 | 412 | ||
406 | // private int m_lastUpdate; | 413 | // private int m_lastUpdate; |
407 | // private bool m_firstHeartbeat = true; | 414 | private bool m_firstHeartbeat = true; |
408 | 415 | ||
409 | private UpdatePrioritizationSchemes m_priorityScheme = UpdatePrioritizationSchemes.Time; | 416 | private UpdatePrioritizationSchemes m_priorityScheme = UpdatePrioritizationSchemes.Time; |
410 | private bool m_reprioritizationEnabled = true; | 417 | private bool m_reprioritizationEnabled = true; |
@@ -448,6 +455,19 @@ namespace OpenSim.Region.Framework.Scenes | |||
448 | get { return m_sceneGridService; } | 455 | get { return m_sceneGridService; } |
449 | } | 456 | } |
450 | 457 | ||
458 | public ISnmpModule SnmpService | ||
459 | { | ||
460 | get | ||
461 | { | ||
462 | if (m_snmpService == null) | ||
463 | { | ||
464 | m_snmpService = RequestModuleInterface<ISnmpModule>(); | ||
465 | } | ||
466 | |||
467 | return m_snmpService; | ||
468 | } | ||
469 | } | ||
470 | |||
451 | public ISimulationDataService SimulationDataService | 471 | public ISimulationDataService SimulationDataService |
452 | { | 472 | { |
453 | get | 473 | get |
@@ -741,6 +761,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
741 | m_SimulationDataService = simDataService; | 761 | m_SimulationDataService = simDataService; |
742 | m_EstateDataService = estateDataService; | 762 | m_EstateDataService = estateDataService; |
743 | m_regionHandle = RegionInfo.RegionHandle; | 763 | m_regionHandle = RegionInfo.RegionHandle; |
764 | m_lastIncoming = 0; | ||
765 | m_lastOutgoing = 0; | ||
744 | 766 | ||
745 | m_asyncSceneObjectDeleter = new AsyncSceneObjectGroupDeleter(this); | 767 | m_asyncSceneObjectDeleter = new AsyncSceneObjectGroupDeleter(this); |
746 | m_asyncSceneObjectDeleter.Enabled = true; | 768 | m_asyncSceneObjectDeleter.Enabled = true; |
@@ -834,7 +856,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
834 | 856 | ||
835 | StartDisabled = startupConfig.GetBoolean("StartDisabled", false); | 857 | StartDisabled = startupConfig.GetBoolean("StartDisabled", false); |
836 | 858 | ||
837 | m_defaultDrawDistance = startupConfig.GetFloat("DefaultDrawDistance", m_defaultDrawDistance); | 859 | m_defaultDrawDistance = startupConfig.GetFloat("DefaultDrawDistance",m_defaultDrawDistance); |
838 | UseBackup = startupConfig.GetBoolean("UseSceneBackup", UseBackup); | 860 | UseBackup = startupConfig.GetBoolean("UseSceneBackup", UseBackup); |
839 | if (!UseBackup) | 861 | if (!UseBackup) |
840 | m_log.InfoFormat("[SCENE]: Backup has been disabled for {0}", RegionInfo.RegionName); | 862 | m_log.InfoFormat("[SCENE]: Backup has been disabled for {0}", RegionInfo.RegionName); |
@@ -846,9 +868,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
846 | 868 | ||
847 | MaxUndoCount = startupConfig.GetInt("MaxPrimUndos", 20); | 869 | MaxUndoCount = startupConfig.GetInt("MaxPrimUndos", 20); |
848 | 870 | ||
849 | PhysicalPrims = startupConfig.GetBoolean("physical_prim", PhysicalPrims); | 871 | PhysicalPrims = startupConfig.GetBoolean("physical_prim", true); |
850 | CollidablePrims = startupConfig.GetBoolean("collidable_prim", CollidablePrims); | 872 | CollidablePrims = startupConfig.GetBoolean("collidable_prim", true); |
851 | |||
852 | m_minNonphys = startupConfig.GetFloat("NonPhysicalPrimMin", m_minNonphys); | 873 | m_minNonphys = startupConfig.GetFloat("NonPhysicalPrimMin", m_minNonphys); |
853 | if (RegionInfo.NonphysPrimMin > 0) | 874 | if (RegionInfo.NonphysPrimMin > 0) |
854 | { | 875 | { |
@@ -868,11 +889,21 @@ namespace OpenSim.Region.Framework.Scenes | |||
868 | } | 889 | } |
869 | 890 | ||
870 | m_maxPhys = startupConfig.GetFloat("PhysicalPrimMax", m_maxPhys); | 891 | m_maxPhys = startupConfig.GetFloat("PhysicalPrimMax", m_maxPhys); |
892 | |||
871 | if (RegionInfo.PhysPrimMax > 0) | 893 | if (RegionInfo.PhysPrimMax > 0) |
872 | { | 894 | { |
873 | m_maxPhys = RegionInfo.PhysPrimMax; | 895 | m_maxPhys = RegionInfo.PhysPrimMax; |
874 | } | 896 | } |
875 | 897 | ||
898 | m_linksetCapacity = startupConfig.GetInt("LinksetPrims", m_linksetCapacity); | ||
899 | if (RegionInfo.LinksetCapacity > 0) | ||
900 | { | ||
901 | m_linksetCapacity = RegionInfo.LinksetCapacity; | ||
902 | } | ||
903 | |||
904 | SpawnPointRouting = startupConfig.GetString("SpawnPointRouting", "closest"); | ||
905 | TelehubAllowLandmarks = startupConfig.GetBoolean("TelehubAllowLandmark", false); | ||
906 | |||
876 | // Here, if clamping is requested in either global or | 907 | // Here, if clamping is requested in either global or |
877 | // local config, it will be used | 908 | // local config, it will be used |
878 | // | 909 | // |
@@ -882,13 +913,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
882 | m_clampPrimSize = true; | 913 | m_clampPrimSize = true; |
883 | } | 914 | } |
884 | 915 | ||
885 | m_linksetCapacity = startupConfig.GetInt("LinksetPrims", m_linksetCapacity); | 916 | m_useTrashOnDelete = startupConfig.GetBoolean("UseTrashOnDelete",m_useTrashOnDelete); |
886 | if (RegionInfo.LinksetCapacity > 0) | ||
887 | { | ||
888 | m_linksetCapacity = RegionInfo.LinksetCapacity; | ||
889 | } | ||
890 | |||
891 | m_useTrashOnDelete = startupConfig.GetBoolean("UseTrashOnDelete", m_useTrashOnDelete); | ||
892 | m_trustBinaries = startupConfig.GetBoolean("TrustBinaries", m_trustBinaries); | 917 | m_trustBinaries = startupConfig.GetBoolean("TrustBinaries", m_trustBinaries); |
893 | m_allowScriptCrossings = startupConfig.GetBoolean("AllowScriptCrossing", m_allowScriptCrossings); | 918 | m_allowScriptCrossings = startupConfig.GetBoolean("AllowScriptCrossing", m_allowScriptCrossings); |
894 | m_dontPersistBefore = | 919 | m_dontPersistBefore = |
@@ -899,11 +924,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
899 | m_persistAfter *= 10000000; | 924 | m_persistAfter *= 10000000; |
900 | 925 | ||
901 | m_defaultScriptEngine = startupConfig.GetString("DefaultScriptEngine", "XEngine"); | 926 | m_defaultScriptEngine = startupConfig.GetString("DefaultScriptEngine", "XEngine"); |
902 | 927 | m_log.InfoFormat("[SCENE]: Default script engine {0}", m_defaultScriptEngine); | |
903 | SpawnPointRouting = startupConfig.GetString("SpawnPointRouting", "closest"); | ||
904 | TelehubAllowLandmarks = startupConfig.GetBoolean("TelehubAllowLandmark", false); | ||
905 | 928 | ||
906 | m_strictAccessControl = startupConfig.GetBoolean("StrictAccessControl", m_strictAccessControl); | 929 | m_strictAccessControl = startupConfig.GetBoolean("StrictAccessControl", m_strictAccessControl); |
930 | m_seeIntoBannedRegion = startupConfig.GetBoolean("SeeIntoBannedRegion", m_seeIntoBannedRegion); | ||
931 | CombineRegions = startupConfig.GetBoolean("CombineContiguousRegions", false); | ||
907 | 932 | ||
908 | string[] possibleMapConfigSections = new string[] { "Map", "Startup" }; | 933 | string[] possibleMapConfigSections = new string[] { "Map", "Startup" }; |
909 | 934 | ||
@@ -948,7 +973,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
948 | 973 | ||
949 | if (grant.Length > 0) | 974 | if (grant.Length > 0) |
950 | { | 975 | { |
951 | foreach (string viewer in grant.Split('|')) | 976 | foreach (string viewer in grant.Split(',')) |
952 | { | 977 | { |
953 | m_AllowedViewers.Add(viewer.Trim().ToLower()); | 978 | m_AllowedViewers.Add(viewer.Trim().ToLower()); |
954 | } | 979 | } |
@@ -960,7 +985,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
960 | 985 | ||
961 | if (grant.Length > 0) | 986 | if (grant.Length > 0) |
962 | { | 987 | { |
963 | foreach (string viewer in grant.Split('|')) | 988 | foreach (string viewer in grant.Split(',')) |
964 | { | 989 | { |
965 | m_BannedViewers.Add(viewer.Trim().ToLower()); | 990 | m_BannedViewers.Add(viewer.Trim().ToLower()); |
966 | } | 991 | } |
@@ -1020,6 +1045,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
1020 | StatsReporter = new SimStatsReporter(this); | 1045 | StatsReporter = new SimStatsReporter(this); |
1021 | StatsReporter.OnSendStatsResult += SendSimStatsPackets; | 1046 | StatsReporter.OnSendStatsResult += SendSimStatsPackets; |
1022 | StatsReporter.OnStatsIncorrect += m_sceneGraph.RecalculateStats; | 1047 | StatsReporter.OnStatsIncorrect += m_sceneGraph.RecalculateStats; |
1048 | |||
1049 | MainConsole.Instance.Commands.AddCommand("scene", false, "gc collect", "gc collect", "gc collect", "Cause the garbage collector to make a single pass", HandleGcCollect); | ||
1023 | } | 1050 | } |
1024 | 1051 | ||
1025 | public Scene(RegionInfo regInfo) : base(regInfo) | 1052 | public Scene(RegionInfo regInfo) : base(regInfo) |
@@ -1315,8 +1342,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
1315 | // Stop all client threads. | 1342 | // Stop all client threads. |
1316 | ForEachScenePresence(delegate(ScenePresence avatar) { CloseAgent(avatar.UUID, false); }); | 1343 | ForEachScenePresence(delegate(ScenePresence avatar) { CloseAgent(avatar.UUID, false); }); |
1317 | 1344 | ||
1318 | m_log.Debug("[SCENE]: Persisting changed objects"); | 1345 | m_log.Debug("[SCENE]: TriggerSceneShuttingDown"); |
1319 | EventManager.TriggerSceneShuttingDown(this); | 1346 | EventManager.TriggerSceneShuttingDown(this); |
1347 | |||
1348 | m_log.Debug("[SCENE]: Persisting changed objects"); | ||
1349 | |||
1320 | Backup(false); | 1350 | Backup(false); |
1321 | m_sceneGraph.Close(); | 1351 | m_sceneGraph.Close(); |
1322 | 1352 | ||
@@ -1330,6 +1360,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1330 | // attempt to reference a null or disposed physics scene. | 1360 | // attempt to reference a null or disposed physics scene. |
1331 | if (PhysicsScene != null) | 1361 | if (PhysicsScene != null) |
1332 | { | 1362 | { |
1363 | m_log.Debug("[SCENE]: Dispose Physics"); | ||
1333 | PhysicsScene phys = PhysicsScene; | 1364 | PhysicsScene phys = PhysicsScene; |
1334 | // remove the physics engine from both Scene and SceneGraph | 1365 | // remove the physics engine from both Scene and SceneGraph |
1335 | PhysicsScene = null; | 1366 | PhysicsScene = null; |
@@ -1360,11 +1391,29 @@ namespace OpenSim.Region.Framework.Scenes | |||
1360 | //m_heartbeatTimer.Elapsed += new ElapsedEventHandler(Heartbeat); | 1391 | //m_heartbeatTimer.Elapsed += new ElapsedEventHandler(Heartbeat); |
1361 | if (m_heartbeatThread != null) | 1392 | if (m_heartbeatThread != null) |
1362 | { | 1393 | { |
1394 | m_hbRestarts++; | ||
1395 | if(m_hbRestarts > 10) | ||
1396 | Environment.Exit(1); | ||
1397 | m_log.ErrorFormat("[SCENE]: Restarting heartbeat thread because it hasn't reported in in region {0}", RegionInfo.RegionName); | ||
1398 | |||
1399 | //int pid = System.Diagnostics.Process.GetCurrentProcess().Id; | ||
1400 | //System.Diagnostics.Process proc = new System.Diagnostics.Process(); | ||
1401 | //proc.EnableRaisingEvents=false; | ||
1402 | //proc.StartInfo.FileName = "/bin/kill"; | ||
1403 | //proc.StartInfo.Arguments = "-QUIT " + pid.ToString(); | ||
1404 | //proc.Start(); | ||
1405 | //proc.WaitForExit(); | ||
1406 | //Thread.Sleep(1000); | ||
1407 | //Environment.Exit(1); | ||
1363 | m_heartbeatThread.Abort(); | 1408 | m_heartbeatThread.Abort(); |
1409 | Watchdog.AbortThread(m_heartbeatThread.ManagedThreadId); | ||
1364 | m_heartbeatThread = null; | 1410 | m_heartbeatThread = null; |
1365 | } | 1411 | } |
1366 | // m_lastUpdate = Util.EnvironmentTickCount(); | 1412 | // m_lastUpdate = Util.EnvironmentTickCount(); |
1367 | 1413 | ||
1414 | // m_sceneGraph.PreparePhysicsSimulation(); | ||
1415 | |||
1416 | |||
1368 | m_heartbeatThread | 1417 | m_heartbeatThread |
1369 | = Watchdog.StartThread( | 1418 | = Watchdog.StartThread( |
1370 | Heartbeat, string.Format("Heartbeat ({0})", RegionInfo.RegionName), ThreadPriority.Normal, false, false); | 1419 | Heartbeat, string.Format("Heartbeat ({0})", RegionInfo.RegionName), ThreadPriority.Normal, false, false); |
@@ -1509,16 +1558,20 @@ namespace OpenSim.Region.Framework.Scenes | |||
1509 | endFrame = Frame + frames; | 1558 | endFrame = Frame + frames; |
1510 | 1559 | ||
1511 | float physicsFPS = 0f; | 1560 | float physicsFPS = 0f; |
1512 | int previousFrameTick, tmpMS; | 1561 | int tmpMS; |
1513 | int maintc = Util.EnvironmentTickCount(); | 1562 | int previousFrameTick; |
1563 | int maintc; | ||
1564 | int sleepMS; | ||
1565 | int framestart; | ||
1514 | 1566 | ||
1515 | while (!m_shuttingDown && ((endFrame == null && Active) || Frame < endFrame)) | 1567 | while (!m_shuttingDown && ((endFrame == null && Active) || Frame < endFrame)) |
1516 | { | 1568 | { |
1569 | framestart = Util.EnvironmentTickCount(); | ||
1517 | ++Frame; | 1570 | ++Frame; |
1518 | 1571 | ||
1519 | // m_log.DebugFormat("[SCENE]: Processing frame {0} in {1}", Frame, RegionInfo.RegionName); | 1572 | // m_log.DebugFormat("[SCENE]: Processing frame {0} in {1}", Frame, RegionInfo.RegionName); |
1520 | 1573 | ||
1521 | agentMS = tempOnRezMS = eventMS = backupMS = terrainMS = landMS = spareMS = 0; | 1574 | agentMS = tempOnRezMS = eventMS = backupMS = terrainMS = landMS = 0; |
1522 | 1575 | ||
1523 | try | 1576 | try |
1524 | { | 1577 | { |
@@ -1572,6 +1625,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1572 | m_sceneGraph.UpdatePresences(); | 1625 | m_sceneGraph.UpdatePresences(); |
1573 | 1626 | ||
1574 | agentMS += Util.EnvironmentTickCountSubtract(tmpMS); | 1627 | agentMS += Util.EnvironmentTickCountSubtract(tmpMS); |
1628 | |||
1575 | 1629 | ||
1576 | // Delete temp-on-rez stuff | 1630 | // Delete temp-on-rez stuff |
1577 | if (Frame % m_update_temp_cleaning == 0 && !m_cleaningTemps) | 1631 | if (Frame % m_update_temp_cleaning == 0 && !m_cleaningTemps) |
@@ -1653,34 +1707,37 @@ namespace OpenSim.Region.Framework.Scenes | |||
1653 | 1707 | ||
1654 | Watchdog.UpdateThread(); | 1708 | Watchdog.UpdateThread(); |
1655 | 1709 | ||
1710 | otherMS = tempOnRezMS + eventMS + backupMS + terrainMS + landMS; | ||
1711 | |||
1712 | StatsReporter.AddPhysicsFPS(physicsFPS); | ||
1713 | StatsReporter.AddTimeDilation(TimeDilation); | ||
1714 | StatsReporter.AddFPS(1); | ||
1715 | |||
1716 | StatsReporter.addAgentMS(agentMS); | ||
1717 | StatsReporter.addPhysicsMS(physicsMS + physicsMS2); | ||
1718 | StatsReporter.addOtherMS(otherMS); | ||
1719 | StatsReporter.addScriptLines(m_sceneGraph.GetScriptLPS()); | ||
1720 | |||
1656 | previousFrameTick = m_lastFrameTick; | 1721 | previousFrameTick = m_lastFrameTick; |
1657 | m_lastFrameTick = Util.EnvironmentTickCount(); | 1722 | m_lastFrameTick = Util.EnvironmentTickCount(); |
1658 | tmpMS = Util.EnvironmentTickCountSubtract(m_lastFrameTick, maintc); | 1723 | tmpMS = Util.EnvironmentTickCountSubtract(m_lastFrameTick, framestart); |
1659 | tmpMS = (int)(MinFrameTime * 1000) - tmpMS; | 1724 | tmpMS = (int)(MinFrameTime * 1000) - tmpMS; |
1660 | 1725 | ||
1726 | m_firstHeartbeat = false; | ||
1727 | |||
1728 | sleepMS = Util.EnvironmentTickCount(); | ||
1729 | |||
1661 | if (tmpMS > 0) | 1730 | if (tmpMS > 0) |
1662 | { | ||
1663 | Thread.Sleep(tmpMS); | 1731 | Thread.Sleep(tmpMS); |
1664 | spareMS += tmpMS; | ||
1665 | } | ||
1666 | 1732 | ||
1667 | frameMS = Util.EnvironmentTickCountSubtract(maintc); | 1733 | sleepMS = Util.EnvironmentTickCountSubtract(sleepMS); |
1668 | maintc = Util.EnvironmentTickCount(); | 1734 | frameMS = Util.EnvironmentTickCountSubtract(framestart); |
1669 | 1735 | StatsReporter.addSleepMS(sleepMS); | |
1670 | otherMS = tempOnRezMS + eventMS + backupMS + terrainMS + landMS; | 1736 | StatsReporter.addFrameMS(frameMS); |
1671 | 1737 | ||
1672 | // if (Frame%m_update_avatars == 0) | 1738 | // if (Frame%m_update_avatars == 0) |
1673 | // UpdateInWorldTime(); | 1739 | // UpdateInWorldTime(); |
1674 | StatsReporter.AddPhysicsFPS(physicsFPS); | ||
1675 | StatsReporter.AddTimeDilation(TimeDilation); | ||
1676 | StatsReporter.AddFPS(1); | ||
1677 | 1740 | ||
1678 | StatsReporter.addFrameMS(frameMS); | ||
1679 | StatsReporter.addAgentMS(agentMS); | ||
1680 | StatsReporter.addPhysicsMS(physicsMS + physicsMS2); | ||
1681 | StatsReporter.addOtherMS(otherMS); | ||
1682 | StatsReporter.AddSpareMS(spareMS); | ||
1683 | StatsReporter.addScriptLines(m_sceneGraph.GetScriptLPS()); | ||
1684 | 1741 | ||
1685 | // Optionally warn if a frame takes double the amount of time that it should. | 1742 | // Optionally warn if a frame takes double the amount of time that it should. |
1686 | if (DebugUpdates | 1743 | if (DebugUpdates |
@@ -1697,7 +1754,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1697 | public void AddGroupTarget(SceneObjectGroup grp) | 1754 | public void AddGroupTarget(SceneObjectGroup grp) |
1698 | { | 1755 | { |
1699 | lock (m_groupsWithTargets) | 1756 | lock (m_groupsWithTargets) |
1700 | m_groupsWithTargets[grp.UUID] = grp; | 1757 | m_groupsWithTargets[grp.UUID] = 0; |
1701 | } | 1758 | } |
1702 | 1759 | ||
1703 | public void RemoveGroupTarget(SceneObjectGroup grp) | 1760 | public void RemoveGroupTarget(SceneObjectGroup grp) |
@@ -1708,18 +1765,24 @@ namespace OpenSim.Region.Framework.Scenes | |||
1708 | 1765 | ||
1709 | private void CheckAtTargets() | 1766 | private void CheckAtTargets() |
1710 | { | 1767 | { |
1711 | List<SceneObjectGroup> objs = null; | 1768 | List<UUID> objs = null; |
1712 | 1769 | ||
1713 | lock (m_groupsWithTargets) | 1770 | lock (m_groupsWithTargets) |
1714 | { | 1771 | { |
1715 | if (m_groupsWithTargets.Count != 0) | 1772 | if (m_groupsWithTargets.Count != 0) |
1716 | objs = new List<SceneObjectGroup>(m_groupsWithTargets.Values); | 1773 | objs = new List<UUID>(m_groupsWithTargets.Keys); |
1717 | } | 1774 | } |
1718 | 1775 | ||
1719 | if (objs != null) | 1776 | if (objs != null) |
1720 | { | 1777 | { |
1721 | foreach (SceneObjectGroup entry in objs) | 1778 | foreach (UUID entry in objs) |
1722 | entry.checkAtTargets(); | 1779 | { |
1780 | SceneObjectGroup grp = GetSceneObjectGroup(entry); | ||
1781 | if (grp == null) | ||
1782 | m_groupsWithTargets.Remove(entry); | ||
1783 | else | ||
1784 | grp.checkAtTargets(); | ||
1785 | } | ||
1723 | } | 1786 | } |
1724 | } | 1787 | } |
1725 | 1788 | ||
@@ -1798,7 +1861,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1798 | msg.fromAgentName = "Server"; | 1861 | msg.fromAgentName = "Server"; |
1799 | msg.dialog = (byte)19; // Object msg | 1862 | msg.dialog = (byte)19; // Object msg |
1800 | msg.fromGroup = false; | 1863 | msg.fromGroup = false; |
1801 | msg.offline = (byte)0; | 1864 | msg.offline = (byte)1; |
1802 | msg.ParentEstateID = RegionInfo.EstateSettings.ParentEstateID; | 1865 | msg.ParentEstateID = RegionInfo.EstateSettings.ParentEstateID; |
1803 | msg.Position = Vector3.Zero; | 1866 | msg.Position = Vector3.Zero; |
1804 | msg.RegionID = RegionInfo.RegionID.Guid; | 1867 | msg.RegionID = RegionInfo.RegionID.Guid; |
@@ -2032,7 +2095,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2032 | return PhysicsScene.SupportsRaycastWorldFiltered(); | 2095 | return PhysicsScene.SupportsRaycastWorldFiltered(); |
2033 | } | 2096 | } |
2034 | 2097 | ||
2035 | public object RayCastFiltered(Vector3 position, Vector3 direction, float length, int Count, RayFilterFlags filter) | 2098 | public object RayCastFiltered(Vector3 position, Vector3 direction, float length, int Count, RayFilterFlags filter) |
2036 | { | 2099 | { |
2037 | if (PhysicsScene == null) | 2100 | if (PhysicsScene == null) |
2038 | return null; | 2101 | return null; |
@@ -2054,14 +2117,24 @@ namespace OpenSim.Region.Framework.Scenes | |||
2054 | /// <returns></returns> | 2117 | /// <returns></returns> |
2055 | public Vector3 GetNewRezLocation(Vector3 RayStart, Vector3 RayEnd, UUID RayTargetID, Quaternion rot, byte bypassRayCast, byte RayEndIsIntersection, bool frontFacesOnly, Vector3 scale, bool FaceCenter) | 2118 | public Vector3 GetNewRezLocation(Vector3 RayStart, Vector3 RayEnd, UUID RayTargetID, Quaternion rot, byte bypassRayCast, byte RayEndIsIntersection, bool frontFacesOnly, Vector3 scale, bool FaceCenter) |
2056 | { | 2119 | { |
2120 | |||
2121 | float wheight = (float)RegionInfo.RegionSettings.WaterHeight; | ||
2122 | Vector3 wpos = Vector3.Zero; | ||
2123 | // Check for water surface intersection from above | ||
2124 | if ( (RayStart.Z > wheight) && (RayEnd.Z < wheight) ) | ||
2125 | { | ||
2126 | float ratio = (RayStart.Z - wheight) / (RayStart.Z - RayEnd.Z); | ||
2127 | wpos.X = RayStart.X - (ratio * (RayStart.X - RayEnd.X)); | ||
2128 | wpos.Y = RayStart.Y - (ratio * (RayStart.Y - RayEnd.Y)); | ||
2129 | wpos.Z = wheight; | ||
2130 | } | ||
2131 | |||
2057 | Vector3 pos = Vector3.Zero; | 2132 | Vector3 pos = Vector3.Zero; |
2058 | if (RayEndIsIntersection == (byte)1) | 2133 | if (RayEndIsIntersection == (byte)1) |
2059 | { | 2134 | { |
2060 | pos = RayEnd; | 2135 | pos = RayEnd; |
2061 | return pos; | ||
2062 | } | 2136 | } |
2063 | 2137 | else if (RayTargetID != UUID.Zero) | |
2064 | if (RayTargetID != UUID.Zero) | ||
2065 | { | 2138 | { |
2066 | SceneObjectPart target = GetSceneObjectPart(RayTargetID); | 2139 | SceneObjectPart target = GetSceneObjectPart(RayTargetID); |
2067 | 2140 | ||
@@ -2083,7 +2156,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2083 | EntityIntersection ei = target.TestIntersectionOBB(NewRay, Quaternion.Identity, frontFacesOnly, FaceCenter); | 2156 | EntityIntersection ei = target.TestIntersectionOBB(NewRay, Quaternion.Identity, frontFacesOnly, FaceCenter); |
2084 | 2157 | ||
2085 | // Un-comment out the following line to Get Raytrace results printed to the console. | 2158 | // Un-comment out the following line to Get Raytrace results printed to the console. |
2086 | // m_log.Info("[RAYTRACERESULTS]: Hit:" + ei.HitTF.ToString() + " Point: " + ei.ipoint.ToString() + " Normal: " + ei.normal.ToString()); | 2159 | // m_log.Info("[RAYTRACERESULTS]: Hit:" + ei.HitTF.ToString() + " Point: " + ei.ipoint.ToString() + " Normal: " + ei.normal.ToString()); |
2087 | float ScaleOffset = 0.5f; | 2160 | float ScaleOffset = 0.5f; |
2088 | 2161 | ||
2089 | // If we hit something | 2162 | // If we hit something |
@@ -2106,13 +2179,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
2106 | //pos.Z -= 0.25F; | 2179 | //pos.Z -= 0.25F; |
2107 | 2180 | ||
2108 | } | 2181 | } |
2109 | |||
2110 | return pos; | ||
2111 | } | 2182 | } |
2112 | else | 2183 | else |
2113 | { | 2184 | { |
2114 | // We don't have a target here, so we're going to raytrace all the objects in the scene. | 2185 | // We don't have a target here, so we're going to raytrace all the objects in the scene. |
2115 | |||
2116 | EntityIntersection ei = m_sceneGraph.GetClosestIntersectingPrim(new Ray(AXOrigin, AXdirection), true, false); | 2186 | EntityIntersection ei = m_sceneGraph.GetClosestIntersectingPrim(new Ray(AXOrigin, AXdirection), true, false); |
2117 | 2187 | ||
2118 | // Un-comment the following line to print the raytrace results to the console. | 2188 | // Un-comment the following line to print the raytrace results to the console. |
@@ -2121,13 +2191,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
2121 | if (ei.HitTF) | 2191 | if (ei.HitTF) |
2122 | { | 2192 | { |
2123 | pos = new Vector3(ei.ipoint.X, ei.ipoint.Y, ei.ipoint.Z); | 2193 | pos = new Vector3(ei.ipoint.X, ei.ipoint.Y, ei.ipoint.Z); |
2124 | } else | 2194 | } |
2195 | else | ||
2125 | { | 2196 | { |
2126 | // fall back to our stupid functionality | 2197 | // fall back to our stupid functionality |
2127 | pos = RayEnd; | 2198 | pos = RayEnd; |
2128 | } | 2199 | } |
2129 | |||
2130 | return pos; | ||
2131 | } | 2200 | } |
2132 | } | 2201 | } |
2133 | else | 2202 | else |
@@ -2138,8 +2207,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
2138 | //increase height so its above the ground. | 2207 | //increase height so its above the ground. |
2139 | //should be getting the normal of the ground at the rez point and using that? | 2208 | //should be getting the normal of the ground at the rez point and using that? |
2140 | pos.Z += scale.Z / 2f; | 2209 | pos.Z += scale.Z / 2f; |
2141 | return pos; | 2210 | // return pos; |
2142 | } | 2211 | } |
2212 | |||
2213 | // check against posible water intercept | ||
2214 | if (wpos.Z > pos.Z) pos = wpos; | ||
2215 | return pos; | ||
2143 | } | 2216 | } |
2144 | 2217 | ||
2145 | 2218 | ||
@@ -2230,12 +2303,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
2230 | { | 2303 | { |
2231 | if (m_sceneGraph.AddRestoredSceneObject(sceneObject, attachToBackup, alreadyPersisted, sendClientUpdates)) | 2304 | if (m_sceneGraph.AddRestoredSceneObject(sceneObject, attachToBackup, alreadyPersisted, sendClientUpdates)) |
2232 | { | 2305 | { |
2306 | sceneObject.IsDeleted = false; | ||
2233 | EventManager.TriggerObjectAddedToScene(sceneObject); | 2307 | EventManager.TriggerObjectAddedToScene(sceneObject); |
2234 | return true; | 2308 | return true; |
2235 | } | 2309 | } |
2236 | 2310 | ||
2237 | return false; | 2311 | return false; |
2238 | |||
2239 | } | 2312 | } |
2240 | 2313 | ||
2241 | /// <summary> | 2314 | /// <summary> |
@@ -2327,6 +2400,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
2327 | /// </summary> | 2400 | /// </summary> |
2328 | public void DeleteAllSceneObjects() | 2401 | public void DeleteAllSceneObjects() |
2329 | { | 2402 | { |
2403 | DeleteAllSceneObjects(false); | ||
2404 | } | ||
2405 | |||
2406 | /// <summary> | ||
2407 | /// Delete every object from the scene. This does not include attachments worn by avatars. | ||
2408 | /// </summary> | ||
2409 | public void DeleteAllSceneObjects(bool exceptNoCopy) | ||
2410 | { | ||
2411 | List<SceneObjectGroup> toReturn = new List<SceneObjectGroup>(); | ||
2330 | lock (Entities) | 2412 | lock (Entities) |
2331 | { | 2413 | { |
2332 | EntityBase[] entities = Entities.GetEntities(); | 2414 | EntityBase[] entities = Entities.GetEntities(); |
@@ -2335,11 +2417,24 @@ namespace OpenSim.Region.Framework.Scenes | |||
2335 | if (e is SceneObjectGroup) | 2417 | if (e is SceneObjectGroup) |
2336 | { | 2418 | { |
2337 | SceneObjectGroup sog = (SceneObjectGroup)e; | 2419 | SceneObjectGroup sog = (SceneObjectGroup)e; |
2338 | if (!sog.IsAttachment) | 2420 | if (sog != null && !sog.IsAttachment) |
2339 | DeleteSceneObject((SceneObjectGroup)e, false); | 2421 | { |
2422 | if (!exceptNoCopy || ((sog.GetEffectivePermissions() & (uint)PermissionMask.Copy) != 0)) | ||
2423 | { | ||
2424 | DeleteSceneObject((SceneObjectGroup)e, false); | ||
2425 | } | ||
2426 | else | ||
2427 | { | ||
2428 | toReturn.Add((SceneObjectGroup)e); | ||
2429 | } | ||
2430 | } | ||
2340 | } | 2431 | } |
2341 | } | 2432 | } |
2342 | } | 2433 | } |
2434 | if (toReturn.Count > 0) | ||
2435 | { | ||
2436 | returnObjects(toReturn.ToArray(), UUID.Zero); | ||
2437 | } | ||
2343 | } | 2438 | } |
2344 | 2439 | ||
2345 | /// <summary> | 2440 | /// <summary> |
@@ -2370,6 +2465,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
2370 | else | 2465 | else |
2371 | group.StopScriptInstances(); | 2466 | group.StopScriptInstances(); |
2372 | 2467 | ||
2468 | List<UUID> avatars = group.GetSittingAvatars(); | ||
2469 | foreach (UUID av in avatars) | ||
2470 | { | ||
2471 | ScenePresence p = GetScenePresence(av); | ||
2472 | if (p != null) | ||
2473 | p.StandUp(); | ||
2474 | } | ||
2475 | |||
2373 | SceneObjectPart[] partList = group.Parts; | 2476 | SceneObjectPart[] partList = group.Parts; |
2374 | 2477 | ||
2375 | foreach (SceneObjectPart part in partList) | 2478 | foreach (SceneObjectPart part in partList) |
@@ -2397,6 +2500,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2397 | } | 2500 | } |
2398 | 2501 | ||
2399 | group.DeleteGroupFromScene(silent); | 2502 | group.DeleteGroupFromScene(silent); |
2503 | if (!silent) | ||
2504 | SendKillObject(new List<uint>() { group.LocalId }); | ||
2400 | 2505 | ||
2401 | // m_log.DebugFormat("[SCENE]: Exit DeleteSceneObject() for {0} {1}", group.Name, group.UUID); | 2506 | // m_log.DebugFormat("[SCENE]: Exit DeleteSceneObject() for {0} {1}", group.Name, group.UUID); |
2402 | } | 2507 | } |
@@ -2686,7 +2791,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2686 | // If the user is banned, we won't let any of their objects | 2791 | // If the user is banned, we won't let any of their objects |
2687 | // enter. Period. | 2792 | // enter. Period. |
2688 | // | 2793 | // |
2689 | if (RegionInfo.EstateSettings.IsBanned(newObject.OwnerID)) | 2794 | if (RegionInfo.EstateSettings.IsBanned(newObject.OwnerID, 36)) |
2690 | { | 2795 | { |
2691 | m_log.InfoFormat("[INTERREGION]: Denied prim crossing for banned avatar {0}", newObject.OwnerID); | 2796 | m_log.InfoFormat("[INTERREGION]: Denied prim crossing for banned avatar {0}", newObject.OwnerID); |
2692 | return false; | 2797 | return false; |
@@ -2722,8 +2827,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
2722 | newObject.RootPart.ParentGroup.CreateScriptInstances(0, false, DefaultScriptEngine, GetStateSource(newObject)); | 2827 | newObject.RootPart.ParentGroup.CreateScriptInstances(0, false, DefaultScriptEngine, GetStateSource(newObject)); |
2723 | newObject.ResumeScripts(); | 2828 | newObject.ResumeScripts(); |
2724 | 2829 | ||
2725 | if (newObject.RootPart.KeyframeMotion != null) | 2830 | // AddSceneObject already does this and doing it again messes |
2726 | newObject.RootPart.KeyframeMotion.UpdateSceneObject(newObject); | 2831 | // up region crossings, so don't. |
2832 | //if (newObject.RootPart.KeyframeMotion != null) | ||
2833 | // newObject.RootPart.KeyframeMotion.UpdateSceneObject(newObject); | ||
2727 | } | 2834 | } |
2728 | 2835 | ||
2729 | // Do this as late as possible so that listeners have full access to the incoming object | 2836 | // Do this as late as possible so that listeners have full access to the incoming object |
@@ -2741,6 +2848,23 @@ namespace OpenSim.Region.Framework.Scenes | |||
2741 | /// <returns>True if the SceneObjectGroup was added, False if it was not</returns> | 2848 | /// <returns>True if the SceneObjectGroup was added, False if it was not</returns> |
2742 | public bool AddSceneObject(SceneObjectGroup sceneObject) | 2849 | public bool AddSceneObject(SceneObjectGroup sceneObject) |
2743 | { | 2850 | { |
2851 | if (sceneObject.OwnerID == UUID.Zero) | ||
2852 | { | ||
2853 | m_log.ErrorFormat("[SCENE]: Owner ID for {0} was zero", sceneObject.UUID); | ||
2854 | return false; | ||
2855 | } | ||
2856 | |||
2857 | // If the user is banned, we won't let any of their objects | ||
2858 | // enter. Period. | ||
2859 | // | ||
2860 | int flags = GetUserFlags(sceneObject.OwnerID); | ||
2861 | if (RegionInfo.EstateSettings.IsBanned(sceneObject.OwnerID, flags)) | ||
2862 | { | ||
2863 | m_log.InfoFormat("[INTERREGION]: Denied prim crossing for banned avatar {0}", sceneObject.OwnerID); | ||
2864 | |||
2865 | return false; | ||
2866 | } | ||
2867 | |||
2744 | // Force allocation of new LocalId | 2868 | // Force allocation of new LocalId |
2745 | // | 2869 | // |
2746 | SceneObjectPart[] parts = sceneObject.Parts; | 2870 | SceneObjectPart[] parts = sceneObject.Parts; |
@@ -2777,16 +2901,27 @@ namespace OpenSim.Region.Framework.Scenes | |||
2777 | // information that this is due to a teleport/border cross rather than an ordinary attachment. | 2901 | // information that this is due to a teleport/border cross rather than an ordinary attachment. |
2778 | // We currently do this in Scene.MakeRootAgent() instead. | 2902 | // We currently do this in Scene.MakeRootAgent() instead. |
2779 | if (AttachmentsModule != null) | 2903 | if (AttachmentsModule != null) |
2780 | AttachmentsModule.AttachObject(sp, grp, 0, false, false, true); | 2904 | AttachmentsModule.AttachObject(sp, grp, 0, false, false, false, true); |
2781 | } | 2905 | } |
2782 | else | 2906 | else |
2783 | { | 2907 | { |
2908 | m_log.DebugFormat("[SCENE]: Attachment {0} arrived and scene presence was not found, setting to temp", sceneObject.UUID); | ||
2784 | RootPrim.RemFlag(PrimFlags.TemporaryOnRez); | 2909 | RootPrim.RemFlag(PrimFlags.TemporaryOnRez); |
2785 | RootPrim.AddFlag(PrimFlags.TemporaryOnRez); | 2910 | RootPrim.AddFlag(PrimFlags.TemporaryOnRez); |
2786 | } | 2911 | } |
2912 | if (sceneObject.OwnerID == UUID.Zero) | ||
2913 | { | ||
2914 | m_log.ErrorFormat("[SCENE]: Owner ID for {0} was zero after attachment processing. BUG!", sceneObject.UUID); | ||
2915 | return false; | ||
2916 | } | ||
2787 | } | 2917 | } |
2788 | else | 2918 | else |
2789 | { | 2919 | { |
2920 | if (sceneObject.OwnerID == UUID.Zero) | ||
2921 | { | ||
2922 | m_log.ErrorFormat("[SCENE]: Owner ID for non-attachment {0} was zero", sceneObject.UUID); | ||
2923 | return false; | ||
2924 | } | ||
2790 | AddRestoredSceneObject(sceneObject, true, false); | 2925 | AddRestoredSceneObject(sceneObject, true, false); |
2791 | } | 2926 | } |
2792 | 2927 | ||
@@ -2803,6 +2938,24 @@ namespace OpenSim.Region.Framework.Scenes | |||
2803 | return 2; // StateSource.PrimCrossing | 2938 | return 2; // StateSource.PrimCrossing |
2804 | } | 2939 | } |
2805 | 2940 | ||
2941 | public int GetUserFlags(UUID user) | ||
2942 | { | ||
2943 | //Unfortunately the SP approach means that the value is cached until region is restarted | ||
2944 | /* | ||
2945 | ScenePresence sp; | ||
2946 | if (TryGetScenePresence(user, out sp)) | ||
2947 | { | ||
2948 | return sp.UserFlags; | ||
2949 | } | ||
2950 | else | ||
2951 | { | ||
2952 | */ | ||
2953 | UserAccount uac = UserAccountService.GetUserAccount(RegionInfo.ScopeID, user); | ||
2954 | if (uac == null) | ||
2955 | return 0; | ||
2956 | return uac.UserFlags; | ||
2957 | //} | ||
2958 | } | ||
2806 | #endregion | 2959 | #endregion |
2807 | 2960 | ||
2808 | #region Add/Remove Avatar Methods | 2961 | #region Add/Remove Avatar Methods |
@@ -2836,7 +2989,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2836 | = (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0 | 2989 | = (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0 |
2837 | || (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0; | 2990 | || (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0; |
2838 | 2991 | ||
2839 | // CheckHeartbeat(); | 2992 | CheckHeartbeat(); |
2840 | 2993 | ||
2841 | sp = GetScenePresence(client.AgentId); | 2994 | sp = GetScenePresence(client.AgentId); |
2842 | 2995 | ||
@@ -2854,6 +3007,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
2854 | SubscribeToClientEvents(client); | 3007 | SubscribeToClientEvents(client); |
2855 | 3008 | ||
2856 | sp = m_sceneGraph.CreateAndAddChildScenePresence(client, aCircuit.Appearance, type); | 3009 | sp = m_sceneGraph.CreateAndAddChildScenePresence(client, aCircuit.Appearance, type); |
3010 | InventoryFolderBase cof = InventoryService.GetFolderForType(client.AgentId, (AssetType)46); | ||
3011 | if (cof == null) | ||
3012 | sp.COF = UUID.Zero; | ||
3013 | else | ||
3014 | sp.COF = cof.ID; | ||
3015 | |||
3016 | m_log.DebugFormat("[SCENE]: COF for {0} is {1}", client.AgentId, sp.COF); | ||
2857 | m_eventManager.TriggerOnNewPresence(sp); | 3017 | m_eventManager.TriggerOnNewPresence(sp); |
2858 | 3018 | ||
2859 | sp.TeleportFlags = (TPFlags)aCircuit.teleportFlags; | 3019 | sp.TeleportFlags = (TPFlags)aCircuit.teleportFlags; |
@@ -2974,19 +3134,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
2974 | // and the scene presence and the client, if they exist | 3134 | // and the scene presence and the client, if they exist |
2975 | try | 3135 | try |
2976 | { | 3136 | { |
2977 | // We need to wait for the client to make UDP contact first. | 3137 | ScenePresence sp = GetScenePresence(agentID); |
2978 | // It's the UDP contact that creates the scene presence | 3138 | |
2979 | ScenePresence sp = WaitGetScenePresence(agentID); | ||
2980 | if (sp != null) | 3139 | if (sp != null) |
2981 | { | 3140 | { |
2982 | PresenceService.LogoutAgent(sp.ControllingClient.SessionId); | 3141 | PresenceService.LogoutAgent(sp.ControllingClient.SessionId); |
2983 | 3142 | ||
2984 | CloseAgent(sp.UUID, false); | 3143 | CloseAgent(sp.UUID, false); |
2985 | } | 3144 | } |
2986 | else | 3145 | |
2987 | { | ||
2988 | m_log.WarnFormat("[SCENE]: Could not find scene presence for {0}", agentID); | ||
2989 | } | ||
2990 | // BANG! SLASH! | 3146 | // BANG! SLASH! |
2991 | m_authenticateHandler.RemoveCircuit(agentID); | 3147 | m_authenticateHandler.RemoveCircuit(agentID); |
2992 | 3148 | ||
@@ -3031,6 +3187,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
3031 | client.OnUpdatePrimGroupPosition += m_sceneGraph.UpdatePrimGroupPosition; | 3187 | client.OnUpdatePrimGroupPosition += m_sceneGraph.UpdatePrimGroupPosition; |
3032 | client.OnUpdatePrimSinglePosition += m_sceneGraph.UpdatePrimSinglePosition; | 3188 | client.OnUpdatePrimSinglePosition += m_sceneGraph.UpdatePrimSinglePosition; |
3033 | 3189 | ||
3190 | client.onClientChangeObject += m_sceneGraph.ClientChangeObject; | ||
3191 | |||
3034 | client.OnUpdatePrimGroupRotation += m_sceneGraph.UpdatePrimGroupRotation; | 3192 | client.OnUpdatePrimGroupRotation += m_sceneGraph.UpdatePrimGroupRotation; |
3035 | client.OnUpdatePrimGroupMouseRotation += m_sceneGraph.UpdatePrimGroupRotation; | 3193 | client.OnUpdatePrimGroupMouseRotation += m_sceneGraph.UpdatePrimGroupRotation; |
3036 | client.OnUpdatePrimSingleRotation += m_sceneGraph.UpdatePrimSingleRotation; | 3194 | client.OnUpdatePrimSingleRotation += m_sceneGraph.UpdatePrimSingleRotation; |
@@ -3087,6 +3245,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3087 | client.OnFetchInventory += m_asyncInventorySender.HandleFetchInventory; | 3245 | client.OnFetchInventory += m_asyncInventorySender.HandleFetchInventory; |
3088 | client.OnUpdateInventoryItem += UpdateInventoryItemAsset; | 3246 | client.OnUpdateInventoryItem += UpdateInventoryItemAsset; |
3089 | client.OnCopyInventoryItem += CopyInventoryItem; | 3247 | client.OnCopyInventoryItem += CopyInventoryItem; |
3248 | client.OnMoveItemsAndLeaveCopy += MoveInventoryItemsLeaveCopy; | ||
3090 | client.OnMoveInventoryItem += MoveInventoryItem; | 3249 | client.OnMoveInventoryItem += MoveInventoryItem; |
3091 | client.OnRemoveInventoryItem += RemoveInventoryItem; | 3250 | client.OnRemoveInventoryItem += RemoveInventoryItem; |
3092 | client.OnRemoveInventoryFolder += RemoveInventoryFolder; | 3251 | client.OnRemoveInventoryFolder += RemoveInventoryFolder; |
@@ -3156,6 +3315,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
3156 | client.OnUpdatePrimGroupPosition -= m_sceneGraph.UpdatePrimGroupPosition; | 3315 | client.OnUpdatePrimGroupPosition -= m_sceneGraph.UpdatePrimGroupPosition; |
3157 | client.OnUpdatePrimSinglePosition -= m_sceneGraph.UpdatePrimSinglePosition; | 3316 | client.OnUpdatePrimSinglePosition -= m_sceneGraph.UpdatePrimSinglePosition; |
3158 | 3317 | ||
3318 | client.onClientChangeObject -= m_sceneGraph.ClientChangeObject; | ||
3319 | |||
3159 | client.OnUpdatePrimGroupRotation -= m_sceneGraph.UpdatePrimGroupRotation; | 3320 | client.OnUpdatePrimGroupRotation -= m_sceneGraph.UpdatePrimGroupRotation; |
3160 | client.OnUpdatePrimGroupMouseRotation -= m_sceneGraph.UpdatePrimGroupRotation; | 3321 | client.OnUpdatePrimGroupMouseRotation -= m_sceneGraph.UpdatePrimGroupRotation; |
3161 | client.OnUpdatePrimSingleRotation -= m_sceneGraph.UpdatePrimSingleRotation; | 3322 | client.OnUpdatePrimSingleRotation -= m_sceneGraph.UpdatePrimSingleRotation; |
@@ -3467,7 +3628,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3467 | // TODO: We shouldn't use closeChildAgents here - it's being used by the NPC module to stop | 3628 | // TODO: We shouldn't use closeChildAgents here - it's being used by the NPC module to stop |
3468 | // unnecessary operations. This should go away once NPCs have no accompanying IClientAPI | 3629 | // unnecessary operations. This should go away once NPCs have no accompanying IClientAPI |
3469 | if (closeChildAgents && CapsModule != null) | 3630 | if (closeChildAgents && CapsModule != null) |
3470 | CapsModule.RemoveCaps(agentID); | 3631 | CapsModule.RemoveCaps(agentID, avatar.ControllingClient.CircuitCode); |
3471 | 3632 | ||
3472 | if (closeChildAgents && !isChildAgent) | 3633 | if (closeChildAgents && !isChildAgent) |
3473 | { | 3634 | { |
@@ -3500,6 +3661,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3500 | // It's possible for child agents to have transactions if changes are being made cross-border. | 3661 | // It's possible for child agents to have transactions if changes are being made cross-border. |
3501 | if (AgentTransactionsModule != null) | 3662 | if (AgentTransactionsModule != null) |
3502 | AgentTransactionsModule.RemoveAgentAssetTransactions(agentID); | 3663 | AgentTransactionsModule.RemoveAgentAssetTransactions(agentID); |
3664 | m_log.Debug("[Scene] The avatar has left the building"); | ||
3503 | } | 3665 | } |
3504 | catch (Exception e) | 3666 | catch (Exception e) |
3505 | { | 3667 | { |
@@ -3807,13 +3969,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
3807 | // On login test land permisions | 3969 | // On login test land permisions |
3808 | if (vialogin) | 3970 | if (vialogin) |
3809 | { | 3971 | { |
3972 | IUserAccountCacheModule cache = RequestModuleInterface<IUserAccountCacheModule>(); | ||
3973 | if (cache != null) | ||
3974 | cache.Remove(acd.firstname + " " + acd.lastname); | ||
3810 | if (land != null && !TestLandRestrictions(acd.AgentID, out reason, ref acd.startpos.X, ref acd.startpos.Y)) | 3975 | if (land != null && !TestLandRestrictions(acd.AgentID, out reason, ref acd.startpos.X, ref acd.startpos.Y)) |
3811 | { | 3976 | { |
3812 | m_authenticateHandler.RemoveCircuit(acd.circuitcode); | 3977 | m_authenticateHandler.RemoveCircuit(acd.circuitcode); |
3813 | return false; | 3978 | return false; |
3814 | } | 3979 | } |
3815 | } | 3980 | } |
3816 | 3981 | ||
3817 | if (sp == null) // We don't have an [child] agent here already | 3982 | if (sp == null) // We don't have an [child] agent here already |
3818 | { | 3983 | { |
3819 | if (requirePresenceLookup) | 3984 | if (requirePresenceLookup) |
@@ -3835,7 +4000,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3835 | return false; | 4000 | return false; |
3836 | } | 4001 | } |
3837 | } | 4002 | } |
3838 | 4003 | ||
3839 | try | 4004 | try |
3840 | { | 4005 | { |
3841 | if (!AuthorizeUser(acd, (vialogin ? false : SeeIntoRegion), out reason)) | 4006 | if (!AuthorizeUser(acd, (vialogin ? false : SeeIntoRegion), out reason)) |
@@ -3852,7 +4017,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3852 | m_authenticateHandler.RemoveCircuit(acd.circuitcode); | 4017 | m_authenticateHandler.RemoveCircuit(acd.circuitcode); |
3853 | return false; | 4018 | return false; |
3854 | } | 4019 | } |
3855 | 4020 | ||
3856 | m_log.InfoFormat( | 4021 | m_log.InfoFormat( |
3857 | "[SCENE]: Region {0} authenticated and authorized incoming {1} agent {2} {3} {4} (circuit code {5})", | 4022 | "[SCENE]: Region {0} authenticated and authorized incoming {1} agent {2} {3} {4} (circuit code {5})", |
3858 | Name, (acd.child ? "child" : "root"), acd.firstname, acd.lastname, | 4023 | Name, (acd.child ? "child" : "root"), acd.firstname, acd.lastname, |
@@ -3861,7 +4026,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3861 | if (CapsModule != null) | 4026 | if (CapsModule != null) |
3862 | { | 4027 | { |
3863 | CapsModule.SetAgentCapsSeeds(acd); | 4028 | CapsModule.SetAgentCapsSeeds(acd); |
3864 | CapsModule.CreateCaps(acd.AgentID); | 4029 | CapsModule.CreateCaps(acd.AgentID, acd.circuitcode); |
3865 | } | 4030 | } |
3866 | } | 4031 | } |
3867 | else | 4032 | else |
@@ -3881,7 +4046,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3881 | if (CapsModule != null) | 4046 | if (CapsModule != null) |
3882 | { | 4047 | { |
3883 | CapsModule.SetAgentCapsSeeds(acd); | 4048 | CapsModule.SetAgentCapsSeeds(acd); |
3884 | CapsModule.CreateCaps(acd.AgentID); | 4049 | CapsModule.CreateCaps(acd.AgentID, acd.circuitcode); |
3885 | } | 4050 | } |
3886 | } | 4051 | } |
3887 | } | 4052 | } |
@@ -3892,6 +4057,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
3892 | CacheUserName(null, acd); | 4057 | CacheUserName(null, acd); |
3893 | } | 4058 | } |
3894 | 4059 | ||
4060 | if (CapsModule != null) | ||
4061 | { | ||
4062 | CapsModule.ActivateCaps(acd.circuitcode); | ||
4063 | } | ||
4064 | |||
3895 | if (vialogin) | 4065 | if (vialogin) |
3896 | { | 4066 | { |
3897 | // CleanDroppedAttachments(); | 4067 | // CleanDroppedAttachments(); |
@@ -3983,6 +4153,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
3983 | } | 4153 | } |
3984 | 4154 | ||
3985 | // Honor parcel landing type and position. | 4155 | // Honor parcel landing type and position. |
4156 | /* | ||
4157 | ILandObject land = LandChannel.GetLandObject(agent.startpos.X, agent.startpos.Y); | ||
3986 | if (land != null) | 4158 | if (land != null) |
3987 | { | 4159 | { |
3988 | if (land.LandData.LandingType == (byte)1 && land.LandData.UserLocation != Vector3.Zero) | 4160 | if (land.LandData.LandingType == (byte)1 && land.LandData.UserLocation != Vector3.Zero) |
@@ -3990,6 +4162,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3990 | acd.startpos = land.LandData.UserLocation; | 4162 | acd.startpos = land.LandData.UserLocation; |
3991 | } | 4163 | } |
3992 | } | 4164 | } |
4165 | */// This is now handled properly in ScenePresence.MakeRootAgent | ||
3993 | } | 4166 | } |
3994 | 4167 | ||
3995 | return true; | 4168 | return true; |
@@ -4087,7 +4260,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4087 | 4260 | ||
4088 | if (!m_strictAccessControl) return true; | 4261 | if (!m_strictAccessControl) return true; |
4089 | if (Permissions.IsGod(agent.AgentID)) return true; | 4262 | if (Permissions.IsGod(agent.AgentID)) return true; |
4090 | 4263 | ||
4091 | if (AuthorizationService != null) | 4264 | if (AuthorizationService != null) |
4092 | { | 4265 | { |
4093 | if (!AuthorizationService.IsAuthorizedForRegion( | 4266 | if (!AuthorizationService.IsAuthorizedForRegion( |
@@ -4108,7 +4281,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
4108 | { | 4281 | { |
4109 | if (RegionInfo.EstateSettings != null) | 4282 | if (RegionInfo.EstateSettings != null) |
4110 | { | 4283 | { |
4111 | if (RegionInfo.EstateSettings.IsBanned(agent.AgentID)) | 4284 | int flags = GetUserFlags(agent.AgentID); |
4285 | if (RegionInfo.EstateSettings.IsBanned(agent.AgentID, flags)) | ||
4112 | { | 4286 | { |
4113 | m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the user is on the banlist", | 4287 | m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the user is on the banlist", |
4114 | agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName); | 4288 | agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName); |
@@ -4297,6 +4471,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
4297 | m_log.DebugFormat( | 4471 | m_log.DebugFormat( |
4298 | "[SCENE]: Incoming child agent update for {0} in {1}", cAgentData.AgentID, RegionInfo.RegionName); | 4472 | "[SCENE]: Incoming child agent update for {0} in {1}", cAgentData.AgentID, RegionInfo.RegionName); |
4299 | 4473 | ||
4474 | // We have to wait until the viewer contacts this region after receiving EAC. | ||
4475 | // That calls AddNewClient, which finally creates the ScenePresence | ||
4476 | int flags = GetUserFlags(cAgentData.AgentID); | ||
4477 | if (RegionInfo.EstateSettings.IsBanned(cAgentData.AgentID, flags)) | ||
4478 | { | ||
4479 | m_log.DebugFormat("[SCENE]: Denying root agent entry to {0}: banned", cAgentData.AgentID); | ||
4480 | return false; | ||
4481 | } | ||
4482 | |||
4300 | // TODO: This check should probably be in QueryAccess(). | 4483 | // TODO: This check should probably be in QueryAccess(). |
4301 | ILandObject nearestParcel = GetNearestAllowedParcel(cAgentData.AgentID, Constants.RegionSize / 2, Constants.RegionSize / 2); | 4484 | ILandObject nearestParcel = GetNearestAllowedParcel(cAgentData.AgentID, Constants.RegionSize / 2, Constants.RegionSize / 2); |
4302 | if (nearestParcel == null) | 4485 | if (nearestParcel == null) |
@@ -4397,7 +4580,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4397 | /// <param name='agentID'></param> | 4580 | /// <param name='agentID'></param> |
4398 | protected virtual ScenePresence WaitGetScenePresence(UUID agentID) | 4581 | protected virtual ScenePresence WaitGetScenePresence(UUID agentID) |
4399 | { | 4582 | { |
4400 | int ntimes = 20; | 4583 | int ntimes = 30; |
4401 | ScenePresence sp = null; | 4584 | ScenePresence sp = null; |
4402 | while ((sp = GetScenePresence(agentID)) == null && (ntimes-- > 0)) | 4585 | while ((sp = GetScenePresence(agentID)) == null && (ntimes-- > 0)) |
4403 | Thread.Sleep(1000); | 4586 | Thread.Sleep(1000); |
@@ -4459,6 +4642,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
4459 | return false; | 4642 | return false; |
4460 | } | 4643 | } |
4461 | 4644 | ||
4645 | // public bool IncomingCloseAgent(UUID agentID) | ||
4646 | // { | ||
4647 | // return IncomingCloseAgent(agentID, false); | ||
4648 | // } | ||
4649 | |||
4650 | // public bool IncomingCloseChildAgent(UUID agentID) | ||
4651 | // { | ||
4652 | // return IncomingCloseAgent(agentID, true); | ||
4653 | // } | ||
4654 | |||
4462 | /// <summary> | 4655 | /// <summary> |
4463 | /// Tell a single client to prepare to close. | 4656 | /// Tell a single client to prepare to close. |
4464 | /// </summary> | 4657 | /// </summary> |
@@ -4557,7 +4750,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4557 | 4750 | ||
4558 | if (sp != null) | 4751 | if (sp != null) |
4559 | { | 4752 | { |
4560 | sp.ControllingClient.Close(force); | 4753 | sp.ControllingClient.Close(force, force); |
4561 | return true; | 4754 | return true; |
4562 | } | 4755 | } |
4563 | 4756 | ||
@@ -5175,7 +5368,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
5175 | { | 5368 | { |
5176 | if ((grp.RootPart.Flags & PrimFlags.TemporaryOnRez) != 0) | 5369 | if ((grp.RootPart.Flags & PrimFlags.TemporaryOnRez) != 0) |
5177 | { | 5370 | { |
5178 | if (grp.RootPart.Expires <= DateTime.Now) | 5371 | if (grp.GetSittingAvatarsCount() == 0 && grp.RootPart.Expires <= DateTime.Now) |
5179 | DeleteSceneObject(grp, false); | 5372 | DeleteSceneObject(grp, false); |
5180 | } | 5373 | } |
5181 | } | 5374 | } |
@@ -5189,35 +5382,81 @@ namespace OpenSim.Region.Framework.Scenes | |||
5189 | SimulationDataService.RemoveObject(uuid, RegionInfo.RegionID); | 5382 | SimulationDataService.RemoveObject(uuid, RegionInfo.RegionID); |
5190 | } | 5383 | } |
5191 | 5384 | ||
5192 | public int GetHealth() | 5385 | public int GetHealth(out int flags, out string message) |
5193 | { | 5386 | { |
5194 | // Returns: | 5387 | // Returns: |
5195 | // 1 = sim is up and accepting http requests. The heartbeat has | 5388 | // 1 = sim is up and accepting http requests. The heartbeat has |
5196 | // stopped and the sim is probably locked up, but a remote | 5389 | // stopped and the sim is probably locked up, but a remote |
5197 | // admin restart may succeed | 5390 | // admin restart may succeed |
5198 | // | 5391 | // |
5199 | // 2 = Sim is up and the heartbeat is running. The sim is likely | 5392 | // 2 = Sim is up and the heartbeat is running. The sim is likely |
5200 | // usable for people within and logins _may_ work | 5393 | // usable for people within |
5394 | // | ||
5395 | // 3 = Sim is up and one packet thread is running. Sim is | ||
5396 | // unstable and will not accept new logins | ||
5201 | // | 5397 | // |
5202 | // 3 = We have seen a new user enter within the past 4 minutes | 5398 | // 4 = Sim is up and both packet threads are running. Sim is |
5399 | // likely usable | ||
5400 | // | ||
5401 | // 5 = We have seen a new user enter within the past 4 minutes | ||
5203 | // which can be seen as positive confirmation of sim health | 5402 | // which can be seen as positive confirmation of sim health |
5204 | // | 5403 | // |
5404 | |||
5405 | flags = 0; | ||
5406 | message = String.Empty; | ||
5407 | |||
5408 | CheckHeartbeat(); | ||
5409 | |||
5410 | if (m_firstHeartbeat || (m_lastIncoming == 0 && m_lastOutgoing == 0)) | ||
5411 | { | ||
5412 | // We're still starting | ||
5413 | // 0 means "in startup", it can't happen another way, since | ||
5414 | // to get here, we must be able to accept http connections | ||
5415 | return 0; | ||
5416 | } | ||
5417 | |||
5205 | int health=1; // Start at 1, means we're up | 5418 | int health=1; // Start at 1, means we're up |
5206 | 5419 | ||
5207 | if ((Util.EnvironmentTickCountSubtract(m_lastFrameTick)) < 1000) | 5420 | if ((Util.EnvironmentTickCountSubtract(m_lastFrameTick)) < 1000) |
5208 | health += 1; | 5421 | { |
5422 | health+=1; | ||
5423 | flags |= 1; | ||
5424 | } | ||
5425 | |||
5426 | if (Util.EnvironmentTickCountSubtract(m_lastIncoming) < 1000) | ||
5427 | { | ||
5428 | health+=1; | ||
5429 | flags |= 2; | ||
5430 | } | ||
5431 | |||
5432 | if (Util.EnvironmentTickCountSubtract(m_lastOutgoing) < 1000) | ||
5433 | { | ||
5434 | health+=1; | ||
5435 | flags |= 4; | ||
5436 | } | ||
5209 | else | 5437 | else |
5438 | { | ||
5439 | int pid = System.Diagnostics.Process.GetCurrentProcess().Id; | ||
5440 | System.Diagnostics.Process proc = new System.Diagnostics.Process(); | ||
5441 | proc.EnableRaisingEvents=false; | ||
5442 | proc.StartInfo.FileName = "/bin/kill"; | ||
5443 | proc.StartInfo.Arguments = "-QUIT " + pid.ToString(); | ||
5444 | proc.Start(); | ||
5445 | proc.WaitForExit(); | ||
5446 | Thread.Sleep(1000); | ||
5447 | Environment.Exit(1); | ||
5448 | } | ||
5449 | |||
5450 | if (flags != 7) | ||
5210 | return health; | 5451 | return health; |
5211 | 5452 | ||
5212 | // A login in the last 4 mins? We can't be doing too badly | 5453 | // A login in the last 4 mins? We can't be doing too badly |
5213 | // | 5454 | // |
5214 | if ((Util.EnvironmentTickCountSubtract(m_LastLogin)) < 240000) | 5455 | if (Util.EnvironmentTickCountSubtract(m_LastLogin) < 240000) |
5215 | health++; | 5456 | health++; |
5216 | else | 5457 | else |
5217 | return health; | 5458 | return health; |
5218 | 5459 | ||
5219 | // CheckHeartbeat(); | ||
5220 | |||
5221 | return health; | 5460 | return health; |
5222 | } | 5461 | } |
5223 | 5462 | ||
@@ -5305,7 +5544,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
5305 | bool wasUsingPhysics = ((jointProxyObject.Flags & PrimFlags.Physics) != 0); | 5544 | bool wasUsingPhysics = ((jointProxyObject.Flags & PrimFlags.Physics) != 0); |
5306 | if (wasUsingPhysics) | 5545 | if (wasUsingPhysics) |
5307 | { | 5546 | { |
5308 | 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 | 5547 | 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 |
5309 | } | 5548 | } |
5310 | } | 5549 | } |
5311 | 5550 | ||
@@ -5404,14 +5643,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
5404 | return (((vsn.X * xdiff) + (vsn.Y * ydiff)) / (-1 * vsn.Z)) + p0.Z; | 5643 | return (((vsn.X * xdiff) + (vsn.Y * ydiff)) / (-1 * vsn.Z)) + p0.Z; |
5405 | } | 5644 | } |
5406 | 5645 | ||
5407 | // private void CheckHeartbeat() | 5646 | private void CheckHeartbeat() |
5408 | // { | 5647 | { |
5409 | // if (m_firstHeartbeat) | 5648 | if (m_firstHeartbeat) |
5410 | // return; | 5649 | return; |
5411 | // | 5650 | |
5412 | // if (Util.EnvironmentTickCountSubtract(m_lastFrameTick) > 2000) | 5651 | if ((Util.EnvironmentTickCountSubtract(m_lastFrameTick)) > 5000) |
5413 | // StartTimer(); | 5652 | Start(); |
5414 | // } | 5653 | } |
5415 | 5654 | ||
5416 | public override ISceneObject DeserializeObject(string representation) | 5655 | public override ISceneObject DeserializeObject(string representation) |
5417 | { | 5656 | { |
@@ -5469,7 +5708,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
5469 | Vector3 nearestRegionEdgePoint = GetNearestRegionEdgePosition(avatar); | 5708 | Vector3 nearestRegionEdgePoint = GetNearestRegionEdgePosition(avatar); |
5470 | 5709 | ||
5471 | //Debug.WriteLine("They are really in a place they don't belong, sending them to: " + nearestRegionEdgePoint.ToString()); | 5710 | //Debug.WriteLine("They are really in a place they don't belong, sending them to: " + nearestRegionEdgePoint.ToString()); |
5472 | 5711 | ||
5473 | return nearestRegionEdgePoint; | 5712 | return nearestRegionEdgePoint; |
5474 | } | 5713 | } |
5475 | 5714 | ||
@@ -5723,7 +5962,55 @@ namespace OpenSim.Region.Framework.Scenes | |||
5723 | mapModule.GenerateMaptile(); | 5962 | mapModule.GenerateMaptile(); |
5724 | } | 5963 | } |
5725 | 5964 | ||
5726 | private void RegenerateMaptileAndReregister(object sender, ElapsedEventArgs e) | 5965 | // public void CleanDroppedAttachments() |
5966 | // { | ||
5967 | // List<SceneObjectGroup> objectsToDelete = | ||
5968 | // new List<SceneObjectGroup>(); | ||
5969 | // | ||
5970 | // lock (m_cleaningAttachments) | ||
5971 | // { | ||
5972 | // ForEachSOG(delegate (SceneObjectGroup grp) | ||
5973 | // { | ||
5974 | // if (grp.RootPart.Shape.PCode == 0 && grp.RootPart.Shape.State != 0 && (!objectsToDelete.Contains(grp))) | ||
5975 | // { | ||
5976 | // UUID agentID = grp.OwnerID; | ||
5977 | // if (agentID == UUID.Zero) | ||
5978 | // { | ||
5979 | // objectsToDelete.Add(grp); | ||
5980 | // return; | ||
5981 | // } | ||
5982 | // | ||
5983 | // ScenePresence sp = GetScenePresence(agentID); | ||
5984 | // if (sp == null) | ||
5985 | // { | ||
5986 | // objectsToDelete.Add(grp); | ||
5987 | // return; | ||
5988 | // } | ||
5989 | // } | ||
5990 | // }); | ||
5991 | // } | ||
5992 | // | ||
5993 | // foreach (SceneObjectGroup grp in objectsToDelete) | ||
5994 | // { | ||
5995 | // m_log.InfoFormat("[SCENE]: Deleting dropped attachment {0} of user {1}", grp.UUID, grp.OwnerID); | ||
5996 | // DeleteSceneObject(grp, true); | ||
5997 | // } | ||
5998 | // } | ||
5999 | |||
6000 | public void ThreadAlive(int threadCode) | ||
6001 | { | ||
6002 | switch(threadCode) | ||
6003 | { | ||
6004 | case 1: // Incoming | ||
6005 | m_lastIncoming = Util.EnvironmentTickCount(); | ||
6006 | break; | ||
6007 | case 2: // Incoming | ||
6008 | m_lastOutgoing = Util.EnvironmentTickCount(); | ||
6009 | break; | ||
6010 | } | ||
6011 | } | ||
6012 | |||
6013 | public void RegenerateMaptileAndReregister(object sender, ElapsedEventArgs e) | ||
5727 | { | 6014 | { |
5728 | RegenerateMaptile(); | 6015 | RegenerateMaptile(); |
5729 | 6016 | ||
@@ -5874,7 +6161,19 @@ namespace OpenSim.Region.Framework.Scenes | |||
5874 | return true; | 6161 | return true; |
5875 | } | 6162 | } |
5876 | 6163 | ||
5877 | /// <summary> | 6164 | public void StartTimerWatchdog() |
6165 | { | ||
6166 | m_timerWatchdog.Interval = 1000; | ||
6167 | m_timerWatchdog.Elapsed += TimerWatchdog; | ||
6168 | m_timerWatchdog.AutoReset = true; | ||
6169 | m_timerWatchdog.Start(); | ||
6170 | } | ||
6171 | |||
6172 | public void TimerWatchdog(object sender, ElapsedEventArgs e) | ||
6173 | { | ||
6174 | CheckHeartbeat(); | ||
6175 | } | ||
6176 | |||
5878 | /// This method deals with movement when an avatar is automatically moving (but this is distinct from the | 6177 | /// This method deals with movement when an avatar is automatically moving (but this is distinct from the |
5879 | /// autopilot that moves an avatar to a sit target!. | 6178 | /// autopilot that moves an avatar to a sit target!. |
5880 | /// </summary> | 6179 | /// </summary> |
@@ -5953,6 +6252,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
5953 | return m_SpawnPoint - 1; | 6252 | return m_SpawnPoint - 1; |
5954 | } | 6253 | } |
5955 | 6254 | ||
6255 | private void HandleGcCollect(string module, string[] args) | ||
6256 | { | ||
6257 | GC.Collect(); | ||
6258 | } | ||
6259 | |||
5956 | /// <summary> | 6260 | /// <summary> |
5957 | /// Wrappers to get physics modules retrieve assets. | 6261 | /// Wrappers to get physics modules retrieve assets. |
5958 | /// </summary> | 6262 | /// </summary> |