diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Scene.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.cs | 353 |
1 files changed, 277 insertions, 76 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 12fd813..a4f630a 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -84,6 +84,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
84 | // TODO: need to figure out how allow client agents but deny | 84 | // TODO: need to figure out how allow client agents but deny |
85 | // root agents when ACL denies access to root agent | 85 | // root agents when ACL denies access to root agent |
86 | public bool m_strictAccessControl = true; | 86 | public bool m_strictAccessControl = true; |
87 | public bool m_seeIntoBannedRegion = false; | ||
87 | public int MaxUndoCount = 5; | 88 | public int MaxUndoCount = 5; |
88 | public bool LoginsDisabled = true; | 89 | public bool LoginsDisabled = true; |
89 | public bool LoadingPrims; | 90 | public bool LoadingPrims; |
@@ -102,6 +103,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
102 | protected ModuleLoader m_moduleLoader; | 103 | protected ModuleLoader m_moduleLoader; |
103 | protected AgentCircuitManager m_authenticateHandler; | 104 | protected AgentCircuitManager m_authenticateHandler; |
104 | protected SceneCommunicationService m_sceneGridService; | 105 | protected SceneCommunicationService m_sceneGridService; |
106 | protected ISnmpModule m_snmpService = null; | ||
105 | 107 | ||
106 | protected ISimulationDataService m_SimulationDataService; | 108 | protected ISimulationDataService m_SimulationDataService; |
107 | protected IEstateDataService m_EstateDataService; | 109 | protected IEstateDataService m_EstateDataService; |
@@ -149,7 +151,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
149 | private int m_update_events = 1; | 151 | private int m_update_events = 1; |
150 | private int m_update_backup = 200; | 152 | private int m_update_backup = 200; |
151 | private int m_update_terrain = 50; | 153 | private int m_update_terrain = 50; |
152 | // private int m_update_land = 1; | 154 | private int m_update_land = 10; |
153 | private int m_update_coarse_locations = 50; | 155 | private int m_update_coarse_locations = 50; |
154 | 156 | ||
155 | private int frameMS; | 157 | private int frameMS; |
@@ -163,6 +165,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
163 | private int landMS; | 165 | private int landMS; |
164 | private int lastCompletedFrame; | 166 | private int lastCompletedFrame; |
165 | 167 | ||
168 | public bool CombineRegions = false; | ||
166 | private bool m_physics_enabled = true; | 169 | private bool m_physics_enabled = true; |
167 | private bool m_scripts_enabled = true; | 170 | private bool m_scripts_enabled = true; |
168 | private string m_defaultScriptEngine; | 171 | private string m_defaultScriptEngine; |
@@ -171,6 +174,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
171 | private volatile bool shuttingdown; | 174 | private volatile bool shuttingdown; |
172 | 175 | ||
173 | private int m_lastUpdate; | 176 | private int m_lastUpdate; |
177 | private int m_lastIncoming; | ||
178 | private int m_lastOutgoing; | ||
174 | private bool m_firstHeartbeat = true; | 179 | private bool m_firstHeartbeat = true; |
175 | 180 | ||
176 | private object m_deleting_scene_object = new object(); | 181 | private object m_deleting_scene_object = new object(); |
@@ -222,6 +227,19 @@ namespace OpenSim.Region.Framework.Scenes | |||
222 | get { return m_sceneGridService; } | 227 | get { return m_sceneGridService; } |
223 | } | 228 | } |
224 | 229 | ||
230 | public ISnmpModule SnmpService | ||
231 | { | ||
232 | get | ||
233 | { | ||
234 | if (m_snmpService == null) | ||
235 | { | ||
236 | m_snmpService = RequestModuleInterface<ISnmpModule>(); | ||
237 | } | ||
238 | |||
239 | return m_snmpService; | ||
240 | } | ||
241 | } | ||
242 | |||
225 | public ISimulationDataService SimulationDataService | 243 | public ISimulationDataService SimulationDataService |
226 | { | 244 | { |
227 | get | 245 | get |
@@ -553,6 +571,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
553 | m_regionName = m_regInfo.RegionName; | 571 | m_regionName = m_regInfo.RegionName; |
554 | m_datastore = m_regInfo.DataStore; | 572 | m_datastore = m_regInfo.DataStore; |
555 | m_lastUpdate = Util.EnvironmentTickCount(); | 573 | m_lastUpdate = Util.EnvironmentTickCount(); |
574 | m_lastIncoming = 0; | ||
575 | m_lastOutgoing = 0; | ||
556 | 576 | ||
557 | m_physicalPrim = physicalPrim; | 577 | m_physicalPrim = physicalPrim; |
558 | m_seeIntoRegionFromNeighbor = SeeIntoRegionFromNeighbor; | 578 | m_seeIntoRegionFromNeighbor = SeeIntoRegionFromNeighbor; |
@@ -566,6 +586,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
566 | #region Region Settings | 586 | #region Region Settings |
567 | 587 | ||
568 | // Load region settings | 588 | // Load region settings |
589 | m_regInfo.WindlightSettings = SimulationDataService.LoadRegionWindlightSettings(m_regInfo.RegionID); | ||
590 | |||
569 | m_regInfo.RegionSettings = simDataService.LoadRegionSettings(m_regInfo.RegionID); | 591 | m_regInfo.RegionSettings = simDataService.LoadRegionSettings(m_regInfo.RegionID); |
570 | if (estateDataService != null) | 592 | if (estateDataService != null) |
571 | m_regInfo.EstateSettings = estateDataService.LoadEstateSettings(m_regInfo.RegionID, false); | 593 | m_regInfo.EstateSettings = estateDataService.LoadEstateSettings(m_regInfo.RegionID, false); |
@@ -625,9 +647,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
625 | //Animation states | 647 | //Animation states |
626 | m_useFlySlow = startupConfig.GetBoolean("enableflyslow", false); | 648 | m_useFlySlow = startupConfig.GetBoolean("enableflyslow", false); |
627 | // TODO: Change default to true once the feature is supported | 649 | // TODO: Change default to true once the feature is supported |
628 | m_usePreJump = startupConfig.GetBoolean("enableprejump", false); | 650 | m_usePreJump = startupConfig.GetBoolean("enableprejump", true); |
629 | |||
630 | m_maxNonphys = startupConfig.GetFloat("NonPhysicalPrimMax", m_maxNonphys); | 651 | m_maxNonphys = startupConfig.GetFloat("NonPhysicalPrimMax", m_maxNonphys); |
652 | |||
653 | m_log.DebugFormat("[SCENE]: prejump is {0}", m_usePreJump ? "ON" : "OFF"); | ||
631 | if (RegionInfo.NonphysPrimMax > 0) | 654 | if (RegionInfo.NonphysPrimMax > 0) |
632 | { | 655 | { |
633 | m_maxNonphys = RegionInfo.NonphysPrimMax; | 656 | m_maxNonphys = RegionInfo.NonphysPrimMax; |
@@ -659,6 +682,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
659 | m_persistAfter *= 10000000; | 682 | m_persistAfter *= 10000000; |
660 | 683 | ||
661 | m_defaultScriptEngine = startupConfig.GetString("DefaultScriptEngine", "XEngine"); | 684 | m_defaultScriptEngine = startupConfig.GetString("DefaultScriptEngine", "XEngine"); |
685 | m_log.InfoFormat("[SCENE]: Default script engine {0}", m_defaultScriptEngine); | ||
662 | 686 | ||
663 | IConfig packetConfig = m_config.Configs["PacketPool"]; | 687 | IConfig packetConfig = m_config.Configs["PacketPool"]; |
664 | if (packetConfig != null) | 688 | if (packetConfig != null) |
@@ -668,6 +692,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
668 | } | 692 | } |
669 | 693 | ||
670 | m_strictAccessControl = startupConfig.GetBoolean("StrictAccessControl", m_strictAccessControl); | 694 | m_strictAccessControl = startupConfig.GetBoolean("StrictAccessControl", m_strictAccessControl); |
695 | m_seeIntoBannedRegion = startupConfig.GetBoolean("SeeIntoBannedRegion", m_seeIntoBannedRegion); | ||
696 | CombineRegions = startupConfig.GetBoolean("CombineContiguousRegions", false); | ||
671 | 697 | ||
672 | m_generateMaptiles = startupConfig.GetBoolean("GenerateMaptiles", true); | 698 | m_generateMaptiles = startupConfig.GetBoolean("GenerateMaptiles", true); |
673 | if (m_generateMaptiles) | 699 | if (m_generateMaptiles) |
@@ -692,9 +718,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
692 | } | 718 | } |
693 | } | 719 | } |
694 | } | 720 | } |
695 | catch | 721 | catch (Exception e) |
696 | { | 722 | { |
697 | m_log.Warn("[SCENE]: Failed to load StartupConfig"); | 723 | m_log.Error("[SCENE]: Failed to load StartupConfig: " + e.ToString()); |
698 | } | 724 | } |
699 | 725 | ||
700 | #endregion Region Config | 726 | #endregion Region Config |
@@ -1065,7 +1091,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
1065 | //m_heartbeatTimer.Elapsed += new ElapsedEventHandler(Heartbeat); | 1091 | //m_heartbeatTimer.Elapsed += new ElapsedEventHandler(Heartbeat); |
1066 | if (HeartbeatThread != null) | 1092 | if (HeartbeatThread != null) |
1067 | { | 1093 | { |
1094 | m_log.ErrorFormat("[SCENE]: Restarting heartbeat thread because it hasn't reported in in region {0}", RegionInfo.RegionName); | ||
1068 | HeartbeatThread.Abort(); | 1095 | HeartbeatThread.Abort(); |
1096 | Watchdog.RemoveThread(HeartbeatThread.ManagedThreadId); | ||
1069 | HeartbeatThread = null; | 1097 | HeartbeatThread = null; |
1070 | } | 1098 | } |
1071 | m_lastUpdate = Util.EnvironmentTickCount(); | 1099 | m_lastUpdate = Util.EnvironmentTickCount(); |
@@ -1188,9 +1216,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1188 | try | 1216 | try |
1189 | { | 1217 | { |
1190 | Update(); | 1218 | Update(); |
1191 | |||
1192 | m_lastUpdate = Util.EnvironmentTickCount(); | ||
1193 | m_firstHeartbeat = false; | ||
1194 | } | 1219 | } |
1195 | catch (ThreadAbortException) | 1220 | catch (ThreadAbortException) |
1196 | { | 1221 | { |
@@ -1305,12 +1330,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
1305 | terrainMS = Util.EnvironmentTickCountSubtract(terMS); | 1330 | terrainMS = Util.EnvironmentTickCountSubtract(terMS); |
1306 | } | 1331 | } |
1307 | 1332 | ||
1308 | //if (m_frame % m_update_land == 0) | 1333 | if (m_frame % m_update_land == 0) |
1309 | //{ | 1334 | { |
1310 | // int ldMS = Util.EnvironmentTickCount(); | 1335 | int ldMS = Util.EnvironmentTickCount(); |
1311 | // UpdateLand(); | 1336 | UpdateLand(); |
1312 | // landMS = Util.EnvironmentTickCountSubtract(ldMS); | 1337 | landMS = Util.EnvironmentTickCountSubtract(ldMS); |
1313 | //} | 1338 | } |
1314 | 1339 | ||
1315 | frameMS = Util.EnvironmentTickCountSubtract(tmpFrameMS); | 1340 | frameMS = Util.EnvironmentTickCountSubtract(tmpFrameMS); |
1316 | otherMS = tempOnRezMS + eventMS + backupMS + terrainMS + landMS; | 1341 | otherMS = tempOnRezMS + eventMS + backupMS + terrainMS + landMS; |
@@ -1381,6 +1406,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
1381 | 1406 | ||
1382 | // Tell the watchdog that this thread is still alive | 1407 | // Tell the watchdog that this thread is still alive |
1383 | Watchdog.UpdateThread(); | 1408 | Watchdog.UpdateThread(); |
1409 | |||
1410 | m_lastUpdate = Util.EnvironmentTickCount(); | ||
1411 | m_firstHeartbeat = false; | ||
1384 | } | 1412 | } |
1385 | } | 1413 | } |
1386 | 1414 | ||
@@ -1400,9 +1428,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
1400 | 1428 | ||
1401 | private void CheckAtTargets() | 1429 | private void CheckAtTargets() |
1402 | { | 1430 | { |
1403 | Dictionary<UUID, SceneObjectGroup>.ValueCollection objs; | 1431 | List<SceneObjectGroup> objs = new List<SceneObjectGroup>(); |
1404 | lock (m_groupsWithTargets) | 1432 | lock (m_groupsWithTargets) |
1405 | objs = m_groupsWithTargets.Values; | 1433 | objs = new List<SceneObjectGroup>(m_groupsWithTargets.Values); |
1406 | 1434 | ||
1407 | foreach (SceneObjectGroup entry in objs) | 1435 | foreach (SceneObjectGroup entry in objs) |
1408 | entry.checkAtTargets(); | 1436 | entry.checkAtTargets(); |
@@ -1736,14 +1764,24 @@ namespace OpenSim.Region.Framework.Scenes | |||
1736 | /// <returns></returns> | 1764 | /// <returns></returns> |
1737 | public Vector3 GetNewRezLocation(Vector3 RayStart, Vector3 RayEnd, UUID RayTargetID, Quaternion rot, byte bypassRayCast, byte RayEndIsIntersection, bool frontFacesOnly, Vector3 scale, bool FaceCenter) | 1765 | public Vector3 GetNewRezLocation(Vector3 RayStart, Vector3 RayEnd, UUID RayTargetID, Quaternion rot, byte bypassRayCast, byte RayEndIsIntersection, bool frontFacesOnly, Vector3 scale, bool FaceCenter) |
1738 | { | 1766 | { |
1767 | |||
1768 | float wheight = (float)RegionInfo.RegionSettings.WaterHeight; | ||
1769 | Vector3 wpos = Vector3.Zero; | ||
1770 | // Check for water surface intersection from above | ||
1771 | if ( (RayStart.Z > wheight) && (RayEnd.Z < wheight) ) | ||
1772 | { | ||
1773 | float ratio = (RayStart.Z - wheight) / (RayStart.Z - RayEnd.Z); | ||
1774 | wpos.X = RayStart.X - (ratio * (RayStart.X - RayEnd.X)); | ||
1775 | wpos.Y = RayStart.Y - (ratio * (RayStart.Y - RayEnd.Y)); | ||
1776 | wpos.Z = wheight; | ||
1777 | } | ||
1778 | |||
1739 | Vector3 pos = Vector3.Zero; | 1779 | Vector3 pos = Vector3.Zero; |
1740 | if (RayEndIsIntersection == (byte)1) | 1780 | if (RayEndIsIntersection == (byte)1) |
1741 | { | 1781 | { |
1742 | pos = RayEnd; | 1782 | pos = RayEnd; |
1743 | return pos; | ||
1744 | } | 1783 | } |
1745 | 1784 | else if (RayTargetID != UUID.Zero) | |
1746 | if (RayTargetID != UUID.Zero) | ||
1747 | { | 1785 | { |
1748 | SceneObjectPart target = GetSceneObjectPart(RayTargetID); | 1786 | SceneObjectPart target = GetSceneObjectPart(RayTargetID); |
1749 | 1787 | ||
@@ -1765,7 +1803,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1765 | EntityIntersection ei = target.TestIntersectionOBB(NewRay, Quaternion.Identity, frontFacesOnly, FaceCenter); | 1803 | EntityIntersection ei = target.TestIntersectionOBB(NewRay, Quaternion.Identity, frontFacesOnly, FaceCenter); |
1766 | 1804 | ||
1767 | // Un-comment out the following line to Get Raytrace results printed to the console. | 1805 | // Un-comment out the following line to Get Raytrace results printed to the console. |
1768 | // m_log.Info("[RAYTRACERESULTS]: Hit:" + ei.HitTF.ToString() + " Point: " + ei.ipoint.ToString() + " Normal: " + ei.normal.ToString()); | 1806 | // m_log.Info("[RAYTRACERESULTS]: Hit:" + ei.HitTF.ToString() + " Point: " + ei.ipoint.ToString() + " Normal: " + ei.normal.ToString()); |
1769 | float ScaleOffset = 0.5f; | 1807 | float ScaleOffset = 0.5f; |
1770 | 1808 | ||
1771 | // If we hit something | 1809 | // If we hit something |
@@ -1788,13 +1826,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
1788 | //pos.Z -= 0.25F; | 1826 | //pos.Z -= 0.25F; |
1789 | 1827 | ||
1790 | } | 1828 | } |
1791 | |||
1792 | return pos; | ||
1793 | } | 1829 | } |
1794 | else | 1830 | else |
1795 | { | 1831 | { |
1796 | // We don't have a target here, so we're going to raytrace all the objects in the scene. | 1832 | // We don't have a target here, so we're going to raytrace all the objects in the scene. |
1797 | |||
1798 | EntityIntersection ei = m_sceneGraph.GetClosestIntersectingPrim(new Ray(AXOrigin, AXdirection), true, false); | 1833 | EntityIntersection ei = m_sceneGraph.GetClosestIntersectingPrim(new Ray(AXOrigin, AXdirection), true, false); |
1799 | 1834 | ||
1800 | // Un-comment the following line to print the raytrace results to the console. | 1835 | // Un-comment the following line to print the raytrace results to the console. |
@@ -1803,13 +1838,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
1803 | if (ei.HitTF) | 1838 | if (ei.HitTF) |
1804 | { | 1839 | { |
1805 | pos = new Vector3(ei.ipoint.X, ei.ipoint.Y, ei.ipoint.Z); | 1840 | pos = new Vector3(ei.ipoint.X, ei.ipoint.Y, ei.ipoint.Z); |
1806 | } else | 1841 | } |
1842 | else | ||
1807 | { | 1843 | { |
1808 | // fall back to our stupid functionality | 1844 | // fall back to our stupid functionality |
1809 | pos = RayEnd; | 1845 | pos = RayEnd; |
1810 | } | 1846 | } |
1811 | |||
1812 | return pos; | ||
1813 | } | 1847 | } |
1814 | } | 1848 | } |
1815 | else | 1849 | else |
@@ -1820,8 +1854,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
1820 | //increase height so its above the ground. | 1854 | //increase height so its above the ground. |
1821 | //should be getting the normal of the ground at the rez point and using that? | 1855 | //should be getting the normal of the ground at the rez point and using that? |
1822 | pos.Z += scale.Z / 2f; | 1856 | pos.Z += scale.Z / 2f; |
1823 | return pos; | 1857 | // return pos; |
1824 | } | 1858 | } |
1859 | |||
1860 | // check against posible water intercept | ||
1861 | if (wpos.Z > pos.Z) pos = wpos; | ||
1862 | return pos; | ||
1825 | } | 1863 | } |
1826 | 1864 | ||
1827 | 1865 | ||
@@ -1901,7 +1939,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
1901 | public bool AddRestoredSceneObject( | 1939 | public bool AddRestoredSceneObject( |
1902 | SceneObjectGroup sceneObject, bool attachToBackup, bool alreadyPersisted, bool sendClientUpdates) | 1940 | SceneObjectGroup sceneObject, bool attachToBackup, bool alreadyPersisted, bool sendClientUpdates) |
1903 | { | 1941 | { |
1904 | return m_sceneGraph.AddRestoredSceneObject(sceneObject, attachToBackup, alreadyPersisted, sendClientUpdates); | 1942 | bool result = m_sceneGraph.AddRestoredSceneObject(sceneObject, attachToBackup, alreadyPersisted, sendClientUpdates); |
1943 | if (result) | ||
1944 | sceneObject.IsDeleted = false; | ||
1945 | return result; | ||
1905 | } | 1946 | } |
1906 | 1947 | ||
1907 | /// <summary> | 1948 | /// <summary> |
@@ -1978,6 +2019,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
1978 | /// </summary> | 2019 | /// </summary> |
1979 | public void DeleteAllSceneObjects() | 2020 | public void DeleteAllSceneObjects() |
1980 | { | 2021 | { |
2022 | DeleteAllSceneObjects(false); | ||
2023 | } | ||
2024 | |||
2025 | /// <summary> | ||
2026 | /// Delete every object from the scene. This does not include attachments worn by avatars. | ||
2027 | /// </summary> | ||
2028 | public void DeleteAllSceneObjects(bool exceptNoCopy) | ||
2029 | { | ||
2030 | List<SceneObjectGroup> toReturn = new List<SceneObjectGroup>(); | ||
1981 | lock (Entities) | 2031 | lock (Entities) |
1982 | { | 2032 | { |
1983 | EntityBase[] entities = Entities.GetEntities(); | 2033 | EntityBase[] entities = Entities.GetEntities(); |
@@ -1986,11 +2036,24 @@ namespace OpenSim.Region.Framework.Scenes | |||
1986 | if (e is SceneObjectGroup) | 2036 | if (e is SceneObjectGroup) |
1987 | { | 2037 | { |
1988 | SceneObjectGroup sog = (SceneObjectGroup)e; | 2038 | SceneObjectGroup sog = (SceneObjectGroup)e; |
1989 | if (!sog.IsAttachment) | 2039 | if (sog != null && !sog.IsAttachment) |
1990 | DeleteSceneObject((SceneObjectGroup)e, false); | 2040 | { |
2041 | if (!exceptNoCopy || ((sog.GetEffectivePermissions() & (uint)PermissionMask.Copy) != 0)) | ||
2042 | { | ||
2043 | DeleteSceneObject((SceneObjectGroup)e, false); | ||
2044 | } | ||
2045 | else | ||
2046 | { | ||
2047 | toReturn.Add((SceneObjectGroup)e); | ||
2048 | } | ||
2049 | } | ||
1991 | } | 2050 | } |
1992 | } | 2051 | } |
1993 | } | 2052 | } |
2053 | if (toReturn.Count > 0) | ||
2054 | { | ||
2055 | returnObjects(toReturn.ToArray(), UUID.Zero); | ||
2056 | } | ||
1994 | } | 2057 | } |
1995 | 2058 | ||
1996 | /// <summary> | 2059 | /// <summary> |
@@ -2039,6 +2102,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2039 | } | 2102 | } |
2040 | 2103 | ||
2041 | group.DeleteGroupFromScene(silent); | 2104 | group.DeleteGroupFromScene(silent); |
2105 | if (!silent) | ||
2106 | SendKillObject(new List<uint>() { group.LocalId }); | ||
2042 | 2107 | ||
2043 | // m_log.DebugFormat("[SCENE]: Exit DeleteSceneObject() for {0} {1}", group.Name, group.UUID); | 2108 | // m_log.DebugFormat("[SCENE]: Exit DeleteSceneObject() for {0} {1}", group.Name, group.UUID); |
2044 | } | 2109 | } |
@@ -2369,6 +2434,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
2369 | /// <returns>True if the SceneObjectGroup was added, False if it was not</returns> | 2434 | /// <returns>True if the SceneObjectGroup was added, False if it was not</returns> |
2370 | public bool AddSceneObject(SceneObjectGroup sceneObject) | 2435 | public bool AddSceneObject(SceneObjectGroup sceneObject) |
2371 | { | 2436 | { |
2437 | if (sceneObject.OwnerID == UUID.Zero) | ||
2438 | { | ||
2439 | m_log.ErrorFormat("[SCENE]: Owner ID for {0} was zero", sceneObject.UUID); | ||
2440 | return false; | ||
2441 | } | ||
2442 | |||
2372 | // If the user is banned, we won't let any of their objects | 2443 | // If the user is banned, we won't let any of their objects |
2373 | // enter. Period. | 2444 | // enter. Period. |
2374 | // | 2445 | // |
@@ -2416,15 +2487,28 @@ namespace OpenSim.Region.Framework.Scenes | |||
2416 | 2487 | ||
2417 | if (AttachmentsModule != null) | 2488 | if (AttachmentsModule != null) |
2418 | AttachmentsModule.AttachObject(sp.ControllingClient, grp, 0, false); | 2489 | AttachmentsModule.AttachObject(sp.ControllingClient, grp, 0, false); |
2490 | |||
2491 | m_log.DebugFormat("[SCENE]: Attachment {0} arrived and scene presence was found, attaching", sceneObject.UUID); | ||
2419 | } | 2492 | } |
2420 | else | 2493 | else |
2421 | { | 2494 | { |
2495 | m_log.DebugFormat("[SCENE]: Attachment {0} arrived and scene presence was not found, setting to temp", sceneObject.UUID); | ||
2422 | RootPrim.RemFlag(PrimFlags.TemporaryOnRez); | 2496 | RootPrim.RemFlag(PrimFlags.TemporaryOnRez); |
2423 | RootPrim.AddFlag(PrimFlags.TemporaryOnRez); | 2497 | RootPrim.AddFlag(PrimFlags.TemporaryOnRez); |
2424 | } | 2498 | } |
2499 | if (sceneObject.OwnerID == UUID.Zero) | ||
2500 | { | ||
2501 | m_log.ErrorFormat("[SCENE]: Owner ID for {0} was zero after attachment processing. BUG!", sceneObject.UUID); | ||
2502 | return false; | ||
2503 | } | ||
2425 | } | 2504 | } |
2426 | else | 2505 | else |
2427 | { | 2506 | { |
2507 | if (sceneObject.OwnerID == UUID.Zero) | ||
2508 | { | ||
2509 | m_log.ErrorFormat("[SCENE]: Owner ID for non-attachment {0} was zero", sceneObject.UUID); | ||
2510 | return false; | ||
2511 | } | ||
2428 | AddRestoredSceneObject(sceneObject, true, false); | 2512 | AddRestoredSceneObject(sceneObject, true, false); |
2429 | 2513 | ||
2430 | if (!Permissions.CanObjectEntry(sceneObject.UUID, | 2514 | if (!Permissions.CanObjectEntry(sceneObject.UUID, |
@@ -2536,12 +2620,19 @@ namespace OpenSim.Region.Framework.Scenes | |||
2536 | } | 2620 | } |
2537 | } | 2621 | } |
2538 | 2622 | ||
2539 | if (GetScenePresence(client.AgentId) != null) | 2623 | if (TryGetScenePresence(client.AgentId, out presence)) |
2540 | { | 2624 | { |
2541 | m_LastLogin = Util.EnvironmentTickCount(); | 2625 | m_LastLogin = Util.EnvironmentTickCount(); |
2542 | EventManager.TriggerOnNewClient(client); | 2626 | EventManager.TriggerOnNewClient(client); |
2543 | if (vialogin) | 2627 | if (vialogin) |
2628 | { | ||
2544 | EventManager.TriggerOnClientLogin(client); | 2629 | EventManager.TriggerOnClientLogin(client); |
2630 | |||
2631 | // Send initial parcel data | ||
2632 | Vector3 pos = presence.AbsolutePosition; | ||
2633 | ILandObject land = LandChannel.GetLandObject(pos.X, pos.Y); | ||
2634 | land.SendLandUpdateToClient(presence.ControllingClient); | ||
2635 | } | ||
2545 | } | 2636 | } |
2546 | } | 2637 | } |
2547 | 2638 | ||
@@ -2592,19 +2683,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
2592 | // and the scene presence and the client, if they exist | 2683 | // and the scene presence and the client, if they exist |
2593 | try | 2684 | try |
2594 | { | 2685 | { |
2595 | // We need to wait for the client to make UDP contact first. | 2686 | ScenePresence sp = GetScenePresence(agentID); |
2596 | // It's the UDP contact that creates the scene presence | 2687 | PresenceService.LogoutAgent(sp.ControllingClient.SessionId); |
2597 | ScenePresence sp = WaitGetScenePresence(agentID); | 2688 | |
2598 | if (sp != null) | 2689 | if (sp != null) |
2599 | { | ||
2600 | PresenceService.LogoutAgent(sp.ControllingClient.SessionId); | ||
2601 | |||
2602 | sp.ControllingClient.Close(); | 2690 | sp.ControllingClient.Close(); |
2603 | } | 2691 | |
2604 | else | ||
2605 | { | ||
2606 | m_log.WarnFormat("[SCENE]: Could not find scene presence for {0}", agentID); | ||
2607 | } | ||
2608 | // BANG! SLASH! | 2692 | // BANG! SLASH! |
2609 | m_authenticateHandler.RemoveCircuit(agentID); | 2693 | m_authenticateHandler.RemoveCircuit(agentID); |
2610 | 2694 | ||
@@ -2704,6 +2788,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2704 | client.OnFetchInventory += HandleFetchInventory; | 2788 | client.OnFetchInventory += HandleFetchInventory; |
2705 | client.OnUpdateInventoryItem += UpdateInventoryItemAsset; | 2789 | client.OnUpdateInventoryItem += UpdateInventoryItemAsset; |
2706 | client.OnCopyInventoryItem += CopyInventoryItem; | 2790 | client.OnCopyInventoryItem += CopyInventoryItem; |
2791 | client.OnMoveItemsAndLeaveCopy += MoveInventoryItemsLeaveCopy; | ||
2707 | client.OnMoveInventoryItem += MoveInventoryItem; | 2792 | client.OnMoveInventoryItem += MoveInventoryItem; |
2708 | client.OnRemoveInventoryItem += RemoveInventoryItem; | 2793 | client.OnRemoveInventoryItem += RemoveInventoryItem; |
2709 | client.OnRemoveInventoryFolder += RemoveInventoryFolder; | 2794 | client.OnRemoveInventoryFolder += RemoveInventoryFolder; |
@@ -2882,15 +2967,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
2882 | /// </summary> | 2967 | /// </summary> |
2883 | /// <param name="agentId">The avatar's Unique ID</param> | 2968 | /// <param name="agentId">The avatar's Unique ID</param> |
2884 | /// <param name="client">The IClientAPI for the client</param> | 2969 | /// <param name="client">The IClientAPI for the client</param> |
2885 | public virtual void TeleportClientHome(UUID agentId, IClientAPI client) | 2970 | public virtual bool TeleportClientHome(UUID agentId, IClientAPI client) |
2886 | { | 2971 | { |
2887 | if (m_teleportModule != null) | 2972 | if (m_teleportModule != null) |
2888 | m_teleportModule.TeleportHome(agentId, client); | 2973 | return m_teleportModule.TeleportHome(agentId, client); |
2889 | else | 2974 | else |
2890 | { | 2975 | { |
2891 | m_log.DebugFormat("[SCENE]: Unable to teleport user home: no AgentTransferModule is active"); | 2976 | m_log.DebugFormat("[SCENE]: Unable to teleport user home: no AgentTransferModule is active"); |
2892 | client.SendTeleportFailed("Unable to perform teleports on this simulator."); | 2977 | client.SendTeleportFailed("Unable to perform teleports on this simulator."); |
2893 | } | 2978 | } |
2979 | return false; | ||
2894 | } | 2980 | } |
2895 | 2981 | ||
2896 | /// <summary> | 2982 | /// <summary> |
@@ -2989,6 +3075,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
2989 | /// <param name="flags"></param> | 3075 | /// <param name="flags"></param> |
2990 | public virtual void SetHomeRezPoint(IClientAPI remoteClient, ulong regionHandle, Vector3 position, Vector3 lookAt, uint flags) | 3076 | public virtual void SetHomeRezPoint(IClientAPI remoteClient, ulong regionHandle, Vector3 position, Vector3 lookAt, uint flags) |
2991 | { | 3077 | { |
3078 | //Add half the avatar's height so that the user doesn't fall through prims | ||
3079 | ScenePresence presence; | ||
3080 | if (TryGetScenePresence(remoteClient.AgentId, out presence)) | ||
3081 | { | ||
3082 | if (presence.Appearance != null) | ||
3083 | { | ||
3084 | position.Z = position.Z + (presence.Appearance.AvatarHeight / 2); | ||
3085 | } | ||
3086 | } | ||
3087 | |||
2992 | if (GridUserService != null && GridUserService.SetHome(remoteClient.AgentId.ToString(), RegionInfo.RegionID, position, lookAt)) | 3088 | if (GridUserService != null && GridUserService.SetHome(remoteClient.AgentId.ToString(), RegionInfo.RegionID, position, lookAt)) |
2993 | // FUBAR ALERT: this needs to be "Home position set." so the viewer saves a home-screenshot. | 3089 | // FUBAR ALERT: this needs to be "Home position set." so the viewer saves a home-screenshot. |
2994 | m_dialogModule.SendAlertToUser(remoteClient, "Home position set."); | 3090 | m_dialogModule.SendAlertToUser(remoteClient, "Home position set."); |
@@ -3082,7 +3178,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
3082 | regions.Remove(RegionInfo.RegionHandle); | 3178 | regions.Remove(RegionInfo.RegionHandle); |
3083 | m_sceneGridService.SendCloseChildAgentConnections(agentID, regions); | 3179 | m_sceneGridService.SendCloseChildAgentConnections(agentID, regions); |
3084 | } | 3180 | } |
3181 | m_log.Debug("[Scene] Beginning ClientClosed"); | ||
3085 | m_eventManager.TriggerClientClosed(agentID, this); | 3182 | m_eventManager.TriggerClientClosed(agentID, this); |
3183 | m_log.Debug("[Scene] Finished ClientClosed"); | ||
3086 | } | 3184 | } |
3087 | catch (NullReferenceException) | 3185 | catch (NullReferenceException) |
3088 | { | 3186 | { |
@@ -3090,7 +3188,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
3090 | // Avatar is already disposed :/ | 3188 | // Avatar is already disposed :/ |
3091 | } | 3189 | } |
3092 | 3190 | ||
3191 | m_log.Debug("[Scene] Beginning OnRemovePresence"); | ||
3093 | m_eventManager.TriggerOnRemovePresence(agentID); | 3192 | m_eventManager.TriggerOnRemovePresence(agentID); |
3193 | m_log.Debug("[Scene] Finished OnRemovePresence"); | ||
3194 | |||
3195 | if (avatar != null && (!avatar.IsChildAgent)) | ||
3196 | avatar.SaveChangedAttachments(); | ||
3094 | 3197 | ||
3095 | if (avatar != null && (!avatar.IsChildAgent)) | 3198 | if (avatar != null && (!avatar.IsChildAgent)) |
3096 | avatar.SaveChangedAttachments(); | 3199 | avatar.SaveChangedAttachments(); |
@@ -3099,7 +3202,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3099 | delegate(IClientAPI client) | 3202 | delegate(IClientAPI client) |
3100 | { | 3203 | { |
3101 | //We can safely ignore null reference exceptions. It means the avatar is dead and cleaned up anyway | 3204 | //We can safely ignore null reference exceptions. It means the avatar is dead and cleaned up anyway |
3102 | try { client.SendKillObject(avatar.RegionHandle, avatar.LocalId); } | 3205 | try { client.SendKillObject(avatar.RegionHandle, new List<uint>() { avatar.LocalId}); } |
3103 | catch (NullReferenceException) { } | 3206 | catch (NullReferenceException) { } |
3104 | }); | 3207 | }); |
3105 | 3208 | ||
@@ -3110,8 +3213,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
3110 | } | 3213 | } |
3111 | 3214 | ||
3112 | // Remove the avatar from the scene | 3215 | // Remove the avatar from the scene |
3216 | m_log.Debug("[Scene] Begin RemoveScenePresence"); | ||
3113 | m_sceneGraph.RemoveScenePresence(agentID); | 3217 | m_sceneGraph.RemoveScenePresence(agentID); |
3218 | m_log.Debug("[Scene] Finished RemoveScenePresence. Removing the client manager"); | ||
3114 | m_clientManager.Remove(agentID); | 3219 | m_clientManager.Remove(agentID); |
3220 | m_log.Debug("[Scene] Removed the client manager. Firing avatar.close"); | ||
3115 | 3221 | ||
3116 | try | 3222 | try |
3117 | { | 3223 | { |
@@ -3125,9 +3231,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
3125 | { | 3231 | { |
3126 | m_log.Error("[SCENE] Scene.cs:RemoveClient exception: " + e.ToString()); | 3232 | m_log.Error("[SCENE] Scene.cs:RemoveClient exception: " + e.ToString()); |
3127 | } | 3233 | } |
3128 | 3234 | m_log.Debug("[Scene] Done. Firing RemoveCircuit"); | |
3129 | m_authenticateHandler.RemoveCircuit(avatar.ControllingClient.CircuitCode); | 3235 | m_authenticateHandler.RemoveCircuit(avatar.ControllingClient.CircuitCode); |
3130 | CleanDroppedAttachments(); | 3236 | CleanDroppedAttachments(); |
3237 | m_log.Debug("[Scene] The avatar has left the building"); | ||
3131 | //m_log.InfoFormat("[SCENE] Memory pre GC {0}", System.GC.GetTotalMemory(false)); | 3238 | //m_log.InfoFormat("[SCENE] Memory pre GC {0}", System.GC.GetTotalMemory(false)); |
3132 | //m_log.InfoFormat("[SCENE] Memory post GC {0}", System.GC.GetTotalMemory(true)); | 3239 | //m_log.InfoFormat("[SCENE] Memory post GC {0}", System.GC.GetTotalMemory(true)); |
3133 | } | 3240 | } |
@@ -3158,18 +3265,24 @@ namespace OpenSim.Region.Framework.Scenes | |||
3158 | 3265 | ||
3159 | #region Entities | 3266 | #region Entities |
3160 | 3267 | ||
3161 | public void SendKillObject(uint localID) | 3268 | public void SendKillObject(List<uint> localIDs) |
3162 | { | 3269 | { |
3163 | SceneObjectPart part = GetSceneObjectPart(localID); | 3270 | List<uint> deleteIDs = new List<uint>(); |
3164 | if (part != null) // It is a prim | 3271 | |
3272 | foreach (uint localID in localIDs) | ||
3165 | { | 3273 | { |
3166 | if (part.ParentGroup != null && !part.ParentGroup.IsDeleted) // Valid | 3274 | SceneObjectPart part = GetSceneObjectPart(localID); |
3275 | if (part != null) // It is a prim | ||
3167 | { | 3276 | { |
3168 | if (part.ParentGroup.RootPart != part) // Child part | 3277 | if (part.ParentGroup != null && !part.ParentGroup.IsDeleted) // Valid |
3169 | return; | 3278 | { |
3279 | if (part.ParentGroup.RootPart != part) // Child part | ||
3280 | continue; | ||
3281 | } | ||
3170 | } | 3282 | } |
3283 | deleteIDs.Add(localID); | ||
3171 | } | 3284 | } |
3172 | ForEachClient(delegate(IClientAPI client) { client.SendKillObject(m_regionHandle, localID); }); | 3285 | ForEachClient(delegate(IClientAPI client) { client.SendKillObject(m_regionHandle, deleteIDs); }); |
3173 | } | 3286 | } |
3174 | 3287 | ||
3175 | #endregion | 3288 | #endregion |
@@ -3187,7 +3300,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
3187 | //m_sceneGridService.OnChildAgentUpdate += IncomingChildAgentDataUpdate; | 3300 | //m_sceneGridService.OnChildAgentUpdate += IncomingChildAgentDataUpdate; |
3188 | //m_sceneGridService.OnRemoveKnownRegionFromAvatar += HandleRemoveKnownRegionsFromAvatar; | 3301 | //m_sceneGridService.OnRemoveKnownRegionFromAvatar += HandleRemoveKnownRegionsFromAvatar; |
3189 | m_sceneGridService.OnLogOffUser += HandleLogOffUserFromGrid; | 3302 | m_sceneGridService.OnLogOffUser += HandleLogOffUserFromGrid; |
3190 | m_sceneGridService.KiPrimitive += SendKillObject; | ||
3191 | m_sceneGridService.OnGetLandData += GetLandData; | 3303 | m_sceneGridService.OnGetLandData += GetLandData; |
3192 | } | 3304 | } |
3193 | 3305 | ||
@@ -3196,7 +3308,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
3196 | /// </summary> | 3308 | /// </summary> |
3197 | public void UnRegisterRegionWithComms() | 3309 | public void UnRegisterRegionWithComms() |
3198 | { | 3310 | { |
3199 | m_sceneGridService.KiPrimitive -= SendKillObject; | ||
3200 | m_sceneGridService.OnLogOffUser -= HandleLogOffUserFromGrid; | 3311 | m_sceneGridService.OnLogOffUser -= HandleLogOffUserFromGrid; |
3201 | //m_sceneGridService.OnRemoveKnownRegionFromAvatar -= HandleRemoveKnownRegionsFromAvatar; | 3312 | //m_sceneGridService.OnRemoveKnownRegionFromAvatar -= HandleRemoveKnownRegionsFromAvatar; |
3202 | //m_sceneGridService.OnChildAgentUpdate -= IncomingChildAgentDataUpdate; | 3313 | //m_sceneGridService.OnChildAgentUpdate -= IncomingChildAgentDataUpdate; |
@@ -3283,6 +3394,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3283 | { | 3394 | { |
3284 | if (land != null && !TestLandRestrictions(agent, land, out reason)) | 3395 | if (land != null && !TestLandRestrictions(agent, land, out reason)) |
3285 | { | 3396 | { |
3397 | m_log.DebugFormat("[CONNECTION BEGIN]: Denying access to {0} due to no land access", agent.AgentID.ToString()); | ||
3286 | return false; | 3398 | return false; |
3287 | } | 3399 | } |
3288 | } | 3400 | } |
@@ -3400,6 +3512,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
3400 | } | 3512 | } |
3401 | } | 3513 | } |
3402 | // Honor parcel landing type and position. | 3514 | // Honor parcel landing type and position. |
3515 | /* | ||
3516 | ILandObject land = LandChannel.GetLandObject(agent.startpos.X, agent.startpos.Y); | ||
3403 | if (land != null) | 3517 | if (land != null) |
3404 | { | 3518 | { |
3405 | if (land.LandData.LandingType == (byte)1 && land.LandData.UserLocation != Vector3.Zero) | 3519 | if (land.LandData.LandingType == (byte)1 && land.LandData.UserLocation != Vector3.Zero) |
@@ -3407,6 +3521,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3407 | agent.startpos = land.LandData.UserLocation; | 3521 | agent.startpos = land.LandData.UserLocation; |
3408 | } | 3522 | } |
3409 | } | 3523 | } |
3524 | */// This is now handled properly in ScenePresence.MakeRootAgent | ||
3410 | } | 3525 | } |
3411 | 3526 | ||
3412 | return true; | 3527 | return true; |
@@ -3502,7 +3617,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3502 | 3617 | ||
3503 | if (m_regInfo.EstateSettings != null) | 3618 | if (m_regInfo.EstateSettings != null) |
3504 | { | 3619 | { |
3505 | if (m_regInfo.EstateSettings.IsBanned(agent.AgentID)) | 3620 | if ((!m_seeIntoBannedRegion) && m_regInfo.EstateSettings.IsBanned(agent.AgentID)) |
3506 | { | 3621 | { |
3507 | m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the user is on the banlist", | 3622 | m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the user is on the banlist", |
3508 | agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName); | 3623 | agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName); |
@@ -3692,6 +3807,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
3692 | 3807 | ||
3693 | // We have to wait until the viewer contacts this region after receiving EAC. | 3808 | // We have to wait until the viewer contacts this region after receiving EAC. |
3694 | // That calls AddNewClient, which finally creates the ScenePresence | 3809 | // That calls AddNewClient, which finally creates the ScenePresence |
3810 | if (m_regInfo.EstateSettings.IsBanned(cAgentData.AgentID)) | ||
3811 | { | ||
3812 | m_log.DebugFormat("[SCENE]: Denying root agent entry to {0}: banned", cAgentData.AgentID); | ||
3813 | return false; | ||
3814 | } | ||
3815 | |||
3695 | ILandObject nearestParcel = GetNearestAllowedParcel(cAgentData.AgentID, Constants.RegionSize / 2, Constants.RegionSize / 2); | 3816 | ILandObject nearestParcel = GetNearestAllowedParcel(cAgentData.AgentID, Constants.RegionSize / 2, Constants.RegionSize / 2); |
3696 | if (nearestParcel == null) | 3817 | if (nearestParcel == null) |
3697 | { | 3818 | { |
@@ -3699,6 +3820,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
3699 | return false; | 3820 | return false; |
3700 | } | 3821 | } |
3701 | 3822 | ||
3823 | int num = m_sceneGraph.GetNumberOfScenePresences(); | ||
3824 | |||
3825 | if (num >= RegionInfo.RegionSettings.AgentLimit) | ||
3826 | { | ||
3827 | if (!Permissions.IsAdministrator(cAgentData.AgentID)) | ||
3828 | return false; | ||
3829 | } | ||
3830 | |||
3702 | ScenePresence childAgentUpdate = WaitGetScenePresence(cAgentData.AgentID); | 3831 | ScenePresence childAgentUpdate = WaitGetScenePresence(cAgentData.AgentID); |
3703 | 3832 | ||
3704 | if (childAgentUpdate != null) | 3833 | if (childAgentUpdate != null) |
@@ -3765,12 +3894,22 @@ namespace OpenSim.Region.Framework.Scenes | |||
3765 | return false; | 3894 | return false; |
3766 | } | 3895 | } |
3767 | 3896 | ||
3897 | public bool IncomingCloseAgent(UUID agentID) | ||
3898 | { | ||
3899 | return IncomingCloseAgent(agentID, false); | ||
3900 | } | ||
3901 | |||
3902 | public bool IncomingCloseChildAgent(UUID agentID) | ||
3903 | { | ||
3904 | return IncomingCloseAgent(agentID, true); | ||
3905 | } | ||
3906 | |||
3768 | /// <summary> | 3907 | /// <summary> |
3769 | /// Tell a single agent to disconnect from the region. | 3908 | /// Tell a single agent to disconnect from the region. |
3770 | /// </summary> | 3909 | /// </summary> |
3771 | /// <param name="regionHandle"></param> | ||
3772 | /// <param name="agentID"></param> | 3910 | /// <param name="agentID"></param> |
3773 | public bool IncomingCloseAgent(UUID agentID) | 3911 | /// <param name="childOnly"></param> |
3912 | public bool IncomingCloseAgent(UUID agentID, bool childOnly) | ||
3774 | { | 3913 | { |
3775 | //m_log.DebugFormat("[SCENE]: Processing incoming close agent for {0}", agentID); | 3914 | //m_log.DebugFormat("[SCENE]: Processing incoming close agent for {0}", agentID); |
3776 | 3915 | ||
@@ -3782,7 +3921,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3782 | { | 3921 | { |
3783 | m_sceneGraph.removeUserCount(false); | 3922 | m_sceneGraph.removeUserCount(false); |
3784 | } | 3923 | } |
3785 | else | 3924 | else if (!childOnly) |
3786 | { | 3925 | { |
3787 | m_sceneGraph.removeUserCount(true); | 3926 | m_sceneGraph.removeUserCount(true); |
3788 | } | 3927 | } |
@@ -3798,9 +3937,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
3798 | } | 3937 | } |
3799 | else | 3938 | else |
3800 | presence.ControllingClient.SendShutdownConnectionNotice(); | 3939 | presence.ControllingClient.SendShutdownConnectionNotice(); |
3940 | presence.ControllingClient.Close(false); | ||
3941 | } | ||
3942 | else if (!childOnly) | ||
3943 | { | ||
3944 | presence.ControllingClient.Close(true); | ||
3801 | } | 3945 | } |
3802 | |||
3803 | presence.ControllingClient.Close(); | ||
3804 | return true; | 3946 | return true; |
3805 | } | 3947 | } |
3806 | 3948 | ||
@@ -4408,34 +4550,66 @@ namespace OpenSim.Region.Framework.Scenes | |||
4408 | SimulationDataService.RemoveObject(uuid, m_regInfo.RegionID); | 4550 | SimulationDataService.RemoveObject(uuid, m_regInfo.RegionID); |
4409 | } | 4551 | } |
4410 | 4552 | ||
4411 | public int GetHealth() | 4553 | public int GetHealth(out int flags, out string message) |
4412 | { | 4554 | { |
4413 | // Returns: | 4555 | // Returns: |
4414 | // 1 = sim is up and accepting http requests. The heartbeat has | 4556 | // 1 = sim is up and accepting http requests. The heartbeat has |
4415 | // stopped and the sim is probably locked up, but a remote | 4557 | // stopped and the sim is probably locked up, but a remote |
4416 | // admin restart may succeed | 4558 | // admin restart may succeed |
4417 | // | 4559 | // |
4418 | // 2 = Sim is up and the heartbeat is running. The sim is likely | 4560 | // 2 = Sim is up and the heartbeat is running. The sim is likely |
4419 | // usable for people within and logins _may_ work | 4561 | // usable for people within |
4562 | // | ||
4563 | // 3 = Sim is up and one packet thread is running. Sim is | ||
4564 | // unstable and will not accept new logins | ||
4565 | // | ||
4566 | // 4 = Sim is up and both packet threads are running. Sim is | ||
4567 | // likely usable | ||
4420 | // | 4568 | // |
4421 | // 3 = We have seen a new user enter within the past 4 minutes | 4569 | // 5 = We have seen a new user enter within the past 4 minutes |
4422 | // which can be seen as positive confirmation of sim health | 4570 | // which can be seen as positive confirmation of sim health |
4423 | // | 4571 | // |
4572 | |||
4573 | flags = 0; | ||
4574 | message = String.Empty; | ||
4575 | |||
4576 | CheckHeartbeat(); | ||
4577 | |||
4578 | if (m_firstHeartbeat || (m_lastIncoming == 0 && m_lastOutgoing == 0)) | ||
4579 | { | ||
4580 | // We're still starting | ||
4581 | // 0 means "in startup", it can't happen another way, since | ||
4582 | // to get here, we must be able to accept http connections | ||
4583 | return 0; | ||
4584 | } | ||
4585 | |||
4424 | int health=1; // Start at 1, means we're up | 4586 | int health=1; // Start at 1, means we're up |
4425 | 4587 | ||
4426 | if ((Util.EnvironmentTickCountSubtract(m_lastUpdate)) < 1000) | 4588 | if (Util.EnvironmentTickCountSubtract(m_lastUpdate) < 1000) |
4589 | { | ||
4427 | health+=1; | 4590 | health+=1; |
4428 | else | 4591 | flags |= 1; |
4592 | } | ||
4593 | |||
4594 | if (Util.EnvironmentTickCountSubtract(m_lastIncoming) < 1000) | ||
4595 | { | ||
4596 | health+=1; | ||
4597 | flags |= 2; | ||
4598 | } | ||
4599 | |||
4600 | if (Util.EnvironmentTickCountSubtract(m_lastOutgoing) < 1000) | ||
4601 | { | ||
4602 | health+=1; | ||
4603 | flags |= 4; | ||
4604 | } | ||
4605 | |||
4606 | if (flags != 7) | ||
4429 | return health; | 4607 | return health; |
4430 | 4608 | ||
4431 | // A login in the last 4 mins? We can't be doing too badly | 4609 | // A login in the last 4 mins? We can't be doing too badly |
4432 | // | 4610 | // |
4433 | if ((Util.EnvironmentTickCountSubtract(m_LastLogin)) < 240000) | 4611 | if (Util.EnvironmentTickCountSubtract(m_LastLogin) < 240000) |
4434 | health++; | 4612 | health++; |
4435 | else | ||
4436 | return health; | ||
4437 | |||
4438 | CheckHeartbeat(); | ||
4439 | 4613 | ||
4440 | return health; | 4614 | return health; |
4441 | } | 4615 | } |
@@ -4628,7 +4802,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4628 | if (m_firstHeartbeat) | 4802 | if (m_firstHeartbeat) |
4629 | return; | 4803 | return; |
4630 | 4804 | ||
4631 | if (Util.EnvironmentTickCountSubtract(m_lastUpdate) > 2000) | 4805 | if (Util.EnvironmentTickCountSubtract(m_lastUpdate) > 10000) |
4632 | StartTimer(); | 4806 | StartTimer(); |
4633 | } | 4807 | } |
4634 | 4808 | ||
@@ -4886,8 +5060,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
4886 | { | 5060 | { |
4887 | float ominX, ominY, ominZ, omaxX, omaxY, omaxZ; | 5061 | float ominX, ominY, ominZ, omaxX, omaxY, omaxZ; |
4888 | 5062 | ||
5063 | Vector3 vec = g.AbsolutePosition; | ||
5064 | |||
4889 | g.GetAxisAlignedBoundingBoxRaw(out ominX, out omaxX, out ominY, out omaxY, out ominZ, out omaxZ); | 5065 | g.GetAxisAlignedBoundingBoxRaw(out ominX, out omaxX, out ominY, out omaxY, out ominZ, out omaxZ); |
4890 | 5066 | ||
5067 | ominX += vec.X; | ||
5068 | omaxX += vec.X; | ||
5069 | ominY += vec.Y; | ||
5070 | omaxY += vec.Y; | ||
5071 | ominZ += vec.Z; | ||
5072 | omaxZ += vec.Z; | ||
5073 | |||
4891 | if (minX > ominX) | 5074 | if (minX > ominX) |
4892 | minX = ominX; | 5075 | minX = ominX; |
4893 | if (minY > ominY) | 5076 | if (minY > ominY) |
@@ -4957,10 +5140,28 @@ namespace OpenSim.Region.Framework.Scenes | |||
4957 | }); | 5140 | }); |
4958 | } | 5141 | } |
4959 | 5142 | ||
4960 | foreach (SceneObjectGroup grp in objectsToDelete) | 5143 | if (objectsToDelete.Count > 0) |
4961 | { | 5144 | { |
4962 | m_log.InfoFormat("[SCENE]: Deleting dropped attachment {0} of user {1}", grp.UUID, grp.OwnerID); | 5145 | m_log.DebugFormat("[SCENE]: Starting delete of {0} dropped attachments", objectsToDelete.Count); |
4963 | DeleteSceneObject(grp, true); | 5146 | foreach (SceneObjectGroup grp in objectsToDelete) |
5147 | { | ||
5148 | m_log.InfoFormat("[SCENE]: Deleting dropped attachment {0} of user {1}", grp.UUID, grp.OwnerID); | ||
5149 | DeleteSceneObject(grp, true); | ||
5150 | } | ||
5151 | m_log.Debug("[SCENE]: Finished dropped attachment deletion"); | ||
5152 | } | ||
5153 | } | ||
5154 | |||
5155 | public void ThreadAlive(int threadCode) | ||
5156 | { | ||
5157 | switch(threadCode) | ||
5158 | { | ||
5159 | case 1: // Incoming | ||
5160 | m_lastIncoming = Util.EnvironmentTickCount(); | ||
5161 | break; | ||
5162 | case 2: // Incoming | ||
5163 | m_lastOutgoing = Util.EnvironmentTickCount(); | ||
5164 | break; | ||
4964 | } | 5165 | } |
4965 | } | 5166 | } |
4966 | 5167 | ||