diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Scene.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.cs | 679 |
1 files changed, 520 insertions, 159 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 9e59d50..68c05f8 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -104,6 +104,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
104 | // TODO: need to figure out how allow client agents but deny | 104 | // TODO: need to figure out how allow client agents but deny |
105 | // root agents when ACL denies access to root agent | 105 | // root agents when ACL denies access to root agent |
106 | public bool m_strictAccessControl = true; | 106 | public bool m_strictAccessControl = true; |
107 | public bool m_seeIntoBannedRegion = false; | ||
107 | public int MaxUndoCount = 5; | 108 | public int MaxUndoCount = 5; |
108 | // Using this for RegionReady module to prevent LoginsDisabled from changing under our feet; | 109 | // Using this for RegionReady module to prevent LoginsDisabled from changing under our feet; |
109 | public bool LoginLock = false; | 110 | public bool LoginLock = false; |
@@ -119,12 +120,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
119 | 120 | ||
120 | protected int m_splitRegionID; | 121 | protected int m_splitRegionID; |
121 | protected Timer m_restartWaitTimer = new Timer(); | 122 | protected Timer m_restartWaitTimer = new Timer(); |
123 | protected Timer m_timerWatchdog = new Timer(); | ||
122 | protected List<RegionInfo> m_regionRestartNotifyList = new List<RegionInfo>(); | 124 | protected List<RegionInfo> m_regionRestartNotifyList = new List<RegionInfo>(); |
123 | protected List<RegionInfo> m_neighbours = new List<RegionInfo>(); | 125 | protected List<RegionInfo> m_neighbours = new List<RegionInfo>(); |
124 | protected string m_simulatorVersion = "OpenSimulator Server"; | 126 | protected string m_simulatorVersion = "OpenSimulator Server"; |
125 | protected ModuleLoader m_moduleLoader; | 127 | protected ModuleLoader m_moduleLoader; |
126 | protected AgentCircuitManager m_authenticateHandler; | 128 | protected AgentCircuitManager m_authenticateHandler; |
127 | protected SceneCommunicationService m_sceneGridService; | 129 | protected SceneCommunicationService m_sceneGridService; |
130 | protected ISnmpModule m_snmpService = null; | ||
128 | 131 | ||
129 | protected ISimulationDataService m_SimulationDataService; | 132 | protected ISimulationDataService m_SimulationDataService; |
130 | protected IEstateDataService m_EstateDataService; | 133 | protected IEstateDataService m_EstateDataService; |
@@ -177,7 +180,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
177 | private int m_update_events = 1; | 180 | private int m_update_events = 1; |
178 | private int m_update_backup = 200; | 181 | private int m_update_backup = 200; |
179 | private int m_update_terrain = 50; | 182 | private int m_update_terrain = 50; |
180 | // private int m_update_land = 1; | 183 | private int m_update_land = 10; |
181 | private int m_update_coarse_locations = 50; | 184 | private int m_update_coarse_locations = 50; |
182 | 185 | ||
183 | private int agentMS; | 186 | private int agentMS; |
@@ -192,6 +195,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
192 | private int landMS; | 195 | private int landMS; |
193 | private int lastCompletedFrame; | 196 | private int lastCompletedFrame; |
194 | 197 | ||
198 | public bool CombineRegions = false; | ||
195 | /// <summary> | 199 | /// <summary> |
196 | /// Signals whether temporary objects are currently being cleaned up. Needed because this is launched | 200 | /// Signals whether temporary objects are currently being cleaned up. Needed because this is launched |
197 | /// asynchronously from the update loop. | 201 | /// asynchronously from the update loop. |
@@ -214,11 +218,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
214 | private bool m_scripts_enabled = true; | 218 | private bool m_scripts_enabled = true; |
215 | private string m_defaultScriptEngine; | 219 | private string m_defaultScriptEngine; |
216 | private int m_LastLogin; | 220 | private int m_LastLogin; |
217 | private Thread HeartbeatThread; | 221 | private Thread HeartbeatThread = null; |
218 | private volatile bool shuttingdown; | 222 | private volatile bool shuttingdown; |
219 | 223 | ||
220 | private int m_lastUpdate; | 224 | private int m_lastUpdate; |
225 | private int m_lastIncoming; | ||
226 | private int m_lastOutgoing; | ||
221 | private bool m_firstHeartbeat = true; | 227 | private bool m_firstHeartbeat = true; |
228 | private int m_hbRestarts = 0; | ||
222 | 229 | ||
223 | private object m_deleting_scene_object = new object(); | 230 | private object m_deleting_scene_object = new object(); |
224 | 231 | ||
@@ -265,6 +272,19 @@ namespace OpenSim.Region.Framework.Scenes | |||
265 | get { return m_sceneGridService; } | 272 | get { return m_sceneGridService; } |
266 | } | 273 | } |
267 | 274 | ||
275 | public ISnmpModule SnmpService | ||
276 | { | ||
277 | get | ||
278 | { | ||
279 | if (m_snmpService == null) | ||
280 | { | ||
281 | m_snmpService = RequestModuleInterface<ISnmpModule>(); | ||
282 | } | ||
283 | |||
284 | return m_snmpService; | ||
285 | } | ||
286 | } | ||
287 | |||
268 | public ISimulationDataService SimulationDataService | 288 | public ISimulationDataService SimulationDataService |
269 | { | 289 | { |
270 | get | 290 | get |
@@ -546,6 +566,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
546 | m_EstateDataService = estateDataService; | 566 | m_EstateDataService = estateDataService; |
547 | m_regionHandle = m_regInfo.RegionHandle; | 567 | m_regionHandle = m_regInfo.RegionHandle; |
548 | m_regionName = m_regInfo.RegionName; | 568 | m_regionName = m_regInfo.RegionName; |
569 | m_lastUpdate = Util.EnvironmentTickCount(); | ||
570 | m_lastIncoming = 0; | ||
571 | m_lastOutgoing = 0; | ||
549 | 572 | ||
550 | m_asyncSceneObjectDeleter = new AsyncSceneObjectGroupDeleter(this); | 573 | m_asyncSceneObjectDeleter = new AsyncSceneObjectGroupDeleter(this); |
551 | m_asyncSceneObjectDeleter.Enabled = true; | 574 | m_asyncSceneObjectDeleter.Enabled = true; |
@@ -630,96 +653,106 @@ namespace OpenSim.Region.Framework.Scenes | |||
630 | 653 | ||
631 | // Region config overrides global config | 654 | // Region config overrides global config |
632 | // | 655 | // |
633 | if (m_config.Configs["Startup"] != null) | 656 | try |
634 | { | 657 | { |
635 | IConfig startupConfig = m_config.Configs["Startup"]; | 658 | if (m_config.Configs["Startup"] != null) |
659 | { | ||
660 | IConfig startupConfig = m_config.Configs["Startup"]; | ||
636 | 661 | ||
637 | m_defaultDrawDistance = startupConfig.GetFloat("DefaultDrawDistance",m_defaultDrawDistance); | 662 | m_defaultDrawDistance = startupConfig.GetFloat("DefaultDrawDistance",m_defaultDrawDistance); |
638 | m_useBackup = startupConfig.GetBoolean("UseSceneBackup", m_useBackup); | 663 | m_useBackup = startupConfig.GetBoolean("UseSceneBackup", m_useBackup); |
639 | if (!m_useBackup) | 664 | if (!m_useBackup) |
640 | m_log.InfoFormat("[SCENE]: Backup has been disabled for {0}", RegionInfo.RegionName); | 665 | m_log.InfoFormat("[SCENE]: Backup has been disabled for {0}", RegionInfo.RegionName); |
641 | 666 | ||
642 | //Animation states | 667 | //Animation states |
643 | m_useFlySlow = startupConfig.GetBoolean("enableflyslow", false); | 668 | m_useFlySlow = startupConfig.GetBoolean("enableflyslow", false); |
644 | 669 | ||
645 | PhysicalPrims = startupConfig.GetBoolean("physical_prim", true); | 670 | PhysicalPrims = startupConfig.GetBoolean("physical_prim", true); |
646 | CollidablePrims = startupConfig.GetBoolean("collidable_prim", true); | 671 | CollidablePrims = startupConfig.GetBoolean("collidable_prim", true); |
647 | 672 | ||
648 | m_maxNonphys = startupConfig.GetFloat("NonphysicalPrimMax", m_maxNonphys); | 673 | m_maxNonphys = startupConfig.GetFloat("NonphysicalPrimMax", m_maxNonphys); |
649 | if (RegionInfo.NonphysPrimMax > 0) | 674 | if (RegionInfo.NonphysPrimMax > 0) |
650 | { | 675 | { |
651 | m_maxNonphys = RegionInfo.NonphysPrimMax; | 676 | m_maxNonphys = RegionInfo.NonphysPrimMax; |
652 | } | 677 | } |
653 | 678 | ||
654 | m_maxPhys = startupConfig.GetFloat("PhysicalPrimMax", m_maxPhys); | 679 | m_maxPhys = startupConfig.GetFloat("PhysicalPrimMax", m_maxPhys); |
655 | 680 | ||
656 | if (RegionInfo.PhysPrimMax > 0) | 681 | if (RegionInfo.PhysPrimMax > 0) |
657 | { | 682 | { |
658 | m_maxPhys = RegionInfo.PhysPrimMax; | 683 | m_maxPhys = RegionInfo.PhysPrimMax; |
659 | } | 684 | } |
660 | 685 | ||
661 | // Here, if clamping is requested in either global or | 686 | // Here, if clamping is requested in either global or |
662 | // local config, it will be used | 687 | // local config, it will be used |
663 | // | 688 | // |
664 | m_clampPrimSize = startupConfig.GetBoolean("ClampPrimSize", m_clampPrimSize); | 689 | m_clampPrimSize = startupConfig.GetBoolean("ClampPrimSize", m_clampPrimSize); |
665 | if (RegionInfo.ClampPrimSize) | 690 | if (RegionInfo.ClampPrimSize) |
666 | { | 691 | { |
667 | m_clampPrimSize = true; | 692 | m_clampPrimSize = true; |
668 | } | 693 | } |
669 | 694 | ||
670 | m_trustBinaries = startupConfig.GetBoolean("TrustBinaries", m_trustBinaries); | 695 | m_trustBinaries = startupConfig.GetBoolean("TrustBinaries", m_trustBinaries); |
671 | m_allowScriptCrossings = startupConfig.GetBoolean("AllowScriptCrossing", m_allowScriptCrossings); | 696 | m_allowScriptCrossings = startupConfig.GetBoolean("AllowScriptCrossing", m_allowScriptCrossings); |
672 | m_dontPersistBefore = | 697 | m_dontPersistBefore = |
673 | startupConfig.GetLong("MinimumTimeBeforePersistenceConsidered", DEFAULT_MIN_TIME_FOR_PERSISTENCE); | 698 | startupConfig.GetLong("MinimumTimeBeforePersistenceConsidered", DEFAULT_MIN_TIME_FOR_PERSISTENCE); |
674 | m_dontPersistBefore *= 10000000; | 699 | m_dontPersistBefore *= 10000000; |
675 | m_persistAfter = | 700 | m_persistAfter = |
676 | startupConfig.GetLong("MaximumTimeBeforePersistenceConsidered", DEFAULT_MAX_TIME_FOR_PERSISTENCE); | 701 | startupConfig.GetLong("MaximumTimeBeforePersistenceConsidered", DEFAULT_MAX_TIME_FOR_PERSISTENCE); |
677 | m_persistAfter *= 10000000; | 702 | m_persistAfter *= 10000000; |
678 | 703 | ||
679 | m_defaultScriptEngine = startupConfig.GetString("DefaultScriptEngine", "XEngine"); | 704 | m_defaultScriptEngine = startupConfig.GetString("DefaultScriptEngine", "XEngine"); |
705 | m_log.InfoFormat("[SCENE]: Default script engine {0}", m_defaultScriptEngine); | ||
680 | 706 | ||
681 | IConfig packetConfig = m_config.Configs["PacketPool"]; | 707 | IConfig packetConfig = m_config.Configs["PacketPool"]; |
682 | if (packetConfig != null) | 708 | if (packetConfig != null) |
683 | { | 709 | { |
684 | PacketPool.Instance.RecyclePackets = packetConfig.GetBoolean("RecyclePackets", true); | 710 | PacketPool.Instance.RecyclePackets = packetConfig.GetBoolean("RecyclePackets", true); |
685 | PacketPool.Instance.RecycleDataBlocks = packetConfig.GetBoolean("RecycleDataBlocks", true); | 711 | PacketPool.Instance.RecycleDataBlocks = packetConfig.GetBoolean("RecycleDataBlocks", true); |
686 | } | 712 | } |
687 | 713 | ||
688 | m_strictAccessControl = startupConfig.GetBoolean("StrictAccessControl", m_strictAccessControl); | 714 | m_strictAccessControl = startupConfig.GetBoolean("StrictAccessControl", m_strictAccessControl); |
715 | m_seeIntoBannedRegion = startupConfig.GetBoolean("SeeIntoBannedRegion", m_seeIntoBannedRegion); | ||
716 | CombineRegions = startupConfig.GetBoolean("CombineContiguousRegions", false); | ||
689 | 717 | ||
690 | m_generateMaptiles = startupConfig.GetBoolean("GenerateMaptiles", true); | 718 | m_generateMaptiles = startupConfig.GetBoolean("GenerateMaptiles", true); |
691 | if (m_generateMaptiles) | 719 | if (m_generateMaptiles) |
692 | { | ||
693 | int maptileRefresh = startupConfig.GetInt("MaptileRefresh", 0); | ||
694 | if (maptileRefresh != 0) | ||
695 | { | 720 | { |
696 | m_mapGenerationTimer.Interval = maptileRefresh * 1000; | 721 | int maptileRefresh = startupConfig.GetInt("MaptileRefresh", 0); |
697 | m_mapGenerationTimer.Elapsed += RegenerateMaptileAndReregister; | 722 | if (maptileRefresh != 0) |
698 | m_mapGenerationTimer.AutoReset = true; | 723 | { |
699 | m_mapGenerationTimer.Start(); | 724 | m_mapGenerationTimer.Interval = maptileRefresh * 1000; |
725 | m_mapGenerationTimer.Elapsed += RegenerateMaptileAndReregister; | ||
726 | m_mapGenerationTimer.AutoReset = true; | ||
727 | m_mapGenerationTimer.Start(); | ||
728 | } | ||
700 | } | 729 | } |
701 | } | 730 | else |
702 | else | ||
703 | { | ||
704 | string tile = startupConfig.GetString("MaptileStaticUUID", UUID.Zero.ToString()); | ||
705 | UUID tileID; | ||
706 | |||
707 | if (UUID.TryParse(tile, out tileID)) | ||
708 | { | 731 | { |
709 | RegionInfo.RegionSettings.TerrainImageID = tileID; | 732 | string tile = startupConfig.GetString("MaptileStaticUUID", UUID.Zero.ToString()); |
733 | UUID tileID; | ||
734 | |||
735 | if (UUID.TryParse(tile, out tileID)) | ||
736 | { | ||
737 | RegionInfo.RegionSettings.TerrainImageID = tileID; | ||
738 | } | ||
710 | } | 739 | } |
711 | } | ||
712 | 740 | ||
713 | MinFrameTime = startupConfig.GetFloat( "MinFrameTime", MinFrameTime); | 741 | MinFrameTime = startupConfig.GetFloat( "MinFrameTime", MinFrameTime); |
714 | m_update_backup = startupConfig.GetInt( "UpdateStorageEveryNFrames", m_update_backup); | 742 | m_update_backup = startupConfig.GetInt( "UpdateStorageEveryNFrames", m_update_backup); |
715 | m_update_coarse_locations = startupConfig.GetInt( "UpdateCoarseLocationsEveryNFrames", m_update_coarse_locations); | 743 | m_update_coarse_locations = startupConfig.GetInt( "UpdateCoarseLocationsEveryNFrames", m_update_coarse_locations); |
716 | m_update_entitymovement = startupConfig.GetInt( "UpdateEntityMovementEveryNFrames", m_update_entitymovement); | 744 | m_update_entitymovement = startupConfig.GetInt( "UpdateEntityMovementEveryNFrames", m_update_entitymovement); |
717 | m_update_events = startupConfig.GetInt( "UpdateEventsEveryNFrames", m_update_events); | 745 | m_update_events = startupConfig.GetInt( "UpdateEventsEveryNFrames", m_update_events); |
718 | m_update_objects = startupConfig.GetInt( "UpdateObjectsEveryNFrames", m_update_objects); | 746 | m_update_objects = startupConfig.GetInt( "UpdateObjectsEveryNFrames", m_update_objects); |
719 | m_update_physics = startupConfig.GetInt( "UpdatePhysicsEveryNFrames", m_update_physics); | 747 | m_update_physics = startupConfig.GetInt( "UpdatePhysicsEveryNFrames", m_update_physics); |
720 | m_update_presences = startupConfig.GetInt( "UpdateAgentsEveryNFrames", m_update_presences); | 748 | m_update_presences = startupConfig.GetInt( "UpdateAgentsEveryNFrames", m_update_presences); |
721 | m_update_terrain = startupConfig.GetInt( "UpdateTerrainEveryNFrames", m_update_terrain); | 749 | m_update_terrain = startupConfig.GetInt( "UpdateTerrainEveryNFrames", m_update_terrain); |
722 | m_update_temp_cleaning = startupConfig.GetInt( "UpdateTempCleaningEveryNFrames", m_update_temp_cleaning); | 750 | m_update_temp_cleaning = startupConfig.GetInt( "UpdateTempCleaningEveryNFrames", m_update_temp_cleaning); |
751 | } | ||
752 | } | ||
753 | catch (Exception e) | ||
754 | { | ||
755 | m_log.Error("[SCENE]: Failed to load StartupConfig: " + e.ToString()); | ||
723 | } | 756 | } |
724 | 757 | ||
725 | #endregion Region Config | 758 | #endregion Region Config |
@@ -1128,7 +1161,22 @@ namespace OpenSim.Region.Framework.Scenes | |||
1128 | //m_heartbeatTimer.Elapsed += new ElapsedEventHandler(Heartbeat); | 1161 | //m_heartbeatTimer.Elapsed += new ElapsedEventHandler(Heartbeat); |
1129 | if (HeartbeatThread != null) | 1162 | if (HeartbeatThread != null) |
1130 | { | 1163 | { |
1164 | m_hbRestarts++; | ||
1165 | if(m_hbRestarts > 10) | ||
1166 | Environment.Exit(1); | ||
1167 | m_log.ErrorFormat("[SCENE]: Restarting heartbeat thread because it hasn't reported in in region {0}", RegionInfo.RegionName); | ||
1168 | |||
1169 | //int pid = System.Diagnostics.Process.GetCurrentProcess().Id; | ||
1170 | //System.Diagnostics.Process proc = new System.Diagnostics.Process(); | ||
1171 | //proc.EnableRaisingEvents=false; | ||
1172 | //proc.StartInfo.FileName = "/bin/kill"; | ||
1173 | //proc.StartInfo.Arguments = "-QUIT " + pid.ToString(); | ||
1174 | //proc.Start(); | ||
1175 | //proc.WaitForExit(); | ||
1176 | //Thread.Sleep(1000); | ||
1177 | //Environment.Exit(1); | ||
1131 | HeartbeatThread.Abort(); | 1178 | HeartbeatThread.Abort(); |
1179 | Watchdog.AbortThread(HeartbeatThread.ManagedThreadId); | ||
1132 | HeartbeatThread = null; | 1180 | HeartbeatThread = null; |
1133 | } | 1181 | } |
1134 | m_lastUpdate = Util.EnvironmentTickCount(); | 1182 | m_lastUpdate = Util.EnvironmentTickCount(); |
@@ -1182,9 +1230,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1182 | 1230 | ||
1183 | while (!shuttingdown) | 1231 | while (!shuttingdown) |
1184 | Update(); | 1232 | Update(); |
1185 | |||
1186 | m_lastUpdate = Util.EnvironmentTickCount(); | ||
1187 | m_firstHeartbeat = false; | ||
1188 | } | 1233 | } |
1189 | catch (ThreadAbortException) | 1234 | catch (ThreadAbortException) |
1190 | { | 1235 | { |
@@ -1282,6 +1327,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
1282 | eventMS = Util.EnvironmentTickCountSubtract(evMS); ; | 1327 | eventMS = Util.EnvironmentTickCountSubtract(evMS); ; |
1283 | } | 1328 | } |
1284 | 1329 | ||
1330 | // if (Frame % m_update_land == 0) | ||
1331 | // { | ||
1332 | // int ldMS = Util.EnvironmentTickCount(); | ||
1333 | // UpdateLand(); | ||
1334 | // landMS = Util.EnvironmentTickCountSubtract(ldMS); | ||
1335 | // } | ||
1336 | |||
1285 | if (Frame % m_update_backup == 0) | 1337 | if (Frame % m_update_backup == 0) |
1286 | { | 1338 | { |
1287 | int backMS = Util.EnvironmentTickCount(); | 1339 | int backMS = Util.EnvironmentTickCount(); |
@@ -1375,12 +1427,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
1375 | maintc = Util.EnvironmentTickCountSubtract(maintc); | 1427 | maintc = Util.EnvironmentTickCountSubtract(maintc); |
1376 | maintc = (int)(MinFrameTime * 1000) - maintc; | 1428 | maintc = (int)(MinFrameTime * 1000) - maintc; |
1377 | 1429 | ||
1430 | |||
1431 | m_lastUpdate = Util.EnvironmentTickCount(); | ||
1432 | m_firstHeartbeat = false; | ||
1433 | |||
1378 | if (maintc > 0) | 1434 | if (maintc > 0) |
1379 | Thread.Sleep(maintc); | 1435 | Thread.Sleep(maintc); |
1380 | 1436 | ||
1381 | // Tell the watchdog that this thread is still alive | 1437 | // Tell the watchdog that this thread is still alive |
1382 | Watchdog.UpdateThread(); | 1438 | Watchdog.UpdateThread(); |
1383 | } | 1439 | } |
1384 | 1440 | ||
1385 | public void AddGroupTarget(SceneObjectGroup grp) | 1441 | public void AddGroupTarget(SceneObjectGroup grp) |
1386 | { | 1442 | { |
@@ -1396,9 +1452,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
1396 | 1452 | ||
1397 | private void CheckAtTargets() | 1453 | private void CheckAtTargets() |
1398 | { | 1454 | { |
1399 | Dictionary<UUID, SceneObjectGroup>.ValueCollection objs; | 1455 | List<SceneObjectGroup> objs = new List<SceneObjectGroup>(); |
1400 | lock (m_groupsWithTargets) | 1456 | lock (m_groupsWithTargets) |
1401 | objs = m_groupsWithTargets.Values; | 1457 | objs = new List<SceneObjectGroup>(m_groupsWithTargets.Values); |
1402 | 1458 | ||
1403 | foreach (SceneObjectGroup entry in objs) | 1459 | foreach (SceneObjectGroup entry in objs) |
1404 | entry.checkAtTargets(); | 1460 | entry.checkAtTargets(); |
@@ -1479,7 +1535,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1479 | msg.fromAgentName = "Server"; | 1535 | msg.fromAgentName = "Server"; |
1480 | msg.dialog = (byte)19; // Object msg | 1536 | msg.dialog = (byte)19; // Object msg |
1481 | msg.fromGroup = false; | 1537 | msg.fromGroup = false; |
1482 | msg.offline = (byte)0; | 1538 | msg.offline = (byte)1; |
1483 | msg.ParentEstateID = RegionInfo.EstateSettings.ParentEstateID; | 1539 | msg.ParentEstateID = RegionInfo.EstateSettings.ParentEstateID; |
1484 | msg.Position = Vector3.Zero; | 1540 | msg.Position = Vector3.Zero; |
1485 | msg.RegionID = RegionInfo.RegionID.Guid; | 1541 | msg.RegionID = RegionInfo.RegionID.Guid; |
@@ -1710,14 +1766,24 @@ namespace OpenSim.Region.Framework.Scenes | |||
1710 | /// <returns></returns> | 1766 | /// <returns></returns> |
1711 | public Vector3 GetNewRezLocation(Vector3 RayStart, Vector3 RayEnd, UUID RayTargetID, Quaternion rot, byte bypassRayCast, byte RayEndIsIntersection, bool frontFacesOnly, Vector3 scale, bool FaceCenter) | 1767 | public Vector3 GetNewRezLocation(Vector3 RayStart, Vector3 RayEnd, UUID RayTargetID, Quaternion rot, byte bypassRayCast, byte RayEndIsIntersection, bool frontFacesOnly, Vector3 scale, bool FaceCenter) |
1712 | { | 1768 | { |
1769 | |||
1770 | float wheight = (float)RegionInfo.RegionSettings.WaterHeight; | ||
1771 | Vector3 wpos = Vector3.Zero; | ||
1772 | // Check for water surface intersection from above | ||
1773 | if ( (RayStart.Z > wheight) && (RayEnd.Z < wheight) ) | ||
1774 | { | ||
1775 | float ratio = (RayStart.Z - wheight) / (RayStart.Z - RayEnd.Z); | ||
1776 | wpos.X = RayStart.X - (ratio * (RayStart.X - RayEnd.X)); | ||
1777 | wpos.Y = RayStart.Y - (ratio * (RayStart.Y - RayEnd.Y)); | ||
1778 | wpos.Z = wheight; | ||
1779 | } | ||
1780 | |||
1713 | Vector3 pos = Vector3.Zero; | 1781 | Vector3 pos = Vector3.Zero; |
1714 | if (RayEndIsIntersection == (byte)1) | 1782 | if (RayEndIsIntersection == (byte)1) |
1715 | { | 1783 | { |
1716 | pos = RayEnd; | 1784 | pos = RayEnd; |
1717 | return pos; | ||
1718 | } | 1785 | } |
1719 | 1786 | else if (RayTargetID != UUID.Zero) | |
1720 | if (RayTargetID != UUID.Zero) | ||
1721 | { | 1787 | { |
1722 | SceneObjectPart target = GetSceneObjectPart(RayTargetID); | 1788 | SceneObjectPart target = GetSceneObjectPart(RayTargetID); |
1723 | 1789 | ||
@@ -1739,7 +1805,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1739 | EntityIntersection ei = target.TestIntersectionOBB(NewRay, Quaternion.Identity, frontFacesOnly, FaceCenter); | 1805 | EntityIntersection ei = target.TestIntersectionOBB(NewRay, Quaternion.Identity, frontFacesOnly, FaceCenter); |
1740 | 1806 | ||
1741 | // Un-comment out the following line to Get Raytrace results printed to the console. | 1807 | // Un-comment out the following line to Get Raytrace results printed to the console. |
1742 | // m_log.Info("[RAYTRACERESULTS]: Hit:" + ei.HitTF.ToString() + " Point: " + ei.ipoint.ToString() + " Normal: " + ei.normal.ToString()); | 1808 | // m_log.Info("[RAYTRACERESULTS]: Hit:" + ei.HitTF.ToString() + " Point: " + ei.ipoint.ToString() + " Normal: " + ei.normal.ToString()); |
1743 | float ScaleOffset = 0.5f; | 1809 | float ScaleOffset = 0.5f; |
1744 | 1810 | ||
1745 | // If we hit something | 1811 | // If we hit something |
@@ -1762,13 +1828,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
1762 | //pos.Z -= 0.25F; | 1828 | //pos.Z -= 0.25F; |
1763 | 1829 | ||
1764 | } | 1830 | } |
1765 | |||
1766 | return pos; | ||
1767 | } | 1831 | } |
1768 | else | 1832 | else |
1769 | { | 1833 | { |
1770 | // We don't have a target here, so we're going to raytrace all the objects in the scene. | 1834 | // We don't have a target here, so we're going to raytrace all the objects in the scene. |
1771 | |||
1772 | EntityIntersection ei = m_sceneGraph.GetClosestIntersectingPrim(new Ray(AXOrigin, AXdirection), true, false); | 1835 | EntityIntersection ei = m_sceneGraph.GetClosestIntersectingPrim(new Ray(AXOrigin, AXdirection), true, false); |
1773 | 1836 | ||
1774 | // Un-comment the following line to print the raytrace results to the console. | 1837 | // Un-comment the following line to print the raytrace results to the console. |
@@ -1777,13 +1840,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
1777 | if (ei.HitTF) | 1840 | if (ei.HitTF) |
1778 | { | 1841 | { |
1779 | pos = new Vector3(ei.ipoint.X, ei.ipoint.Y, ei.ipoint.Z); | 1842 | pos = new Vector3(ei.ipoint.X, ei.ipoint.Y, ei.ipoint.Z); |
1780 | } else | 1843 | } |
1844 | else | ||
1781 | { | 1845 | { |
1782 | // fall back to our stupid functionality | 1846 | // fall back to our stupid functionality |
1783 | pos = RayEnd; | 1847 | pos = RayEnd; |
1784 | } | 1848 | } |
1785 | |||
1786 | return pos; | ||
1787 | } | 1849 | } |
1788 | } | 1850 | } |
1789 | else | 1851 | else |
@@ -1794,8 +1856,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
1794 | //increase height so its above the ground. | 1856 | //increase height so its above the ground. |
1795 | //should be getting the normal of the ground at the rez point and using that? | 1857 | //should be getting the normal of the ground at the rez point and using that? |
1796 | pos.Z += scale.Z / 2f; | 1858 | pos.Z += scale.Z / 2f; |
1797 | return pos; | 1859 | // return pos; |
1798 | } | 1860 | } |
1861 | |||
1862 | // check against posible water intercept | ||
1863 | if (wpos.Z > pos.Z) pos = wpos; | ||
1864 | return pos; | ||
1799 | } | 1865 | } |
1800 | 1866 | ||
1801 | 1867 | ||
@@ -1879,7 +1945,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
1879 | public bool AddRestoredSceneObject( | 1945 | public bool AddRestoredSceneObject( |
1880 | SceneObjectGroup sceneObject, bool attachToBackup, bool alreadyPersisted, bool sendClientUpdates) | 1946 | SceneObjectGroup sceneObject, bool attachToBackup, bool alreadyPersisted, bool sendClientUpdates) |
1881 | { | 1947 | { |
1882 | return m_sceneGraph.AddRestoredSceneObject(sceneObject, attachToBackup, alreadyPersisted, sendClientUpdates); | 1948 | bool result = m_sceneGraph.AddRestoredSceneObject(sceneObject, attachToBackup, alreadyPersisted, sendClientUpdates); |
1949 | if (result) | ||
1950 | sceneObject.IsDeleted = false; | ||
1951 | return result; | ||
1883 | } | 1952 | } |
1884 | 1953 | ||
1885 | /// <summary> | 1954 | /// <summary> |
@@ -1971,6 +2040,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
1971 | /// </summary> | 2040 | /// </summary> |
1972 | public void DeleteAllSceneObjects() | 2041 | public void DeleteAllSceneObjects() |
1973 | { | 2042 | { |
2043 | DeleteAllSceneObjects(false); | ||
2044 | } | ||
2045 | |||
2046 | /// <summary> | ||
2047 | /// Delete every object from the scene. This does not include attachments worn by avatars. | ||
2048 | /// </summary> | ||
2049 | public void DeleteAllSceneObjects(bool exceptNoCopy) | ||
2050 | { | ||
2051 | List<SceneObjectGroup> toReturn = new List<SceneObjectGroup>(); | ||
1974 | lock (Entities) | 2052 | lock (Entities) |
1975 | { | 2053 | { |
1976 | EntityBase[] entities = Entities.GetEntities(); | 2054 | EntityBase[] entities = Entities.GetEntities(); |
@@ -1979,11 +2057,24 @@ namespace OpenSim.Region.Framework.Scenes | |||
1979 | if (e is SceneObjectGroup) | 2057 | if (e is SceneObjectGroup) |
1980 | { | 2058 | { |
1981 | SceneObjectGroup sog = (SceneObjectGroup)e; | 2059 | SceneObjectGroup sog = (SceneObjectGroup)e; |
1982 | if (!sog.IsAttachment) | 2060 | if (sog != null && !sog.IsAttachment) |
1983 | DeleteSceneObject((SceneObjectGroup)e, false); | 2061 | { |
2062 | if (!exceptNoCopy || ((sog.GetEffectivePermissions() & (uint)PermissionMask.Copy) != 0)) | ||
2063 | { | ||
2064 | DeleteSceneObject((SceneObjectGroup)e, false); | ||
2065 | } | ||
2066 | else | ||
2067 | { | ||
2068 | toReturn.Add((SceneObjectGroup)e); | ||
2069 | } | ||
2070 | } | ||
1984 | } | 2071 | } |
1985 | } | 2072 | } |
1986 | } | 2073 | } |
2074 | if (toReturn.Count > 0) | ||
2075 | { | ||
2076 | returnObjects(toReturn.ToArray(), UUID.Zero); | ||
2077 | } | ||
1987 | } | 2078 | } |
1988 | 2079 | ||
1989 | /// <summary> | 2080 | /// <summary> |
@@ -2031,6 +2122,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2031 | } | 2122 | } |
2032 | 2123 | ||
2033 | group.DeleteGroupFromScene(silent); | 2124 | group.DeleteGroupFromScene(silent); |
2125 | if (!silent) | ||
2126 | SendKillObject(new List<uint>() { group.LocalId }); | ||
2034 | 2127 | ||
2035 | // m_log.DebugFormat("[SCENE]: Exit DeleteSceneObject() for {0} {1}", group.Name, group.UUID); | 2128 | // m_log.DebugFormat("[SCENE]: Exit DeleteSceneObject() for {0} {1}", group.Name, group.UUID); |
2036 | } | 2129 | } |
@@ -2320,6 +2413,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2320 | 2413 | ||
2321 | if (newPosition != Vector3.Zero) | 2414 | if (newPosition != Vector3.Zero) |
2322 | newObject.RootPart.GroupPosition = newPosition; | 2415 | newObject.RootPart.GroupPosition = newPosition; |
2416 | if (newObject.RootPart.KeyframeMotion != null) | ||
2417 | newObject.RootPart.KeyframeMotion.UpdateSceneObject(newObject); | ||
2323 | 2418 | ||
2324 | if (!AddSceneObject(newObject)) | 2419 | if (!AddSceneObject(newObject)) |
2325 | { | 2420 | { |
@@ -2388,10 +2483,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
2388 | /// <returns>True if the SceneObjectGroup was added, False if it was not</returns> | 2483 | /// <returns>True if the SceneObjectGroup was added, False if it was not</returns> |
2389 | public bool AddSceneObject(SceneObjectGroup sceneObject) | 2484 | public bool AddSceneObject(SceneObjectGroup sceneObject) |
2390 | { | 2485 | { |
2486 | if (sceneObject.OwnerID == UUID.Zero) | ||
2487 | { | ||
2488 | m_log.ErrorFormat("[SCENE]: Owner ID for {0} was zero", sceneObject.UUID); | ||
2489 | return false; | ||
2490 | } | ||
2491 | |||
2391 | // If the user is banned, we won't let any of their objects | 2492 | // If the user is banned, we won't let any of their objects |
2392 | // enter. Period. | 2493 | // enter. Period. |
2393 | // | 2494 | // |
2394 | if (m_regInfo.EstateSettings.IsBanned(sceneObject.OwnerID)) | 2495 | int flags = GetUserFlags(sceneObject.OwnerID); |
2496 | if (m_regInfo.EstateSettings.IsBanned(sceneObject.OwnerID, flags)) | ||
2395 | { | 2497 | { |
2396 | m_log.InfoFormat("[INTERREGION]: Denied prim crossing for banned avatar {0}", sceneObject.OwnerID); | 2498 | m_log.InfoFormat("[INTERREGION]: Denied prim crossing for banned avatar {0}", sceneObject.OwnerID); |
2397 | 2499 | ||
@@ -2437,12 +2539,23 @@ namespace OpenSim.Region.Framework.Scenes | |||
2437 | } | 2539 | } |
2438 | else | 2540 | else |
2439 | { | 2541 | { |
2542 | m_log.DebugFormat("[SCENE]: Attachment {0} arrived and scene presence was not found, setting to temp", sceneObject.UUID); | ||
2440 | RootPrim.RemFlag(PrimFlags.TemporaryOnRez); | 2543 | RootPrim.RemFlag(PrimFlags.TemporaryOnRez); |
2441 | RootPrim.AddFlag(PrimFlags.TemporaryOnRez); | 2544 | RootPrim.AddFlag(PrimFlags.TemporaryOnRez); |
2442 | } | 2545 | } |
2546 | if (sceneObject.OwnerID == UUID.Zero) | ||
2547 | { | ||
2548 | m_log.ErrorFormat("[SCENE]: Owner ID for {0} was zero after attachment processing. BUG!", sceneObject.UUID); | ||
2549 | return false; | ||
2550 | } | ||
2443 | } | 2551 | } |
2444 | else | 2552 | else |
2445 | { | 2553 | { |
2554 | if (sceneObject.OwnerID == UUID.Zero) | ||
2555 | { | ||
2556 | m_log.ErrorFormat("[SCENE]: Owner ID for non-attachment {0} was zero", sceneObject.UUID); | ||
2557 | return false; | ||
2558 | } | ||
2446 | AddRestoredSceneObject(sceneObject, true, false); | 2559 | AddRestoredSceneObject(sceneObject, true, false); |
2447 | 2560 | ||
2448 | if (!Permissions.CanObjectEntry(sceneObject.UUID, | 2561 | if (!Permissions.CanObjectEntry(sceneObject.UUID, |
@@ -2471,6 +2584,24 @@ namespace OpenSim.Region.Framework.Scenes | |||
2471 | return 2; // StateSource.PrimCrossing | 2584 | return 2; // StateSource.PrimCrossing |
2472 | } | 2585 | } |
2473 | 2586 | ||
2587 | public int GetUserFlags(UUID user) | ||
2588 | { | ||
2589 | //Unfortunately the SP approach means that the value is cached until region is restarted | ||
2590 | /* | ||
2591 | ScenePresence sp; | ||
2592 | if (TryGetScenePresence(user, out sp)) | ||
2593 | { | ||
2594 | return sp.UserFlags; | ||
2595 | } | ||
2596 | else | ||
2597 | { | ||
2598 | */ | ||
2599 | UserAccount uac = UserAccountService.GetUserAccount(RegionInfo.ScopeID, user); | ||
2600 | if (uac == null) | ||
2601 | return 0; | ||
2602 | return uac.UserFlags; | ||
2603 | //} | ||
2604 | } | ||
2474 | #endregion | 2605 | #endregion |
2475 | 2606 | ||
2476 | #region Add/Remove Avatar Methods | 2607 | #region Add/Remove Avatar Methods |
@@ -2485,6 +2616,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2485 | || (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0; | 2616 | || (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0; |
2486 | 2617 | ||
2487 | CheckHeartbeat(); | 2618 | CheckHeartbeat(); |
2619 | ScenePresence presence; | ||
2488 | 2620 | ||
2489 | ScenePresence sp = GetScenePresence(client.AgentId); | 2621 | ScenePresence sp = GetScenePresence(client.AgentId); |
2490 | 2622 | ||
@@ -2533,7 +2665,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
2533 | 2665 | ||
2534 | EventManager.TriggerOnNewClient(client); | 2666 | EventManager.TriggerOnNewClient(client); |
2535 | if (vialogin) | 2667 | if (vialogin) |
2668 | { | ||
2536 | EventManager.TriggerOnClientLogin(client); | 2669 | EventManager.TriggerOnClientLogin(client); |
2670 | // Send initial parcel data | ||
2671 | Vector3 pos = sp.AbsolutePosition; | ||
2672 | ILandObject land = LandChannel.GetLandObject(pos.X, pos.Y); | ||
2673 | land.SendLandUpdateToClient(client); | ||
2674 | } | ||
2537 | 2675 | ||
2538 | return sp; | 2676 | return sp; |
2539 | } | 2677 | } |
@@ -2623,19 +2761,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
2623 | // and the scene presence and the client, if they exist | 2761 | // and the scene presence and the client, if they exist |
2624 | try | 2762 | try |
2625 | { | 2763 | { |
2626 | // We need to wait for the client to make UDP contact first. | 2764 | ScenePresence sp = GetScenePresence(agentID); |
2627 | // It's the UDP contact that creates the scene presence | 2765 | PresenceService.LogoutAgent(sp.ControllingClient.SessionId); |
2628 | ScenePresence sp = WaitGetScenePresence(agentID); | 2766 | |
2629 | if (sp != null) | 2767 | if (sp != null) |
2630 | { | ||
2631 | PresenceService.LogoutAgent(sp.ControllingClient.SessionId); | ||
2632 | |||
2633 | sp.ControllingClient.Close(); | 2768 | sp.ControllingClient.Close(); |
2634 | } | 2769 | |
2635 | else | ||
2636 | { | ||
2637 | m_log.WarnFormat("[SCENE]: Could not find scene presence for {0}", agentID); | ||
2638 | } | ||
2639 | // BANG! SLASH! | 2770 | // BANG! SLASH! |
2640 | m_authenticateHandler.RemoveCircuit(agentID); | 2771 | m_authenticateHandler.RemoveCircuit(agentID); |
2641 | 2772 | ||
@@ -2736,6 +2867,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2736 | client.OnFetchInventory += m_asyncInventorySender.HandleFetchInventory; | 2867 | client.OnFetchInventory += m_asyncInventorySender.HandleFetchInventory; |
2737 | client.OnUpdateInventoryItem += UpdateInventoryItemAsset; | 2868 | client.OnUpdateInventoryItem += UpdateInventoryItemAsset; |
2738 | client.OnCopyInventoryItem += CopyInventoryItem; | 2869 | client.OnCopyInventoryItem += CopyInventoryItem; |
2870 | client.OnMoveItemsAndLeaveCopy += MoveInventoryItemsLeaveCopy; | ||
2739 | client.OnMoveInventoryItem += MoveInventoryItem; | 2871 | client.OnMoveInventoryItem += MoveInventoryItem; |
2740 | client.OnRemoveInventoryItem += RemoveInventoryItem; | 2872 | client.OnRemoveInventoryItem += RemoveInventoryItem; |
2741 | client.OnRemoveInventoryFolder += RemoveInventoryFolder; | 2873 | client.OnRemoveInventoryFolder += RemoveInventoryFolder; |
@@ -2911,15 +3043,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
2911 | /// </summary> | 3043 | /// </summary> |
2912 | /// <param name="agentId">The avatar's Unique ID</param> | 3044 | /// <param name="agentId">The avatar's Unique ID</param> |
2913 | /// <param name="client">The IClientAPI for the client</param> | 3045 | /// <param name="client">The IClientAPI for the client</param> |
2914 | public virtual void TeleportClientHome(UUID agentId, IClientAPI client) | 3046 | public virtual bool TeleportClientHome(UUID agentId, IClientAPI client) |
2915 | { | 3047 | { |
2916 | if (m_teleportModule != null) | 3048 | if (m_teleportModule != null) |
2917 | m_teleportModule.TeleportHome(agentId, client); | 3049 | return m_teleportModule.TeleportHome(agentId, client); |
2918 | else | 3050 | else |
2919 | { | 3051 | { |
2920 | m_log.DebugFormat("[SCENE]: Unable to teleport user home: no AgentTransferModule is active"); | 3052 | m_log.DebugFormat("[SCENE]: Unable to teleport user home: no AgentTransferModule is active"); |
2921 | client.SendTeleportFailed("Unable to perform teleports on this simulator."); | 3053 | client.SendTeleportFailed("Unable to perform teleports on this simulator."); |
2922 | } | 3054 | } |
3055 | return false; | ||
2923 | } | 3056 | } |
2924 | 3057 | ||
2925 | /// <summary> | 3058 | /// <summary> |
@@ -3029,6 +3162,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
3029 | /// <param name="flags"></param> | 3162 | /// <param name="flags"></param> |
3030 | public virtual void SetHomeRezPoint(IClientAPI remoteClient, ulong regionHandle, Vector3 position, Vector3 lookAt, uint flags) | 3163 | public virtual void SetHomeRezPoint(IClientAPI remoteClient, ulong regionHandle, Vector3 position, Vector3 lookAt, uint flags) |
3031 | { | 3164 | { |
3165 | //Add half the avatar's height so that the user doesn't fall through prims | ||
3166 | ScenePresence presence; | ||
3167 | if (TryGetScenePresence(remoteClient.AgentId, out presence)) | ||
3168 | { | ||
3169 | if (presence.Appearance != null) | ||
3170 | { | ||
3171 | position.Z = position.Z + (presence.Appearance.AvatarHeight / 2); | ||
3172 | } | ||
3173 | } | ||
3174 | |||
3032 | if (GridUserService != null && GridUserService.SetHome(remoteClient.AgentId.ToString(), RegionInfo.RegionID, position, lookAt)) | 3175 | if (GridUserService != null && GridUserService.SetHome(remoteClient.AgentId.ToString(), RegionInfo.RegionID, position, lookAt)) |
3033 | // FUBAR ALERT: this needs to be "Home position set." so the viewer saves a home-screenshot. | 3176 | // FUBAR ALERT: this needs to be "Home position set." so the viewer saves a home-screenshot. |
3034 | m_dialogModule.SendAlertToUser(remoteClient, "Home position set."); | 3177 | m_dialogModule.SendAlertToUser(remoteClient, "Home position set."); |
@@ -3097,8 +3240,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
3097 | regions.Remove(RegionInfo.RegionHandle); | 3240 | regions.Remove(RegionInfo.RegionHandle); |
3098 | m_sceneGridService.SendCloseChildAgentConnections(agentID, regions); | 3241 | m_sceneGridService.SendCloseChildAgentConnections(agentID, regions); |
3099 | } | 3242 | } |
3100 | 3243 | m_log.Debug("[Scene] Beginning ClientClosed"); | |
3101 | m_eventManager.TriggerClientClosed(agentID, this); | 3244 | m_eventManager.TriggerClientClosed(agentID, this); |
3245 | m_log.Debug("[Scene] Finished ClientClosed"); | ||
3102 | } | 3246 | } |
3103 | catch (NullReferenceException) | 3247 | catch (NullReferenceException) |
3104 | { | 3248 | { |
@@ -3160,9 +3304,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
3160 | { | 3304 | { |
3161 | m_log.ErrorFormat("[SCENE] Scene.cs:RemoveClient exception {0}{1}", e.Message, e.StackTrace); | 3305 | m_log.ErrorFormat("[SCENE] Scene.cs:RemoveClient exception {0}{1}", e.Message, e.StackTrace); |
3162 | } | 3306 | } |
3163 | 3307 | m_log.Debug("[Scene] Done. Firing RemoveCircuit"); | |
3164 | m_authenticateHandler.RemoveCircuit(avatar.ControllingClient.CircuitCode); | 3308 | m_authenticateHandler.RemoveCircuit(avatar.ControllingClient.CircuitCode); |
3165 | // CleanDroppedAttachments(); | 3309 | // CleanDroppedAttachments(); |
3310 | m_log.Debug("[Scene] The avatar has left the building"); | ||
3166 | //m_log.InfoFormat("[SCENE] Memory pre GC {0}", System.GC.GetTotalMemory(false)); | 3311 | //m_log.InfoFormat("[SCENE] Memory pre GC {0}", System.GC.GetTotalMemory(false)); |
3167 | //m_log.InfoFormat("[SCENE] Memory post GC {0}", System.GC.GetTotalMemory(true)); | 3312 | //m_log.InfoFormat("[SCENE] Memory post GC {0}", System.GC.GetTotalMemory(true)); |
3168 | } | 3313 | } |
@@ -3284,13 +3429,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
3284 | sp = null; | 3429 | sp = null; |
3285 | } | 3430 | } |
3286 | 3431 | ||
3287 | ILandObject land = LandChannel.GetLandObject(agent.startpos.X, agent.startpos.Y); | ||
3288 | 3432 | ||
3289 | //On login test land permisions | 3433 | //On login test land permisions |
3290 | if (vialogin) | 3434 | if (vialogin) |
3291 | { | 3435 | { |
3292 | if (land != null && !TestLandRestrictions(agent, land, out reason)) | 3436 | IUserAccountCacheModule cache = RequestModuleInterface<IUserAccountCacheModule>(); |
3437 | if (cache != null) | ||
3438 | cache.Remove(agent.firstname + " " + agent.lastname); | ||
3439 | if (!TestLandRestrictions(agent.AgentID, out reason, ref agent.startpos.X, ref agent.startpos.Y)) | ||
3293 | { | 3440 | { |
3441 | m_log.DebugFormat("[CONNECTION BEGIN]: Denying access to {0} due to no land access", agent.AgentID.ToString()); | ||
3294 | return false; | 3442 | return false; |
3295 | } | 3443 | } |
3296 | } | 3444 | } |
@@ -3314,8 +3462,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
3314 | 3462 | ||
3315 | try | 3463 | try |
3316 | { | 3464 | { |
3317 | if (!AuthorizeUser(agent, out reason)) | 3465 | // Always check estate if this is a login. Always |
3318 | return false; | 3466 | // check if banned regions are to be blacked out. |
3467 | if (vialogin || (!m_seeIntoBannedRegion)) | ||
3468 | { | ||
3469 | if (!AuthorizeUser(agent, out reason)) | ||
3470 | return false; | ||
3471 | } | ||
3319 | } | 3472 | } |
3320 | catch (Exception e) | 3473 | catch (Exception e) |
3321 | { | 3474 | { |
@@ -3441,6 +3594,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
3441 | } | 3594 | } |
3442 | 3595 | ||
3443 | // Honor parcel landing type and position. | 3596 | // Honor parcel landing type and position. |
3597 | /* | ||
3598 | ILandObject land = LandChannel.GetLandObject(agent.startpos.X, agent.startpos.Y); | ||
3444 | if (land != null) | 3599 | if (land != null) |
3445 | { | 3600 | { |
3446 | if (land.LandData.LandingType == (byte)1 && land.LandData.UserLocation != Vector3.Zero) | 3601 | if (land.LandData.LandingType == (byte)1 && land.LandData.UserLocation != Vector3.Zero) |
@@ -3448,26 +3603,34 @@ namespace OpenSim.Region.Framework.Scenes | |||
3448 | agent.startpos = land.LandData.UserLocation; | 3603 | agent.startpos = land.LandData.UserLocation; |
3449 | } | 3604 | } |
3450 | } | 3605 | } |
3606 | */// This is now handled properly in ScenePresence.MakeRootAgent | ||
3451 | } | 3607 | } |
3452 | 3608 | ||
3453 | return true; | 3609 | return true; |
3454 | } | 3610 | } |
3455 | 3611 | ||
3456 | private bool TestLandRestrictions(AgentCircuitData agent, ILandObject land, out string reason) | 3612 | public bool TestLandRestrictions(UUID agentID, out string reason, ref float posX, ref float posY) |
3457 | { | 3613 | { |
3458 | 3614 | reason = String.Empty; | |
3459 | bool banned = land.IsBannedFromLand(agent.AgentID); | 3615 | if (Permissions.IsGod(agentID)) |
3460 | bool restricted = land.IsRestrictedFromLand(agent.AgentID); | 3616 | return true; |
3617 | |||
3618 | ILandObject land = LandChannel.GetLandObject(posX, posY); | ||
3619 | if (land == null) | ||
3620 | return false; | ||
3621 | |||
3622 | bool banned = land.IsBannedFromLand(agentID); | ||
3623 | bool restricted = land.IsRestrictedFromLand(agentID); | ||
3461 | 3624 | ||
3462 | if (banned || restricted) | 3625 | if (banned || restricted) |
3463 | { | 3626 | { |
3464 | ILandObject nearestParcel = GetNearestAllowedParcel(agent.AgentID, agent.startpos.X, agent.startpos.Y); | 3627 | ILandObject nearestParcel = GetNearestAllowedParcel(agentID, posX, posY); |
3465 | if (nearestParcel != null) | 3628 | if (nearestParcel != null) |
3466 | { | 3629 | { |
3467 | //Move agent to nearest allowed | 3630 | //Move agent to nearest allowed |
3468 | Vector3 newPosition = GetParcelCenterAtGround(nearestParcel); | 3631 | Vector3 newPosition = GetParcelCenterAtGround(nearestParcel); |
3469 | agent.startpos.X = newPosition.X; | 3632 | posX = newPosition.X; |
3470 | agent.startpos.Y = newPosition.Y; | 3633 | posY = newPosition.Y; |
3471 | } | 3634 | } |
3472 | else | 3635 | else |
3473 | { | 3636 | { |
@@ -3529,7 +3692,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3529 | 3692 | ||
3530 | if (!m_strictAccessControl) return true; | 3693 | if (!m_strictAccessControl) return true; |
3531 | if (Permissions.IsGod(agent.AgentID)) return true; | 3694 | if (Permissions.IsGod(agent.AgentID)) return true; |
3532 | 3695 | ||
3533 | if (AuthorizationService != null) | 3696 | if (AuthorizationService != null) |
3534 | { | 3697 | { |
3535 | if (!AuthorizationService.IsAuthorizedForRegion( | 3698 | if (!AuthorizationService.IsAuthorizedForRegion( |
@@ -3537,14 +3700,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
3537 | { | 3700 | { |
3538 | m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the user does not have access to the region", | 3701 | m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the user does not have access to the region", |
3539 | agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName); | 3702 | agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName); |
3540 | 3703 | ||
3541 | return false; | 3704 | return false; |
3542 | } | 3705 | } |
3543 | } | 3706 | } |
3544 | 3707 | ||
3545 | if (m_regInfo.EstateSettings != null) | 3708 | if (m_regInfo.EstateSettings != null) |
3546 | { | 3709 | { |
3547 | if (m_regInfo.EstateSettings.IsBanned(agent.AgentID)) | 3710 | if (m_regInfo.EstateSettings.IsBanned(agent.AgentID,0)) |
3548 | { | 3711 | { |
3549 | m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the user is on the banlist", | 3712 | m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the user is on the banlist", |
3550 | agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName); | 3713 | agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName); |
@@ -3736,6 +3899,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
3736 | 3899 | ||
3737 | // We have to wait until the viewer contacts this region after receiving EAC. | 3900 | // We have to wait until the viewer contacts this region after receiving EAC. |
3738 | // That calls AddNewClient, which finally creates the ScenePresence | 3901 | // That calls AddNewClient, which finally creates the ScenePresence |
3902 | int flags = GetUserFlags(cAgentData.AgentID); | ||
3903 | if (m_regInfo.EstateSettings.IsBanned(cAgentData.AgentID, flags)) | ||
3904 | { | ||
3905 | m_log.DebugFormat("[SCENE]: Denying root agent entry to {0}: banned", cAgentData.AgentID); | ||
3906 | return false; | ||
3907 | } | ||
3908 | |||
3739 | ILandObject nearestParcel = GetNearestAllowedParcel(cAgentData.AgentID, Constants.RegionSize / 2, Constants.RegionSize / 2); | 3909 | ILandObject nearestParcel = GetNearestAllowedParcel(cAgentData.AgentID, Constants.RegionSize / 2, Constants.RegionSize / 2); |
3740 | if (nearestParcel == null) | 3910 | if (nearestParcel == null) |
3741 | { | 3911 | { |
@@ -3817,12 +3987,22 @@ namespace OpenSim.Region.Framework.Scenes | |||
3817 | return false; | 3987 | return false; |
3818 | } | 3988 | } |
3819 | 3989 | ||
3990 | public bool IncomingCloseAgent(UUID agentID) | ||
3991 | { | ||
3992 | return IncomingCloseAgent(agentID, false); | ||
3993 | } | ||
3994 | |||
3995 | public bool IncomingCloseChildAgent(UUID agentID) | ||
3996 | { | ||
3997 | return IncomingCloseAgent(agentID, true); | ||
3998 | } | ||
3999 | |||
3820 | /// <summary> | 4000 | /// <summary> |
3821 | /// Tell a single agent to disconnect from the region. | 4001 | /// Tell a single agent to disconnect from the region. |
3822 | /// </summary> | 4002 | /// </summary> |
3823 | /// <param name="regionHandle"></param> | ||
3824 | /// <param name="agentID"></param> | 4003 | /// <param name="agentID"></param> |
3825 | public bool IncomingCloseAgent(UUID agentID) | 4004 | /// <param name="childOnly"></param> |
4005 | public bool IncomingCloseAgent(UUID agentID, bool childOnly) | ||
3826 | { | 4006 | { |
3827 | //m_log.DebugFormat("[SCENE]: Processing incoming close agent for {0}", agentID); | 4007 | //m_log.DebugFormat("[SCENE]: Processing incoming close agent for {0}", agentID); |
3828 | 4008 | ||
@@ -3834,7 +4014,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3834 | { | 4014 | { |
3835 | m_sceneGraph.removeUserCount(false); | 4015 | m_sceneGraph.removeUserCount(false); |
3836 | } | 4016 | } |
3837 | else | 4017 | else if (!childOnly) |
3838 | { | 4018 | { |
3839 | m_sceneGraph.removeUserCount(true); | 4019 | m_sceneGraph.removeUserCount(true); |
3840 | } | 4020 | } |
@@ -3850,9 +4030,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
3850 | } | 4030 | } |
3851 | else | 4031 | else |
3852 | presence.ControllingClient.SendShutdownConnectionNotice(); | 4032 | presence.ControllingClient.SendShutdownConnectionNotice(); |
4033 | presence.ControllingClient.Close(false); | ||
4034 | } | ||
4035 | else if (!childOnly) | ||
4036 | { | ||
4037 | presence.ControllingClient.Close(true); | ||
3853 | } | 4038 | } |
3854 | |||
3855 | presence.ControllingClient.Close(); | ||
3856 | return true; | 4039 | return true; |
3857 | } | 4040 | } |
3858 | 4041 | ||
@@ -4434,34 +4617,78 @@ namespace OpenSim.Region.Framework.Scenes | |||
4434 | SimulationDataService.RemoveObject(uuid, m_regInfo.RegionID); | 4617 | SimulationDataService.RemoveObject(uuid, m_regInfo.RegionID); |
4435 | } | 4618 | } |
4436 | 4619 | ||
4437 | public int GetHealth() | 4620 | public int GetHealth(out int flags, out string message) |
4438 | { | 4621 | { |
4439 | // Returns: | 4622 | // Returns: |
4440 | // 1 = sim is up and accepting http requests. The heartbeat has | 4623 | // 1 = sim is up and accepting http requests. The heartbeat has |
4441 | // stopped and the sim is probably locked up, but a remote | 4624 | // stopped and the sim is probably locked up, but a remote |
4442 | // admin restart may succeed | 4625 | // admin restart may succeed |
4443 | // | 4626 | // |
4444 | // 2 = Sim is up and the heartbeat is running. The sim is likely | 4627 | // 2 = Sim is up and the heartbeat is running. The sim is likely |
4445 | // usable for people within and logins _may_ work | 4628 | // usable for people within |
4446 | // | 4629 | // |
4447 | // 3 = We have seen a new user enter within the past 4 minutes | 4630 | // 3 = Sim is up and one packet thread is running. Sim is |
4631 | // unstable and will not accept new logins | ||
4632 | // | ||
4633 | // 4 = Sim is up and both packet threads are running. Sim is | ||
4634 | // likely usable | ||
4635 | // | ||
4636 | // 5 = We have seen a new user enter within the past 4 minutes | ||
4448 | // which can be seen as positive confirmation of sim health | 4637 | // which can be seen as positive confirmation of sim health |
4449 | // | 4638 | // |
4639 | |||
4640 | flags = 0; | ||
4641 | message = String.Empty; | ||
4642 | |||
4643 | CheckHeartbeat(); | ||
4644 | |||
4645 | if (m_firstHeartbeat || (m_lastIncoming == 0 && m_lastOutgoing == 0)) | ||
4646 | { | ||
4647 | // We're still starting | ||
4648 | // 0 means "in startup", it can't happen another way, since | ||
4649 | // to get here, we must be able to accept http connections | ||
4650 | return 0; | ||
4651 | } | ||
4652 | |||
4450 | int health=1; // Start at 1, means we're up | 4653 | int health=1; // Start at 1, means we're up |
4451 | 4654 | ||
4452 | if ((Util.EnvironmentTickCountSubtract(m_lastUpdate)) < 1000) | 4655 | if (Util.EnvironmentTickCountSubtract(m_lastUpdate) < 1000) |
4656 | { | ||
4657 | health+=1; | ||
4658 | flags |= 1; | ||
4659 | } | ||
4660 | |||
4661 | if (Util.EnvironmentTickCountSubtract(m_lastIncoming) < 1000) | ||
4662 | { | ||
4453 | health+=1; | 4663 | health+=1; |
4664 | flags |= 2; | ||
4665 | } | ||
4666 | |||
4667 | if (Util.EnvironmentTickCountSubtract(m_lastOutgoing) < 1000) | ||
4668 | { | ||
4669 | health+=1; | ||
4670 | flags |= 4; | ||
4671 | } | ||
4454 | else | 4672 | else |
4673 | { | ||
4674 | int pid = System.Diagnostics.Process.GetCurrentProcess().Id; | ||
4675 | System.Diagnostics.Process proc = new System.Diagnostics.Process(); | ||
4676 | proc.EnableRaisingEvents=false; | ||
4677 | proc.StartInfo.FileName = "/bin/kill"; | ||
4678 | proc.StartInfo.Arguments = "-QUIT " + pid.ToString(); | ||
4679 | proc.Start(); | ||
4680 | proc.WaitForExit(); | ||
4681 | Thread.Sleep(1000); | ||
4682 | Environment.Exit(1); | ||
4683 | } | ||
4684 | |||
4685 | if (flags != 7) | ||
4455 | return health; | 4686 | return health; |
4456 | 4687 | ||
4457 | // A login in the last 4 mins? We can't be doing too badly | 4688 | // A login in the last 4 mins? We can't be doing too badly |
4458 | // | 4689 | // |
4459 | if ((Util.EnvironmentTickCountSubtract(m_LastLogin)) < 240000) | 4690 | if (Util.EnvironmentTickCountSubtract(m_LastLogin) < 240000) |
4460 | health++; | 4691 | health++; |
4461 | else | ||
4462 | return health; | ||
4463 | |||
4464 | CheckHeartbeat(); | ||
4465 | 4692 | ||
4466 | return health; | 4693 | return health; |
4467 | } | 4694 | } |
@@ -4550,7 +4777,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4550 | bool wasUsingPhysics = ((jointProxyObject.Flags & PrimFlags.Physics) != 0); | 4777 | bool wasUsingPhysics = ((jointProxyObject.Flags & PrimFlags.Physics) != 0); |
4551 | if (wasUsingPhysics) | 4778 | if (wasUsingPhysics) |
4552 | { | 4779 | { |
4553 | 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 | 4780 | 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 |
4554 | } | 4781 | } |
4555 | } | 4782 | } |
4556 | 4783 | ||
@@ -4654,7 +4881,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4654 | if (m_firstHeartbeat) | 4881 | if (m_firstHeartbeat) |
4655 | return; | 4882 | return; |
4656 | 4883 | ||
4657 | if (Util.EnvironmentTickCountSubtract(m_lastUpdate) > 2000) | 4884 | if (Util.EnvironmentTickCountSubtract(m_lastUpdate) > 5000) |
4658 | StartTimer(); | 4885 | StartTimer(); |
4659 | } | 4886 | } |
4660 | 4887 | ||
@@ -4668,9 +4895,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
4668 | get { return m_allowScriptCrossings; } | 4895 | get { return m_allowScriptCrossings; } |
4669 | } | 4896 | } |
4670 | 4897 | ||
4671 | public Vector3? GetNearestAllowedPosition(ScenePresence avatar) | 4898 | public Vector3 GetNearestAllowedPosition(ScenePresence avatar) |
4899 | { | ||
4900 | return GetNearestAllowedPosition(avatar, null); | ||
4901 | } | ||
4902 | |||
4903 | public Vector3 GetNearestAllowedPosition(ScenePresence avatar, ILandObject excludeParcel) | ||
4672 | { | 4904 | { |
4673 | ILandObject nearestParcel = GetNearestAllowedParcel(avatar.UUID, avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y); | 4905 | ILandObject nearestParcel = GetNearestAllowedParcel(avatar.UUID, avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y, excludeParcel); |
4674 | 4906 | ||
4675 | if (nearestParcel != null) | 4907 | if (nearestParcel != null) |
4676 | { | 4908 | { |
@@ -4679,10 +4911,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4679 | Vector3? nearestPoint = GetNearestPointInParcelAlongDirectionFromPoint(avatar.AbsolutePosition, dir, nearestParcel); | 4911 | Vector3? nearestPoint = GetNearestPointInParcelAlongDirectionFromPoint(avatar.AbsolutePosition, dir, nearestParcel); |
4680 | if (nearestPoint != null) | 4912 | if (nearestPoint != null) |
4681 | { | 4913 | { |
4682 | // m_log.DebugFormat( | 4914 | Debug.WriteLine("Found a sane previous position based on velocity, sending them to: " + nearestPoint.ToString()); |
4683 | // "[SCENE]: Found a sane previous position based on velocity for {0}, sending them to {1} in {2}", | ||
4684 | // avatar.Name, nearestPoint, nearestParcel.LandData.Name); | ||
4685 | |||
4686 | return nearestPoint.Value; | 4915 | return nearestPoint.Value; |
4687 | } | 4916 | } |
4688 | 4917 | ||
@@ -4692,17 +4921,20 @@ namespace OpenSim.Region.Framework.Scenes | |||
4692 | nearestPoint = GetNearestPointInParcelAlongDirectionFromPoint(avatar.AbsolutePosition, dir, nearestParcel); | 4921 | nearestPoint = GetNearestPointInParcelAlongDirectionFromPoint(avatar.AbsolutePosition, dir, nearestParcel); |
4693 | if (nearestPoint != null) | 4922 | if (nearestPoint != null) |
4694 | { | 4923 | { |
4695 | // m_log.DebugFormat( | 4924 | Debug.WriteLine("They had a zero velocity, sending them to: " + nearestPoint.ToString()); |
4696 | // "[SCENE]: {0} had a zero velocity, sending them to {1}", avatar.Name, nearestPoint); | ||
4697 | |||
4698 | return nearestPoint.Value; | 4925 | return nearestPoint.Value; |
4699 | } | 4926 | } |
4700 | 4927 | ||
4701 | //Ultimate backup if we have no idea where they are | 4928 | ILandObject dest = LandChannel.GetLandObject(avatar.lastKnownAllowedPosition.X, avatar.lastKnownAllowedPosition.Y); |
4702 | // m_log.DebugFormat( | 4929 | if (dest != excludeParcel) |
4703 | // "[SCENE]: No idea where {0} is, sending them to {1}", avatar.Name, avatar.lastKnownAllowedPosition); | 4930 | { |
4931 | // Ultimate backup if we have no idea where they are and | ||
4932 | // the last allowed position was in another parcel | ||
4933 | Debug.WriteLine("Have no idea where they are, sending them to: " + avatar.lastKnownAllowedPosition.ToString()); | ||
4934 | return avatar.lastKnownAllowedPosition; | ||
4935 | } | ||
4704 | 4936 | ||
4705 | return avatar.lastKnownAllowedPosition; | 4937 | // else fall through to region edge |
4706 | } | 4938 | } |
4707 | 4939 | ||
4708 | //Go to the edge, this happens in teleporting to a region with no available parcels | 4940 | //Go to the edge, this happens in teleporting to a region with no available parcels |
@@ -4736,13 +4968,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
4736 | 4968 | ||
4737 | public ILandObject GetNearestAllowedParcel(UUID avatarId, float x, float y) | 4969 | public ILandObject GetNearestAllowedParcel(UUID avatarId, float x, float y) |
4738 | { | 4970 | { |
4971 | return GetNearestAllowedParcel(avatarId, x, y, null); | ||
4972 | } | ||
4973 | |||
4974 | public ILandObject GetNearestAllowedParcel(UUID avatarId, float x, float y, ILandObject excludeParcel) | ||
4975 | { | ||
4739 | List<ILandObject> all = AllParcels(); | 4976 | List<ILandObject> all = AllParcels(); |
4740 | float minParcelDistance = float.MaxValue; | 4977 | float minParcelDistance = float.MaxValue; |
4741 | ILandObject nearestParcel = null; | 4978 | ILandObject nearestParcel = null; |
4742 | 4979 | ||
4743 | foreach (var parcel in all) | 4980 | foreach (var parcel in all) |
4744 | { | 4981 | { |
4745 | if (!parcel.IsEitherBannedOrRestricted(avatarId)) | 4982 | if (!parcel.IsEitherBannedOrRestricted(avatarId) && parcel != excludeParcel) |
4746 | { | 4983 | { |
4747 | float parcelDistance = GetParcelDistancefromPoint(parcel, x, y); | 4984 | float parcelDistance = GetParcelDistancefromPoint(parcel, x, y); |
4748 | if (parcelDistance < minParcelDistance) | 4985 | if (parcelDistance < minParcelDistance) |
@@ -4984,7 +5221,55 @@ namespace OpenSim.Region.Framework.Scenes | |||
4984 | mapModule.GenerateMaptile(); | 5221 | mapModule.GenerateMaptile(); |
4985 | } | 5222 | } |
4986 | 5223 | ||
4987 | private void RegenerateMaptileAndReregister(object sender, ElapsedEventArgs e) | 5224 | // public void CleanDroppedAttachments() |
5225 | // { | ||
5226 | // List<SceneObjectGroup> objectsToDelete = | ||
5227 | // new List<SceneObjectGroup>(); | ||
5228 | // | ||
5229 | // lock (m_cleaningAttachments) | ||
5230 | // { | ||
5231 | // ForEachSOG(delegate (SceneObjectGroup grp) | ||
5232 | // { | ||
5233 | // if (grp.RootPart.Shape.PCode == 0 && grp.RootPart.Shape.State != 0 && (!objectsToDelete.Contains(grp))) | ||
5234 | // { | ||
5235 | // UUID agentID = grp.OwnerID; | ||
5236 | // if (agentID == UUID.Zero) | ||
5237 | // { | ||
5238 | // objectsToDelete.Add(grp); | ||
5239 | // return; | ||
5240 | // } | ||
5241 | // | ||
5242 | // ScenePresence sp = GetScenePresence(agentID); | ||
5243 | // if (sp == null) | ||
5244 | // { | ||
5245 | // objectsToDelete.Add(grp); | ||
5246 | // return; | ||
5247 | // } | ||
5248 | // } | ||
5249 | // }); | ||
5250 | // } | ||
5251 | // | ||
5252 | // foreach (SceneObjectGroup grp in objectsToDelete) | ||
5253 | // { | ||
5254 | // m_log.InfoFormat("[SCENE]: Deleting dropped attachment {0} of user {1}", grp.UUID, grp.OwnerID); | ||
5255 | // DeleteSceneObject(grp, true); | ||
5256 | // } | ||
5257 | // } | ||
5258 | |||
5259 | public void ThreadAlive(int threadCode) | ||
5260 | { | ||
5261 | switch(threadCode) | ||
5262 | { | ||
5263 | case 1: // Incoming | ||
5264 | m_lastIncoming = Util.EnvironmentTickCount(); | ||
5265 | break; | ||
5266 | case 2: // Incoming | ||
5267 | m_lastOutgoing = Util.EnvironmentTickCount(); | ||
5268 | break; | ||
5269 | } | ||
5270 | } | ||
5271 | |||
5272 | public void RegenerateMaptileAndReregister(object sender, ElapsedEventArgs e) | ||
4988 | { | 5273 | { |
4989 | RegenerateMaptile(); | 5274 | RegenerateMaptile(); |
4990 | 5275 | ||
@@ -5003,6 +5288,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
5003 | // child agent creation, thereby emulating the SL behavior. | 5288 | // child agent creation, thereby emulating the SL behavior. |
5004 | public bool QueryAccess(UUID agentID, Vector3 position, out string reason) | 5289 | public bool QueryAccess(UUID agentID, Vector3 position, out string reason) |
5005 | { | 5290 | { |
5291 | reason = "You are banned from the region"; | ||
5292 | |||
5293 | if (Permissions.IsGod(agentID)) | ||
5294 | { | ||
5295 | reason = String.Empty; | ||
5296 | return true; | ||
5297 | } | ||
5298 | |||
5006 | int num = m_sceneGraph.GetNumberOfScenePresences(); | 5299 | int num = m_sceneGraph.GetNumberOfScenePresences(); |
5007 | 5300 | ||
5008 | if (num >= RegionInfo.RegionSettings.AgentLimit) | 5301 | if (num >= RegionInfo.RegionSettings.AgentLimit) |
@@ -5014,6 +5307,41 @@ namespace OpenSim.Region.Framework.Scenes | |||
5014 | } | 5307 | } |
5015 | } | 5308 | } |
5016 | 5309 | ||
5310 | ScenePresence presence = GetScenePresence(agentID); | ||
5311 | IClientAPI client = null; | ||
5312 | AgentCircuitData aCircuit = null; | ||
5313 | |||
5314 | if (presence != null) | ||
5315 | { | ||
5316 | client = presence.ControllingClient; | ||
5317 | if (client != null) | ||
5318 | aCircuit = client.RequestClientInfo(); | ||
5319 | } | ||
5320 | |||
5321 | // We may be called before there is a presence or a client. | ||
5322 | // Fake AgentCircuitData to keep IAuthorizationModule smiling | ||
5323 | if (client == null) | ||
5324 | { | ||
5325 | aCircuit = new AgentCircuitData(); | ||
5326 | aCircuit.AgentID = agentID; | ||
5327 | aCircuit.firstname = String.Empty; | ||
5328 | aCircuit.lastname = String.Empty; | ||
5329 | } | ||
5330 | |||
5331 | try | ||
5332 | { | ||
5333 | if (!AuthorizeUser(aCircuit, out reason)) | ||
5334 | { | ||
5335 | // m_log.DebugFormat("[SCENE]: Denying access for {0}", agentID); | ||
5336 | return false; | ||
5337 | } | ||
5338 | } | ||
5339 | catch (Exception e) | ||
5340 | { | ||
5341 | m_log.DebugFormat("[SCENE]: Exception authorizing agent: {0} "+ e.StackTrace, e.Message); | ||
5342 | return false; | ||
5343 | } | ||
5344 | |||
5017 | if (position == Vector3.Zero) // Teleport | 5345 | if (position == Vector3.Zero) // Teleport |
5018 | { | 5346 | { |
5019 | if (!RegionInfo.EstateSettings.AllowDirectTeleport) | 5347 | if (!RegionInfo.EstateSettings.AllowDirectTeleport) |
@@ -5042,13 +5370,46 @@ namespace OpenSim.Region.Framework.Scenes | |||
5042 | } | 5370 | } |
5043 | } | 5371 | } |
5044 | } | 5372 | } |
5373 | |||
5374 | float posX = 128.0f; | ||
5375 | float posY = 128.0f; | ||
5376 | |||
5377 | if (!TestLandRestrictions(agentID, out reason, ref posX, ref posY)) | ||
5378 | { | ||
5379 | // m_log.DebugFormat("[SCENE]: Denying {0} because they are banned on all parcels", agentID); | ||
5380 | return false; | ||
5381 | } | ||
5382 | } | ||
5383 | else // Walking | ||
5384 | { | ||
5385 | ILandObject land = LandChannel.GetLandObject(position.X, position.Y); | ||
5386 | if (land == null) | ||
5387 | return false; | ||
5388 | |||
5389 | bool banned = land.IsBannedFromLand(agentID); | ||
5390 | bool restricted = land.IsRestrictedFromLand(agentID); | ||
5391 | |||
5392 | if (banned || restricted) | ||
5393 | return false; | ||
5045 | } | 5394 | } |
5046 | 5395 | ||
5047 | reason = String.Empty; | 5396 | reason = String.Empty; |
5048 | return true; | 5397 | return true; |
5049 | } | 5398 | } |
5050 | 5399 | ||
5051 | /// <summary> | 5400 | public void StartTimerWatchdog() |
5401 | { | ||
5402 | m_timerWatchdog.Interval = 1000; | ||
5403 | m_timerWatchdog.Elapsed += TimerWatchdog; | ||
5404 | m_timerWatchdog.AutoReset = true; | ||
5405 | m_timerWatchdog.Start(); | ||
5406 | } | ||
5407 | |||
5408 | public void TimerWatchdog(object sender, ElapsedEventArgs e) | ||
5409 | { | ||
5410 | CheckHeartbeat(); | ||
5411 | } | ||
5412 | |||
5052 | /// This method deals with movement when an avatar is automatically moving (but this is distinct from the | 5413 | /// This method deals with movement when an avatar is automatically moving (but this is distinct from the |
5053 | /// autopilot that moves an avatar to a sit target!. | 5414 | /// autopilot that moves an avatar to a sit target!. |
5054 | /// </summary> | 5415 | /// </summary> |