aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/Scene.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Scene.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs582
1 files changed, 453 insertions, 129 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 80c4922..1023e25 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 // Using this for RegionReady module to prevent LoginsDisabled from changing under our feet; 233 // Using this for RegionReady module to prevent LoginsDisabled from changing under our feet;
234 public bool LoginLock = false; 234 public bool LoginLock = false;
@@ -244,11 +244,13 @@ namespace OpenSim.Region.Framework.Scenes
244 244
245 protected int m_splitRegionID; 245 protected int m_splitRegionID;
246 protected Timer m_restartWaitTimer = new Timer(); 246 protected Timer m_restartWaitTimer = new Timer();
247 protected Timer m_timerWatchdog = new Timer();
247 protected List<RegionInfo> m_regionRestartNotifyList = new List<RegionInfo>(); 248 protected List<RegionInfo> m_regionRestartNotifyList = new List<RegionInfo>();
248 protected List<RegionInfo> m_neighbours = new List<RegionInfo>(); 249 protected List<RegionInfo> m_neighbours = new List<RegionInfo>();
249 protected string m_simulatorVersion = "OpenSimulator Server"; 250 protected string m_simulatorVersion = "OpenSimulator Server";
250 protected AgentCircuitManager m_authenticateHandler; 251 protected AgentCircuitManager m_authenticateHandler;
251 protected SceneCommunicationService m_sceneGridService; 252 protected SceneCommunicationService m_sceneGridService;
253 protected ISnmpModule m_snmpService = null;
252 254
253 protected ISimulationDataService m_SimulationDataService; 255 protected ISimulationDataService m_SimulationDataService;
254 protected IEstateDataService m_EstateDataService; 256 protected IEstateDataService m_EstateDataService;
@@ -311,8 +313,8 @@ namespace OpenSim.Region.Framework.Scenes
311 private int m_update_presences = 1; // Update scene presence movements 313 private int m_update_presences = 1; // Update scene presence movements
312 private int m_update_events = 1; 314 private int m_update_events = 1;
313 private int m_update_backup = 200; 315 private int m_update_backup = 200;
314 private int m_update_terrain = 50; 316 private int m_update_terrain = 1000;
315// private int m_update_land = 1; 317 private int m_update_land = 10;
316 private int m_update_coarse_locations = 50; 318 private int m_update_coarse_locations = 50;
317 319
318 private int agentMS; 320 private int agentMS;
@@ -325,13 +327,13 @@ namespace OpenSim.Region.Framework.Scenes
325 private int backupMS; 327 private int backupMS;
326 private int terrainMS; 328 private int terrainMS;
327 private int landMS; 329 private int landMS;
328 private int spareMS;
329 330
330 /// <summary> 331 /// <summary>
331 /// Tick at which the last frame was processed. 332 /// Tick at which the last frame was processed.
332 /// </summary> 333 /// </summary>
333 private int m_lastFrameTick; 334 private int m_lastFrameTick;
334 335
336 public bool CombineRegions = false;
335 /// <summary> 337 /// <summary>
336 /// Tick at which the last maintenance run occurred. 338 /// Tick at which the last maintenance run occurred.
337 /// </summary> 339 /// </summary>
@@ -351,7 +353,7 @@ namespace OpenSim.Region.Framework.Scenes
351 private readonly Timer m_restartTimer = new Timer(15000); // Wait before firing 353 private readonly Timer m_restartTimer = new Timer(15000); // Wait before firing
352 private volatile bool m_backingup; 354 private volatile bool m_backingup;
353 private Dictionary<UUID, ReturnInfo> m_returns = new Dictionary<UUID, ReturnInfo>(); 355 private Dictionary<UUID, ReturnInfo> m_returns = new Dictionary<UUID, ReturnInfo>();
354 private Dictionary<UUID, SceneObjectGroup> m_groupsWithTargets = new Dictionary<UUID, SceneObjectGroup>(); 356 private Dictionary<UUID, int> m_groupsWithTargets = new Dictionary<UUID, int>();
355 357
356 private string m_defaultScriptEngine; 358 private string m_defaultScriptEngine;
357 359
@@ -360,6 +362,11 @@ namespace OpenSim.Region.Framework.Scenes
360 /// </summary> 362 /// </summary>
361 private int m_LastLogin; 363 private int m_LastLogin;
362 364
365 private int m_lastIncoming;
366 private int m_lastOutgoing;
367 private int m_hbRestarts = 0;
368
369
363 /// <summary> 370 /// <summary>
364 /// Thread that runs the scene loop. 371 /// Thread that runs the scene loop.
365 /// </summary> 372 /// </summary>
@@ -402,7 +409,7 @@ namespace OpenSim.Region.Framework.Scenes
402 private volatile bool m_active; 409 private volatile bool m_active;
403 410
404// private int m_lastUpdate; 411// private int m_lastUpdate;
405// private bool m_firstHeartbeat = true; 412 private bool m_firstHeartbeat = true;
406 413
407 private UpdatePrioritizationSchemes m_priorityScheme = UpdatePrioritizationSchemes.Time; 414 private UpdatePrioritizationSchemes m_priorityScheme = UpdatePrioritizationSchemes.Time;
408 private bool m_reprioritizationEnabled = true; 415 private bool m_reprioritizationEnabled = true;
@@ -446,6 +453,19 @@ namespace OpenSim.Region.Framework.Scenes
446 get { return m_sceneGridService; } 453 get { return m_sceneGridService; }
447 } 454 }
448 455
456 public ISnmpModule SnmpService
457 {
458 get
459 {
460 if (m_snmpService == null)
461 {
462 m_snmpService = RequestModuleInterface<ISnmpModule>();
463 }
464
465 return m_snmpService;
466 }
467 }
468
449 public ISimulationDataService SimulationDataService 469 public ISimulationDataService SimulationDataService
450 { 470 {
451 get 471 get
@@ -738,6 +758,8 @@ namespace OpenSim.Region.Framework.Scenes
738 m_SimulationDataService = simDataService; 758 m_SimulationDataService = simDataService;
739 m_EstateDataService = estateDataService; 759 m_EstateDataService = estateDataService;
740 m_regionHandle = RegionInfo.RegionHandle; 760 m_regionHandle = RegionInfo.RegionHandle;
761 m_lastIncoming = 0;
762 m_lastOutgoing = 0;
741 763
742 m_asyncSceneObjectDeleter = new AsyncSceneObjectGroupDeleter(this); 764 m_asyncSceneObjectDeleter = new AsyncSceneObjectGroupDeleter(this);
743 m_asyncSceneObjectDeleter.Enabled = true; 765 m_asyncSceneObjectDeleter.Enabled = true;
@@ -831,7 +853,7 @@ namespace OpenSim.Region.Framework.Scenes
831 853
832 StartDisabled = startupConfig.GetBoolean("StartDisabled", false); 854 StartDisabled = startupConfig.GetBoolean("StartDisabled", false);
833 855
834 m_defaultDrawDistance = startupConfig.GetFloat("DefaultDrawDistance", m_defaultDrawDistance); 856 m_defaultDrawDistance = startupConfig.GetFloat("DefaultDrawDistance",m_defaultDrawDistance);
835 UseBackup = startupConfig.GetBoolean("UseSceneBackup", UseBackup); 857 UseBackup = startupConfig.GetBoolean("UseSceneBackup", UseBackup);
836 if (!UseBackup) 858 if (!UseBackup)
837 m_log.InfoFormat("[SCENE]: Backup has been disabled for {0}", RegionInfo.RegionName); 859 m_log.InfoFormat("[SCENE]: Backup has been disabled for {0}", RegionInfo.RegionName);
@@ -839,10 +861,8 @@ namespace OpenSim.Region.Framework.Scenes
839 //Animation states 861 //Animation states
840 m_useFlySlow = startupConfig.GetBoolean("enableflyslow", false); 862 m_useFlySlow = startupConfig.GetBoolean("enableflyslow", false);
841 863
842 MaxUndoCount = startupConfig.GetInt("MaxPrimUndos", 20); 864 PhysicalPrims = startupConfig.GetBoolean("physical_prim", true);
843 865 CollidablePrims = startupConfig.GetBoolean("collidable_prim", true);
844 PhysicalPrims = startupConfig.GetBoolean("physical_prim", PhysicalPrims);
845 CollidablePrims = startupConfig.GetBoolean("collidable_prim", CollidablePrims);
846 866
847 m_minNonphys = startupConfig.GetFloat("NonPhysicalPrimMin", m_minNonphys); 867 m_minNonphys = startupConfig.GetFloat("NonPhysicalPrimMin", m_minNonphys);
848 if (RegionInfo.NonphysPrimMin > 0) 868 if (RegionInfo.NonphysPrimMin > 0)
@@ -863,11 +883,21 @@ namespace OpenSim.Region.Framework.Scenes
863 } 883 }
864 884
865 m_maxPhys = startupConfig.GetFloat("PhysicalPrimMax", m_maxPhys); 885 m_maxPhys = startupConfig.GetFloat("PhysicalPrimMax", m_maxPhys);
886
866 if (RegionInfo.PhysPrimMax > 0) 887 if (RegionInfo.PhysPrimMax > 0)
867 { 888 {
868 m_maxPhys = RegionInfo.PhysPrimMax; 889 m_maxPhys = RegionInfo.PhysPrimMax;
869 } 890 }
870 891
892 m_linksetCapacity = startupConfig.GetInt("LinksetPrims", m_linksetCapacity);
893 if (RegionInfo.LinksetCapacity > 0)
894 {
895 m_linksetCapacity = RegionInfo.LinksetCapacity;
896 }
897
898 SpawnPointRouting = startupConfig.GetString("SpawnPointRouting", "closest");
899 TelehubAllowLandmarks = startupConfig.GetBoolean("TelehubAllowLandmark", false);
900
871 // Here, if clamping is requested in either global or 901 // Here, if clamping is requested in either global or
872 // local config, it will be used 902 // local config, it will be used
873 // 903 //
@@ -877,13 +907,7 @@ namespace OpenSim.Region.Framework.Scenes
877 m_clampPrimSize = true; 907 m_clampPrimSize = true;
878 } 908 }
879 909
880 m_linksetCapacity = startupConfig.GetInt("LinksetPrims", m_linksetCapacity); 910 m_useTrashOnDelete = startupConfig.GetBoolean("UseTrashOnDelete",m_useTrashOnDelete);
881 if (RegionInfo.LinksetCapacity > 0)
882 {
883 m_linksetCapacity = RegionInfo.LinksetCapacity;
884 }
885
886 m_useTrashOnDelete = startupConfig.GetBoolean("UseTrashOnDelete", m_useTrashOnDelete);
887 m_trustBinaries = startupConfig.GetBoolean("TrustBinaries", m_trustBinaries); 911 m_trustBinaries = startupConfig.GetBoolean("TrustBinaries", m_trustBinaries);
888 m_allowScriptCrossings = startupConfig.GetBoolean("AllowScriptCrossing", m_allowScriptCrossings); 912 m_allowScriptCrossings = startupConfig.GetBoolean("AllowScriptCrossing", m_allowScriptCrossings);
889 m_dontPersistBefore = 913 m_dontPersistBefore =
@@ -894,11 +918,11 @@ namespace OpenSim.Region.Framework.Scenes
894 m_persistAfter *= 10000000; 918 m_persistAfter *= 10000000;
895 919
896 m_defaultScriptEngine = startupConfig.GetString("DefaultScriptEngine", "XEngine"); 920 m_defaultScriptEngine = startupConfig.GetString("DefaultScriptEngine", "XEngine");
897 921 m_log.InfoFormat("[SCENE]: Default script engine {0}", m_defaultScriptEngine);
898 SpawnPointRouting = startupConfig.GetString("SpawnPointRouting", "closest");
899 TelehubAllowLandmarks = startupConfig.GetBoolean("TelehubAllowLandmark", false);
900 922
901 m_strictAccessControl = startupConfig.GetBoolean("StrictAccessControl", m_strictAccessControl); 923 m_strictAccessControl = startupConfig.GetBoolean("StrictAccessControl", m_strictAccessControl);
924 m_seeIntoBannedRegion = startupConfig.GetBoolean("SeeIntoBannedRegion", m_seeIntoBannedRegion);
925 CombineRegions = startupConfig.GetBoolean("CombineContiguousRegions", false);
902 926
903 string[] possibleMapConfigSections = new string[] { "Map", "Startup" }; 927 string[] possibleMapConfigSections = new string[] { "Map", "Startup" };
904 928
@@ -943,7 +967,7 @@ namespace OpenSim.Region.Framework.Scenes
943 967
944 if (grant.Length > 0) 968 if (grant.Length > 0)
945 { 969 {
946 foreach (string viewer in grant.Split('|')) 970 foreach (string viewer in grant.Split(','))
947 { 971 {
948 m_AllowedViewers.Add(viewer.Trim().ToLower()); 972 m_AllowedViewers.Add(viewer.Trim().ToLower());
949 } 973 }
@@ -955,7 +979,7 @@ namespace OpenSim.Region.Framework.Scenes
955 979
956 if (grant.Length > 0) 980 if (grant.Length > 0)
957 { 981 {
958 foreach (string viewer in grant.Split('|')) 982 foreach (string viewer in grant.Split(','))
959 { 983 {
960 m_BannedViewers.Add(viewer.Trim().ToLower()); 984 m_BannedViewers.Add(viewer.Trim().ToLower());
961 } 985 }
@@ -1015,6 +1039,8 @@ namespace OpenSim.Region.Framework.Scenes
1015 StatsReporter = new SimStatsReporter(this); 1039 StatsReporter = new SimStatsReporter(this);
1016 StatsReporter.OnSendStatsResult += SendSimStatsPackets; 1040 StatsReporter.OnSendStatsResult += SendSimStatsPackets;
1017 StatsReporter.OnStatsIncorrect += m_sceneGraph.RecalculateStats; 1041 StatsReporter.OnStatsIncorrect += m_sceneGraph.RecalculateStats;
1042
1043 MainConsole.Instance.Commands.AddCommand("scene", false, "gc collect", "gc collect", "gc collect", "Cause the garbage collector to make a single pass", HandleGcCollect);
1018 } 1044 }
1019 1045
1020 public Scene(RegionInfo regInfo) : base(regInfo) 1046 public Scene(RegionInfo regInfo) : base(regInfo)
@@ -1310,8 +1336,11 @@ namespace OpenSim.Region.Framework.Scenes
1310 // Stop all client threads. 1336 // Stop all client threads.
1311 ForEachScenePresence(delegate(ScenePresence avatar) { avatar.ControllingClient.Close(); }); 1337 ForEachScenePresence(delegate(ScenePresence avatar) { avatar.ControllingClient.Close(); });
1312 1338
1313 m_log.Debug("[SCENE]: Persisting changed objects"); 1339 m_log.Debug("[SCENE]: TriggerSceneShuttingDown");
1314 EventManager.TriggerSceneShuttingDown(this); 1340 EventManager.TriggerSceneShuttingDown(this);
1341
1342 m_log.Debug("[SCENE]: Persisting changed objects");
1343
1315 Backup(false); 1344 Backup(false);
1316 m_sceneGraph.Close(); 1345 m_sceneGraph.Close();
1317 1346
@@ -1325,6 +1354,7 @@ namespace OpenSim.Region.Framework.Scenes
1325 // attempt to reference a null or disposed physics scene. 1354 // attempt to reference a null or disposed physics scene.
1326 if (PhysicsScene != null) 1355 if (PhysicsScene != null)
1327 { 1356 {
1357 m_log.Debug("[SCENE]: Dispose Physics");
1328 PhysicsScene phys = PhysicsScene; 1358 PhysicsScene phys = PhysicsScene;
1329 // remove the physics engine from both Scene and SceneGraph 1359 // remove the physics engine from both Scene and SceneGraph
1330 PhysicsScene = null; 1360 PhysicsScene = null;
@@ -1355,11 +1385,29 @@ namespace OpenSim.Region.Framework.Scenes
1355 //m_heartbeatTimer.Elapsed += new ElapsedEventHandler(Heartbeat); 1385 //m_heartbeatTimer.Elapsed += new ElapsedEventHandler(Heartbeat);
1356 if (m_heartbeatThread != null) 1386 if (m_heartbeatThread != null)
1357 { 1387 {
1388 m_hbRestarts++;
1389 if(m_hbRestarts > 10)
1390 Environment.Exit(1);
1391 m_log.ErrorFormat("[SCENE]: Restarting heartbeat thread because it hasn't reported in in region {0}", RegionInfo.RegionName);
1392
1393//int pid = System.Diagnostics.Process.GetCurrentProcess().Id;
1394//System.Diagnostics.Process proc = new System.Diagnostics.Process();
1395//proc.EnableRaisingEvents=false;
1396//proc.StartInfo.FileName = "/bin/kill";
1397//proc.StartInfo.Arguments = "-QUIT " + pid.ToString();
1398//proc.Start();
1399//proc.WaitForExit();
1400//Thread.Sleep(1000);
1401//Environment.Exit(1);
1358 m_heartbeatThread.Abort(); 1402 m_heartbeatThread.Abort();
1403 Watchdog.AbortThread(m_heartbeatThread.ManagedThreadId);
1359 m_heartbeatThread = null; 1404 m_heartbeatThread = null;
1360 } 1405 }
1361// m_lastUpdate = Util.EnvironmentTickCount(); 1406// m_lastUpdate = Util.EnvironmentTickCount();
1362 1407
1408// m_sceneGraph.PreparePhysicsSimulation();
1409
1410
1363 m_heartbeatThread 1411 m_heartbeatThread
1364 = Watchdog.StartThread( 1412 = Watchdog.StartThread(
1365 Heartbeat, string.Format("Heartbeat ({0})", RegionInfo.RegionName), ThreadPriority.Normal, false, false); 1413 Heartbeat, string.Format("Heartbeat ({0})", RegionInfo.RegionName), ThreadPriority.Normal, false, false);
@@ -1504,16 +1552,20 @@ namespace OpenSim.Region.Framework.Scenes
1504 endFrame = Frame + frames; 1552 endFrame = Frame + frames;
1505 1553
1506 float physicsFPS = 0f; 1554 float physicsFPS = 0f;
1507 int previousFrameTick, tmpMS; 1555 int tmpMS;
1508 int maintc = Util.EnvironmentTickCount(); 1556 int previousFrameTick;
1557 int maintc;
1558 int sleepMS;
1559 int framestart;
1509 1560
1510 while (!m_shuttingDown && ((endFrame == null && Active) || Frame < endFrame)) 1561 while (!m_shuttingDown && ((endFrame == null && Active) || Frame < endFrame))
1511 { 1562 {
1563 framestart = Util.EnvironmentTickCount();
1512 ++Frame; 1564 ++Frame;
1513 1565
1514// m_log.DebugFormat("[SCENE]: Processing frame {0} in {1}", Frame, RegionInfo.RegionName); 1566// m_log.DebugFormat("[SCENE]: Processing frame {0} in {1}", Frame, RegionInfo.RegionName);
1515 1567
1516 agentMS = tempOnRezMS = eventMS = backupMS = terrainMS = landMS = spareMS = 0; 1568 agentMS = tempOnRezMS = eventMS = backupMS = terrainMS = landMS = 0;
1517 1569
1518 try 1570 try
1519 { 1571 {
@@ -1565,6 +1617,7 @@ namespace OpenSim.Region.Framework.Scenes
1565 m_sceneGraph.UpdatePresences(); 1617 m_sceneGraph.UpdatePresences();
1566 1618
1567 agentMS += Util.EnvironmentTickCountSubtract(tmpMS); 1619 agentMS += Util.EnvironmentTickCountSubtract(tmpMS);
1620
1568 1621
1569 // Delete temp-on-rez stuff 1622 // Delete temp-on-rez stuff
1570 if (Frame % m_update_temp_cleaning == 0 && !m_cleaningTemps) 1623 if (Frame % m_update_temp_cleaning == 0 && !m_cleaningTemps)
@@ -1646,34 +1699,37 @@ namespace OpenSim.Region.Framework.Scenes
1646 1699
1647 Watchdog.UpdateThread(); 1700 Watchdog.UpdateThread();
1648 1701
1702 otherMS = tempOnRezMS + eventMS + backupMS + terrainMS + landMS;
1703
1704 StatsReporter.AddPhysicsFPS(physicsFPS);
1705 StatsReporter.AddTimeDilation(TimeDilation);
1706 StatsReporter.AddFPS(1);
1707
1708 StatsReporter.addAgentMS(agentMS);
1709 StatsReporter.addPhysicsMS(physicsMS + physicsMS2);
1710 StatsReporter.addOtherMS(otherMS);
1711 StatsReporter.addScriptLines(m_sceneGraph.GetScriptLPS());
1712
1649 previousFrameTick = m_lastFrameTick; 1713 previousFrameTick = m_lastFrameTick;
1650 m_lastFrameTick = Util.EnvironmentTickCount(); 1714 m_lastFrameTick = Util.EnvironmentTickCount();
1651 tmpMS = Util.EnvironmentTickCountSubtract(m_lastFrameTick, maintc); 1715 tmpMS = Util.EnvironmentTickCountSubtract(m_lastFrameTick, framestart);
1652 tmpMS = (int)(MinFrameTime * 1000) - tmpMS; 1716 tmpMS = (int)(MinFrameTime * 1000) - tmpMS;
1653 1717
1718 m_firstHeartbeat = false;
1719
1720 sleepMS = Util.EnvironmentTickCount();
1721
1654 if (tmpMS > 0) 1722 if (tmpMS > 0)
1655 {
1656 Thread.Sleep(tmpMS); 1723 Thread.Sleep(tmpMS);
1657 spareMS += tmpMS;
1658 }
1659
1660 frameMS = Util.EnvironmentTickCountSubtract(maintc);
1661 maintc = Util.EnvironmentTickCount();
1662 1724
1663 otherMS = tempOnRezMS + eventMS + backupMS + terrainMS + landMS; 1725 sleepMS = Util.EnvironmentTickCountSubtract(sleepMS);
1726 frameMS = Util.EnvironmentTickCountSubtract(framestart);
1727 StatsReporter.addSleepMS(sleepMS);
1728 StatsReporter.addFrameMS(frameMS);
1664 1729
1665 // if (Frame%m_update_avatars == 0) 1730 // if (Frame%m_update_avatars == 0)
1666 // UpdateInWorldTime(); 1731 // UpdateInWorldTime();
1667 StatsReporter.AddPhysicsFPS(physicsFPS);
1668 StatsReporter.AddTimeDilation(TimeDilation);
1669 StatsReporter.AddFPS(1);
1670 1732
1671 StatsReporter.addFrameMS(frameMS);
1672 StatsReporter.addAgentMS(agentMS);
1673 StatsReporter.addPhysicsMS(physicsMS + physicsMS2);
1674 StatsReporter.addOtherMS(otherMS);
1675 StatsReporter.AddSpareMS(spareMS);
1676 StatsReporter.addScriptLines(m_sceneGraph.GetScriptLPS());
1677 1733
1678 // Optionally warn if a frame takes double the amount of time that it should. 1734 // Optionally warn if a frame takes double the amount of time that it should.
1679 if (DebugUpdates 1735 if (DebugUpdates
@@ -1690,7 +1746,7 @@ namespace OpenSim.Region.Framework.Scenes
1690 public void AddGroupTarget(SceneObjectGroup grp) 1746 public void AddGroupTarget(SceneObjectGroup grp)
1691 { 1747 {
1692 lock (m_groupsWithTargets) 1748 lock (m_groupsWithTargets)
1693 m_groupsWithTargets[grp.UUID] = grp; 1749 m_groupsWithTargets[grp.UUID] = 0;
1694 } 1750 }
1695 1751
1696 public void RemoveGroupTarget(SceneObjectGroup grp) 1752 public void RemoveGroupTarget(SceneObjectGroup grp)
@@ -1701,18 +1757,24 @@ namespace OpenSim.Region.Framework.Scenes
1701 1757
1702 private void CheckAtTargets() 1758 private void CheckAtTargets()
1703 { 1759 {
1704 List<SceneObjectGroup> objs = null; 1760 List<UUID> objs = null;
1705 1761
1706 lock (m_groupsWithTargets) 1762 lock (m_groupsWithTargets)
1707 { 1763 {
1708 if (m_groupsWithTargets.Count != 0) 1764 if (m_groupsWithTargets.Count != 0)
1709 objs = new List<SceneObjectGroup>(m_groupsWithTargets.Values); 1765 objs = new List<UUID>(m_groupsWithTargets.Keys);
1710 } 1766 }
1711 1767
1712 if (objs != null) 1768 if (objs != null)
1713 { 1769 {
1714 foreach (SceneObjectGroup entry in objs) 1770 foreach (UUID entry in objs)
1715 entry.checkAtTargets(); 1771 {
1772 SceneObjectGroup grp = GetSceneObjectGroup(entry);
1773 if (grp == null)
1774 m_groupsWithTargets.Remove(entry);
1775 else
1776 grp.checkAtTargets();
1777 }
1716 } 1778 }
1717 } 1779 }
1718 1780
@@ -1791,7 +1853,7 @@ namespace OpenSim.Region.Framework.Scenes
1791 msg.fromAgentName = "Server"; 1853 msg.fromAgentName = "Server";
1792 msg.dialog = (byte)19; // Object msg 1854 msg.dialog = (byte)19; // Object msg
1793 msg.fromGroup = false; 1855 msg.fromGroup = false;
1794 msg.offline = (byte)0; 1856 msg.offline = (byte)1;
1795 msg.ParentEstateID = RegionInfo.EstateSettings.ParentEstateID; 1857 msg.ParentEstateID = RegionInfo.EstateSettings.ParentEstateID;
1796 msg.Position = Vector3.Zero; 1858 msg.Position = Vector3.Zero;
1797 msg.RegionID = RegionInfo.RegionID.Guid; 1859 msg.RegionID = RegionInfo.RegionID.Guid;
@@ -2020,7 +2082,7 @@ namespace OpenSim.Region.Framework.Scenes
2020 return PhysicsScene.SupportsRaycastWorldFiltered(); 2082 return PhysicsScene.SupportsRaycastWorldFiltered();
2021 } 2083 }
2022 2084
2023 public object RayCastFiltered(Vector3 position, Vector3 direction, float length, int Count, RayFilterFlags filter) 2085 public object RayCastFiltered(Vector3 position, Vector3 direction, float length, int Count, RayFilterFlags filter)
2024 { 2086 {
2025 if (PhysicsScene == null) 2087 if (PhysicsScene == null)
2026 return null; 2088 return null;
@@ -2042,14 +2104,24 @@ namespace OpenSim.Region.Framework.Scenes
2042 /// <returns></returns> 2104 /// <returns></returns>
2043 public Vector3 GetNewRezLocation(Vector3 RayStart, Vector3 RayEnd, UUID RayTargetID, Quaternion rot, byte bypassRayCast, byte RayEndIsIntersection, bool frontFacesOnly, Vector3 scale, bool FaceCenter) 2105 public Vector3 GetNewRezLocation(Vector3 RayStart, Vector3 RayEnd, UUID RayTargetID, Quaternion rot, byte bypassRayCast, byte RayEndIsIntersection, bool frontFacesOnly, Vector3 scale, bool FaceCenter)
2044 { 2106 {
2107
2108 float wheight = (float)RegionInfo.RegionSettings.WaterHeight;
2109 Vector3 wpos = Vector3.Zero;
2110 // Check for water surface intersection from above
2111 if ( (RayStart.Z > wheight) && (RayEnd.Z < wheight) )
2112 {
2113 float ratio = (RayStart.Z - wheight) / (RayStart.Z - RayEnd.Z);
2114 wpos.X = RayStart.X - (ratio * (RayStart.X - RayEnd.X));
2115 wpos.Y = RayStart.Y - (ratio * (RayStart.Y - RayEnd.Y));
2116 wpos.Z = wheight;
2117 }
2118
2045 Vector3 pos = Vector3.Zero; 2119 Vector3 pos = Vector3.Zero;
2046 if (RayEndIsIntersection == (byte)1) 2120 if (RayEndIsIntersection == (byte)1)
2047 { 2121 {
2048 pos = RayEnd; 2122 pos = RayEnd;
2049 return pos;
2050 } 2123 }
2051 2124 else if (RayTargetID != UUID.Zero)
2052 if (RayTargetID != UUID.Zero)
2053 { 2125 {
2054 SceneObjectPart target = GetSceneObjectPart(RayTargetID); 2126 SceneObjectPart target = GetSceneObjectPart(RayTargetID);
2055 2127
@@ -2071,7 +2143,7 @@ namespace OpenSim.Region.Framework.Scenes
2071 EntityIntersection ei = target.TestIntersectionOBB(NewRay, Quaternion.Identity, frontFacesOnly, FaceCenter); 2143 EntityIntersection ei = target.TestIntersectionOBB(NewRay, Quaternion.Identity, frontFacesOnly, FaceCenter);
2072 2144
2073 // Un-comment out the following line to Get Raytrace results printed to the console. 2145 // Un-comment out the following line to Get Raytrace results printed to the console.
2074 // m_log.Info("[RAYTRACERESULTS]: Hit:" + ei.HitTF.ToString() + " Point: " + ei.ipoint.ToString() + " Normal: " + ei.normal.ToString()); 2146 // m_log.Info("[RAYTRACERESULTS]: Hit:" + ei.HitTF.ToString() + " Point: " + ei.ipoint.ToString() + " Normal: " + ei.normal.ToString());
2075 float ScaleOffset = 0.5f; 2147 float ScaleOffset = 0.5f;
2076 2148
2077 // If we hit something 2149 // If we hit something
@@ -2094,13 +2166,10 @@ namespace OpenSim.Region.Framework.Scenes
2094 //pos.Z -= 0.25F; 2166 //pos.Z -= 0.25F;
2095 2167
2096 } 2168 }
2097
2098 return pos;
2099 } 2169 }
2100 else 2170 else
2101 { 2171 {
2102 // We don't have a target here, so we're going to raytrace all the objects in the scene. 2172 // We don't have a target here, so we're going to raytrace all the objects in the scene.
2103
2104 EntityIntersection ei = m_sceneGraph.GetClosestIntersectingPrim(new Ray(AXOrigin, AXdirection), true, false); 2173 EntityIntersection ei = m_sceneGraph.GetClosestIntersectingPrim(new Ray(AXOrigin, AXdirection), true, false);
2105 2174
2106 // Un-comment the following line to print the raytrace results to the console. 2175 // Un-comment the following line to print the raytrace results to the console.
@@ -2109,13 +2178,12 @@ namespace OpenSim.Region.Framework.Scenes
2109 if (ei.HitTF) 2178 if (ei.HitTF)
2110 { 2179 {
2111 pos = new Vector3(ei.ipoint.X, ei.ipoint.Y, ei.ipoint.Z); 2180 pos = new Vector3(ei.ipoint.X, ei.ipoint.Y, ei.ipoint.Z);
2112 } else 2181 }
2182 else
2113 { 2183 {
2114 // fall back to our stupid functionality 2184 // fall back to our stupid functionality
2115 pos = RayEnd; 2185 pos = RayEnd;
2116 } 2186 }
2117
2118 return pos;
2119 } 2187 }
2120 } 2188 }
2121 else 2189 else
@@ -2126,8 +2194,12 @@ namespace OpenSim.Region.Framework.Scenes
2126 //increase height so its above the ground. 2194 //increase height so its above the ground.
2127 //should be getting the normal of the ground at the rez point and using that? 2195 //should be getting the normal of the ground at the rez point and using that?
2128 pos.Z += scale.Z / 2f; 2196 pos.Z += scale.Z / 2f;
2129 return pos; 2197// return pos;
2130 } 2198 }
2199
2200 // check against posible water intercept
2201 if (wpos.Z > pos.Z) pos = wpos;
2202 return pos;
2131 } 2203 }
2132 2204
2133 2205
@@ -2218,12 +2290,12 @@ namespace OpenSim.Region.Framework.Scenes
2218 { 2290 {
2219 if (m_sceneGraph.AddRestoredSceneObject(sceneObject, attachToBackup, alreadyPersisted, sendClientUpdates)) 2291 if (m_sceneGraph.AddRestoredSceneObject(sceneObject, attachToBackup, alreadyPersisted, sendClientUpdates))
2220 { 2292 {
2293 sceneObject.IsDeleted = false;
2221 EventManager.TriggerObjectAddedToScene(sceneObject); 2294 EventManager.TriggerObjectAddedToScene(sceneObject);
2222 return true; 2295 return true;
2223 } 2296 }
2224 2297
2225 return false; 2298 return false;
2226
2227 } 2299 }
2228 2300
2229 /// <summary> 2301 /// <summary>
@@ -2315,6 +2387,15 @@ namespace OpenSim.Region.Framework.Scenes
2315 /// </summary> 2387 /// </summary>
2316 public void DeleteAllSceneObjects() 2388 public void DeleteAllSceneObjects()
2317 { 2389 {
2390 DeleteAllSceneObjects(false);
2391 }
2392
2393 /// <summary>
2394 /// Delete every object from the scene. This does not include attachments worn by avatars.
2395 /// </summary>
2396 public void DeleteAllSceneObjects(bool exceptNoCopy)
2397 {
2398 List<SceneObjectGroup> toReturn = new List<SceneObjectGroup>();
2318 lock (Entities) 2399 lock (Entities)
2319 { 2400 {
2320 EntityBase[] entities = Entities.GetEntities(); 2401 EntityBase[] entities = Entities.GetEntities();
@@ -2323,11 +2404,24 @@ namespace OpenSim.Region.Framework.Scenes
2323 if (e is SceneObjectGroup) 2404 if (e is SceneObjectGroup)
2324 { 2405 {
2325 SceneObjectGroup sog = (SceneObjectGroup)e; 2406 SceneObjectGroup sog = (SceneObjectGroup)e;
2326 if (!sog.IsAttachment) 2407 if (sog != null && !sog.IsAttachment)
2327 DeleteSceneObject((SceneObjectGroup)e, false); 2408 {
2409 if (!exceptNoCopy || ((sog.GetEffectivePermissions() & (uint)PermissionMask.Copy) != 0))
2410 {
2411 DeleteSceneObject((SceneObjectGroup)e, false);
2412 }
2413 else
2414 {
2415 toReturn.Add((SceneObjectGroup)e);
2416 }
2417 }
2328 } 2418 }
2329 } 2419 }
2330 } 2420 }
2421 if (toReturn.Count > 0)
2422 {
2423 returnObjects(toReturn.ToArray(), UUID.Zero);
2424 }
2331 } 2425 }
2332 2426
2333 /// <summary> 2427 /// <summary>
@@ -2362,6 +2456,12 @@ namespace OpenSim.Region.Framework.Scenes
2362 2456
2363 foreach (SceneObjectPart part in partList) 2457 foreach (SceneObjectPart part in partList)
2364 { 2458 {
2459 if (part.KeyframeMotion != null)
2460 {
2461 part.KeyframeMotion.Delete();
2462 part.KeyframeMotion = null;
2463 }
2464
2365 if (part.IsJoint() && ((part.Flags & PrimFlags.Physics) != 0)) 2465 if (part.IsJoint() && ((part.Flags & PrimFlags.Physics) != 0))
2366 { 2466 {
2367 PhysicsScene.RequestJointDeletion(part.Name); // FIXME: what if the name changed? 2467 PhysicsScene.RequestJointDeletion(part.Name); // FIXME: what if the name changed?
@@ -2379,6 +2479,8 @@ namespace OpenSim.Region.Framework.Scenes
2379 } 2479 }
2380 2480
2381 group.DeleteGroupFromScene(silent); 2481 group.DeleteGroupFromScene(silent);
2482 if (!silent)
2483 SendKillObject(new List<uint>() { group.LocalId });
2382 2484
2383// m_log.DebugFormat("[SCENE]: Exit DeleteSceneObject() for {0} {1}", group.Name, group.UUID); 2485// m_log.DebugFormat("[SCENE]: Exit DeleteSceneObject() for {0} {1}", group.Name, group.UUID);
2384 } 2486 }
@@ -2668,7 +2770,7 @@ namespace OpenSim.Region.Framework.Scenes
2668 // If the user is banned, we won't let any of their objects 2770 // If the user is banned, we won't let any of their objects
2669 // enter. Period. 2771 // enter. Period.
2670 // 2772 //
2671 if (RegionInfo.EstateSettings.IsBanned(newObject.OwnerID)) 2773 if (RegionInfo.EstateSettings.IsBanned(newObject.OwnerID, 36))
2672 { 2774 {
2673 m_log.InfoFormat("[INTERREGION]: Denied prim crossing for banned avatar {0}", newObject.OwnerID); 2775 m_log.InfoFormat("[INTERREGION]: Denied prim crossing for banned avatar {0}", newObject.OwnerID);
2674 return false; 2776 return false;
@@ -2703,6 +2805,9 @@ namespace OpenSim.Region.Framework.Scenes
2703 // before we restart the scripts, or else some functions won't work. 2805 // before we restart the scripts, or else some functions won't work.
2704 newObject.RootPart.ParentGroup.CreateScriptInstances(0, false, DefaultScriptEngine, GetStateSource(newObject)); 2806 newObject.RootPart.ParentGroup.CreateScriptInstances(0, false, DefaultScriptEngine, GetStateSource(newObject));
2705 newObject.ResumeScripts(); 2807 newObject.ResumeScripts();
2808
2809 if (newObject.RootPart.KeyframeMotion != null)
2810 newObject.RootPart.KeyframeMotion.UpdateSceneObject(newObject);
2706 } 2811 }
2707 2812
2708 // Do this as late as possible so that listeners have full access to the incoming object 2813 // Do this as late as possible so that listeners have full access to the incoming object
@@ -2720,6 +2825,23 @@ namespace OpenSim.Region.Framework.Scenes
2720 /// <returns>True if the SceneObjectGroup was added, False if it was not</returns> 2825 /// <returns>True if the SceneObjectGroup was added, False if it was not</returns>
2721 public bool AddSceneObject(SceneObjectGroup sceneObject) 2826 public bool AddSceneObject(SceneObjectGroup sceneObject)
2722 { 2827 {
2828 if (sceneObject.OwnerID == UUID.Zero)
2829 {
2830 m_log.ErrorFormat("[SCENE]: Owner ID for {0} was zero", sceneObject.UUID);
2831 return false;
2832 }
2833
2834 // If the user is banned, we won't let any of their objects
2835 // enter. Period.
2836 //
2837 int flags = GetUserFlags(sceneObject.OwnerID);
2838 if (RegionInfo.EstateSettings.IsBanned(sceneObject.OwnerID, flags))
2839 {
2840 m_log.InfoFormat("[INTERREGION]: Denied prim crossing for banned avatar {0}", sceneObject.OwnerID);
2841
2842 return false;
2843 }
2844
2723 // Force allocation of new LocalId 2845 // Force allocation of new LocalId
2724 // 2846 //
2725 SceneObjectPart[] parts = sceneObject.Parts; 2847 SceneObjectPart[] parts = sceneObject.Parts;
@@ -2756,16 +2878,27 @@ namespace OpenSim.Region.Framework.Scenes
2756 // information that this is due to a teleport/border cross rather than an ordinary attachment. 2878 // information that this is due to a teleport/border cross rather than an ordinary attachment.
2757 // We currently do this in Scene.MakeRootAgent() instead. 2879 // We currently do this in Scene.MakeRootAgent() instead.
2758 if (AttachmentsModule != null) 2880 if (AttachmentsModule != null)
2759 AttachmentsModule.AttachObject(sp, grp, 0, false, false, true); 2881 AttachmentsModule.AttachObject(sp, grp, 0, false, false, false, true);
2760 } 2882 }
2761 else 2883 else
2762 { 2884 {
2885 m_log.DebugFormat("[SCENE]: Attachment {0} arrived and scene presence was not found, setting to temp", sceneObject.UUID);
2763 RootPrim.RemFlag(PrimFlags.TemporaryOnRez); 2886 RootPrim.RemFlag(PrimFlags.TemporaryOnRez);
2764 RootPrim.AddFlag(PrimFlags.TemporaryOnRez); 2887 RootPrim.AddFlag(PrimFlags.TemporaryOnRez);
2765 } 2888 }
2889 if (sceneObject.OwnerID == UUID.Zero)
2890 {
2891 m_log.ErrorFormat("[SCENE]: Owner ID for {0} was zero after attachment processing. BUG!", sceneObject.UUID);
2892 return false;
2893 }
2766 } 2894 }
2767 else 2895 else
2768 { 2896 {
2897 if (sceneObject.OwnerID == UUID.Zero)
2898 {
2899 m_log.ErrorFormat("[SCENE]: Owner ID for non-attachment {0} was zero", sceneObject.UUID);
2900 return false;
2901 }
2769 AddRestoredSceneObject(sceneObject, true, false); 2902 AddRestoredSceneObject(sceneObject, true, false);
2770 } 2903 }
2771 2904
@@ -2782,6 +2915,24 @@ namespace OpenSim.Region.Framework.Scenes
2782 return 2; // StateSource.PrimCrossing 2915 return 2; // StateSource.PrimCrossing
2783 } 2916 }
2784 2917
2918 public int GetUserFlags(UUID user)
2919 {
2920 //Unfortunately the SP approach means that the value is cached until region is restarted
2921 /*
2922 ScenePresence sp;
2923 if (TryGetScenePresence(user, out sp))
2924 {
2925 return sp.UserFlags;
2926 }
2927 else
2928 {
2929 */
2930 UserAccount uac = UserAccountService.GetUserAccount(RegionInfo.ScopeID, user);
2931 if (uac == null)
2932 return 0;
2933 return uac.UserFlags;
2934 //}
2935 }
2785 #endregion 2936 #endregion
2786 2937
2787 #region Add/Remove Avatar Methods 2938 #region Add/Remove Avatar Methods
@@ -2814,7 +2965,7 @@ namespace OpenSim.Region.Framework.Scenes
2814 = (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0 2965 = (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0
2815 || (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0; 2966 || (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0;
2816 2967
2817 // CheckHeartbeat(); 2968 CheckHeartbeat();
2818 2969
2819 sp = GetScenePresence(client.AgentId); 2970 sp = GetScenePresence(client.AgentId);
2820 2971
@@ -2832,6 +2983,13 @@ namespace OpenSim.Region.Framework.Scenes
2832 SubscribeToClientEvents(client); 2983 SubscribeToClientEvents(client);
2833 2984
2834 sp = m_sceneGraph.CreateAndAddChildScenePresence(client, aCircuit.Appearance, type); 2985 sp = m_sceneGraph.CreateAndAddChildScenePresence(client, aCircuit.Appearance, type);
2986 InventoryFolderBase cof = InventoryService.GetFolderForType(client.AgentId, (AssetType)46);
2987 if (cof == null)
2988 sp.COF = UUID.Zero;
2989 else
2990 sp.COF = cof.ID;
2991
2992 m_log.DebugFormat("[SCENE]: COF for {0} is {1}", client.AgentId, sp.COF);
2835 m_eventManager.TriggerOnNewPresence(sp); 2993 m_eventManager.TriggerOnNewPresence(sp);
2836 2994
2837 sp.TeleportFlags = (TPFlags)aCircuit.teleportFlags; 2995 sp.TeleportFlags = (TPFlags)aCircuit.teleportFlags;
@@ -2944,19 +3102,14 @@ namespace OpenSim.Region.Framework.Scenes
2944 // and the scene presence and the client, if they exist 3102 // and the scene presence and the client, if they exist
2945 try 3103 try
2946 { 3104 {
2947 // We need to wait for the client to make UDP contact first. 3105 ScenePresence sp = GetScenePresence(agentID);
2948 // It's the UDP contact that creates the scene presence 3106
2949 ScenePresence sp = WaitGetScenePresence(agentID);
2950 if (sp != null) 3107 if (sp != null)
2951 { 3108 {
2952 PresenceService.LogoutAgent(sp.ControllingClient.SessionId); 3109 PresenceService.LogoutAgent(sp.ControllingClient.SessionId);
2953
2954 sp.ControllingClient.Close(); 3110 sp.ControllingClient.Close();
2955 } 3111 }
2956 else 3112
2957 {
2958 m_log.WarnFormat("[SCENE]: Could not find scene presence for {0}", agentID);
2959 }
2960 // BANG! SLASH! 3113 // BANG! SLASH!
2961 m_authenticateHandler.RemoveCircuit(agentID); 3114 m_authenticateHandler.RemoveCircuit(agentID);
2962 3115
@@ -3001,6 +3154,8 @@ namespace OpenSim.Region.Framework.Scenes
3001 client.OnUpdatePrimGroupPosition += m_sceneGraph.UpdatePrimGroupPosition; 3154 client.OnUpdatePrimGroupPosition += m_sceneGraph.UpdatePrimGroupPosition;
3002 client.OnUpdatePrimSinglePosition += m_sceneGraph.UpdatePrimSinglePosition; 3155 client.OnUpdatePrimSinglePosition += m_sceneGraph.UpdatePrimSinglePosition;
3003 3156
3157 client.onClientChangeObject += m_sceneGraph.ClientChangeObject;
3158
3004 client.OnUpdatePrimGroupRotation += m_sceneGraph.UpdatePrimGroupRotation; 3159 client.OnUpdatePrimGroupRotation += m_sceneGraph.UpdatePrimGroupRotation;
3005 client.OnUpdatePrimGroupMouseRotation += m_sceneGraph.UpdatePrimGroupRotation; 3160 client.OnUpdatePrimGroupMouseRotation += m_sceneGraph.UpdatePrimGroupRotation;
3006 client.OnUpdatePrimSingleRotation += m_sceneGraph.UpdatePrimSingleRotation; 3161 client.OnUpdatePrimSingleRotation += m_sceneGraph.UpdatePrimSingleRotation;
@@ -3057,6 +3212,7 @@ namespace OpenSim.Region.Framework.Scenes
3057 client.OnFetchInventory += m_asyncInventorySender.HandleFetchInventory; 3212 client.OnFetchInventory += m_asyncInventorySender.HandleFetchInventory;
3058 client.OnUpdateInventoryItem += UpdateInventoryItemAsset; 3213 client.OnUpdateInventoryItem += UpdateInventoryItemAsset;
3059 client.OnCopyInventoryItem += CopyInventoryItem; 3214 client.OnCopyInventoryItem += CopyInventoryItem;
3215 client.OnMoveItemsAndLeaveCopy += MoveInventoryItemsLeaveCopy;
3060 client.OnMoveInventoryItem += MoveInventoryItem; 3216 client.OnMoveInventoryItem += MoveInventoryItem;
3061 client.OnRemoveInventoryItem += RemoveInventoryItem; 3217 client.OnRemoveInventoryItem += RemoveInventoryItem;
3062 client.OnRemoveInventoryFolder += RemoveInventoryFolder; 3218 client.OnRemoveInventoryFolder += RemoveInventoryFolder;
@@ -3128,6 +3284,8 @@ namespace OpenSim.Region.Framework.Scenes
3128 client.OnUpdatePrimGroupPosition -= m_sceneGraph.UpdatePrimGroupPosition; 3284 client.OnUpdatePrimGroupPosition -= m_sceneGraph.UpdatePrimGroupPosition;
3129 client.OnUpdatePrimSinglePosition -= m_sceneGraph.UpdatePrimSinglePosition; 3285 client.OnUpdatePrimSinglePosition -= m_sceneGraph.UpdatePrimSinglePosition;
3130 3286
3287 client.onClientChangeObject -= m_sceneGraph.ClientChangeObject;
3288
3131 client.OnUpdatePrimGroupRotation -= m_sceneGraph.UpdatePrimGroupRotation; 3289 client.OnUpdatePrimGroupRotation -= m_sceneGraph.UpdatePrimGroupRotation;
3132 client.OnUpdatePrimGroupMouseRotation -= m_sceneGraph.UpdatePrimGroupRotation; 3290 client.OnUpdatePrimGroupMouseRotation -= m_sceneGraph.UpdatePrimGroupRotation;
3133 client.OnUpdatePrimSingleRotation -= m_sceneGraph.UpdatePrimSingleRotation; 3291 client.OnUpdatePrimSingleRotation -= m_sceneGraph.UpdatePrimSingleRotation;
@@ -3351,6 +3509,16 @@ namespace OpenSim.Region.Framework.Scenes
3351 /// <param name="flags"></param> 3509 /// <param name="flags"></param>
3352 public virtual void SetHomeRezPoint(IClientAPI remoteClient, ulong regionHandle, Vector3 position, Vector3 lookAt, uint flags) 3510 public virtual void SetHomeRezPoint(IClientAPI remoteClient, ulong regionHandle, Vector3 position, Vector3 lookAt, uint flags)
3353 { 3511 {
3512 //Add half the avatar's height so that the user doesn't fall through prims
3513 ScenePresence presence;
3514 if (TryGetScenePresence(remoteClient.AgentId, out presence))
3515 {
3516 if (presence.Appearance != null)
3517 {
3518 position.Z = position.Z + (presence.Appearance.AvatarHeight / 2);
3519 }
3520 }
3521
3354 if (GridUserService != null && GridUserService.SetHome(remoteClient.AgentId.ToString(), RegionInfo.RegionID, position, lookAt)) 3522 if (GridUserService != null && GridUserService.SetHome(remoteClient.AgentId.ToString(), RegionInfo.RegionID, position, lookAt))
3355 // FUBAR ALERT: this needs to be "Home position set." so the viewer saves a home-screenshot. 3523 // FUBAR ALERT: this needs to be "Home position set." so the viewer saves a home-screenshot.
3356 m_dialogModule.SendAlertToUser(remoteClient, "Home position set."); 3524 m_dialogModule.SendAlertToUser(remoteClient, "Home position set.");
@@ -3452,7 +3620,7 @@ namespace OpenSim.Region.Framework.Scenes
3452 // TODO: We shouldn't use closeChildAgents here - it's being used by the NPC module to stop 3620 // TODO: We shouldn't use closeChildAgents here - it's being used by the NPC module to stop
3453 // unnecessary operations. This should go away once NPCs have no accompanying IClientAPI 3621 // unnecessary operations. This should go away once NPCs have no accompanying IClientAPI
3454 if (closeChildAgents && CapsModule != null) 3622 if (closeChildAgents && CapsModule != null)
3455 CapsModule.RemoveCaps(agentID); 3623 CapsModule.RemoveCaps(agentID, avatar.ControllingClient.CircuitCode);
3456 3624
3457// // REFACTORING PROBLEM -- well not really a problem, but just to point out that whatever 3625// // REFACTORING PROBLEM -- well not really a problem, but just to point out that whatever
3458// // this method is doing is HORRIBLE!!! 3626// // this method is doing is HORRIBLE!!!
@@ -3488,6 +3656,7 @@ namespace OpenSim.Region.Framework.Scenes
3488 // It's possible for child agents to have transactions if changes are being made cross-border. 3656 // It's possible for child agents to have transactions if changes are being made cross-border.
3489 if (AgentTransactionsModule != null) 3657 if (AgentTransactionsModule != null)
3490 AgentTransactionsModule.RemoveAgentAssetTransactions(agentID); 3658 AgentTransactionsModule.RemoveAgentAssetTransactions(agentID);
3659 m_log.Debug("[Scene] The avatar has left the building");
3491 } 3660 }
3492 catch (Exception e) 3661 catch (Exception e)
3493 { 3662 {
@@ -3681,15 +3850,27 @@ namespace OpenSim.Region.Framework.Scenes
3681 agent.firstname, agent.lastname, agent.Viewer); 3850 agent.firstname, agent.lastname, agent.Viewer);
3682 reason = "Access denied, your viewer is banned by the region owner"; 3851 reason = "Access denied, your viewer is banned by the region owner";
3683 return false; 3852 return false;
3684 } 3853 }
3685 3854
3686 ILandObject land; 3855 ScenePresence sp = GetScenePresence(agent.AgentID);
3687 3856
3688 lock (agent) 3857 // If we have noo presence here or if that presence is a zombie root
3858 // presence that will be kicled, we need a new CAPS object.
3859 if (sp == null || (sp != null && !sp.IsChildAgent))
3689 { 3860 {
3690 ScenePresence sp = GetScenePresence(agent.AgentID); 3861 if (CapsModule != null)
3691 3862 {
3692 if (sp != null && !sp.IsChildAgent) 3863 lock (agent)
3864 {
3865 CapsModule.SetAgentCapsSeeds(agent);
3866 CapsModule.CreateCaps(agent.AgentID, agent.circuitcode);
3867 }
3868 }
3869 }
3870
3871 if (sp != null)
3872 {
3873 if (!sp.IsChildAgent)
3693 { 3874 {
3694 // We have a zombie from a crashed session. 3875 // We have a zombie from a crashed session.
3695 // Or the same user is trying to be root twice here, won't work. 3876 // Or the same user is trying to be root twice here, won't work.
@@ -3697,29 +3878,34 @@ namespace OpenSim.Region.Framework.Scenes
3697 m_log.WarnFormat( 3878 m_log.WarnFormat(
3698 "[SCENE]: Existing root scene presence detected for {0} {1} in {2} when connecting. Removing existing presence.", 3879 "[SCENE]: Existing root scene presence detected for {0} {1} in {2} when connecting. Removing existing presence.",
3699 sp.Name, sp.UUID, RegionInfo.RegionName); 3880 sp.Name, sp.UUID, RegionInfo.RegionName);
3700 3881
3701 sp.ControllingClient.Close(true); 3882 sp.ControllingClient.Close(true, true);
3702 sp = null; 3883 sp = null;
3703 } 3884 }
3885 }
3704 3886
3887 lock (agent)
3888 {
3705 // Optimistic: add or update the circuit data with the new agent circuit data and teleport flags. 3889 // Optimistic: add or update the circuit data with the new agent circuit data and teleport flags.
3706 // We need the circuit data here for some of the subsequent checks. (groups, for example) 3890 // We need the circuit data here for some of the subsequent checks. (groups, for example)
3707 // If the checks fail, we remove the circuit. 3891 // If the checks fail, we remove the circuit.
3708 agent.teleportFlags = teleportFlags; 3892 agent.teleportFlags = teleportFlags;
3709 m_authenticateHandler.AddNewCircuit(agent.circuitcode, agent); 3893 m_authenticateHandler.AddNewCircuit(agent.circuitcode, agent);
3710 3894
3711 land = LandChannel.GetLandObject(agent.startpos.X, agent.startpos.Y);
3712
3713 // On login test land permisions 3895 // On login test land permisions
3714 if (vialogin) 3896 if (vialogin)
3715 { 3897 {
3716 if (land != null && !TestLandRestrictions(agent.AgentID, out reason, ref agent.startpos.X, ref agent.startpos.Y)) 3898 IUserAccountCacheModule cache = RequestModuleInterface<IUserAccountCacheModule>();
3899 if (cache != null)
3900 cache.Remove(agent.firstname + " " + agent.lastname);
3901 if (!TestLandRestrictions(agent.AgentID, out reason, ref agent.startpos.X, ref agent.startpos.Y))
3717 { 3902 {
3903 m_log.DebugFormat("[CONNECTION BEGIN]: Denying access to {0} due to no land access", agent.AgentID.ToString());
3718 m_authenticateHandler.RemoveCircuit(agent.circuitcode); 3904 m_authenticateHandler.RemoveCircuit(agent.circuitcode);
3719 return false; 3905 return false;
3720 } 3906 }
3721 } 3907 }
3722 3908
3723 if (sp == null) // We don't have an [child] agent here already 3909 if (sp == null) // We don't have an [child] agent here already
3724 { 3910 {
3725 if (requirePresenceLookup) 3911 if (requirePresenceLookup)
@@ -3741,13 +3927,18 @@ namespace OpenSim.Region.Framework.Scenes
3741 return false; 3927 return false;
3742 } 3928 }
3743 } 3929 }
3744 3930
3745 try 3931 try
3746 { 3932 {
3747 if (!AuthorizeUser(agent, out reason)) 3933 // Always check estate if this is a login. Always
3934 // check if banned regions are to be blacked out.
3935 if (vialogin || (!m_seeIntoBannedRegion))
3748 { 3936 {
3749 m_authenticateHandler.RemoveCircuit(agent.circuitcode); 3937 if (!AuthorizeUser(agent, out reason))
3750 return false; 3938 {
3939 m_authenticateHandler.RemoveCircuit(agent.circuitcode);
3940 return false;
3941 }
3751 } 3942 }
3752 } 3943 }
3753 catch (Exception e) 3944 catch (Exception e)
@@ -3758,32 +3949,27 @@ namespace OpenSim.Region.Framework.Scenes
3758 m_authenticateHandler.RemoveCircuit(agent.circuitcode); 3949 m_authenticateHandler.RemoveCircuit(agent.circuitcode);
3759 return false; 3950 return false;
3760 } 3951 }
3761 3952
3762 m_log.InfoFormat( 3953 m_log.InfoFormat(
3763 "[SCENE]: Region {0} authenticated and authorized incoming {1} agent {2} {3} {4} (circuit code {5})", 3954 "[SCENE]: Region {0} authenticated and authorized incoming {1} agent {2} {3} {4} (circuit code {5})",
3764 RegionInfo.RegionName, (agent.child ? "child" : "root"), agent.firstname, agent.lastname, 3955 RegionInfo.RegionName, (agent.child ? "child" : "root"), agent.firstname, agent.lastname,
3765 agent.AgentID, agent.circuitcode); 3956 agent.AgentID, agent.circuitcode);
3766 3957
3767 if (CapsModule != null)
3768 {
3769 CapsModule.SetAgentCapsSeeds(agent);
3770 CapsModule.CreateCaps(agent.AgentID);
3771 }
3772 } 3958 }
3773 else 3959 else
3774 { 3960 {
3775 // Let the SP know how we got here. This has a lot of interesting 3961 // Let the SP know how we got here. This has a lot of interesting
3776 // uses down the line. 3962 // uses down the line.
3777 sp.TeleportFlags = (TPFlags)teleportFlags; 3963 sp.TeleportFlags = (TPFlags)teleportFlags;
3778 3964
3779 if (sp.IsChildAgent) 3965 if (sp.IsChildAgent)
3780 { 3966 {
3781 m_log.DebugFormat( 3967 m_log.DebugFormat(
3782 "[SCENE]: Adjusting known seeds for existing agent {0} in {1}", 3968 "[SCENE]: Adjusting known seeds for existing agent {0} in {1}",
3783 agent.AgentID, RegionInfo.RegionName); 3969 agent.AgentID, RegionInfo.RegionName);
3784 3970
3785 sp.AdjustKnownSeeds(); 3971 sp.AdjustKnownSeeds();
3786 3972
3787 if (CapsModule != null) 3973 if (CapsModule != null)
3788 CapsModule.SetAgentCapsSeeds(agent); 3974 CapsModule.SetAgentCapsSeeds(agent);
3789 } 3975 }
@@ -3791,6 +3977,11 @@ namespace OpenSim.Region.Framework.Scenes
3791 } 3977 }
3792 3978
3793 3979
3980 if (CapsModule != null)
3981 {
3982 CapsModule.ActivateCaps(agent.circuitcode);
3983 }
3984
3794 if (vialogin) 3985 if (vialogin)
3795 { 3986 {
3796// CleanDroppedAttachments(); 3987// CleanDroppedAttachments();
@@ -3882,6 +4073,8 @@ namespace OpenSim.Region.Framework.Scenes
3882 } 4073 }
3883 4074
3884 // Honor parcel landing type and position. 4075 // Honor parcel landing type and position.
4076 /*
4077 ILandObject land = LandChannel.GetLandObject(agent.startpos.X, agent.startpos.Y);
3885 if (land != null) 4078 if (land != null)
3886 { 4079 {
3887 if (land.LandData.LandingType == (byte)1 && land.LandData.UserLocation != Vector3.Zero) 4080 if (land.LandData.LandingType == (byte)1 && land.LandData.UserLocation != Vector3.Zero)
@@ -3889,6 +4082,7 @@ namespace OpenSim.Region.Framework.Scenes
3889 agent.startpos = land.LandData.UserLocation; 4082 agent.startpos = land.LandData.UserLocation;
3890 } 4083 }
3891 } 4084 }
4085 */// This is now handled properly in ScenePresence.MakeRootAgent
3892 } 4086 }
3893 4087
3894 return true; 4088 return true;
@@ -3986,7 +4180,7 @@ namespace OpenSim.Region.Framework.Scenes
3986 4180
3987 if (!m_strictAccessControl) return true; 4181 if (!m_strictAccessControl) return true;
3988 if (Permissions.IsGod(agent.AgentID)) return true; 4182 if (Permissions.IsGod(agent.AgentID)) return true;
3989 4183
3990 if (AuthorizationService != null) 4184 if (AuthorizationService != null)
3991 { 4185 {
3992 if (!AuthorizationService.IsAuthorizedForRegion( 4186 if (!AuthorizationService.IsAuthorizedForRegion(
@@ -4001,7 +4195,7 @@ namespace OpenSim.Region.Framework.Scenes
4001 4195
4002 if (RegionInfo.EstateSettings != null) 4196 if (RegionInfo.EstateSettings != null)
4003 { 4197 {
4004 if (RegionInfo.EstateSettings.IsBanned(agent.AgentID)) 4198 if (RegionInfo.EstateSettings.IsBanned(agent.AgentID, 0))
4005 { 4199 {
4006 m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the user is on the banlist", 4200 m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the user is on the banlist",
4007 agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName); 4201 agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName);
@@ -4189,6 +4383,15 @@ namespace OpenSim.Region.Framework.Scenes
4189 m_log.DebugFormat( 4383 m_log.DebugFormat(
4190 "[SCENE]: Incoming child agent update for {0} in {1}", cAgentData.AgentID, RegionInfo.RegionName); 4384 "[SCENE]: Incoming child agent update for {0} in {1}", cAgentData.AgentID, RegionInfo.RegionName);
4191 4385
4386 // We have to wait until the viewer contacts this region after receiving EAC.
4387 // That calls AddNewClient, which finally creates the ScenePresence
4388 int flags = GetUserFlags(cAgentData.AgentID);
4389 if (RegionInfo.EstateSettings.IsBanned(cAgentData.AgentID, flags))
4390 {
4391 m_log.DebugFormat("[SCENE]: Denying root agent entry to {0}: banned", cAgentData.AgentID);
4392 return false;
4393 }
4394
4192 // TODO: This check should probably be in QueryAccess(). 4395 // TODO: This check should probably be in QueryAccess().
4193 ILandObject nearestParcel = GetNearestAllowedParcel(cAgentData.AgentID, Constants.RegionSize / 2, Constants.RegionSize / 2); 4396 ILandObject nearestParcel = GetNearestAllowedParcel(cAgentData.AgentID, Constants.RegionSize / 2, Constants.RegionSize / 2);
4194 if (nearestParcel == null) 4397 if (nearestParcel == null)
@@ -4253,7 +4456,7 @@ namespace OpenSim.Region.Framework.Scenes
4253 /// <param name='agentID'></param> 4456 /// <param name='agentID'></param>
4254 protected virtual ScenePresence WaitGetScenePresence(UUID agentID) 4457 protected virtual ScenePresence WaitGetScenePresence(UUID agentID)
4255 { 4458 {
4256 int ntimes = 10; 4459 int ntimes = 30;
4257 ScenePresence sp = null; 4460 ScenePresence sp = null;
4258 while ((sp = GetScenePresence(agentID)) == null && (ntimes-- > 0)) 4461 while ((sp = GetScenePresence(agentID)) == null && (ntimes-- > 0))
4259 Thread.Sleep(1000); 4462 Thread.Sleep(1000);
@@ -4283,6 +4486,16 @@ namespace OpenSim.Region.Framework.Scenes
4283 return false; 4486 return false;
4284 } 4487 }
4285 4488
4489 public bool IncomingCloseAgent(UUID agentID)
4490 {
4491 return IncomingCloseAgent(agentID, false);
4492 }
4493
4494 public bool IncomingCloseChildAgent(UUID agentID)
4495 {
4496 return IncomingCloseAgent(agentID, true);
4497 }
4498
4286 /// <summary> 4499 /// <summary>
4287 /// Tell a single agent to disconnect from the region. 4500 /// Tell a single agent to disconnect from the region.
4288 /// </summary> 4501 /// </summary>
@@ -4298,7 +4511,7 @@ namespace OpenSim.Region.Framework.Scenes
4298 ScenePresence presence = m_sceneGraph.GetScenePresence(agentID); 4511 ScenePresence presence = m_sceneGraph.GetScenePresence(agentID);
4299 if (presence != null) 4512 if (presence != null)
4300 { 4513 {
4301 presence.ControllingClient.Close(force); 4514 presence.ControllingClient.Close(force, force);
4302 return true; 4515 return true;
4303 } 4516 }
4304 4517
@@ -4931,7 +5144,7 @@ namespace OpenSim.Region.Framework.Scenes
4931 { 5144 {
4932 if ((grp.RootPart.Flags & PrimFlags.TemporaryOnRez) != 0) 5145 if ((grp.RootPart.Flags & PrimFlags.TemporaryOnRez) != 0)
4933 { 5146 {
4934 if (grp.RootPart.Expires <= DateTime.Now) 5147 if (grp.GetSittingAvatarsCount() == 0 && grp.RootPart.Expires <= DateTime.Now)
4935 DeleteSceneObject(grp, false); 5148 DeleteSceneObject(grp, false);
4936 } 5149 }
4937 } 5150 }
@@ -4945,35 +5158,81 @@ namespace OpenSim.Region.Framework.Scenes
4945 SimulationDataService.RemoveObject(uuid, RegionInfo.RegionID); 5158 SimulationDataService.RemoveObject(uuid, RegionInfo.RegionID);
4946 } 5159 }
4947 5160
4948 public int GetHealth() 5161 public int GetHealth(out int flags, out string message)
4949 { 5162 {
4950 // Returns: 5163 // Returns:
4951 // 1 = sim is up and accepting http requests. The heartbeat has 5164 // 1 = sim is up and accepting http requests. The heartbeat has
4952 // stopped and the sim is probably locked up, but a remote 5165 // stopped and the sim is probably locked up, but a remote
4953 // admin restart may succeed 5166 // admin restart may succeed
4954 // 5167 //
4955 // 2 = Sim is up and the heartbeat is running. The sim is likely 5168 // 2 = Sim is up and the heartbeat is running. The sim is likely
4956 // usable for people within and logins _may_ work 5169 // usable for people within
5170 //
5171 // 3 = Sim is up and one packet thread is running. Sim is
5172 // unstable and will not accept new logins
4957 // 5173 //
4958 // 3 = We have seen a new user enter within the past 4 minutes 5174 // 4 = Sim is up and both packet threads are running. Sim is
5175 // likely usable
5176 //
5177 // 5 = We have seen a new user enter within the past 4 minutes
4959 // which can be seen as positive confirmation of sim health 5178 // which can be seen as positive confirmation of sim health
4960 // 5179 //
5180
5181 flags = 0;
5182 message = String.Empty;
5183
5184 CheckHeartbeat();
5185
5186 if (m_firstHeartbeat || (m_lastIncoming == 0 && m_lastOutgoing == 0))
5187 {
5188 // We're still starting
5189 // 0 means "in startup", it can't happen another way, since
5190 // to get here, we must be able to accept http connections
5191 return 0;
5192 }
5193
4961 int health=1; // Start at 1, means we're up 5194 int health=1; // Start at 1, means we're up
4962 5195
4963 if ((Util.EnvironmentTickCountSubtract(m_lastFrameTick)) < 1000) 5196 if ((Util.EnvironmentTickCountSubtract(m_lastFrameTick)) < 1000)
4964 health += 1; 5197 {
5198 health+=1;
5199 flags |= 1;
5200 }
5201
5202 if (Util.EnvironmentTickCountSubtract(m_lastIncoming) < 1000)
5203 {
5204 health+=1;
5205 flags |= 2;
5206 }
5207
5208 if (Util.EnvironmentTickCountSubtract(m_lastOutgoing) < 1000)
5209 {
5210 health+=1;
5211 flags |= 4;
5212 }
4965 else 5213 else
5214 {
5215int pid = System.Diagnostics.Process.GetCurrentProcess().Id;
5216System.Diagnostics.Process proc = new System.Diagnostics.Process();
5217proc.EnableRaisingEvents=false;
5218proc.StartInfo.FileName = "/bin/kill";
5219proc.StartInfo.Arguments = "-QUIT " + pid.ToString();
5220proc.Start();
5221proc.WaitForExit();
5222Thread.Sleep(1000);
5223Environment.Exit(1);
5224 }
5225
5226 if (flags != 7)
4966 return health; 5227 return health;
4967 5228
4968 // A login in the last 4 mins? We can't be doing too badly 5229 // A login in the last 4 mins? We can't be doing too badly
4969 // 5230 //
4970 if ((Util.EnvironmentTickCountSubtract(m_LastLogin)) < 240000) 5231 if (Util.EnvironmentTickCountSubtract(m_LastLogin) < 240000)
4971 health++; 5232 health++;
4972 else 5233 else
4973 return health; 5234 return health;
4974 5235
4975// CheckHeartbeat();
4976
4977 return health; 5236 return health;
4978 } 5237 }
4979 5238
@@ -5061,7 +5320,7 @@ namespace OpenSim.Region.Framework.Scenes
5061 bool wasUsingPhysics = ((jointProxyObject.Flags & PrimFlags.Physics) != 0); 5320 bool wasUsingPhysics = ((jointProxyObject.Flags & PrimFlags.Physics) != 0);
5062 if (wasUsingPhysics) 5321 if (wasUsingPhysics)
5063 { 5322 {
5064 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 5323 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
5065 } 5324 }
5066 } 5325 }
5067 5326
@@ -5160,14 +5419,14 @@ namespace OpenSim.Region.Framework.Scenes
5160 return (((vsn.X * xdiff) + (vsn.Y * ydiff)) / (-1 * vsn.Z)) + p0.Z; 5419 return (((vsn.X * xdiff) + (vsn.Y * ydiff)) / (-1 * vsn.Z)) + p0.Z;
5161 } 5420 }
5162 5421
5163// private void CheckHeartbeat() 5422 private void CheckHeartbeat()
5164// { 5423 {
5165// if (m_firstHeartbeat) 5424 if (m_firstHeartbeat)
5166// return; 5425 return;
5167// 5426
5168// if (Util.EnvironmentTickCountSubtract(m_lastFrameTick) > 2000) 5427 if ((Util.EnvironmentTickCountSubtract(m_lastFrameTick)) > 5000)
5169// StartTimer(); 5428 Start();
5170// } 5429 }
5171 5430
5172 public override ISceneObject DeserializeObject(string representation) 5431 public override ISceneObject DeserializeObject(string representation)
5173 { 5432 {
@@ -5225,7 +5484,7 @@ namespace OpenSim.Region.Framework.Scenes
5225 Vector3 nearestRegionEdgePoint = GetNearestRegionEdgePosition(avatar); 5484 Vector3 nearestRegionEdgePoint = GetNearestRegionEdgePosition(avatar);
5226 5485
5227 //Debug.WriteLine("They are really in a place they don't belong, sending them to: " + nearestRegionEdgePoint.ToString()); 5486 //Debug.WriteLine("They are really in a place they don't belong, sending them to: " + nearestRegionEdgePoint.ToString());
5228 5487
5229 return nearestRegionEdgePoint; 5488 return nearestRegionEdgePoint;
5230 } 5489 }
5231 5490
@@ -5479,7 +5738,55 @@ namespace OpenSim.Region.Framework.Scenes
5479 mapModule.GenerateMaptile(); 5738 mapModule.GenerateMaptile();
5480 } 5739 }
5481 5740
5482 private void RegenerateMaptileAndReregister(object sender, ElapsedEventArgs e) 5741// public void CleanDroppedAttachments()
5742// {
5743// List<SceneObjectGroup> objectsToDelete =
5744// new List<SceneObjectGroup>();
5745//
5746// lock (m_cleaningAttachments)
5747// {
5748// ForEachSOG(delegate (SceneObjectGroup grp)
5749// {
5750// if (grp.RootPart.Shape.PCode == 0 && grp.RootPart.Shape.State != 0 && (!objectsToDelete.Contains(grp)))
5751// {
5752// UUID agentID = grp.OwnerID;
5753// if (agentID == UUID.Zero)
5754// {
5755// objectsToDelete.Add(grp);
5756// return;
5757// }
5758//
5759// ScenePresence sp = GetScenePresence(agentID);
5760// if (sp == null)
5761// {
5762// objectsToDelete.Add(grp);
5763// return;
5764// }
5765// }
5766// });
5767// }
5768//
5769// foreach (SceneObjectGroup grp in objectsToDelete)
5770// {
5771// m_log.InfoFormat("[SCENE]: Deleting dropped attachment {0} of user {1}", grp.UUID, grp.OwnerID);
5772// DeleteSceneObject(grp, true);
5773// }
5774// }
5775
5776 public void ThreadAlive(int threadCode)
5777 {
5778 switch(threadCode)
5779 {
5780 case 1: // Incoming
5781 m_lastIncoming = Util.EnvironmentTickCount();
5782 break;
5783 case 2: // Incoming
5784 m_lastOutgoing = Util.EnvironmentTickCount();
5785 break;
5786 }
5787 }
5788
5789 public void RegenerateMaptileAndReregister(object sender, ElapsedEventArgs e)
5483 { 5790 {
5484 RegenerateMaptile(); 5791 RegenerateMaptile();
5485 5792
@@ -5641,7 +5948,19 @@ namespace OpenSim.Region.Framework.Scenes
5641 return true; 5948 return true;
5642 } 5949 }
5643 5950
5644 /// <summary> 5951 public void StartTimerWatchdog()
5952 {
5953 m_timerWatchdog.Interval = 1000;
5954 m_timerWatchdog.Elapsed += TimerWatchdog;
5955 m_timerWatchdog.AutoReset = true;
5956 m_timerWatchdog.Start();
5957 }
5958
5959 public void TimerWatchdog(object sender, ElapsedEventArgs e)
5960 {
5961 CheckHeartbeat();
5962 }
5963
5645 /// This method deals with movement when an avatar is automatically moving (but this is distinct from the 5964 /// This method deals with movement when an avatar is automatically moving (but this is distinct from the
5646 /// autopilot that moves an avatar to a sit target!. 5965 /// autopilot that moves an avatar to a sit target!.
5647 /// </summary> 5966 /// </summary>
@@ -5720,6 +6039,11 @@ namespace OpenSim.Region.Framework.Scenes
5720 return m_SpawnPoint - 1; 6039 return m_SpawnPoint - 1;
5721 } 6040 }
5722 6041
6042 private void HandleGcCollect(string module, string[] args)
6043 {
6044 GC.Collect();
6045 }
6046
5723 /// <summary> 6047 /// <summary>
5724 /// Wrappers to get physics modules retrieve assets. 6048 /// Wrappers to get physics modules retrieve assets.
5725 /// </summary> 6049 /// </summary>