diff options
Diffstat (limited to 'OpenSim/Region')
-rwxr-xr-x | OpenSim/Region/Framework/Scenes/Scene.cs | 1402 | ||||
-rwxr-xr-x[-rw-r--r--] | OpenSim/Region/Framework/Scenes/SceneGraph.cs | 59 | ||||
-rwxr-xr-x | OpenSim/Region/Framework/Scenes/SimStatsReporter.cs | 221 | ||||
-rwxr-xr-x[-rw-r--r--] | OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | 36 |
4 files changed, 965 insertions, 753 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 906c862..905bde2 100755 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -1,29 +1,29 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://opensimulator.org/ | 2 | * Copyright (c) Contributors, http://opensimulator.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyright | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSimulator Project nor the | 12 | * * Neither the name of the OpenSimulator Project nor the |
13 | * names of its contributors may be used to endorse or promote products | 13 | * names of its contributors may be used to endorse or promote products |
14 | * derived from this software without specific prior written permission. | 14 | * derived from this software without specific prior written permission. |
15 | * | 15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY |
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
@@ -48,7 +48,7 @@ using OpenSim.Region.Framework.Interfaces; | |||
48 | using OpenSim.Region.Framework.Scenes.Scripting; | 48 | using OpenSim.Region.Framework.Scenes.Scripting; |
49 | using OpenSim.Region.Framework.Scenes.Serialization; | 49 | using OpenSim.Region.Framework.Scenes.Serialization; |
50 | using OpenSim.Region.Physics.Manager; | 50 | using OpenSim.Region.Physics.Manager; |
51 | using Timer=System.Timers.Timer; | 51 | using Timer = System.Timers.Timer; |
52 | using TPFlags = OpenSim.Framework.Constants.TeleportFlags; | 52 | using TPFlags = OpenSim.Framework.Constants.TeleportFlags; |
53 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; | 53 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; |
54 | using PermissionMask = OpenSim.Framework.PermissionMask; | 54 | using PermissionMask = OpenSim.Framework.PermissionMask; |
@@ -61,7 +61,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
61 | { | 61 | { |
62 | private const long DEFAULT_MIN_TIME_FOR_PERSISTENCE = 60L; | 62 | private const long DEFAULT_MIN_TIME_FOR_PERSISTENCE = 60L; |
63 | private const long DEFAULT_MAX_TIME_FOR_PERSISTENCE = 600L; | 63 | private const long DEFAULT_MAX_TIME_FOR_PERSISTENCE = 600L; |
64 | |||
65 | public const int m_defaultNumberFramesStored = 10; | ||
64 | 66 | ||
67 | public const int m_defaultNumberFramesStored = 10; | ||
68 | |||
65 | public delegate void SynchronizeSceneHandler(Scene scene); | 69 | public delegate void SynchronizeSceneHandler(Scene scene); |
66 | 70 | ||
67 | #region Fields | 71 | #region Fields |
@@ -103,9 +107,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
103 | /// <summary> | 107 | /// <summary> |
104 | /// If false then physical objects are disabled, though collisions will continue as normal. | 108 | /// If false then physical objects are disabled, though collisions will continue as normal. |
105 | /// </summary> | 109 | /// </summary> |
106 | public bool PhysicsEnabled | 110 | public bool PhysicsEnabled |
107 | { | 111 | { |
108 | get | 112 | get |
109 | { | 113 | { |
110 | return m_physicsEnabled; | 114 | return m_physicsEnabled; |
111 | } | 115 | } |
@@ -119,8 +123,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
119 | IPhysicsParameters physScene = PhysicsScene as IPhysicsParameters; | 123 | IPhysicsParameters physScene = PhysicsScene as IPhysicsParameters; |
120 | 124 | ||
121 | if (physScene != null) | 125 | if (physScene != null) |
122 | physScene.SetPhysicsParameter( | 126 | physScene.SetPhysicsParameter( |
123 | "Active", m_physicsEnabled.ToString(), PhysParameterEntry.APPLY_TO_NONE); | 127 | "Active", m_physicsEnabled.ToString(), PhysParameterEntry.APPLY_TO_NONE); |
124 | } | 128 | } |
125 | } | 129 | } |
126 | } | 130 | } |
@@ -130,10 +134,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
130 | /// <summary> | 134 | /// <summary> |
131 | /// If false then scripts are not enabled on the smiulator | 135 | /// If false then scripts are not enabled on the smiulator |
132 | /// </summary> | 136 | /// </summary> |
133 | public bool ScriptsEnabled | 137 | public bool ScriptsEnabled |
134 | { | 138 | { |
135 | get { return m_scripts_enabled; } | 139 | get { return m_scripts_enabled; } |
136 | set | 140 | set |
137 | { | 141 | { |
138 | if (m_scripts_enabled != value) | 142 | if (m_scripts_enabled != value) |
139 | { | 143 | { |
@@ -145,13 +149,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
145 | foreach (EntityBase ent in entities) | 149 | foreach (EntityBase ent in entities) |
146 | { | 150 | { |
147 | if (ent is SceneObjectGroup) | 151 | if (ent is SceneObjectGroup) |
148 | ((SceneObjectGroup)ent).RemoveScriptInstances(false); | 152 | ((SceneObjectGroup)ent).RemoveScriptInstances(false); |
149 | } | 153 | } |
150 | } | 154 | } |
151 | else | 155 | else |
152 | { | 156 | { |
153 | m_log.Info("Starting all Scripts in Scene"); | 157 | m_log.Info("Starting all Scripts in Scene"); |
154 | 158 | ||
155 | EntityBase[] entities = Entities.GetEntities(); | 159 | EntityBase[] entities = Entities.GetEntities(); |
156 | foreach (EntityBase ent in entities) | 160 | foreach (EntityBase ent in entities) |
157 | { | 161 | { |
@@ -236,8 +240,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
236 | /// <summary> | 240 | /// <summary> |
237 | /// Temporarily setting to trigger appearance resends at 60 second intervals. | 241 | /// Temporarily setting to trigger appearance resends at 60 second intervals. |
238 | /// </summary> | 242 | /// </summary> |
239 | public bool SendPeriodicAppearanceUpdates { get; set; } | 243 | public bool SendPeriodicAppearanceUpdates { get; set; } |
240 | 244 | ||
241 | /// <summary> | 245 | /// <summary> |
242 | /// How much a root agent has to change position before updates are sent to viewers. | 246 | /// How much a root agent has to change position before updates are sent to viewers. |
243 | /// </summary> | 247 | /// </summary> |
@@ -264,10 +268,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
264 | public int ChildTerseUpdatePeriod { get; set; } | 268 | public int ChildTerseUpdatePeriod { get; set; } |
265 | 269 | ||
266 | protected float m_defaultDrawDistance = 255.0f; | 270 | protected float m_defaultDrawDistance = 255.0f; |
267 | public float DefaultDrawDistance | 271 | public float DefaultDrawDistance |
268 | { | 272 | { |
269 | // get { return m_defaultDrawDistance; } | 273 | // get { return m_defaultDrawDistance; } |
270 | get { | 274 | get |
275 | { | ||
271 | if (RegionInfo != null) | 276 | if (RegionInfo != null) |
272 | { | 277 | { |
273 | float largestDimension = Math.Max(RegionInfo.RegionSizeX, RegionInfo.RegionSizeY); | 278 | float largestDimension = Math.Max(RegionInfo.RegionSizeX, RegionInfo.RegionSizeY); |
@@ -280,7 +285,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
280 | 285 | ||
281 | private List<string> m_AllowedViewers = new List<string>(); | 286 | private List<string> m_AllowedViewers = new List<string>(); |
282 | private List<string> m_BannedViewers = new List<string>(); | 287 | private List<string> m_BannedViewers = new List<string>(); |
283 | 288 | ||
284 | // TODO: need to figure out how allow client agents but deny | 289 | // TODO: need to figure out how allow client agents but deny |
285 | // root agents when ACL denies access to root agent | 290 | // root agents when ACL denies access to root agent |
286 | public bool m_strictAccessControl = true; | 291 | public bool m_strictAccessControl = true; |
@@ -367,15 +372,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
367 | /// One can tweak this number to experiment. One current effect of reducing it is to make avatar animations | 372 | /// One can tweak this number to experiment. One current effect of reducing it is to make avatar animations |
368 | /// occur too quickly (viewer 1) or with even more slide (viewer 2). | 373 | /// occur too quickly (viewer 1) or with even more slide (viewer 2). |
369 | /// </remarks> | 374 | /// </remarks> |
370 | public int MinFrameTicks | 375 | public int MinFrameTicks |
371 | { | 376 | { |
372 | get { return m_minFrameTicks; } | 377 | get { return m_minFrameTicks; } |
373 | private set | 378 | private set |
374 | { | 379 | { |
375 | m_minFrameTicks = value; | 380 | m_minFrameTicks = value; |
376 | MinFrameSeconds = (float)m_minFrameTicks / 1000; | 381 | MinFrameSeconds = (float)m_minFrameTicks / 1000; |
377 | } | 382 | } |
378 | } | 383 | } |
379 | private int m_minFrameTicks; | 384 | private int m_minFrameTicks; |
380 | 385 | ||
381 | /// <summary> | 386 | /// <summary> |
@@ -403,7 +408,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
403 | private int m_update_events = 1; | 408 | private int m_update_events = 1; |
404 | private int m_update_backup = 200; | 409 | private int m_update_backup = 200; |
405 | private int m_update_terrain = 50; | 410 | private int m_update_terrain = 50; |
406 | // private int m_update_land = 1; | 411 | // private int m_update_land = 1; |
407 | private int m_update_coarse_locations = 50; | 412 | private int m_update_coarse_locations = 50; |
408 | private int m_update_temp_cleaning = 180; | 413 | private int m_update_temp_cleaning = 180; |
409 | 414 | ||
@@ -434,7 +439,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
434 | /// asynchronously from the update loop. | 439 | /// asynchronously from the update loop. |
435 | /// </summary> | 440 | /// </summary> |
436 | private bool m_cleaningTemps = false; | 441 | private bool m_cleaningTemps = false; |
437 | 442 | ||
438 | /// <summary> | 443 | /// <summary> |
439 | /// Used to control main scene thread looping time when not updating via timer. | 444 | /// Used to control main scene thread looping time when not updating via timer. |
440 | /// </summary> | 445 | /// </summary> |
@@ -489,7 +494,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
489 | if (value) | 494 | if (value) |
490 | { | 495 | { |
491 | if (!m_active) | 496 | if (!m_active) |
492 | Start(false); | 497 | Start(false); |
493 | } | 498 | } |
494 | else | 499 | else |
495 | { | 500 | { |
@@ -526,6 +531,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
526 | get { return m_sceneGraph.PhysicsScene.TimeDilation; } | 531 | get { return m_sceneGraph.PhysicsScene.TimeDilation; } |
527 | } | 532 | } |
528 | 533 | ||
534 | public void setThreadCount(int inUseThreads) | ||
535 | { | ||
536 | // Just pass the thread count information on its way as the Scene | ||
537 | // does not require the value for anything at this time | ||
538 | StatsReporter.SetThreadCount(inUseThreads); | ||
539 | } | ||
540 | |||
529 | public SceneCommunicationService SceneGridService | 541 | public SceneCommunicationService SceneGridService |
530 | { | 542 | { |
531 | get { return m_sceneGridService; } | 543 | get { return m_sceneGridService; } |
@@ -584,7 +596,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
584 | return m_AssetService; | 596 | return m_AssetService; |
585 | } | 597 | } |
586 | } | 598 | } |
587 | 599 | ||
588 | public IAuthorizationService AuthorizationService | 600 | public IAuthorizationService AuthorizationService |
589 | { | 601 | { |
590 | get | 602 | get |
@@ -645,7 +657,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
645 | get | 657 | get |
646 | { | 658 | { |
647 | if (m_LibraryService == null) | 659 | if (m_LibraryService == null) |
648 | m_LibraryService = RequestModuleInterface<ILibraryService>(); | 660 | m_LibraryService = RequestModuleInterface<ILibraryService>(); |
649 | 661 | ||
650 | return m_LibraryService; | 662 | return m_LibraryService; |
651 | } | 663 | } |
@@ -656,7 +668,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
656 | get | 668 | get |
657 | { | 669 | { |
658 | if (m_simulationService == null) | 670 | if (m_simulationService == null) |
659 | m_simulationService = RequestModuleInterface<ISimulationService>(); | 671 | m_simulationService = RequestModuleInterface<ISimulationService>(); |
660 | 672 | ||
661 | return m_simulationService; | 673 | return m_simulationService; |
662 | } | 674 | } |
@@ -667,7 +679,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
667 | get | 679 | get |
668 | { | 680 | { |
669 | if (m_AuthenticationService == null) | 681 | if (m_AuthenticationService == null) |
670 | m_AuthenticationService = RequestModuleInterface<IAuthenticationService>(); | 682 | m_AuthenticationService = RequestModuleInterface<IAuthenticationService>(); |
671 | return m_AuthenticationService; | 683 | return m_AuthenticationService; |
672 | } | 684 | } |
673 | } | 685 | } |
@@ -677,7 +689,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
677 | get | 689 | get |
678 | { | 690 | { |
679 | if (m_PresenceService == null) | 691 | if (m_PresenceService == null) |
680 | m_PresenceService = RequestModuleInterface<IPresenceService>(); | 692 | m_PresenceService = RequestModuleInterface<IPresenceService>(); |
681 | return m_PresenceService; | 693 | return m_PresenceService; |
682 | } | 694 | } |
683 | } | 695 | } |
@@ -687,7 +699,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
687 | get | 699 | get |
688 | { | 700 | { |
689 | if (m_UserAccountService == null) | 701 | if (m_UserAccountService == null) |
690 | m_UserAccountService = RequestModuleInterface<IUserAccountService>(); | 702 | m_UserAccountService = RequestModuleInterface<IUserAccountService>(); |
691 | return m_UserAccountService; | 703 | return m_UserAccountService; |
692 | } | 704 | } |
693 | } | 705 | } |
@@ -697,7 +709,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
697 | get | 709 | get |
698 | { | 710 | { |
699 | if (m_AvatarService == null) | 711 | if (m_AvatarService == null) |
700 | m_AvatarService = RequestModuleInterface<IAvatarService>(); | 712 | m_AvatarService = RequestModuleInterface<IAvatarService>(); |
701 | return m_AvatarService; | 713 | return m_AvatarService; |
702 | } | 714 | } |
703 | } | 715 | } |
@@ -707,7 +719,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
707 | get | 719 | get |
708 | { | 720 | { |
709 | if (m_GridUserService == null) | 721 | if (m_GridUserService == null) |
710 | m_GridUserService = RequestModuleInterface<IGridUserService>(); | 722 | m_GridUserService = RequestModuleInterface<IGridUserService>(); |
711 | return m_GridUserService; | 723 | return m_GridUserService; |
712 | } | 724 | } |
713 | } | 725 | } |
@@ -721,7 +733,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
721 | { | 733 | { |
722 | get { return m_AvatarFactory; } | 734 | get { return m_AvatarFactory; } |
723 | } | 735 | } |
724 | 736 | ||
725 | public ICapabilitiesModule CapsModule | 737 | public ICapabilitiesModule CapsModule |
726 | { | 738 | { |
727 | get { return m_capsModule; } | 739 | get { return m_capsModule; } |
@@ -787,18 +799,20 @@ namespace OpenSim.Region.Framework.Scenes | |||
787 | get { return m_sceneGraph.Entities; } | 799 | get { return m_sceneGraph.Entities; } |
788 | } | 800 | } |
789 | 801 | ||
790 | 802 | ||
791 | // used in sequence see: SpawnPoint() | 803 | // used in sequence see: SpawnPoint() |
792 | private int m_SpawnPoint; | 804 | private int m_SpawnPoint; |
793 | // can be closest/random/sequence | 805 | // can be closest/random/sequence |
794 | public string SpawnPointRouting | 806 | public string SpawnPointRouting |
795 | { | 807 | { |
796 | get; private set; | 808 | get; |
809 | private set; | ||
797 | } | 810 | } |
798 | // allow landmarks to pass | 811 | // allow landmarks to pass |
799 | public bool TelehubAllowLandmarks | 812 | public bool TelehubAllowLandmarks |
800 | { | 813 | { |
801 | get; private set; | 814 | get; |
815 | private set; | ||
802 | } | 816 | } |
803 | 817 | ||
804 | #endregion Properties | 818 | #endregion Properties |
@@ -806,10 +820,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
806 | #region Constructors | 820 | #region Constructors |
807 | 821 | ||
808 | public Scene(RegionInfo regInfo, AgentCircuitManager authen, PhysicsScene physicsScene, | 822 | public Scene(RegionInfo regInfo, AgentCircuitManager authen, PhysicsScene physicsScene, |
809 | SceneCommunicationService sceneGridService, | 823 | SceneCommunicationService sceneGridService, |
810 | ISimulationDataService simDataService, IEstateDataService estateDataService, | 824 | ISimulationDataService simDataService, IEstateDataService estateDataService, |
811 | IConfigSource config, string simulatorVersion) | 825 | IConfigSource config, string simulatorVersion) |
812 | : this(regInfo, physicsScene) | 826 | : this(regInfo, physicsScene) |
813 | { | 827 | { |
814 | m_config = config; | 828 | m_config = config; |
815 | MinFrameTicks = 89; | 829 | MinFrameTicks = 89; |
@@ -866,20 +880,20 @@ namespace OpenSim.Region.Framework.Scenes | |||
866 | } | 880 | } |
867 | 881 | ||
868 | if (updatedTerrainTextures) | 882 | if (updatedTerrainTextures) |
869 | rs.Save(); | 883 | rs.Save(); |
870 | 884 | ||
871 | RegionInfo.RegionSettings = rs; | 885 | RegionInfo.RegionSettings = rs; |
872 | 886 | ||
873 | if (estateDataService != null) | 887 | if (estateDataService != null) |
874 | RegionInfo.EstateSettings = estateDataService.LoadEstateSettings(RegionInfo.RegionID, false); | 888 | RegionInfo.EstateSettings = estateDataService.LoadEstateSettings(RegionInfo.RegionID, false); |
875 | 889 | ||
876 | #endregion Region Settings | 890 | #endregion Region Settings |
877 | 891 | ||
878 | //Bind Storage Manager functions to some land manager functions for this scene | 892 | //Bind Storage Manager functions to some land manager functions for this scene |
879 | EventManager.OnLandObjectAdded += | 893 | EventManager.OnLandObjectAdded += |
880 | new EventManager.LandObjectAdded(simDataService.StoreLandObject); | 894 | new EventManager.LandObjectAdded(simDataService.StoreLandObject); |
881 | EventManager.OnLandObjectRemoved += | 895 | EventManager.OnLandObjectRemoved += |
882 | new EventManager.LandObjectRemoved(simDataService.RemoveLandObject); | 896 | new EventManager.LandObjectRemoved(simDataService.RemoveLandObject); |
883 | 897 | ||
884 | RegisterDefaultSceneEvents(); | 898 | RegisterDefaultSceneEvents(); |
885 | 899 | ||
@@ -904,8 +918,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
904 | m_defaultDrawDistance = startupConfig.GetFloat("DefaultDrawDistance", m_defaultDrawDistance); | 918 | m_defaultDrawDistance = startupConfig.GetFloat("DefaultDrawDistance", m_defaultDrawDistance); |
905 | UseBackup = startupConfig.GetBoolean("UseSceneBackup", UseBackup); | 919 | UseBackup = startupConfig.GetBoolean("UseSceneBackup", UseBackup); |
906 | if (!UseBackup) | 920 | if (!UseBackup) |
907 | m_log.InfoFormat("[SCENE]: Backup has been disabled for {0}", RegionInfo.RegionName); | 921 | m_log.InfoFormat("[SCENE]: Backup has been disabled for {0}", RegionInfo.RegionName); |
908 | 922 | ||
909 | //Animation states | 923 | //Animation states |
910 | m_useFlySlow = startupConfig.GetBoolean("enableflyslow", false); | 924 | m_useFlySlow = startupConfig.GetBoolean("enableflyslow", false); |
911 | 925 | ||
@@ -959,10 +973,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
959 | m_trustBinaries = startupConfig.GetBoolean("TrustBinaries", m_trustBinaries); | 973 | m_trustBinaries = startupConfig.GetBoolean("TrustBinaries", m_trustBinaries); |
960 | m_allowScriptCrossings = startupConfig.GetBoolean("AllowScriptCrossing", m_allowScriptCrossings); | 974 | m_allowScriptCrossings = startupConfig.GetBoolean("AllowScriptCrossing", m_allowScriptCrossings); |
961 | m_dontPersistBefore = | 975 | m_dontPersistBefore = |
962 | startupConfig.GetLong("MinimumTimeBeforePersistenceConsidered", DEFAULT_MIN_TIME_FOR_PERSISTENCE); | 976 | startupConfig.GetLong("MinimumTimeBeforePersistenceConsidered", DEFAULT_MIN_TIME_FOR_PERSISTENCE); |
963 | m_dontPersistBefore *= 10000000; | 977 | m_dontPersistBefore *= 10000000; |
964 | m_persistAfter = | 978 | m_persistAfter = |
965 | startupConfig.GetLong("MaximumTimeBeforePersistenceConsidered", DEFAULT_MAX_TIME_FOR_PERSISTENCE); | 979 | startupConfig.GetLong("MaximumTimeBeforePersistenceConsidered", DEFAULT_MAX_TIME_FOR_PERSISTENCE); |
966 | m_persistAfter *= 10000000; | 980 | m_persistAfter *= 10000000; |
967 | 981 | ||
968 | m_defaultScriptEngine = startupConfig.GetString("DefaultScriptEngine", "XEngine"); | 982 | m_defaultScriptEngine = startupConfig.GetString("DefaultScriptEngine", "XEngine"); |
@@ -974,8 +988,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
974 | 988 | ||
975 | string[] possibleMapConfigSections = new string[] { "Map", "Startup" }; | 989 | string[] possibleMapConfigSections = new string[] { "Map", "Startup" }; |
976 | 990 | ||
977 | m_generateMaptiles | 991 | m_generateMaptiles |
978 | = Util.GetConfigVarFromSections<bool>(config, "GenerateMaptiles", possibleMapConfigSections, true); | 992 | = Util.GetConfigVarFromSections<bool>(config, "GenerateMaptiles", possibleMapConfigSections, true); |
979 | 993 | ||
980 | if (m_generateMaptiles) | 994 | if (m_generateMaptiles) |
981 | { | 995 | { |
@@ -991,9 +1005,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
991 | } | 1005 | } |
992 | else | 1006 | else |
993 | { | 1007 | { |
994 | string tile | 1008 | string tile |
995 | = Util.GetConfigVarFromSections<string>( | 1009 | = Util.GetConfigVarFromSections<string>( |
996 | config, "MaptileStaticUUID", possibleMapConfigSections, UUID.Zero.ToString()); | 1010 | config, "MaptileStaticUUID", possibleMapConfigSections, UUID.Zero.ToString()); |
997 | 1011 | ||
998 | UUID tileID; | 1012 | UUID tileID; |
999 | 1013 | ||
@@ -1010,9 +1024,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
1010 | 1024 | ||
1011 | string[] possibleAccessControlConfigSections = new string[] { "AccessControl", "Startup" }; | 1025 | string[] possibleAccessControlConfigSections = new string[] { "AccessControl", "Startup" }; |
1012 | 1026 | ||
1013 | string grant | 1027 | string grant |
1014 | = Util.GetConfigVarFromSections<string>( | 1028 | = Util.GetConfigVarFromSections<string>( |
1015 | config, "AllowedClients", possibleAccessControlConfigSections, ""); | 1029 | config, "AllowedClients", possibleAccessControlConfigSections, ""); |
1016 | 1030 | ||
1017 | if (grant.Length > 0) | 1031 | if (grant.Length > 0) |
1018 | { | 1032 | { |
@@ -1022,9 +1036,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
1022 | } | 1036 | } |
1023 | } | 1037 | } |
1024 | 1038 | ||
1025 | grant | 1039 | grant |
1026 | = Util.GetConfigVarFromSections<string>( | 1040 | = Util.GetConfigVarFromSections<string>( |
1027 | config, "BannedClients", possibleAccessControlConfigSections, ""); | 1041 | config, "BannedClients", possibleAccessControlConfigSections, ""); |
1028 | 1042 | ||
1029 | if (grant.Length > 0) | 1043 | if (grant.Length > 0) |
1030 | { | 1044 | { |
@@ -1035,27 +1049,27 @@ namespace OpenSim.Region.Framework.Scenes | |||
1035 | } | 1049 | } |
1036 | 1050 | ||
1037 | if (startupConfig.Contains("MinFrameTime")) | 1051 | if (startupConfig.Contains("MinFrameTime")) |
1038 | MinFrameTicks = (int)(startupConfig.GetFloat("MinFrameTime") * 1000); | 1052 | MinFrameTicks = (int)(startupConfig.GetFloat("MinFrameTime") * 1000); |
1039 | 1053 | ||
1040 | m_update_backup = startupConfig.GetInt( "UpdateStorageEveryNFrames", m_update_backup); | 1054 | m_update_backup = startupConfig.GetInt("UpdateStorageEveryNFrames", m_update_backup); |
1041 | m_update_coarse_locations = startupConfig.GetInt( "UpdateCoarseLocationsEveryNFrames", m_update_coarse_locations); | 1055 | m_update_coarse_locations = startupConfig.GetInt("UpdateCoarseLocationsEveryNFrames", m_update_coarse_locations); |
1042 | m_update_entitymovement = startupConfig.GetInt( "UpdateEntityMovementEveryNFrames", m_update_entitymovement); | 1056 | m_update_entitymovement = startupConfig.GetInt("UpdateEntityMovementEveryNFrames", m_update_entitymovement); |
1043 | m_update_events = startupConfig.GetInt( "UpdateEventsEveryNFrames", m_update_events); | 1057 | m_update_events = startupConfig.GetInt("UpdateEventsEveryNFrames", m_update_events); |
1044 | m_update_objects = startupConfig.GetInt( "UpdateObjectsEveryNFrames", m_update_objects); | 1058 | m_update_objects = startupConfig.GetInt("UpdateObjectsEveryNFrames", m_update_objects); |
1045 | m_update_physics = startupConfig.GetInt( "UpdatePhysicsEveryNFrames", m_update_physics); | 1059 | m_update_physics = startupConfig.GetInt("UpdatePhysicsEveryNFrames", m_update_physics); |
1046 | m_update_presences = startupConfig.GetInt( "UpdateAgentsEveryNFrames", m_update_presences); | 1060 | m_update_presences = startupConfig.GetInt("UpdateAgentsEveryNFrames", m_update_presences); |
1047 | m_update_terrain = startupConfig.GetInt( "UpdateTerrainEveryNFrames", m_update_terrain); | 1061 | m_update_terrain = startupConfig.GetInt("UpdateTerrainEveryNFrames", m_update_terrain); |
1048 | m_update_temp_cleaning = startupConfig.GetInt( "UpdateTempCleaningEveryNSeconds", m_update_temp_cleaning); | 1062 | m_update_temp_cleaning = startupConfig.GetInt("UpdateTempCleaningEveryNSeconds", m_update_temp_cleaning); |
1049 | } | 1063 | } |
1050 | 1064 | ||
1051 | // FIXME: Ultimately this should be in a module. | 1065 | // FIXME: Ultimately this should be in a module. |
1052 | SendPeriodicAppearanceUpdates = false; | 1066 | SendPeriodicAppearanceUpdates = false; |
1053 | 1067 | ||
1054 | IConfig appearanceConfig = m_config.Configs["Appearance"]; | 1068 | IConfig appearanceConfig = m_config.Configs["Appearance"]; |
1055 | if (appearanceConfig != null) | 1069 | if (appearanceConfig != null) |
1056 | { | 1070 | { |
1057 | SendPeriodicAppearanceUpdates | 1071 | SendPeriodicAppearanceUpdates |
1058 | = appearanceConfig.GetBoolean("ResendAppearanceUpdates", SendPeriodicAppearanceUpdates); | 1072 | = appearanceConfig.GetBoolean("ResendAppearanceUpdates", SendPeriodicAppearanceUpdates); |
1059 | } | 1073 | } |
1060 | 1074 | ||
1061 | #endregion Region Config | 1075 | #endregion Region Config |
@@ -1083,58 +1097,68 @@ namespace OpenSim.Region.Framework.Scenes | |||
1083 | UpdatePrioritizationScheme = UpdatePrioritizationSchemes.Time; | 1097 | UpdatePrioritizationScheme = UpdatePrioritizationSchemes.Time; |
1084 | } | 1098 | } |
1085 | 1099 | ||
1086 | IsReprioritizationEnabled | 1100 | IsReprioritizationEnabled |
1087 | = interestConfig.GetBoolean("ReprioritizationEnabled", IsReprioritizationEnabled); | 1101 | = interestConfig.GetBoolean("ReprioritizationEnabled", IsReprioritizationEnabled); |
1088 | ReprioritizationInterval | 1102 | ReprioritizationInterval |
1089 | = interestConfig.GetDouble("ReprioritizationInterval", ReprioritizationInterval); | 1103 | = interestConfig.GetDouble("ReprioritizationInterval", ReprioritizationInterval); |
1090 | RootReprioritizationDistance | 1104 | RootReprioritizationDistance |
1091 | = interestConfig.GetDouble("RootReprioritizationDistance", RootReprioritizationDistance); | 1105 | = interestConfig.GetDouble("RootReprioritizationDistance", RootReprioritizationDistance); |
1092 | ChildReprioritizationDistance | 1106 | ChildReprioritizationDistance |
1093 | = interestConfig.GetDouble("ChildReprioritizationDistance", ChildReprioritizationDistance); | 1107 | = interestConfig.GetDouble("ChildReprioritizationDistance", ChildReprioritizationDistance); |
1094 | 1108 | ||
1095 | RootTerseUpdatePeriod = interestConfig.GetInt("RootTerseUpdatePeriod", RootTerseUpdatePeriod); | 1109 | RootTerseUpdatePeriod = interestConfig.GetInt("RootTerseUpdatePeriod", RootTerseUpdatePeriod); |
1096 | ChildTerseUpdatePeriod = interestConfig.GetInt("ChildTerseUpdatePeriod", ChildTerseUpdatePeriod); | 1110 | ChildTerseUpdatePeriod = interestConfig.GetInt("ChildTerseUpdatePeriod", ChildTerseUpdatePeriod); |
1097 | 1111 | ||
1098 | RootPositionUpdateTolerance | 1112 | RootPositionUpdateTolerance |
1099 | = interestConfig.GetFloat("RootPositionUpdateTolerance", RootPositionUpdateTolerance); | 1113 | = interestConfig.GetFloat("RootPositionUpdateTolerance", RootPositionUpdateTolerance); |
1100 | RootRotationUpdateTolerance | 1114 | RootRotationUpdateTolerance |
1101 | = interestConfig.GetFloat("RootRotationUpdateTolerance", RootRotationUpdateTolerance); | 1115 | = interestConfig.GetFloat("RootRotationUpdateTolerance", RootRotationUpdateTolerance); |
1102 | RootVelocityUpdateTolerance | 1116 | RootVelocityUpdateTolerance |
1103 | = interestConfig.GetFloat("RootVelocityUpdateTolerance", RootVelocityUpdateTolerance); | 1117 | = interestConfig.GetFloat("RootVelocityUpdateTolerance", RootVelocityUpdateTolerance); |
1104 | } | 1118 | } |
1105 | 1119 | ||
1106 | m_log.DebugFormat("[SCENE]: Using the {0} prioritization scheme", UpdatePrioritizationScheme); | 1120 | m_log.DebugFormat("[SCENE]: Using the {0} prioritization scheme", UpdatePrioritizationScheme); |
1107 | 1121 | ||
1108 | #endregion Interest Management | 1122 | #endregion Interest Management |
1109 | 1123 | ||
1124 | // The timer used by the Stopwatch class depends on the system hardware and operating system; inform | ||
1125 | // if the timer is based on a high-resolution performance counter or based on the system timer; | ||
1126 | // the performance counter will provide a more precise time than the system timer | ||
1127 | if (Stopwatch.IsHighResolution) | ||
1128 | m_log.InfoFormat("[SCENE]: Using high-resolution performance counter for statistics."); | ||
1129 | else | ||
1130 | m_log.InfoFormat("[SCENE]: Using system timer for statistics."); | ||
1131 | |||
1110 | // Acquire the statistics section of the OpenSim.ini file located | 1132 | // Acquire the statistics section of the OpenSim.ini file located |
1111 | // in the bin directory | 1133 | // in the bin directory |
1112 | IConfig statisticsConfig = m_config.Configs["Statistics"]; | 1134 | IConfig statisticsConfig = m_config.Configs["Statistics"]; |
1113 | 1135 | ||
1114 | // Confirm that the statistics section existed in the configuration | 1136 | // Confirm that the statistics section existed in the configuration |
1115 | // file | 1137 | // file |
1116 | if (statisticsConfig != null) | 1138 | if (statisticsConfig != null) |
1117 | { | 1139 | { |
1118 | // Create the StatsReporter using the number of frames to store | 1140 | // Create the StatsReporter using the number of frames to store |
1119 | // for the frame time statistics, or 10 frames if the config | 1141 | // for the frame time statistics, or 10 frames if the config |
1120 | // file doesn't contain a value | 1142 | // file doesn't contain a value |
1121 | StatsReporter = new SimStatsReporter(this, | 1143 | StatsReporter = new SimStatsReporter(this, |
1122 | statisticsConfig.GetInt("NumberOfFrames", 10)); | 1144 | statisticsConfig.GetInt("NumberOfFrames", |
1145 | m_defaultNumberFramesStored)); | ||
1123 | } | 1146 | } |
1124 | else | 1147 | else |
1125 | { | 1148 | { |
1126 | // Create a StatsReporter with the current scene and a default | 1149 | // Create a StatsReporter with the current scene and a default |
1127 | // 10 frames stored for the frame time statistics | 1150 | // 10 frames stored for the frame time statistics |
1128 | StatsReporter = new SimStatsReporter(this); | 1151 | StatsReporter = new SimStatsReporter(this); |
1129 | } | 1152 | } |
1130 | 1153 | ||
1131 | StatsReporter.OnSendStatsResult += SendSimStatsPackets; | 1154 | StatsReporter.OnSendStatsResult += SendSimStatsPackets; |
1132 | StatsReporter.OnStatsIncorrect += m_sceneGraph.RecalculateStats; | 1155 | StatsReporter.OnStatsIncorrect += m_sceneGraph.RecalculateStats; |
1133 | 1156 | ||
1134 | } | 1157 | } |
1135 | 1158 | ||
1136 | public Scene(RegionInfo regInfo, PhysicsScene physicsScene) : base(regInfo) | 1159 | public Scene(RegionInfo regInfo, PhysicsScene physicsScene) |
1137 | { | 1160 | : base(regInfo) |
1161 | { | ||
1138 | m_sceneGraph = new SceneGraph(this); | 1162 | m_sceneGraph = new SceneGraph(this); |
1139 | m_sceneGraph.PhysicsScene = physicsScene; | 1163 | m_sceneGraph.PhysicsScene = physicsScene; |
1140 | 1164 | ||
@@ -1144,11 +1168,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
1144 | // | 1168 | // |
1145 | // Out of memory | 1169 | // Out of memory |
1146 | // Operating system has killed the plugin | 1170 | // Operating system has killed the plugin |
1147 | m_sceneGraph.UnRecoverableError | 1171 | m_sceneGraph.UnRecoverableError |
1148 | += () => | 1172 | += () => |
1149 | { | 1173 | { |
1150 | m_log.ErrorFormat("[SCENE]: Restarting region {0} due to unrecoverable physics crash", Name); | 1174 | m_log.ErrorFormat("[SCENE]: Restarting region {0} due to unrecoverable physics crash", Name); |
1151 | RestartNow(); | 1175 | RestartNow(); |
1152 | }; | 1176 | }; |
1153 | 1177 | ||
1154 | PhysicalPrims = true; | 1178 | PhysicalPrims = true; |
@@ -1193,7 +1217,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1193 | IDialogModule dm = RequestModuleInterface<IDialogModule>(); | 1217 | IDialogModule dm = RequestModuleInterface<IDialogModule>(); |
1194 | 1218 | ||
1195 | if (dm != null) | 1219 | if (dm != null) |
1196 | m_eventManager.OnPermissionError += dm.SendAlertToUser; | 1220 | m_eventManager.OnPermissionError += dm.SendAlertToUser; |
1197 | 1221 | ||
1198 | m_eventManager.OnSignificantClientMovement += HandleOnSignificantClientMovement; | 1222 | m_eventManager.OnSignificantClientMovement += HandleOnSignificantClientMovement; |
1199 | } | 1223 | } |
@@ -1223,7 +1247,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1223 | //int resultY = Math.Abs((int)ycell - (int)RegionInfo.RegionLocY); | 1247 | //int resultY = Math.Abs((int)ycell - (int)RegionInfo.RegionLocY); |
1224 | //if (resultX <= 1 && resultY <= 1) | 1248 | //if (resultX <= 1 && resultY <= 1) |
1225 | float dist = (float)Math.Max(DefaultDrawDistance, | 1249 | float dist = (float)Math.Max(DefaultDrawDistance, |
1226 | (float)Math.Max(RegionInfo.RegionSizeX, RegionInfo.RegionSizeY)); | 1250 | (float)Math.Max(RegionInfo.RegionSizeX, RegionInfo.RegionSizeY)); |
1227 | uint newRegionX, newRegionY, thisRegionX, thisRegionY; | 1251 | uint newRegionX, newRegionY, thisRegionX, thisRegionY; |
1228 | Util.RegionHandleToRegionLoc(otherRegion.RegionHandle, out newRegionX, out newRegionY); | 1252 | Util.RegionHandleToRegionLoc(otherRegion.RegionHandle, out newRegionX, out newRegionY); |
1229 | Util.RegionHandleToRegionLoc(RegionInfo.RegionHandle, out thisRegionX, out thisRegionY); | 1253 | Util.RegionHandleToRegionLoc(RegionInfo.RegionHandle, out thisRegionX, out thisRegionY); |
@@ -1247,7 +1271,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1247 | old.Add(otherRegion.RegionHandle); | 1271 | old.Add(otherRegion.RegionHandle); |
1248 | agent.DropOldNeighbours(old); | 1272 | agent.DropOldNeighbours(old); |
1249 | if (EntityTransferModule != null && agent.PresenceType != PresenceType.Npc) | 1273 | if (EntityTransferModule != null && agent.PresenceType != PresenceType.Npc) |
1250 | EntityTransferModule.EnableChildAgent(agent, otherRegion); | 1274 | EntityTransferModule.EnableChildAgent(agent, otherRegion); |
1251 | }); | 1275 | }); |
1252 | } | 1276 | } |
1253 | catch (NullReferenceException) | 1277 | catch (NullReferenceException) |
@@ -1260,8 +1284,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
1260 | else | 1284 | else |
1261 | { | 1285 | { |
1262 | m_log.InfoFormat( | 1286 | m_log.InfoFormat( |
1263 | "[SCENE]: Got notice about far away Region: {0} at ({1}, {2})", | 1287 | "[SCENE]: Got notice about far away Region: {0} at ({1}, {2})", |
1264 | otherRegion.RegionName, otherRegion.RegionLocX, otherRegion.RegionLocY); | 1288 | otherRegion.RegionName, otherRegion.RegionLocX, otherRegion.RegionLocY); |
1265 | } | 1289 | } |
1266 | } | 1290 | } |
1267 | } | 1291 | } |
@@ -1339,7 +1363,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1339 | ForEachRootScenePresence(delegate(ScenePresence agent) | 1363 | ForEachRootScenePresence(delegate(ScenePresence agent) |
1340 | { | 1364 | { |
1341 | if (EntityTransferModule != null && agent.PresenceType != PresenceType.Npc) | 1365 | if (EntityTransferModule != null && agent.PresenceType != PresenceType.Npc) |
1342 | EntityTransferModule.EnableChildAgent(agent, r); | 1366 | EntityTransferModule.EnableChildAgent(agent, r); |
1343 | }); | 1367 | }); |
1344 | } | 1368 | } |
1345 | catch (NullReferenceException) | 1369 | catch (NullReferenceException) |
@@ -1377,14 +1401,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
1377 | 1401 | ||
1378 | // Kick all ROOT agents with the message, 'The simulator is going down' | 1402 | // Kick all ROOT agents with the message, 'The simulator is going down' |
1379 | ForEachScenePresence(delegate(ScenePresence avatar) | 1403 | ForEachScenePresence(delegate(ScenePresence avatar) |
1380 | { | 1404 | { |
1381 | avatar.RemoveNeighbourRegion(RegionInfo.RegionHandle); | 1405 | avatar.RemoveNeighbourRegion(RegionInfo.RegionHandle); |
1382 | 1406 | ||
1383 | if (!avatar.IsChildAgent) | 1407 | if (!avatar.IsChildAgent) |
1384 | avatar.ControllingClient.Kick("The simulator is going down."); | 1408 | avatar.ControllingClient.Kick("The simulator is going down."); |
1385 | 1409 | ||
1386 | avatar.ControllingClient.SendShutdownConnectionNotice(); | 1410 | avatar.ControllingClient.SendShutdownConnectionNotice(); |
1387 | }); | 1411 | }); |
1388 | 1412 | ||
1389 | // Stop updating the scene objects and agents. | 1413 | // Stop updating the scene objects and agents. |
1390 | m_shuttingDown = true; | 1414 | m_shuttingDown = true; |
@@ -1403,7 +1427,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1403 | m_sceneGraph.Close(); | 1427 | m_sceneGraph.Close(); |
1404 | 1428 | ||
1405 | if (!GridService.DeregisterRegion(RegionInfo.RegionID)) | 1429 | if (!GridService.DeregisterRegion(RegionInfo.RegionID)) |
1406 | m_log.WarnFormat("[SCENE]: Deregister from grid failed for region {0}", Name); | 1430 | m_log.WarnFormat("[SCENE]: Deregister from grid failed for region {0}", Name); |
1407 | 1431 | ||
1408 | base.Close(); | 1432 | base.Close(); |
1409 | 1433 | ||
@@ -1434,12 +1458,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
1434 | public void Start(bool startScripts) | 1458 | public void Start(bool startScripts) |
1435 | { | 1459 | { |
1436 | if (IsRunning) | 1460 | if (IsRunning) |
1437 | return; | 1461 | return; |
1438 | 1462 | ||
1439 | m_isRunning = true; | 1463 | m_isRunning = true; |
1440 | m_active = true; | 1464 | m_active = true; |
1441 | 1465 | ||
1442 | // m_log.DebugFormat("[SCENE]: Starting Heartbeat timer for {0}", RegionInfo.RegionName); | 1466 | // m_log.DebugFormat("[SCENE]: Starting Heartbeat timer for {0}", RegionInfo.RegionName); |
1443 | if (m_heartbeatThread != null) | 1467 | if (m_heartbeatThread != null) |
1444 | { | 1468 | { |
1445 | m_heartbeatThread.Abort(); | 1469 | m_heartbeatThread.Abort(); |
@@ -1447,8 +1471,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
1447 | } | 1471 | } |
1448 | 1472 | ||
1449 | m_heartbeatThread | 1473 | m_heartbeatThread |
1450 | = WorkManager.StartThread( | 1474 | = WorkManager.StartThread( |
1451 | Heartbeat, string.Format("Heartbeat-({0})", RegionInfo.RegionName.Replace(" ", "_")), ThreadPriority.Normal, false, false); | 1475 | Heartbeat, string.Format("Heartbeat-({0})", RegionInfo.RegionName.Replace(" ", "_")), ThreadPriority.Normal, false, false); |
1452 | 1476 | ||
1453 | StartScripts(); | 1477 | StartScripts(); |
1454 | } | 1478 | } |
@@ -1489,7 +1513,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1489 | Update(1); | 1513 | Update(1); |
1490 | 1514 | ||
1491 | WorkManager.StartThread( | 1515 | WorkManager.StartThread( |
1492 | Maintenance, string.Format("Maintenance ({0})", RegionInfo.RegionName), ThreadPriority.Normal, false, true); | 1516 | Maintenance, string.Format("Maintenance ({0})", RegionInfo.RegionName), ThreadPriority.Normal, false, true); |
1493 | 1517 | ||
1494 | Watchdog.GetCurrentThreadInfo().AlarmIfTimeout = true; | 1518 | Watchdog.GetCurrentThreadInfo().AlarmIfTimeout = true; |
1495 | m_lastFrameTick = Util.EnvironmentTickCount(); | 1519 | m_lastFrameTick = Util.EnvironmentTickCount(); |
@@ -1513,15 +1537,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
1513 | private volatile bool m_isTimerUpdateRunning; | 1537 | private volatile bool m_isTimerUpdateRunning; |
1514 | 1538 | ||
1515 | private void Update(object sender, ElapsedEventArgs e) | 1539 | private void Update(object sender, ElapsedEventArgs e) |
1516 | { | 1540 | { |
1517 | if (m_isTimerUpdateRunning) | 1541 | if (m_isTimerUpdateRunning) |
1518 | return; | 1542 | return; |
1519 | 1543 | ||
1520 | m_isTimerUpdateRunning = true; | 1544 | m_isTimerUpdateRunning = true; |
1521 | 1545 | ||
1522 | // If the last frame did not complete on time, then immediately start the next update on the same thread | 1546 | // If the last frame did not complete on time, then immediately start the next update on the same thread |
1523 | // and ignore further timed updates until we have a frame that had spare time. | 1547 | // and ignore further timed updates until we have a frame that had spare time. |
1524 | while (!Update(1) && Active) {} | 1548 | while (!Update(1) && Active) { } |
1525 | 1549 | ||
1526 | if (!Active || m_shuttingDown) | 1550 | if (!Active || m_shuttingDown) |
1527 | { | 1551 | { |
@@ -1547,7 +1571,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1547 | int previousMaintenanceTick; | 1571 | int previousMaintenanceTick; |
1548 | 1572 | ||
1549 | if (runs >= 0) | 1573 | if (runs >= 0) |
1550 | endRun = MaintenanceRun + runs; | 1574 | endRun = MaintenanceRun + runs; |
1551 | 1575 | ||
1552 | List<Vector3> coarseLocations; | 1576 | List<Vector3> coarseLocations; |
1553 | List<UUID> avatarUUIDs; | 1577 | List<UUID> avatarUUIDs; |
@@ -1557,7 +1581,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1557 | runtc = Util.EnvironmentTickCount(); | 1581 | runtc = Util.EnvironmentTickCount(); |
1558 | ++MaintenanceRun; | 1582 | ++MaintenanceRun; |
1559 | 1583 | ||
1560 | // m_log.DebugFormat("[SCENE]: Maintenance run {0} in {1}", MaintenanceRun, Name); | 1584 | // m_log.DebugFormat("[SCENE]: Maintenance run {0} in {1}", MaintenanceRun, Name); |
1561 | 1585 | ||
1562 | // Coarse locations relate to positions of green dots on the mini-map (on a SecondLife client) | 1586 | // Coarse locations relate to positions of green dots on the mini-map (on a SecondLife client) |
1563 | if (MaintenanceRun % (m_update_coarse_locations / 10) == 0) | 1587 | if (MaintenanceRun % (m_update_coarse_locations / 10) == 0) |
@@ -1572,7 +1596,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1572 | 1596 | ||
1573 | if (SendPeriodicAppearanceUpdates && MaintenanceRun % 60 == 0) | 1597 | if (SendPeriodicAppearanceUpdates && MaintenanceRun % 60 == 0) |
1574 | { | 1598 | { |
1575 | // m_log.DebugFormat("[SCENE]: Sending periodic appearance updates"); | 1599 | // m_log.DebugFormat("[SCENE]: Sending periodic appearance updates"); |
1576 | 1600 | ||
1577 | if (AvatarFactory != null) | 1601 | if (AvatarFactory != null) |
1578 | { | 1602 | { |
@@ -1583,14 +1607,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
1583 | // Delete temp-on-rez stuff | 1607 | // Delete temp-on-rez stuff |
1584 | if (MaintenanceRun % m_update_temp_cleaning == 0 && !m_cleaningTemps) | 1608 | if (MaintenanceRun % m_update_temp_cleaning == 0 && !m_cleaningTemps) |
1585 | { | 1609 | { |
1586 | // m_log.DebugFormat("[SCENE]: Running temp-on-rez cleaning in {0}", Name); | 1610 | // m_log.DebugFormat("[SCENE]: Running temp-on-rez cleaning in {0}", Name); |
1587 | tmpMS = Util.EnvironmentTickCount(); | 1611 | tmpMS = Util.EnvironmentTickCount(); |
1588 | m_cleaningTemps = true; | 1612 | m_cleaningTemps = true; |
1589 | 1613 | ||
1590 | WorkManager.RunInThread( | 1614 | WorkManager.RunInThread( |
1591 | delegate { CleanTempObjects(); m_cleaningTemps = false; }, | 1615 | delegate { CleanTempObjects(); m_cleaningTemps = false; }, |
1592 | null, | 1616 | null, |
1593 | string.Format("CleanTempObjects ({0})", Name)); | 1617 | string.Format("CleanTempObjects ({0})", Name)); |
1594 | 1618 | ||
1595 | tempOnRezMS = Util.EnvironmentTickCountSubtract(tmpMS); | 1619 | tempOnRezMS = Util.EnvironmentTickCountSubtract(tmpMS); |
1596 | } | 1620 | } |
@@ -1601,19 +1625,19 @@ namespace OpenSim.Region.Framework.Scenes | |||
1601 | m_lastMaintenanceTick = Util.EnvironmentTickCount(); | 1625 | m_lastMaintenanceTick = Util.EnvironmentTickCount(); |
1602 | runtc = Util.EnvironmentTickCountSubtract(m_lastMaintenanceTick, runtc); | 1626 | runtc = Util.EnvironmentTickCountSubtract(m_lastMaintenanceTick, runtc); |
1603 | runtc = MinMaintenanceTicks - runtc; | 1627 | runtc = MinMaintenanceTicks - runtc; |
1604 | 1628 | ||
1605 | if (runtc > 0) | 1629 | if (runtc > 0) |
1606 | m_maintenanceWaitEvent.WaitOne(runtc); | 1630 | m_maintenanceWaitEvent.WaitOne(runtc); |
1607 | 1631 | ||
1608 | // Optionally warn if a frame takes double the amount of time that it should. | 1632 | // Optionally warn if a frame takes double the amount of time that it should. |
1609 | if (DebugUpdates | 1633 | if (DebugUpdates |
1610 | && Util.EnvironmentTickCountSubtract( | 1634 | && Util.EnvironmentTickCountSubtract( |
1611 | m_lastMaintenanceTick, previousMaintenanceTick) > MinMaintenanceTicks * 2) | 1635 | m_lastMaintenanceTick, previousMaintenanceTick) > MinMaintenanceTicks * 2) |
1612 | m_log.WarnFormat( | 1636 | m_log.WarnFormat( |
1613 | "[SCENE]: Maintenance took {0} ms (desired max {1} ms) in {2}", | 1637 | "[SCENE]: Maintenance took {0} ms (desired max {1} ms) in {2}", |
1614 | Util.EnvironmentTickCountSubtract(m_lastMaintenanceTick, previousMaintenanceTick), | 1638 | Util.EnvironmentTickCountSubtract(m_lastMaintenanceTick, previousMaintenanceTick), |
1615 | MinMaintenanceTicks, | 1639 | MinMaintenanceTicks, |
1616 | RegionInfo.RegionName); | 1640 | RegionInfo.RegionName); |
1617 | } | 1641 | } |
1618 | } | 1642 | } |
1619 | 1643 | ||
@@ -1622,7 +1646,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1622 | long? endFrame = null; | 1646 | long? endFrame = null; |
1623 | 1647 | ||
1624 | if (frames >= 0) | 1648 | if (frames >= 0) |
1625 | endFrame = Frame + frames; | 1649 | endFrame = Frame + frames; |
1626 | 1650 | ||
1627 | float physicsFPS = 0f; | 1651 | float physicsFPS = 0f; |
1628 | int previousFrameTick, tmpMS; | 1652 | int previousFrameTick, tmpMS; |
@@ -1641,12 +1665,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
1641 | // Begin the stopwatch to keep track of the time that the frame | 1665 | // Begin the stopwatch to keep track of the time that the frame |
1642 | // started running to determine how long the frame took to complete | 1666 | // started running to determine how long the frame took to complete |
1643 | totalFrameStopwatch.Start(); | 1667 | totalFrameStopwatch.Start(); |
1644 | 1668 | ||
1645 | while (!m_shuttingDown && ((endFrame == null && Active) || Frame < endFrame)) | 1669 | while (!m_shuttingDown && ((endFrame == null && Active) || Frame < endFrame)) |
1646 | { | 1670 | { |
1647 | ++Frame; | 1671 | ++Frame; |
1648 | 1672 | ||
1649 | // m_log.DebugFormat("[SCENE]: Processing frame {0} in {1}", Frame, RegionInfo.RegionName); | 1673 | // m_log.DebugFormat("[SCENE]: Processing frame {0} in {1}", Frame, RegionInfo.RegionName); |
1650 | 1674 | ||
1651 | agentMS = eventMS = backupMS = terrainMS = landMS = spareMS = 0; | 1675 | agentMS = eventMS = backupMS = terrainMS = landMS = spareMS = 0; |
1652 | 1676 | ||
@@ -1667,48 +1691,56 @@ namespace OpenSim.Region.Framework.Scenes | |||
1667 | // at this point in time, the precise values all begin | 1691 | // at this point in time, the precise values all begin |
1668 | // with the keyword precise | 1692 | // with the keyword precise |
1669 | tmpMS = Util.EnvironmentTickCount(); | 1693 | tmpMS = Util.EnvironmentTickCount(); |
1670 | |||
1671 | simFrameStopwatch.Start(); | 1694 | simFrameStopwatch.Start(); |
1672 | UpdateTerrain(); | 1695 | UpdateTerrain(); |
1673 | 1696 | ||
1674 | // Get the simulation frame time that the avatar force | 1697 | // Get the simulation frame time that the avatar force |
1675 | // input took | 1698 | // input took |
1676 | simFrameStopwatch.Stop(); | 1699 | simFrameStopwatch.Stop(); |
1677 | preciseSimFrameTime = | 1700 | preciseSimFrameTime = |
1678 | simFrameStopwatch.Elapsed.TotalMilliseconds; | 1701 | simFrameStopwatch.Elapsed.TotalMilliseconds; |
1679 | terrainMS = Util.EnvironmentTickCountSubtract(tmpMS); | 1702 | terrainMS = Util.EnvironmentTickCountSubtract(tmpMS); |
1680 | } | 1703 | } |
1681 | 1704 | ||
1705 | // At several points inside the code there was a need to | ||
1706 | // create a more precise measurement of time elapsed. This | ||
1707 | // led to the addition of variables that have a similar | ||
1708 | // function and thus remain tightly connected to their | ||
1709 | // original counterparts. However, the original code is | ||
1710 | // not receiving comments from our group because we don't | ||
1711 | // feel right modifying the code to that degree at this | ||
1712 | // point in time, the precise values all begin with the | ||
1713 | // keyword precise | ||
1714 | |||
1682 | tmpMS = Util.EnvironmentTickCount(); | 1715 | tmpMS = Util.EnvironmentTickCount(); |
1683 | 1716 | ||
1684 | // Begin the stopwatch to track the time to prepare physics | 1717 | // Begin the stopwatch to track the time to prepare physics |
1685 | physicsFrameStopwatch.Start(); | 1718 | physicsFrameStopwatch.Start(); |
1686 | if (PhysicsEnabled && Frame % m_update_physics == 0) | 1719 | if (PhysicsEnabled && Frame % m_update_physics == 0) |
1687 | m_sceneGraph.UpdatePreparePhysics(); | 1720 | m_sceneGraph.UpdatePreparePhysics(); |
1688 | 1721 | ||
1689 | // Get the time it took to prepare the physics, this | 1722 | // Get the time it took to prepare the physics, this |
1690 | // would report the most precise time that physics was | 1723 | // would report the most precise time that physics was |
1691 | // running on the machine and should the physics not be | 1724 | // running on the machine and should the physics not be |
1692 | // enabled will report the time it took to check if physics | 1725 | // enabled will report the time it took to check if physics |
1693 | // was enabled | 1726 | // was enabled |
1694 | physicsFrameStopwatch.Stop(); | 1727 | physicsFrameStopwatch.Stop(); |
1695 | precisePhysicsFrameTime = | 1728 | precisePhysicsFrameTime = physicsFrameStopwatch.Elapsed.TotalMilliseconds; |
1696 | physicsFrameStopwatch.Elapsed.TotalMilliseconds; | ||
1697 | physicsMS2 = Util.EnvironmentTickCountSubtract(tmpMS); | 1729 | physicsMS2 = Util.EnvironmentTickCountSubtract(tmpMS); |
1698 | 1730 | ||
1699 | // Apply any pending avatar force input to the avatar's velocity | 1731 | // Apply any pending avatar force input to the avatar's velocity |
1700 | tmpMS = Util.EnvironmentTickCount(); | 1732 | tmpMS = Util.EnvironmentTickCount(); |
1701 | simFrameStopwatch.Restart(); | 1733 | simFrameStopwatch.Restart(); |
1702 | if (Frame % m_update_entitymovement == 0) | 1734 | if (Frame % m_update_entitymovement == 0) |
1703 | m_sceneGraph.UpdateScenePresenceMovement(); | 1735 | m_sceneGraph.UpdateScenePresenceMovement(); |
1704 | 1736 | ||
1705 | // Get the simulation frame time that the avatar force input | 1737 | // Get the simulation frame time that the avatar force input |
1706 | // took | 1738 | // took |
1707 | simFrameStopwatch.Stop(); | 1739 | simFrameStopwatch.Stop(); |
1708 | preciseSimFrameTime += | 1740 | preciseSimFrameTime += |
1709 | simFrameStopwatch.Elapsed.TotalMilliseconds; | 1741 | simFrameStopwatch.Elapsed.TotalMilliseconds; |
1710 | agentMS = Util.EnvironmentTickCountSubtract(tmpMS); | 1742 | agentMS = Util.EnvironmentTickCountSubtract(tmpMS); |
1711 | 1743 | ||
1712 | // Perform the main physics update. This will do the actual work of moving objects and avatars according to their | 1744 | // Perform the main physics update. This will do the actual work of moving objects and avatars according to their |
1713 | // velocity | 1745 | // velocity |
1714 | tmpMS = Util.EnvironmentTickCount(); | 1746 | tmpMS = Util.EnvironmentTickCount(); |
@@ -1716,63 +1748,61 @@ namespace OpenSim.Region.Framework.Scenes | |||
1716 | if (Frame % m_update_physics == 0) | 1748 | if (Frame % m_update_physics == 0) |
1717 | { | 1749 | { |
1718 | if (PhysicsEnabled) | 1750 | if (PhysicsEnabled) |
1719 | physicsFPS = m_sceneGraph.UpdatePhysics(MinFrameSeconds); | 1751 | physicsFPS = m_sceneGraph.UpdatePhysics(MinFrameSeconds); |
1720 | 1752 | ||
1721 | if (SynchronizeScene != null) | 1753 | if (SynchronizeScene != null) |
1722 | SynchronizeScene(this); | 1754 | SynchronizeScene(this); |
1723 | } | 1755 | } |
1724 | 1756 | ||
1725 | // Add the main physics update time to the prepare physics | 1757 | // Add the main physics update time to the prepare physics time |
1726 | // time | ||
1727 | physicsFrameStopwatch.Stop(); | 1758 | physicsFrameStopwatch.Stop(); |
1728 | precisePhysicsFrameTime += | 1759 | precisePhysicsFrameTime += physicsFrameStopwatch.Elapsed.TotalMilliseconds; |
1729 | physicsFrameStopwatch.Elapsed.TotalMilliseconds; | ||
1730 | physicsMS = Util.EnvironmentTickCountSubtract(tmpMS); | 1760 | physicsMS = Util.EnvironmentTickCountSubtract(tmpMS); |
1731 | 1761 | ||
1732 | // Start the stopwatch for the remainder of the simulation | 1762 | // Start the stopwatch for the remainder of the simulation |
1733 | simFrameStopwatch.Restart(); | 1763 | simFrameStopwatch.Restart(); |
1734 | tmpMS = Util.EnvironmentTickCount(); | 1764 | tmpMS = Util.EnvironmentTickCount(); |
1735 | 1765 | ||
1736 | // Check if any objects have reached their targets | 1766 | // Check if any objects have reached their targets |
1737 | CheckAtTargets(); | 1767 | CheckAtTargets(); |
1738 | 1768 | ||
1739 | // Update SceneObjectGroups that have scheduled themselves for updates | 1769 | // Update SceneObjectGroups that have scheduled themselves for updates |
1740 | // Objects queue their updates onto all scene presences | 1770 | // Objects queue their updates onto all scene presences |
1741 | if (Frame % m_update_objects == 0) | 1771 | if (Frame % m_update_objects == 0) |
1742 | m_sceneGraph.UpdateObjectGroups(); | 1772 | m_sceneGraph.UpdateObjectGroups(); |
1743 | 1773 | ||
1744 | // Run through all ScenePresences looking for updates | 1774 | // Run through all ScenePresences looking for updates |
1745 | // Presence updates and queued object updates for each presence are sent to clients | 1775 | // Presence updates and queued object updates for each presence are sent to clients |
1746 | if (Frame % m_update_presences == 0) | 1776 | if (Frame % m_update_presences == 0) |
1747 | m_sceneGraph.UpdatePresences(); | 1777 | m_sceneGraph.UpdatePresences(); |
1748 | 1778 | ||
1749 | agentMS += Util.EnvironmentTickCountSubtract(tmpMS); | 1779 | agentMS += Util.EnvironmentTickCountSubtract(tmpMS); |
1750 | 1780 | ||
1751 | if (Frame % m_update_events == 0) | 1781 | if (Frame % m_update_events == 0) |
1752 | { | 1782 | { |
1753 | tmpMS = Util.EnvironmentTickCount(); | 1783 | tmpMS = Util.EnvironmentTickCount(); |
1754 | UpdateEvents(); | 1784 | UpdateEvents(); |
1755 | eventMS = Util.EnvironmentTickCountSubtract(tmpMS); | 1785 | eventMS = Util.EnvironmentTickCountSubtract(tmpMS); |
1756 | } | 1786 | } |
1757 | 1787 | ||
1758 | if (PeriodicBackup && Frame % m_update_backup == 0) | 1788 | if (PeriodicBackup && Frame % m_update_backup == 0) |
1759 | { | 1789 | { |
1760 | tmpMS = Util.EnvironmentTickCount(); | 1790 | tmpMS = Util.EnvironmentTickCount(); |
1761 | UpdateStorageBackup(); | 1791 | UpdateStorageBackup(); |
1762 | backupMS = Util.EnvironmentTickCountSubtract(tmpMS); | 1792 | backupMS = Util.EnvironmentTickCountSubtract(tmpMS); |
1763 | } | 1793 | } |
1764 | 1794 | ||
1765 | //if (Frame % m_update_land == 0) | 1795 | //if (Frame % m_update_land == 0) |
1766 | //{ | 1796 | //{ |
1767 | // int ldMS = Util.EnvironmentTickCount(); | 1797 | // int ldMS = Util.EnvironmentTickCount(); |
1768 | // UpdateLand(); | 1798 | // UpdateLand(); |
1769 | // landMS = Util.EnvironmentTickCountSubtract(ldMS); | 1799 | // landMS = Util.EnvironmentTickCountSubtract(ldMS); |
1770 | //} | 1800 | //} |
1771 | 1801 | ||
1772 | if (!LoginsEnabled && Frame == 20) | 1802 | if (!LoginsEnabled && Frame == 20) |
1773 | { | 1803 | { |
1774 | // m_log.DebugFormat("{0} {1} {2}", LoginsDisabled, m_sceneGraph.GetActiveScriptsCount(), LoginLock); | 1804 | // m_log.DebugFormat("{0} {1} {2}", LoginsDisabled, m_sceneGraph.GetActiveScriptsCount(), LoginLock); |
1775 | 1805 | ||
1776 | // In 99.9% of cases it is a bad idea to manually force garbage collection. However, | 1806 | // In 99.9% of cases it is a bad idea to manually force garbage collection. However, |
1777 | // this is a rare case where we know we have just went through a long cycle of heap | 1807 | // this is a rare case where we know we have just went through a long cycle of heap |
1778 | // allocations, and there is no more work to be done until someone logs in | 1808 | // allocations, and there is no more work to be done until someone logs in |
@@ -1787,7 +1817,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1787 | } | 1817 | } |
1788 | 1818 | ||
1789 | m_sceneGridService.InformNeighborsThatRegionisUp( | 1819 | m_sceneGridService.InformNeighborsThatRegionisUp( |
1790 | RequestModuleInterface<INeighbourService>(), RegionInfo); | 1820 | RequestModuleInterface<INeighbourService>(), RegionInfo); |
1791 | 1821 | ||
1792 | // Region ready should always be set | 1822 | // Region ready should always be set |
1793 | Ready = true; | 1823 | Ready = true; |
@@ -1798,7 +1828,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1798 | if (m_sceneGraph.GetActiveScriptsCount() == 0) | 1828 | if (m_sceneGraph.GetActiveScriptsCount() == 0) |
1799 | { | 1829 | { |
1800 | // In this case, we leave it to the IRegionReadyModule to enable logins | 1830 | // In this case, we leave it to the IRegionReadyModule to enable logins |
1801 | 1831 | ||
1802 | // LoginLock can currently only be set by a region module implementation. | 1832 | // LoginLock can currently only be set by a region module implementation. |
1803 | // If somehow this hasn't been done then the quickest way to bugfix is to see the | 1833 | // If somehow this hasn't been done then the quickest way to bugfix is to see the |
1804 | // NullReferenceException | 1834 | // NullReferenceException |
@@ -1811,18 +1841,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
1811 | catch (Exception e) | 1841 | catch (Exception e) |
1812 | { | 1842 | { |
1813 | m_log.ErrorFormat( | 1843 | m_log.ErrorFormat( |
1814 | "[SCENE]: Failed on region {0} with exception {1}{2}", | 1844 | "[SCENE]: Failed on region {0} with exception {1}{2}", |
1815 | RegionInfo.RegionName, e.Message, e.StackTrace); | 1845 | RegionInfo.RegionName, e.Message, e.StackTrace); |
1816 | } | 1846 | } |
1817 | 1847 | ||
1818 | EventManager.TriggerRegionHeartbeatEnd(this); | 1848 | EventManager.TriggerRegionHeartbeatEnd(this); |
1819 | otherMS = eventMS + backupMS + terrainMS + landMS; | 1849 | otherMS = eventMS + backupMS + terrainMS + landMS; |
1820 | 1850 | ||
1821 | // Get the elapsed time for the simulation frame | 1851 | // Get the elapsed time for the simulation frame |
1822 | simFrameStopwatch.Stop(); | 1852 | simFrameStopwatch.Stop(); |
1823 | preciseSimFrameTime += | 1853 | preciseSimFrameTime += |
1824 | simFrameStopwatch.Elapsed.TotalMilliseconds; | 1854 | simFrameStopwatch.Elapsed.TotalMilliseconds; |
1825 | 1855 | ||
1826 | if (!UpdateOnTimer) | 1856 | if (!UpdateOnTimer) |
1827 | { | 1857 | { |
1828 | Watchdog.UpdateThread(); | 1858 | Watchdog.UpdateThread(); |
@@ -1830,9 +1860,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
1830 | spareMS = MinFrameTicks - Util.EnvironmentTickCountSubtract(m_lastFrameTick); | 1860 | spareMS = MinFrameTicks - Util.EnvironmentTickCountSubtract(m_lastFrameTick); |
1831 | 1861 | ||
1832 | if (spareMS > 0) | 1862 | if (spareMS > 0) |
1833 | m_updateWaitEvent.WaitOne(spareMS); | 1863 | m_updateWaitEvent.WaitOne(spareMS); |
1834 | else | 1864 | else |
1835 | spareMS = 0; | 1865 | spareMS = 0; |
1836 | } | 1866 | } |
1837 | else | 1867 | else |
1838 | { | 1868 | { |
@@ -1841,15 +1871,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
1841 | 1871 | ||
1842 | // Get the total frame time | 1872 | // Get the total frame time |
1843 | totalFrameStopwatch.Stop(); | 1873 | totalFrameStopwatch.Stop(); |
1844 | preciseTotalFrameTime = | 1874 | preciseTotalFrameTime = |
1845 | totalFrameStopwatch.Elapsed.TotalMilliseconds; | 1875 | totalFrameStopwatch.Elapsed.TotalMilliseconds; |
1846 | 1876 | ||
1847 | // Restart the stopwatch for the total time of the next frame | 1877 | // Restart the stopwatch for the total time of the next frame |
1848 | totalFrameStopwatch.Restart(); | 1878 | totalFrameStopwatch.Restart(); |
1849 | 1879 | ||
1850 | previousFrameTick = m_lastFrameTick; | 1880 | previousFrameTick = m_lastFrameTick; |
1851 | frameMS = Util.EnvironmentTickCountSubtract(m_lastFrameTick); | 1881 | frameMS = Util.EnvironmentTickCountSubtract(m_lastFrameTick); |
1852 | m_lastFrameTick = Util.EnvironmentTickCount(); | 1882 | m_lastFrameTick = Util.EnvironmentTickCount(); |
1853 | 1883 | ||
1854 | // if (Frame%m_update_avatars == 0) | 1884 | // if (Frame%m_update_avatars == 0) |
1855 | // UpdateInWorldTime(); | 1885 | // UpdateInWorldTime(); |
@@ -1866,37 +1896,40 @@ namespace OpenSim.Region.Framework.Scenes | |||
1866 | 1896 | ||
1867 | // Send the correct time values to the stats reporter for the | 1897 | // Send the correct time values to the stats reporter for the |
1868 | // frame times | 1898 | // frame times |
1869 | StatsReporter.addFrameTimeMilliseconds(preciseTotalFrameTime, | 1899 | StatsReporter.addFrameTimeMilliseconds(preciseTotalFrameTime, |
1870 | preciseSimFrameTime, precisePhysicsFrameTime, 0.0); | 1900 | preciseSimFrameTime, precisePhysicsFrameTime, 0.0); |
1871 | 1901 | ||
1872 | // Send the correct number of frames that the physics library | 1902 | // Send the correct number of frames that the physics library |
1873 | // has processed to the stats reporter | 1903 | // has processed to the stats reporter |
1874 | StatsReporter.addPhysicsFrame(1); | 1904 | StatsReporter.addPhysicsFrame(1); |
1875 | 1905 | ||
1876 | // Optionally warn if a frame takes double the amount of time that it should. | 1906 | // Optionally warn if a frame takes double the amount of time that it should. |
1877 | if (DebugUpdates | 1907 | if (DebugUpdates |
1878 | && Util.EnvironmentTickCountSubtract( | 1908 | && Util.EnvironmentTickCountSubtract( |
1879 | m_lastFrameTick, previousFrameTick) > MinFrameTicks * 2) | 1909 | m_lastFrameTick, previousFrameTick) > MinFrameTicks * 2) |
1880 | m_log.WarnFormat( | 1910 | m_log.WarnFormat( |
1881 | "[SCENE]: Frame took {0} ms (desired max {1} ms) in {2}", | 1911 | "[SCENE]: Frame took {0} ms (desired max {1} ms) in {2}", |
1882 | Util.EnvironmentTickCountSubtract(m_lastFrameTick, previousFrameTick), | 1912 | Util.EnvironmentTickCountSubtract(m_lastFrameTick, previousFrameTick), |
1883 | MinFrameTicks, | 1913 | MinFrameTicks, |
1884 | RegionInfo.RegionName); | 1914 | RegionInfo.RegionName); |
1885 | } | 1915 | } |
1886 | 1916 | ||
1917 | // Finished updating scene frame, so stop the total frame's Stopwatch | ||
1918 | totalFrameStopwatch.Stop(); | ||
1919 | |||
1887 | return spareMS >= 0; | 1920 | return spareMS >= 0; |
1888 | } | 1921 | } |
1889 | 1922 | ||
1890 | public void AddGroupTarget(SceneObjectGroup grp) | 1923 | public void AddGroupTarget(SceneObjectGroup grp) |
1891 | { | 1924 | { |
1892 | lock (m_groupsWithTargets) | 1925 | lock (m_groupsWithTargets) |
1893 | m_groupsWithTargets[grp.UUID] = grp; | 1926 | m_groupsWithTargets[grp.UUID] = grp; |
1894 | } | 1927 | } |
1895 | 1928 | ||
1896 | public void RemoveGroupTarget(SceneObjectGroup grp) | 1929 | public void RemoveGroupTarget(SceneObjectGroup grp) |
1897 | { | 1930 | { |
1898 | lock (m_groupsWithTargets) | 1931 | lock (m_groupsWithTargets) |
1899 | m_groupsWithTargets.Remove(grp.UUID); | 1932 | m_groupsWithTargets.Remove(grp.UUID); |
1900 | } | 1933 | } |
1901 | 1934 | ||
1902 | private void CheckAtTargets() | 1935 | private void CheckAtTargets() |
@@ -1906,13 +1939,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
1906 | lock (m_groupsWithTargets) | 1939 | lock (m_groupsWithTargets) |
1907 | { | 1940 | { |
1908 | if (m_groupsWithTargets.Count != 0) | 1941 | if (m_groupsWithTargets.Count != 0) |
1909 | objs = new List<SceneObjectGroup>(m_groupsWithTargets.Values); | 1942 | objs = new List<SceneObjectGroup>(m_groupsWithTargets.Values); |
1910 | } | 1943 | } |
1911 | 1944 | ||
1912 | if (objs != null) | 1945 | if (objs != null) |
1913 | { | 1946 | { |
1914 | foreach (SceneObjectGroup entry in objs) | 1947 | foreach (SceneObjectGroup entry in objs) |
1915 | entry.checkAtTargets(); | 1948 | entry.checkAtTargets(); |
1916 | } | 1949 | } |
1917 | } | 1950 | } |
1918 | 1951 | ||
@@ -1955,7 +1988,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1955 | { | 1988 | { |
1956 | m_eventManager.TriggerOnFrame(); | 1989 | m_eventManager.TriggerOnFrame(); |
1957 | } | 1990 | } |
1958 | 1991 | ||
1959 | /// <summary> | 1992 | /// <summary> |
1960 | /// Backup the scene. | 1993 | /// Backup the scene. |
1961 | /// </summary> | 1994 | /// </summary> |
@@ -1995,13 +2028,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
1995 | // We must fill in a null-terminated 'empty' string here since bytes[0] will crash viewer 3. | 2028 | // We must fill in a null-terminated 'empty' string here since bytes[0] will crash viewer 3. |
1996 | msg.binaryBucket = Util.StringToBytes256("\0"); | 2029 | msg.binaryBucket = Util.StringToBytes256("\0"); |
1997 | if (ret.Value.count > 1) | 2030 | if (ret.Value.count > 1) |
1998 | msg.message = string.Format("Your {0} objects were returned from {1} in region {2} due to {3}", ret.Value.count, ret.Value.location.ToString(), RegionInfo.RegionName, ret.Value.reason); | 2031 | msg.message = string.Format("Your {0} objects were returned from {1} in region {2} due to {3}", ret.Value.count, ret.Value.location.ToString(), RegionInfo.RegionName, ret.Value.reason); |
1999 | else | 2032 | else |
2000 | msg.message = string.Format("Your object {0} was returned from {1} in region {2} due to {3}", ret.Value.objectName, ret.Value.location.ToString(), RegionInfo.RegionName, ret.Value.reason); | 2033 | msg.message = string.Format("Your object {0} was returned from {1} in region {2} due to {3}", ret.Value.objectName, ret.Value.location.ToString(), RegionInfo.RegionName, ret.Value.reason); |
2001 | 2034 | ||
2002 | IMessageTransferModule tr = RequestModuleInterface<IMessageTransferModule>(); | 2035 | IMessageTransferModule tr = RequestModuleInterface<IMessageTransferModule>(); |
2003 | if (tr != null) | 2036 | if (tr != null) |
2004 | tr.SendInstantMessage(msg, delegate(bool success) {}); | 2037 | tr.SendInstantMessage(msg, delegate(bool success) { }); |
2005 | } | 2038 | } |
2006 | m_returns.Clear(); | 2039 | m_returns.Clear(); |
2007 | } | 2040 | } |
@@ -2092,7 +2125,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2092 | IConfig terrainConfig = m_config.Configs["Terrain"]; | 2125 | IConfig terrainConfig = m_config.Configs["Terrain"]; |
2093 | String m_InitialTerrain = "pinhead-island"; | 2126 | String m_InitialTerrain = "pinhead-island"; |
2094 | if (terrainConfig != null) | 2127 | if (terrainConfig != null) |
2095 | m_InitialTerrain = terrainConfig.GetString("InitialTerrain", m_InitialTerrain); | 2128 | m_InitialTerrain = terrainConfig.GetString("InitialTerrain", m_InitialTerrain); |
2096 | 2129 | ||
2097 | m_log.InfoFormat("[TERRAIN]: No default terrain. Generating a new terrain {0}.", m_InitialTerrain); | 2130 | m_log.InfoFormat("[TERRAIN]: No default terrain. Generating a new terrain {0}.", m_InitialTerrain); |
2098 | Heightmap = new TerrainChannel(m_InitialTerrain, (int)RegionInfo.RegionSizeX, (int)RegionInfo.RegionSizeY, (int)RegionInfo.RegionSizeZ); | 2131 | Heightmap = new TerrainChannel(m_InitialTerrain, (int)RegionInfo.RegionSizeX, (int)RegionInfo.RegionSizeY, (int)RegionInfo.RegionSizeZ); |
@@ -2107,11 +2140,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
2107 | catch (IOException e) | 2140 | catch (IOException e) |
2108 | { | 2141 | { |
2109 | m_log.WarnFormat( | 2142 | m_log.WarnFormat( |
2110 | "[TERRAIN]: Scene.cs: LoadWorldMap() - Regenerating as failed with exception {0}{1}", | 2143 | "[TERRAIN]: Scene.cs: LoadWorldMap() - Regenerating as failed with exception {0}{1}", |
2111 | e.Message, e.StackTrace); | 2144 | e.Message, e.StackTrace); |
2112 | 2145 | ||
2113 | // Non standard region size. If there's an old terrain in the database, it might read past the buffer | 2146 | // Non standard region size. If there's an old terrain in the database, it might read past the buffer |
2114 | #pragma warning disable 0162 | 2147 | #pragma warning disable 0162 |
2115 | if ((int)Constants.RegionSize != 256) | 2148 | if ((int)Constants.RegionSize != 256) |
2116 | { | 2149 | { |
2117 | Heightmap = new TerrainChannel(); | 2150 | Heightmap = new TerrainChannel(); |
@@ -2122,7 +2155,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2122 | catch (Exception e) | 2155 | catch (Exception e) |
2123 | { | 2156 | { |
2124 | m_log.WarnFormat( | 2157 | m_log.WarnFormat( |
2125 | "[TERRAIN]: Scene.cs: LoadWorldMap() - Failed with exception {0}{1}", e.Message, e.StackTrace); | 2158 | "[TERRAIN]: Scene.cs: LoadWorldMap() - Failed with exception {0}{1}", e.Message, e.StackTrace); |
2126 | } | 2159 | } |
2127 | } | 2160 | } |
2128 | 2161 | ||
@@ -2139,18 +2172,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
2139 | //// stored in the GridService, because that's what the world map module uses | 2172 | //// stored in the GridService, because that's what the world map module uses |
2140 | //// to send the map image UUIDs (of other regions) to the viewer... | 2173 | //// to send the map image UUIDs (of other regions) to the viewer... |
2141 | if (m_generateMaptiles) | 2174 | if (m_generateMaptiles) |
2142 | RegenerateMaptile(); | 2175 | RegenerateMaptile(); |
2143 | 2176 | ||
2144 | GridRegion region = new GridRegion(RegionInfo); | 2177 | GridRegion region = new GridRegion(RegionInfo); |
2145 | string error = GridService.RegisterRegion(RegionInfo.ScopeID, region); | 2178 | string error = GridService.RegisterRegion(RegionInfo.ScopeID, region); |
2146 | // m_log.DebugFormat("[SCENE]: RegisterRegionWithGrid. name={0},id={1},loc=<{2},{3}>,size=<{4},{5}>", | 2179 | // m_log.DebugFormat("[SCENE]: RegisterRegionWithGrid. name={0},id={1},loc=<{2},{3}>,size=<{4},{5}>", |
2147 | // m_regionName, | 2180 | // m_regionName, |
2148 | // RegionInfo.RegionID, | 2181 | // RegionInfo.RegionID, |
2149 | // RegionInfo.RegionLocX, RegionInfo.RegionLocY, | 2182 | // RegionInfo.RegionLocX, RegionInfo.RegionLocY, |
2150 | // RegionInfo.RegionSizeX, RegionInfo.RegionSizeY); | 2183 | // RegionInfo.RegionSizeX, RegionInfo.RegionSizeY); |
2151 | 2184 | ||
2152 | if (error != String.Empty) | 2185 | if (error != String.Empty) |
2153 | throw new Exception(error); | 2186 | throw new Exception(error); |
2154 | } | 2187 | } |
2155 | 2188 | ||
2156 | #endregion | 2189 | #endregion |
@@ -2209,7 +2242,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2209 | rootPart.TrimPermissions(); | 2242 | rootPart.TrimPermissions(); |
2210 | 2243 | ||
2211 | // Don't do this here - it will get done later on when sculpt data is loaded. | 2244 | // Don't do this here - it will get done later on when sculpt data is loaded. |
2212 | // group.CheckSculptAndLoad(); | 2245 | // group.CheckSculptAndLoad(); |
2213 | } | 2246 | } |
2214 | 2247 | ||
2215 | LoadingPrims = false; | 2248 | LoadingPrims = false; |
@@ -2219,15 +2252,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
2219 | public bool SupportsRayCastFiltered() | 2252 | public bool SupportsRayCastFiltered() |
2220 | { | 2253 | { |
2221 | if (PhysicsScene == null) | 2254 | if (PhysicsScene == null) |
2222 | return false; | 2255 | return false; |
2223 | return PhysicsScene.SupportsRaycastWorldFiltered(); | 2256 | return PhysicsScene.SupportsRaycastWorldFiltered(); |
2224 | } | 2257 | } |
2225 | 2258 | ||
2226 | public object RayCastFiltered(Vector3 position, Vector3 direction, float length, int Count, RayFilterFlags filter) | 2259 | public object RayCastFiltered(Vector3 position, Vector3 direction, float length, int Count, RayFilterFlags filter) |
2227 | { | 2260 | { |
2228 | if (PhysicsScene == null) | 2261 | if (PhysicsScene == null) |
2229 | return null; | 2262 | return null; |
2230 | return PhysicsScene.RaycastWorld(position, direction, length, Count,filter); | 2263 | return PhysicsScene.RaycastWorld(position, direction, length, Count, filter); |
2231 | } | 2264 | } |
2232 | 2265 | ||
2233 | /// <summary> | 2266 | /// <summary> |
@@ -2295,7 +2328,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2295 | //And in cases when we weren't rezzing from inventory we were re-adding the 0.25 straight after calling this method | 2328 | //And in cases when we weren't rezzing from inventory we were re-adding the 0.25 straight after calling this method |
2296 | // Un-offset the prim (it gets offset later by the consumer method) | 2329 | // Un-offset the prim (it gets offset later by the consumer method) |
2297 | //pos.Z -= 0.25F; | 2330 | //pos.Z -= 0.25F; |
2298 | 2331 | ||
2299 | } | 2332 | } |
2300 | 2333 | ||
2301 | return pos; | 2334 | return pos; |
@@ -2312,7 +2345,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2312 | if (ei.HitTF) | 2345 | if (ei.HitTF) |
2313 | { | 2346 | { |
2314 | pos = ei.ipoint; | 2347 | pos = ei.ipoint; |
2315 | } | 2348 | } |
2316 | else | 2349 | else |
2317 | { | 2350 | { |
2318 | // fall back to our stupid functionality | 2351 | // fall back to our stupid functionality |
@@ -2348,8 +2381,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2348 | /// <param name="RayTargetID"></param> | 2381 | /// <param name="RayTargetID"></param> |
2349 | /// <param name="RayEndIsIntersection"></param> | 2382 | /// <param name="RayEndIsIntersection"></param> |
2350 | public virtual void AddNewPrim(UUID ownerID, UUID groupID, Vector3 RayEnd, Quaternion rot, PrimitiveBaseShape shape, | 2383 | public virtual void AddNewPrim(UUID ownerID, UUID groupID, Vector3 RayEnd, Quaternion rot, PrimitiveBaseShape shape, |
2351 | byte bypassRaycast, Vector3 RayStart, UUID RayTargetID, | 2384 | byte bypassRaycast, Vector3 RayStart, UUID RayTargetID, |
2352 | byte RayEndIsIntersection) | 2385 | byte RayEndIsIntersection) |
2353 | { | 2386 | { |
2354 | Vector3 pos = GetNewRezLocation(RayStart, RayEnd, RayTargetID, rot, bypassRaycast, RayEndIsIntersection, true, new Vector3(0.5f, 0.5f, 0.5f), false); | 2387 | Vector3 pos = GetNewRezLocation(RayStart, RayEnd, RayTargetID, rot, bypassRaycast, RayEndIsIntersection, true, new Vector3(0.5f, 0.5f, 0.5f), false); |
2355 | 2388 | ||
@@ -2364,18 +2397,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
2364 | { | 2397 | { |
2365 | IClientAPI client = null; | 2398 | IClientAPI client = null; |
2366 | if (TryGetClient(ownerID, out client)) | 2399 | if (TryGetClient(ownerID, out client)) |
2367 | client.SendAlertMessage("You cannot create objects here."); | 2400 | client.SendAlertMessage("You cannot create objects here."); |
2368 | } | 2401 | } |
2369 | } | 2402 | } |
2370 | 2403 | ||
2371 | public virtual SceneObjectGroup AddNewPrim( | 2404 | public virtual SceneObjectGroup AddNewPrim( |
2372 | UUID ownerID, UUID groupID, Vector3 pos, Quaternion rot, PrimitiveBaseShape shape) | 2405 | UUID ownerID, UUID groupID, Vector3 pos, Quaternion rot, PrimitiveBaseShape shape) |
2373 | { | 2406 | { |
2374 | //m_log.DebugFormat( | 2407 | //m_log.DebugFormat( |
2375 | // "[SCENE]: Scene.AddNewPrim() pcode {0} called for {1} in {2}", shape.PCode, ownerID, RegionInfo.RegionName); | 2408 | // "[SCENE]: Scene.AddNewPrim() pcode {0} called for {1} in {2}", shape.PCode, ownerID, RegionInfo.RegionName); |
2376 | 2409 | ||
2377 | SceneObjectGroup sceneObject = null; | 2410 | SceneObjectGroup sceneObject = null; |
2378 | 2411 | ||
2379 | // If an entity creator has been registered for this prim type then use that | 2412 | // If an entity creator has been registered for this prim type then use that |
2380 | if (m_entityCreators.ContainsKey((PCode)shape.PCode)) | 2413 | if (m_entityCreators.ContainsKey((PCode)shape.PCode)) |
2381 | { | 2414 | { |
@@ -2390,13 +2423,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
2390 | } | 2423 | } |
2391 | 2424 | ||
2392 | if (UserManagementModule != null) | 2425 | if (UserManagementModule != null) |
2393 | sceneObject.RootPart.CreatorIdentification = UserManagementModule.GetUserUUI(ownerID); | 2426 | sceneObject.RootPart.CreatorIdentification = UserManagementModule.GetUserUUI(ownerID); |
2394 | 2427 | ||
2395 | sceneObject.ScheduleGroupForFullUpdate(); | 2428 | sceneObject.ScheduleGroupForFullUpdate(); |
2396 | 2429 | ||
2397 | return sceneObject; | 2430 | return sceneObject; |
2398 | } | 2431 | } |
2399 | 2432 | ||
2400 | /// <summary> | 2433 | /// <summary> |
2401 | /// Add an object into the scene that has come from storage | 2434 | /// Add an object into the scene that has come from storage |
2402 | /// </summary> | 2435 | /// </summary> |
@@ -2418,7 +2451,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2418 | /// true if the object was added, false if an object with the same uuid was already in the scene | 2451 | /// true if the object was added, false if an object with the same uuid was already in the scene |
2419 | /// </returns> | 2452 | /// </returns> |
2420 | public bool AddRestoredSceneObject( | 2453 | public bool AddRestoredSceneObject( |
2421 | SceneObjectGroup sceneObject, bool attachToBackup, bool alreadyPersisted, bool sendClientUpdates) | 2454 | SceneObjectGroup sceneObject, bool attachToBackup, bool alreadyPersisted, bool sendClientUpdates) |
2422 | { | 2455 | { |
2423 | if (m_sceneGraph.AddRestoredSceneObject(sceneObject, attachToBackup, alreadyPersisted, sendClientUpdates)) | 2456 | if (m_sceneGraph.AddRestoredSceneObject(sceneObject, attachToBackup, alreadyPersisted, sendClientUpdates)) |
2424 | { | 2457 | { |
@@ -2429,7 +2462,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2429 | return false; | 2462 | return false; |
2430 | 2463 | ||
2431 | } | 2464 | } |
2432 | 2465 | ||
2433 | /// <summary> | 2466 | /// <summary> |
2434 | /// Add an object into the scene that has come from storage | 2467 | /// Add an object into the scene that has come from storage |
2435 | /// </summary> | 2468 | /// </summary> |
@@ -2447,7 +2480,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2447 | /// true if the object was added, false if an object with the same uuid was already in the scene | 2480 | /// true if the object was added, false if an object with the same uuid was already in the scene |
2448 | /// </returns> | 2481 | /// </returns> |
2449 | public bool AddRestoredSceneObject( | 2482 | public bool AddRestoredSceneObject( |
2450 | SceneObjectGroup sceneObject, bool attachToBackup, bool alreadyPersisted) | 2483 | SceneObjectGroup sceneObject, bool attachToBackup, bool alreadyPersisted) |
2451 | { | 2484 | { |
2452 | return AddRestoredSceneObject(sceneObject, attachToBackup, alreadyPersisted, true); | 2485 | return AddRestoredSceneObject(sceneObject, attachToBackup, alreadyPersisted, true); |
2453 | } | 2486 | } |
@@ -2465,7 +2498,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2465 | { | 2498 | { |
2466 | return AddNewSceneObject(sceneObject, attachToBackup, true); | 2499 | return AddNewSceneObject(sceneObject, attachToBackup, true); |
2467 | } | 2500 | } |
2468 | 2501 | ||
2469 | /// <summary> | 2502 | /// <summary> |
2470 | /// Add a newly created object to the scene | 2503 | /// Add a newly created object to the scene |
2471 | /// </summary> | 2504 | /// </summary> |
@@ -2480,16 +2513,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
2480 | /// </param> | 2513 | /// </param> |
2481 | /// <returns>true if the object was added. false if not</returns> | 2514 | /// <returns>true if the object was added. false if not</returns> |
2482 | public bool AddNewSceneObject(SceneObjectGroup sceneObject, bool attachToBackup, bool sendClientUpdates) | 2515 | public bool AddNewSceneObject(SceneObjectGroup sceneObject, bool attachToBackup, bool sendClientUpdates) |
2483 | { | 2516 | { |
2484 | if (m_sceneGraph.AddNewSceneObject(sceneObject, attachToBackup, sendClientUpdates)) | 2517 | if (m_sceneGraph.AddNewSceneObject(sceneObject, attachToBackup, sendClientUpdates)) |
2485 | { | 2518 | { |
2486 | EventManager.TriggerObjectAddedToScene(sceneObject); | 2519 | EventManager.TriggerObjectAddedToScene(sceneObject); |
2487 | return true; | 2520 | return true; |
2488 | } | 2521 | } |
2489 | 2522 | ||
2490 | return false; | 2523 | return false; |
2491 | } | 2524 | } |
2492 | 2525 | ||
2493 | /// <summary> | 2526 | /// <summary> |
2494 | /// Add a newly created object to the scene. | 2527 | /// Add a newly created object to the scene. |
2495 | /// </summary> | 2528 | /// </summary> |
@@ -2503,10 +2536,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
2503 | /// <param name="vel">Velocity of the object. This parameter only has an effect if the object is physical</param> | 2536 | /// <param name="vel">Velocity of the object. This parameter only has an effect if the object is physical</param> |
2504 | /// <returns></returns> | 2537 | /// <returns></returns> |
2505 | public bool AddNewSceneObject( | 2538 | public bool AddNewSceneObject( |
2506 | SceneObjectGroup sceneObject, bool attachToBackup, Vector3? pos, Quaternion? rot, Vector3 vel) | 2539 | SceneObjectGroup sceneObject, bool attachToBackup, Vector3? pos, Quaternion? rot, Vector3 vel) |
2507 | { | 2540 | { |
2508 | if (m_sceneGraph.AddNewSceneObject(sceneObject, attachToBackup, pos, rot, vel)) | 2541 | if (m_sceneGraph.AddNewSceneObject(sceneObject, attachToBackup, pos, rot, vel)) |
2509 | { | 2542 | { |
2510 | EventManager.TriggerObjectAddedToScene(sceneObject); | 2543 | EventManager.TriggerObjectAddedToScene(sceneObject); |
2511 | return true; | 2544 | return true; |
2512 | } | 2545 | } |
@@ -2528,7 +2561,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2528 | { | 2561 | { |
2529 | SceneObjectGroup sog = (SceneObjectGroup)e; | 2562 | SceneObjectGroup sog = (SceneObjectGroup)e; |
2530 | if (!sog.IsAttachment) | 2563 | if (!sog.IsAttachment) |
2531 | DeleteSceneObject((SceneObjectGroup)e, false); | 2564 | DeleteSceneObject((SceneObjectGroup)e, false); |
2532 | } | 2565 | } |
2533 | } | 2566 | } |
2534 | } | 2567 | } |
@@ -2554,13 +2587,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
2554 | /// <param name="silent">Suppress broadcasting changes to other clients.</param> | 2587 | /// <param name="silent">Suppress broadcasting changes to other clients.</param> |
2555 | /// <param name="removeScripts">If true, then scripts are removed. If false, then they are only stopped.</para> | 2588 | /// <param name="removeScripts">If true, then scripts are removed. If false, then they are only stopped.</para> |
2556 | public void DeleteSceneObject(SceneObjectGroup group, bool silent, bool removeScripts) | 2589 | public void DeleteSceneObject(SceneObjectGroup group, bool silent, bool removeScripts) |
2557 | { | 2590 | { |
2558 | // m_log.DebugFormat("[SCENE]: Deleting scene object {0} {1}", group.Name, group.UUID); | 2591 | // m_log.DebugFormat("[SCENE]: Deleting scene object {0} {1}", group.Name, group.UUID); |
2559 | 2592 | ||
2560 | if (removeScripts) | 2593 | if (removeScripts) |
2561 | group.RemoveScriptInstances(true); | 2594 | group.RemoveScriptInstances(true); |
2562 | else | 2595 | else |
2563 | group.StopScriptInstances(); | 2596 | group.StopScriptInstances(); |
2564 | 2597 | ||
2565 | SceneObjectPart[] partList = group.Parts; | 2598 | SceneObjectPart[] partList = group.Parts; |
2566 | 2599 | ||
@@ -2590,7 +2623,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2590 | 2623 | ||
2591 | group.DeleteGroupFromScene(silent); | 2624 | group.DeleteGroupFromScene(silent); |
2592 | 2625 | ||
2593 | // m_log.DebugFormat("[SCENE]: Exit DeleteSceneObject() for {0} {1}", group.Name, group.UUID); | 2626 | // m_log.DebugFormat("[SCENE]: Exit DeleteSceneObject() for {0} {1}", group.Name, group.UUID); |
2594 | } | 2627 | } |
2595 | 2628 | ||
2596 | /// <summary> | 2629 | /// <summary> |
@@ -2610,12 +2643,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
2610 | // database update, because RemoveObject() works by searching on the SceneGroupID. | 2643 | // database update, because RemoveObject() works by searching on the SceneGroupID. |
2611 | // This is an expensive thing to do so only do it if absolutely necessary. | 2644 | // This is an expensive thing to do so only do it if absolutely necessary. |
2612 | if (so.GroupContainsForeignPrims) | 2645 | if (so.GroupContainsForeignPrims) |
2613 | ForceSceneObjectBackup(so); | 2646 | ForceSceneObjectBackup(so); |
2614 | 2647 | ||
2615 | so.DetachFromBackup(); | 2648 | so.DetachFromBackup(); |
2616 | SimulationDataService.RemoveObject(so.UUID, RegionInfo.RegionID); | 2649 | SimulationDataService.RemoveObject(so.UUID, RegionInfo.RegionID); |
2617 | } | 2650 | } |
2618 | 2651 | ||
2619 | // We need to keep track of this state in case this group is still queued for further backup. | 2652 | // We need to keep track of this state in case this group is still queued for further backup. |
2620 | so.IsDeleted = true; | 2653 | so.IsDeleted = true; |
2621 | 2654 | ||
@@ -2635,9 +2668,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
2635 | public void CrossPrimGroupIntoNewRegion(Vector3 attemptedPosition, SceneObjectGroup grp, bool silent) | 2668 | public void CrossPrimGroupIntoNewRegion(Vector3 attemptedPosition, SceneObjectGroup grp, bool silent) |
2636 | { | 2669 | { |
2637 | if (grp == null) | 2670 | if (grp == null) |
2638 | return; | 2671 | return; |
2639 | if (grp.IsDeleted) | 2672 | if (grp.IsDeleted) |
2640 | return; | 2673 | return; |
2641 | 2674 | ||
2642 | if (grp.RootPart.DIE_AT_EDGE) | 2675 | if (grp.RootPart.DIE_AT_EDGE) |
2643 | { | 2676 | { |
@@ -2671,7 +2704,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2671 | } | 2704 | } |
2672 | 2705 | ||
2673 | if (EntityTransferModule != null) | 2706 | if (EntityTransferModule != null) |
2674 | EntityTransferModule.Cross(grp, attemptedPosition, silent); | 2707 | EntityTransferModule.Cross(grp, attemptedPosition, silent); |
2675 | } | 2708 | } |
2676 | 2709 | ||
2677 | // Simple test to see if a position is in the current region. | 2710 | // Simple test to see if a position is in the current region. |
@@ -2684,14 +2717,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
2684 | int xx = (int)Math.Floor(pos.X); | 2717 | int xx = (int)Math.Floor(pos.X); |
2685 | int yy = (int)Math.Floor(pos.Y); | 2718 | int yy = (int)Math.Floor(pos.Y); |
2686 | if (xx < 0 || yy < 0) | 2719 | if (xx < 0 || yy < 0) |
2687 | return false; | 2720 | return false; |
2688 | 2721 | ||
2689 | IRegionCombinerModule regionCombinerModule = RequestModuleInterface<IRegionCombinerModule>(); | 2722 | IRegionCombinerModule regionCombinerModule = RequestModuleInterface<IRegionCombinerModule>(); |
2690 | if (regionCombinerModule == null) | 2723 | if (regionCombinerModule == null) |
2691 | { | 2724 | { |
2692 | // Regular region. Just check for region size | 2725 | // Regular region. Just check for region size |
2693 | if (xx < RegionInfo.RegionSizeX && yy < RegionInfo.RegionSizeY ) | 2726 | if (xx < RegionInfo.RegionSizeX && yy < RegionInfo.RegionSizeY) |
2694 | ret = true; | 2727 | ret = true; |
2695 | } | 2728 | } |
2696 | else | 2729 | else |
2697 | { | 2730 | { |
@@ -2725,7 +2758,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2725 | } | 2758 | } |
2726 | 2759 | ||
2727 | if (!EntityTransferModule.HandleIncomingSceneObject(newObject, newPosition)) | 2760 | if (!EntityTransferModule.HandleIncomingSceneObject(newObject, newPosition)) |
2728 | return false; | 2761 | return false; |
2729 | 2762 | ||
2730 | // Do this as late as possible so that listeners have full access to the incoming object | 2763 | // Do this as late as possible so that listeners have full access to the incoming object |
2731 | EventManager.TriggerOnIncomingSceneObject(newObject); | 2764 | EventManager.TriggerOnIncomingSceneObject(newObject); |
@@ -2746,13 +2779,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
2746 | // | 2779 | // |
2747 | SceneObjectPart[] parts = sceneObject.Parts; | 2780 | SceneObjectPart[] parts = sceneObject.Parts; |
2748 | for (int i = 0; i < parts.Length; i++) | 2781 | for (int i = 0; i < parts.Length; i++) |
2749 | parts[i].LocalId = 0; | 2782 | parts[i].LocalId = 0; |
2750 | 2783 | ||
2751 | if (sceneObject.IsAttachmentCheckFull()) // Attachment | 2784 | if (sceneObject.IsAttachmentCheckFull()) // Attachment |
2752 | { | 2785 | { |
2753 | sceneObject.RootPart.AddFlag(PrimFlags.TemporaryOnRez); | 2786 | sceneObject.RootPart.AddFlag(PrimFlags.TemporaryOnRez); |
2754 | sceneObject.RootPart.AddFlag(PrimFlags.Phantom); | 2787 | sceneObject.RootPart.AddFlag(PrimFlags.Phantom); |
2755 | 2788 | ||
2756 | // Don't sent a full update here because this will cause full updates to be sent twice for | 2789 | // Don't sent a full update here because this will cause full updates to be sent twice for |
2757 | // attachments on region crossings, resulting in viewer glitches. | 2790 | // attachments on region crossings, resulting in viewer glitches. |
2758 | AddRestoredSceneObject(sceneObject, false, false, false); | 2791 | AddRestoredSceneObject(sceneObject, false, false, false); |
@@ -2767,10 +2800,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
2767 | { | 2800 | { |
2768 | SceneObjectGroup grp = sceneObject; | 2801 | SceneObjectGroup grp = sceneObject; |
2769 | 2802 | ||
2770 | // m_log.DebugFormat( | 2803 | // m_log.DebugFormat( |
2771 | // "[ATTACHMENT]: Received attachment {0}, inworld asset id {1}", grp.FromItemID, grp.UUID); | 2804 | // "[ATTACHMENT]: Received attachment {0}, inworld asset id {1}", grp.FromItemID, grp.UUID); |
2772 | // m_log.DebugFormat( | 2805 | // m_log.DebugFormat( |
2773 | // "[ATTACHMENT]: Attach to avatar {0} at position {1}", sp.UUID, grp.AbsolutePosition); | 2806 | // "[ATTACHMENT]: Attach to avatar {0} at position {1}", sp.UUID, grp.AbsolutePosition); |
2774 | 2807 | ||
2775 | RootPrim.RemFlag(PrimFlags.TemporaryOnRez); | 2808 | RootPrim.RemFlag(PrimFlags.TemporaryOnRez); |
2776 | 2809 | ||
@@ -2778,7 +2811,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2778 | // information that this is due to a teleport/border cross rather than an ordinary attachment. | 2811 | // information that this is due to a teleport/border cross rather than an ordinary attachment. |
2779 | // We currently do this in Scene.MakeRootAgent() instead. | 2812 | // We currently do this in Scene.MakeRootAgent() instead. |
2780 | if (AttachmentsModule != null) | 2813 | if (AttachmentsModule != null) |
2781 | AttachmentsModule.AttachObject(sp, grp, 0, false, false, true); | 2814 | AttachmentsModule.AttachObject(sp, grp, 0, false, false, true); |
2782 | } | 2815 | } |
2783 | else | 2816 | else |
2784 | { | 2817 | { |
@@ -2804,6 +2837,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
2804 | bool vialogin; | 2837 | bool vialogin; |
2805 | bool reallyNew = true; | 2838 | bool reallyNew = true; |
2806 | 2839 | ||
2840 | // Update the number of users attempting to login | ||
2841 | StatsReporter.UpdateUsersLoggingIn(true); | ||
2842 | |||
2807 | // Validation occurs in LLUDPServer | 2843 | // Validation occurs in LLUDPServer |
2808 | // | 2844 | // |
2809 | // XXX: A race condition exists here where two simultaneous calls to AddNewAgent can interfere with | 2845 | // XXX: A race condition exists here where two simultaneous calls to AddNewAgent can interfere with |
@@ -2824,11 +2860,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
2824 | lock (aCircuit) | 2860 | lock (aCircuit) |
2825 | { | 2861 | { |
2826 | vialogin | 2862 | vialogin |
2827 | = (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0 | 2863 | = (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0 |
2828 | || (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0; | 2864 | || (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0; |
2829 | 2865 | ||
2830 | // CheckHeartbeat(); | 2866 | // CheckHeartbeat(); |
2831 | 2867 | ||
2832 | sp = GetScenePresence(client.AgentId); | 2868 | sp = GetScenePresence(client.AgentId); |
2833 | 2869 | ||
2834 | // XXX: Not sure how good it is to add a new client if a scene presence already exists. Possibly this | 2870 | // XXX: Not sure how good it is to add a new client if a scene presence already exists. Possibly this |
@@ -2838,9 +2874,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
2838 | if (sp == null) | 2874 | if (sp == null) |
2839 | { | 2875 | { |
2840 | m_log.DebugFormat( | 2876 | m_log.DebugFormat( |
2841 | "[SCENE]: Adding new child scene presence {0} {1} to scene {2} at pos {3}", | 2877 | "[SCENE]: Adding new child scene presence {0} {1} to scene {2} at pos {3}", |
2842 | client.Name, client.AgentId, RegionInfo.RegionName, client.StartPos); | 2878 | client.Name, client.AgentId, RegionInfo.RegionName, client.StartPos); |
2843 | 2879 | ||
2844 | sp = m_sceneGraph.CreateAndAddChildScenePresence(client, aCircuit.Appearance, type); | 2880 | sp = m_sceneGraph.CreateAndAddChildScenePresence(client, aCircuit.Appearance, type); |
2845 | 2881 | ||
2846 | // We must set this here so that TriggerOnNewClient and TriggerOnClientLogin can determine whether the | 2882 | // We must set this here so that TriggerOnNewClient and TriggerOnClientLogin can determine whether the |
@@ -2857,7 +2893,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2857 | m_clientManager.Add(client); | 2893 | m_clientManager.Add(client); |
2858 | SubscribeToClientEvents(client); | 2894 | SubscribeToClientEvents(client); |
2859 | m_eventManager.TriggerOnNewPresence(sp); | 2895 | m_eventManager.TriggerOnNewPresence(sp); |
2860 | 2896 | ||
2861 | sp.TeleportFlags = (TPFlags)aCircuit.teleportFlags; | 2897 | sp.TeleportFlags = (TPFlags)aCircuit.teleportFlags; |
2862 | } | 2898 | } |
2863 | else | 2899 | else |
@@ -2870,24 +2906,28 @@ namespace OpenSim.Region.Framework.Scenes | |||
2870 | client.SceneAgent = sp; | 2906 | client.SceneAgent = sp; |
2871 | 2907 | ||
2872 | m_log.WarnFormat( | 2908 | m_log.WarnFormat( |
2873 | "[SCENE]: Already found {0} scene presence for {1} in {2} when asked to add new scene presence", | 2909 | "[SCENE]: Already found {0} scene presence for {1} in {2} when asked to add new scene presence", |
2874 | sp.IsChildAgent ? "child" : "root", sp.Name, RegionInfo.RegionName); | 2910 | sp.IsChildAgent ? "child" : "root", sp.Name, RegionInfo.RegionName); |
2875 | 2911 | ||
2876 | reallyNew = false; | 2912 | reallyNew = false; |
2877 | } | 2913 | } |
2878 | 2914 | ||
2879 | // This is currently also being done earlier in NewUserConnection for real users to see if this | 2915 | // This is currently also being done earlier in NewUserConnection for real users to see if this |
2880 | // resolves problems where HG agents are occasionally seen by others as "Unknown user" in chat and other | 2916 | // resolves problems where HG agents are occasionally seen by others as "Unknown user" in chat and other |
2881 | // places. However, we still need to do it here for NPCs. | 2917 | // places. However, we still need to do it here for NPCs. |
2882 | CacheUserName(sp, aCircuit); | 2918 | CacheUserName(sp, aCircuit); |
2883 | 2919 | ||
2884 | if (reallyNew) | 2920 | if (reallyNew) |
2885 | EventManager.TriggerOnNewClient(client); | 2921 | EventManager.TriggerOnNewClient(client); |
2886 | 2922 | ||
2887 | if (vialogin) | 2923 | if (vialogin) |
2888 | EventManager.TriggerOnClientLogin(client); | 2924 | EventManager.TriggerOnClientLogin(client); |
2889 | } | 2925 | } |
2890 | 2926 | ||
2927 | // User has logged into the scene so update the list of users logging | ||
2928 | // in | ||
2929 | StatsReporter.UpdateUsersLoggingIn(false); | ||
2930 | |||
2891 | m_LastLogin = Util.EnvironmentTickCount(); | 2931 | m_LastLogin = Util.EnvironmentTickCount(); |
2892 | 2932 | ||
2893 | return sp; | 2933 | return sp; |
@@ -2900,9 +2940,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
2900 | { | 2940 | { |
2901 | AgentCircuitData circuit = AuthenticateHandler.GetAgentCircuitData(agentID); | 2941 | AgentCircuitData circuit = AuthenticateHandler.GetAgentCircuitData(agentID); |
2902 | if (circuit != null && circuit.ServiceURLs != null && circuit.ServiceURLs.ContainsKey("HomeURI")) | 2942 | if (circuit != null && circuit.ServiceURLs != null && circuit.ServiceURLs.ContainsKey("HomeURI")) |
2903 | return circuit.ServiceURLs["HomeURI"].ToString(); | 2943 | return circuit.ServiceURLs["HomeURI"].ToString(); |
2904 | else | 2944 | else |
2905 | return null; | 2945 | return null; |
2906 | } | 2946 | } |
2907 | 2947 | ||
2908 | /// <summary> | 2948 | /// <summary> |
@@ -2925,7 +2965,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2925 | string homeURL = string.Empty; | 2965 | string homeURL = string.Empty; |
2926 | 2966 | ||
2927 | if (aCircuit.ServiceURLs.ContainsKey("HomeURI")) | 2967 | if (aCircuit.ServiceURLs.ContainsKey("HomeURI")) |
2928 | homeURL = aCircuit.ServiceURLs["HomeURI"].ToString(); | 2968 | homeURL = aCircuit.ServiceURLs["HomeURI"].ToString(); |
2929 | 2969 | ||
2930 | if (aCircuit.lastname.StartsWith("@")) | 2970 | if (aCircuit.lastname.StartsWith("@")) |
2931 | { | 2971 | { |
@@ -2945,7 +2985,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2945 | private bool VerifyClient(AgentCircuitData aCircuit, System.Net.IPEndPoint ep, out bool vialogin) | 2985 | private bool VerifyClient(AgentCircuitData aCircuit, System.Net.IPEndPoint ep, out bool vialogin) |
2946 | { | 2986 | { |
2947 | vialogin = false; | 2987 | vialogin = false; |
2948 | 2988 | ||
2949 | // Do the verification here | 2989 | // Do the verification here |
2950 | if ((aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0) | 2990 | if ((aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0) |
2951 | { | 2991 | { |
@@ -2961,7 +3001,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2961 | return false; | 3001 | return false; |
2962 | } | 3002 | } |
2963 | else | 3003 | else |
2964 | m_log.DebugFormat("[SCENE]: User Client Verification for {0} {1} in {2} returned true", aCircuit.firstname, aCircuit.lastname, RegionInfo.RegionName); | 3004 | m_log.DebugFormat("[SCENE]: User Client Verification for {0} {1} in {2} returned true", aCircuit.firstname, aCircuit.lastname, RegionInfo.RegionName); |
2965 | 3005 | ||
2966 | } | 3006 | } |
2967 | } | 3007 | } |
@@ -2969,7 +3009,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2969 | else if ((aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0) | 3009 | else if ((aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0) |
2970 | { | 3010 | { |
2971 | m_log.DebugFormat("[SCENE]: Incoming client {0} {1} in region {2} via regular login. Client IP verification not performed.", | 3011 | m_log.DebugFormat("[SCENE]: Incoming client {0} {1} in region {2} via regular login. Client IP verification not performed.", |
2972 | aCircuit.firstname, aCircuit.lastname, RegionInfo.RegionName); | 3012 | aCircuit.firstname, aCircuit.lastname, RegionInfo.RegionName); |
2973 | vialogin = true; | 3013 | vialogin = true; |
2974 | } | 3014 | } |
2975 | 3015 | ||
@@ -3013,7 +3053,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3013 | } | 3053 | } |
3014 | } | 3054 | } |
3015 | else | 3055 | else |
3016 | return true; | 3056 | return true; |
3017 | } | 3057 | } |
3018 | 3058 | ||
3019 | return false; | 3059 | return false; |
@@ -3040,7 +3080,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3040 | { | 3080 | { |
3041 | client.OnRegionHandShakeReply += SendLayerData; | 3081 | client.OnRegionHandShakeReply += SendLayerData; |
3042 | } | 3082 | } |
3043 | 3083 | ||
3044 | public virtual void SubscribeToClientPrimEvents(IClientAPI client) | 3084 | public virtual void SubscribeToClientPrimEvents(IClientAPI client) |
3045 | { | 3085 | { |
3046 | client.OnUpdatePrimGroupPosition += m_sceneGraph.UpdatePrimGroupPosition; | 3086 | client.OnUpdatePrimGroupPosition += m_sceneGraph.UpdatePrimGroupPosition; |
@@ -3050,7 +3090,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3050 | client.OnUpdatePrimGroupMouseRotation += m_sceneGraph.UpdatePrimGroupRotation; | 3090 | client.OnUpdatePrimGroupMouseRotation += m_sceneGraph.UpdatePrimGroupRotation; |
3051 | client.OnUpdatePrimSingleRotation += m_sceneGraph.UpdatePrimSingleRotation; | 3091 | client.OnUpdatePrimSingleRotation += m_sceneGraph.UpdatePrimSingleRotation; |
3052 | client.OnUpdatePrimSingleRotationPosition += m_sceneGraph.UpdatePrimSingleRotationPosition; | 3092 | client.OnUpdatePrimSingleRotationPosition += m_sceneGraph.UpdatePrimSingleRotationPosition; |
3053 | 3093 | ||
3054 | client.OnUpdatePrimScale += m_sceneGraph.UpdatePrimScale; | 3094 | client.OnUpdatePrimScale += m_sceneGraph.UpdatePrimScale; |
3055 | client.OnUpdatePrimGroupScale += m_sceneGraph.UpdatePrimGroupScale; | 3095 | client.OnUpdatePrimGroupScale += m_sceneGraph.UpdatePrimGroupScale; |
3056 | client.OnUpdateExtraParams += m_sceneGraph.UpdateExtraParam; | 3096 | client.OnUpdateExtraParams += m_sceneGraph.UpdateExtraParam; |
@@ -3063,7 +3103,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3063 | client.OnSpinStart += m_sceneGraph.SpinStart; | 3103 | client.OnSpinStart += m_sceneGraph.SpinStart; |
3064 | client.OnSpinUpdate += m_sceneGraph.SpinObject; | 3104 | client.OnSpinUpdate += m_sceneGraph.SpinObject; |
3065 | client.OnDeRezObject += DeRezObjects; | 3105 | client.OnDeRezObject += DeRezObjects; |
3066 | 3106 | ||
3067 | client.OnObjectName += m_sceneGraph.PrimName; | 3107 | client.OnObjectName += m_sceneGraph.PrimName; |
3068 | client.OnObjectClickAction += m_sceneGraph.PrimClickAction; | 3108 | client.OnObjectClickAction += m_sceneGraph.PrimClickAction; |
3069 | client.OnObjectMaterial += m_sceneGraph.PrimMaterial; | 3109 | client.OnObjectMaterial += m_sceneGraph.PrimMaterial; |
@@ -3075,7 +3115,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3075 | client.OnRequestObjectPropertiesFamily += m_sceneGraph.RequestObjectPropertiesFamily; | 3115 | client.OnRequestObjectPropertiesFamily += m_sceneGraph.RequestObjectPropertiesFamily; |
3076 | client.OnObjectPermissions += HandleObjectPermissionsUpdate; | 3116 | client.OnObjectPermissions += HandleObjectPermissionsUpdate; |
3077 | client.OnGrabObject += ProcessObjectGrab; | 3117 | client.OnGrabObject += ProcessObjectGrab; |
3078 | client.OnGrabUpdate += ProcessObjectGrabUpdate; | 3118 | client.OnGrabUpdate += ProcessObjectGrabUpdate; |
3079 | client.OnDeGrabObject += ProcessObjectDeGrab; | 3119 | client.OnDeGrabObject += ProcessObjectDeGrab; |
3080 | client.OnUndo += m_sceneGraph.HandleUndo; | 3120 | client.OnUndo += m_sceneGraph.HandleUndo; |
3081 | client.OnRedo += m_sceneGraph.HandleRedo; | 3121 | client.OnRedo += m_sceneGraph.HandleRedo; |
@@ -3136,7 +3176,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3136 | //client.OnNameFromUUIDRequest += HandleUUIDNameRequest; | 3176 | //client.OnNameFromUUIDRequest += HandleUUIDNameRequest; |
3137 | client.OnMoneyTransferRequest += ProcessMoneyTransferRequest; | 3177 | client.OnMoneyTransferRequest += ProcessMoneyTransferRequest; |
3138 | } | 3178 | } |
3139 | 3179 | ||
3140 | public virtual void SubscribeToClientNetworkEvents(IClientAPI client) | 3180 | public virtual void SubscribeToClientNetworkEvents(IClientAPI client) |
3141 | { | 3181 | { |
3142 | client.OnNetworkStatsUpdate += StatsReporter.AddPacketsStats; | 3182 | client.OnNetworkStatsUpdate += StatsReporter.AddPacketsStats; |
@@ -3297,7 +3337,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3297 | { | 3337 | { |
3298 | SceneObjectGroup copy = SceneGraph.DuplicateObject(originalPrim, offset, flags, AgentID, GroupID, Quaternion.Identity); | 3338 | SceneObjectGroup copy = SceneGraph.DuplicateObject(originalPrim, offset, flags, AgentID, GroupID, Quaternion.Identity); |
3299 | if (copy != null) | 3339 | if (copy != null) |
3300 | EventManager.TriggerObjectAddedToScene(copy); | 3340 | EventManager.TriggerObjectAddedToScene(copy); |
3301 | } | 3341 | } |
3302 | 3342 | ||
3303 | /// <summary> | 3343 | /// <summary> |
@@ -3316,8 +3356,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
3316 | /// <param name="CopyCenters">Position the object at the center of the face that it's colliding with</param> | 3356 | /// <param name="CopyCenters">Position the object at the center of the face that it's colliding with</param> |
3317 | /// <param name="CopyRotates">Rotate the object the same as the localID object</param> | 3357 | /// <param name="CopyRotates">Rotate the object the same as the localID object</param> |
3318 | public void doObjectDuplicateOnRay(uint localID, uint dupeFlags, UUID AgentID, UUID GroupID, | 3358 | public void doObjectDuplicateOnRay(uint localID, uint dupeFlags, UUID AgentID, UUID GroupID, |
3319 | UUID RayTargetObj, Vector3 RayEnd, Vector3 RayStart, | 3359 | UUID RayTargetObj, Vector3 RayEnd, Vector3 RayStart, |
3320 | bool BypassRaycast, bool RayEndIsIntersection, bool CopyCenters, bool CopyRotates) | 3360 | bool BypassRaycast, bool RayEndIsIntersection, bool CopyCenters, bool CopyRotates) |
3321 | { | 3361 | { |
3322 | Vector3 pos; | 3362 | Vector3 pos; |
3323 | const bool frontFacesOnly = true; | 3363 | const bool frontFacesOnly = true; |
@@ -3378,7 +3418,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3378 | } | 3418 | } |
3379 | 3419 | ||
3380 | if (copy != null) | 3420 | if (copy != null) |
3381 | EventManager.TriggerObjectAddedToScene(copy); | 3421 | EventManager.TriggerObjectAddedToScene(copy); |
3382 | } | 3422 | } |
3383 | } | 3423 | } |
3384 | } | 3424 | } |
@@ -3429,25 +3469,25 @@ namespace OpenSim.Region.Framework.Scenes | |||
3429 | if (acd == null) | 3469 | if (acd == null) |
3430 | { | 3470 | { |
3431 | m_log.ErrorFormat( | 3471 | m_log.ErrorFormat( |
3432 | "[SCENE]: No agent circuit found for {0} in {1}, aborting Scene.RemoveClient", agentID, Name); | 3472 | "[SCENE]: No agent circuit found for {0} in {1}, aborting Scene.RemoveClient", agentID, Name); |
3433 | 3473 | ||
3434 | return; | 3474 | return; |
3435 | } | 3475 | } |
3436 | 3476 | ||
3437 | // TODO: Can we now remove this lock? | 3477 | // TODO: Can we now remove this lock? |
3438 | lock (acd) | 3478 | lock (acd) |
3439 | { | 3479 | { |
3440 | bool isChildAgent = false; | 3480 | bool isChildAgent = false; |
3441 | 3481 | ||
3442 | ScenePresence avatar = GetScenePresence(agentID); | 3482 | ScenePresence avatar = GetScenePresence(agentID); |
3443 | 3483 | ||
3444 | // Shouldn't be necessary since RemoveClient() is currently only called by IClientAPI.Close() which | 3484 | // Shouldn't be necessary since RemoveClient() is currently only called by IClientAPI.Close() which |
3445 | // in turn is only called by Scene.IncomingCloseAgent() which checks whether the presence exists or not | 3485 | // in turn is only called by Scene.IncomingCloseAgent() which checks whether the presence exists or not |
3446 | // However, will keep for now just in case. | 3486 | // However, will keep for now just in case. |
3447 | if (avatar == null) | 3487 | if (avatar == null) |
3448 | { | 3488 | { |
3449 | m_log.ErrorFormat( | 3489 | m_log.ErrorFormat( |
3450 | "[SCENE]: Called RemoveClient() with agent ID {0} but no such presence is in the scene.", agentID); | 3490 | "[SCENE]: Called RemoveClient() with agent ID {0} but no such presence is in the scene.", agentID); |
3451 | m_authenticateHandler.RemoveCircuit(agentID); | 3491 | m_authenticateHandler.RemoveCircuit(agentID); |
3452 | 3492 | ||
3453 | return; | 3493 | return; |
@@ -3458,9 +3498,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
3458 | isChildAgent = avatar.IsChildAgent; | 3498 | isChildAgent = avatar.IsChildAgent; |
3459 | 3499 | ||
3460 | m_log.DebugFormat( | 3500 | m_log.DebugFormat( |
3461 | "[SCENE]: Removing {0} agent {1} {2} from {3}", | 3501 | "[SCENE]: Removing {0} agent {1} {2} from {3}", |
3462 | isChildAgent ? "child" : "root", avatar.Name, agentID, Name); | 3502 | isChildAgent ? "child" : "root", avatar.Name, agentID, Name); |
3463 | 3503 | ||
3464 | // Don't do this to root agents, it's not nice for the viewer | 3504 | // Don't do this to root agents, it's not nice for the viewer |
3465 | if (closeChildAgents && isChildAgent) | 3505 | if (closeChildAgents && isChildAgent) |
3466 | { | 3506 | { |
@@ -3468,20 +3508,20 @@ namespace OpenSim.Region.Framework.Scenes | |||
3468 | // Let's do this via UDP | 3508 | // Let's do this via UDP |
3469 | avatar.ControllingClient.SendShutdownConnectionNotice(); | 3509 | avatar.ControllingClient.SendShutdownConnectionNotice(); |
3470 | } | 3510 | } |
3471 | 3511 | ||
3472 | // Only applies to root agents. | 3512 | // Only applies to root agents. |
3473 | if (avatar.ParentID != 0) | 3513 | if (avatar.ParentID != 0) |
3474 | { | 3514 | { |
3475 | avatar.StandUp(); | 3515 | avatar.StandUp(); |
3476 | } | 3516 | } |
3477 | 3517 | ||
3478 | m_sceneGraph.removeUserCount(!isChildAgent); | 3518 | m_sceneGraph.removeUserCount(!isChildAgent); |
3479 | 3519 | ||
3480 | // TODO: We shouldn't use closeChildAgents here - it's being used by the NPC module to stop | 3520 | // TODO: We shouldn't use closeChildAgents here - it's being used by the NPC module to stop |
3481 | // unnecessary operations. This should go away once NPCs have no accompanying IClientAPI | 3521 | // unnecessary operations. This should go away once NPCs have no accompanying IClientAPI |
3482 | if (closeChildAgents && CapsModule != null) | 3522 | if (closeChildAgents && CapsModule != null) |
3483 | CapsModule.RemoveCaps(agentID); | 3523 | CapsModule.RemoveCaps(agentID); |
3484 | 3524 | ||
3485 | if (closeChildAgents && !isChildAgent) | 3525 | if (closeChildAgents && !isChildAgent) |
3486 | { | 3526 | { |
3487 | List<ulong> regions = avatar.KnownRegionHandles; | 3527 | List<ulong> regions = avatar.KnownRegionHandles; |
@@ -3490,10 +3530,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
3490 | // This ends up being done asynchronously so that a logout isn't held up where there are many present but unresponsive neighbours. | 3530 | // This ends up being done asynchronously so that a logout isn't held up where there are many present but unresponsive neighbours. |
3491 | m_sceneGridService.SendCloseChildAgentConnections(agentID, acd.SessionID.ToString(), regions); | 3531 | m_sceneGridService.SendCloseChildAgentConnections(agentID, acd.SessionID.ToString(), regions); |
3492 | } | 3532 | } |
3493 | 3533 | ||
3494 | m_eventManager.TriggerClientClosed(agentID, this); | 3534 | m_eventManager.TriggerClientClosed(agentID, this); |
3495 | m_eventManager.TriggerOnRemovePresence(agentID); | 3535 | m_eventManager.TriggerOnRemovePresence(agentID); |
3496 | 3536 | ||
3497 | if (!isChildAgent) | 3537 | if (!isChildAgent) |
3498 | { | 3538 | { |
3499 | if (AttachmentsModule != null) | 3539 | if (AttachmentsModule != null) |
@@ -3502,22 +3542,22 @@ namespace OpenSim.Region.Framework.Scenes | |||
3502 | } | 3542 | } |
3503 | 3543 | ||
3504 | ForEachClient( | 3544 | ForEachClient( |
3505 | delegate(IClientAPI client) | 3545 | delegate(IClientAPI client) |
3506 | { | 3546 | { |
3507 | //We can safely ignore null reference exceptions. It means the avatar is dead and cleaned up anyway | 3547 | //We can safely ignore null reference exceptions. It means the avatar is dead and cleaned up anyway |
3508 | try { client.SendKillObject(new List<uint> { avatar.LocalId }); } | 3548 | try { client.SendKillObject(new List<uint> { avatar.LocalId }); } |
3509 | catch (NullReferenceException) { } | 3549 | catch (NullReferenceException) { } |
3510 | }); | 3550 | }); |
3511 | } | 3551 | } |
3512 | 3552 | ||
3513 | // It's possible for child agents to have transactions if changes are being made cross-border. | 3553 | // It's possible for child agents to have transactions if changes are being made cross-border. |
3514 | if (AgentTransactionsModule != null) | 3554 | if (AgentTransactionsModule != null) |
3515 | AgentTransactionsModule.RemoveAgentAssetTransactions(agentID); | 3555 | AgentTransactionsModule.RemoveAgentAssetTransactions(agentID); |
3516 | } | 3556 | } |
3517 | catch (Exception e) | 3557 | catch (Exception e) |
3518 | { | 3558 | { |
3519 | m_log.Error( | 3559 | m_log.Error( |
3520 | string.Format("[SCENE]: Exception removing {0} from {1}. Cleaning up. Exception ", avatar.Name, Name), e); | 3560 | string.Format("[SCENE]: Exception removing {0} from {1}. Cleaning up. Exception ", avatar.Name, Name), e); |
3521 | } | 3561 | } |
3522 | finally | 3562 | finally |
3523 | { | 3563 | { |
@@ -3529,13 +3569,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
3529 | m_authenticateHandler.RemoveCircuit(agentID); | 3569 | m_authenticateHandler.RemoveCircuit(agentID); |
3530 | m_sceneGraph.RemoveScenePresence(agentID); | 3570 | m_sceneGraph.RemoveScenePresence(agentID); |
3531 | m_clientManager.Remove(agentID); | 3571 | m_clientManager.Remove(agentID); |
3532 | 3572 | ||
3533 | avatar.Close(); | 3573 | avatar.Close(); |
3534 | } | 3574 | } |
3535 | catch (Exception e) | 3575 | catch (Exception e) |
3536 | { | 3576 | { |
3537 | m_log.Error( | 3577 | m_log.Error( |
3538 | string.Format("[SCENE]: Exception in final clean up of {0} in {1}. Exception ", avatar.Name, Name), e); | 3578 | string.Format("[SCENE]: Exception in final clean up of {0} in {1}. Exception ", avatar.Name, Name), e); |
3539 | } | 3579 | } |
3540 | } | 3580 | } |
3541 | } | 3581 | } |
@@ -3581,7 +3621,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3581 | if (part.ParentGroup != null && !part.ParentGroup.IsDeleted) // Valid | 3621 | if (part.ParentGroup != null && !part.ParentGroup.IsDeleted) // Valid |
3582 | { | 3622 | { |
3583 | if (part.ParentGroup.RootPart != part) // Child part | 3623 | if (part.ParentGroup.RootPart != part) // Child part |
3584 | continue; | 3624 | continue; |
3585 | } | 3625 | } |
3586 | } | 3626 | } |
3587 | deleteIDs.Add(localID); | 3627 | deleteIDs.Add(localID); |
@@ -3634,7 +3674,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3634 | public bool NewUserConnection(AgentCircuitData acd, uint teleportFlags, GridRegion source, out string reason, bool requirePresenceLookup) | 3674 | public bool NewUserConnection(AgentCircuitData acd, uint teleportFlags, GridRegion source, out string reason, bool requirePresenceLookup) |
3635 | { | 3675 | { |
3636 | bool vialogin = ((teleportFlags & (uint)TPFlags.ViaLogin) != 0 || | 3676 | bool vialogin = ((teleportFlags & (uint)TPFlags.ViaLogin) != 0 || |
3637 | (teleportFlags & (uint)TPFlags.ViaHGLogin) != 0); | 3677 | (teleportFlags & (uint)TPFlags.ViaHGLogin) != 0); |
3638 | bool viahome = ((teleportFlags & (uint)TPFlags.ViaHome) != 0); | 3678 | bool viahome = ((teleportFlags & (uint)TPFlags.ViaHome) != 0); |
3639 | bool godlike = ((teleportFlags & (uint)TPFlags.Godlike) != 0); | 3679 | bool godlike = ((teleportFlags & (uint)TPFlags.Godlike) != 0); |
3640 | 3680 | ||
@@ -3650,18 +3690,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
3650 | // Don't disable this log message - it's too helpful | 3690 | // Don't disable this log message - it's too helpful |
3651 | string curViewer = Util.GetViewerName(acd); | 3691 | string curViewer = Util.GetViewerName(acd); |
3652 | m_log.DebugFormat( | 3692 | m_log.DebugFormat( |
3653 | "[SCENE]: Region {0} told of incoming {1} agent {2} {3} {4} (circuit code {5}, IP {6}, viewer {7}, teleportflags ({8}), position {9}. {10}", | 3693 | "[SCENE]: Region {0} told of incoming {1} agent {2} {3} {4} (circuit code {5}, IP {6}, viewer {7}, teleportflags ({8}), position {9}. {10}", |
3654 | RegionInfo.RegionName, | 3694 | RegionInfo.RegionName, |
3655 | (acd.child ? "child" : "root"), | 3695 | (acd.child ? "child" : "root"), |
3656 | acd.firstname, | 3696 | acd.firstname, |
3657 | acd.lastname, | 3697 | acd.lastname, |
3658 | acd.AgentID, | 3698 | acd.AgentID, |
3659 | acd.circuitcode, | 3699 | acd.circuitcode, |
3660 | acd.IPAddress, | 3700 | acd.IPAddress, |
3661 | curViewer, | 3701 | curViewer, |
3662 | ((TPFlags)teleportFlags).ToString(), | 3702 | ((TPFlags)teleportFlags).ToString(), |
3663 | acd.startpos, | 3703 | acd.startpos, |
3664 | (source == null) ? "" : string.Format("From region {0} ({1}){2}", source.RegionName, source.RegionID, (source.RawServerURI == null) ? "" : " @ " + source.ServerURI) | 3704 | (source == null) ? "" : string.Format("From region {0} ({1}){2}", source.RegionName, source.RegionID, (source.RawServerURI == null) ? "" : " @ " + source.ServerURI) |
3665 | ); | 3705 | ); |
3666 | 3706 | ||
3667 | if (!LoginsEnabled) | 3707 | if (!LoginsEnabled) |
@@ -3707,8 +3747,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
3707 | if (ViewerDenied) | 3747 | if (ViewerDenied) |
3708 | { | 3748 | { |
3709 | m_log.DebugFormat( | 3749 | m_log.DebugFormat( |
3710 | "[SCENE]: Access denied for {0} {1} using {2}", | 3750 | "[SCENE]: Access denied for {0} {1} using {2}", |
3711 | acd.firstname, acd.lastname, curViewer); | 3751 | acd.firstname, acd.lastname, curViewer); |
3712 | reason = "Access denied, your viewer is banned by the region owner"; | 3752 | reason = "Access denied, your viewer is banned by the region owner"; |
3713 | return false; | 3753 | return false; |
3714 | } | 3754 | } |
@@ -3722,13 +3762,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
3722 | 3762 | ||
3723 | // We need to ensure that we are not already removing the scene presence before we ask it not to be | 3763 | // We need to ensure that we are not already removing the scene presence before we ask it not to be |
3724 | // closed. | 3764 | // closed. |
3725 | if (sp != null && sp.IsChildAgent | 3765 | if (sp != null && sp.IsChildAgent |
3726 | && (sp.LifecycleState == ScenePresenceState.Running | 3766 | && (sp.LifecycleState == ScenePresenceState.Running |
3727 | || sp.LifecycleState == ScenePresenceState.PreRemove)) | 3767 | || sp.LifecycleState == ScenePresenceState.PreRemove)) |
3728 | { | 3768 | { |
3729 | m_log.DebugFormat( | 3769 | m_log.DebugFormat( |
3730 | "[SCENE]: Reusing existing child scene presence for {0}, state {1} in {2}", | 3770 | "[SCENE]: Reusing existing child scene presence for {0}, state {1} in {2}", |
3731 | sp.Name, sp.LifecycleState, Name); | 3771 | sp.Name, sp.LifecycleState, Name); |
3732 | 3772 | ||
3733 | // In the case where, for example, an A B C D region layout, an avatar may | 3773 | // In the case where, for example, an A B C D region layout, an avatar may |
3734 | // teleport from A -> D, but then -> C before A has asked B to close its old child agent. When C | 3774 | // teleport from A -> D, but then -> C before A has asked B to close its old child agent. When C |
@@ -3740,15 +3780,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
3740 | // vulnerable to an issue when a viewer quits a region without sending a proper logout but then | 3780 | // vulnerable to an issue when a viewer quits a region without sending a proper logout but then |
3741 | // re-establishes the connection on a relogin. This could wrongly set the DoNotCloseAfterTeleport | 3781 | // re-establishes the connection on a relogin. This could wrongly set the DoNotCloseAfterTeleport |
3742 | // flag when no teleport had taken place (and hence no close was going to come). | 3782 | // flag when no teleport had taken place (and hence no close was going to come). |
3743 | // if (!acd.ChildrenCapSeeds.ContainsKey(RegionInfo.RegionHandle)) | 3783 | // if (!acd.ChildrenCapSeeds.ContainsKey(RegionInfo.RegionHandle)) |
3744 | // { | 3784 | // { |
3745 | // m_log.DebugFormat( | 3785 | // m_log.DebugFormat( |
3746 | // "[SCENE]: Setting DoNotCloseAfterTeleport for child scene presence {0} in {1} because source will attempt close.", | 3786 | // "[SCENE]: Setting DoNotCloseAfterTeleport for child scene presence {0} in {1} because source will attempt close.", |
3747 | // sp.Name, Name); | 3787 | // sp.Name, Name); |
3748 | // | 3788 | // |
3749 | // sp.DoNotCloseAfterTeleport = true; | 3789 | // sp.DoNotCloseAfterTeleport = true; |
3750 | // } | 3790 | // } |
3751 | // else if (EntityTransferModule.IsInTransit(sp.UUID)) | 3791 | // else if (EntityTransferModule.IsInTransit(sp.UUID)) |
3752 | 3792 | ||
3753 | sp.LifecycleState = ScenePresenceState.Running; | 3793 | sp.LifecycleState = ScenePresenceState.Running; |
3754 | 3794 | ||
@@ -3757,8 +3797,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
3757 | sp.DoNotCloseAfterTeleport = true; | 3797 | sp.DoNotCloseAfterTeleport = true; |
3758 | 3798 | ||
3759 | m_log.DebugFormat( | 3799 | m_log.DebugFormat( |
3760 | "[SCENE]: Set DoNotCloseAfterTeleport for child scene presence {0} in {1} because this region will attempt end-of-teleport close from a previous close.", | 3800 | "[SCENE]: Set DoNotCloseAfterTeleport for child scene presence {0} in {1} because this region will attempt end-of-teleport close from a previous close.", |
3761 | sp.Name, Name); | 3801 | sp.Name, Name); |
3762 | } | 3802 | } |
3763 | } | 3803 | } |
3764 | } | 3804 | } |
@@ -3772,21 +3812,21 @@ namespace OpenSim.Region.Framework.Scenes | |||
3772 | int pollsLeft = polls; | 3812 | int pollsLeft = polls; |
3773 | 3813 | ||
3774 | while (sp.LifecycleState == ScenePresenceState.Removing && pollsLeft-- > 0) | 3814 | while (sp.LifecycleState == ScenePresenceState.Removing && pollsLeft-- > 0) |
3775 | Thread.Sleep(pollInterval); | 3815 | Thread.Sleep(pollInterval); |
3776 | 3816 | ||
3777 | if (sp.LifecycleState == ScenePresenceState.Removing) | 3817 | if (sp.LifecycleState == ScenePresenceState.Removing) |
3778 | { | 3818 | { |
3779 | m_log.WarnFormat( | 3819 | m_log.WarnFormat( |
3780 | "[SCENE]: Agent {0} in {1} was still being removed after {2}s. Aborting NewUserConnection.", | 3820 | "[SCENE]: Agent {0} in {1} was still being removed after {2}s. Aborting NewUserConnection.", |
3781 | sp.Name, Name, polls * pollInterval / 1000); | 3821 | sp.Name, Name, polls * pollInterval / 1000); |
3782 | 3822 | ||
3783 | return false; | 3823 | return false; |
3784 | } | 3824 | } |
3785 | else if (polls != pollsLeft) | 3825 | else if (polls != pollsLeft) |
3786 | { | 3826 | { |
3787 | m_log.DebugFormat( | 3827 | m_log.DebugFormat( |
3788 | "[SCENE]: NewUserConnection for agent {0} in {1} had to wait {2}s for in-progress removal to complete on an old presence.", | 3828 | "[SCENE]: NewUserConnection for agent {0} in {1} had to wait {2}s for in-progress removal to complete on an old presence.", |
3789 | sp.Name, Name, polls * pollInterval / 1000); | 3829 | sp.Name, Name, polls * pollInterval / 1000); |
3790 | } | 3830 | } |
3791 | } | 3831 | } |
3792 | 3832 | ||
@@ -3802,11 +3842,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
3802 | // Or the same user is trying to be root twice here, won't work. | 3842 | // Or the same user is trying to be root twice here, won't work. |
3803 | // Kill it. | 3843 | // Kill it. |
3804 | m_log.WarnFormat( | 3844 | m_log.WarnFormat( |
3805 | "[SCENE]: Existing root scene presence detected for {0} {1} in {2} when connecting. Removing existing presence.", | 3845 | "[SCENE]: Existing root scene presence detected for {0} {1} in {2} when connecting. Removing existing presence.", |
3806 | sp.Name, sp.UUID, RegionInfo.RegionName); | 3846 | sp.Name, sp.UUID, RegionInfo.RegionName); |
3807 | 3847 | ||
3808 | if (sp.ControllingClient != null) | 3848 | if (sp.ControllingClient != null) |
3809 | CloseAgent(sp.UUID, true); | 3849 | CloseAgent(sp.UUID, true); |
3810 | 3850 | ||
3811 | sp = null; | 3851 | sp = null; |
3812 | } | 3852 | } |
@@ -3821,7 +3861,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3821 | m_authenticateHandler.AddNewCircuit(acd.circuitcode, acd); | 3861 | m_authenticateHandler.AddNewCircuit(acd.circuitcode, acd); |
3822 | 3862 | ||
3823 | land = LandChannel.GetLandObject(acd.startpos.X, acd.startpos.Y); | 3863 | land = LandChannel.GetLandObject(acd.startpos.X, acd.startpos.Y); |
3824 | 3864 | ||
3825 | // On login test land permisions | 3865 | // On login test land permisions |
3826 | if (vialogin) | 3866 | if (vialogin) |
3827 | { | 3867 | { |
@@ -3831,7 +3871,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3831 | return false; | 3871 | return false; |
3832 | } | 3872 | } |
3833 | } | 3873 | } |
3834 | 3874 | ||
3835 | if (sp == null) // We don't have an [child] agent here already | 3875 | if (sp == null) // We don't have an [child] agent here already |
3836 | { | 3876 | { |
3837 | if (requirePresenceLookup) | 3877 | if (requirePresenceLookup) |
@@ -3847,13 +3887,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
3847 | catch (Exception e) | 3887 | catch (Exception e) |
3848 | { | 3888 | { |
3849 | m_log.ErrorFormat( | 3889 | m_log.ErrorFormat( |
3850 | "[SCENE]: Exception verifying presence {0}{1}", e.Message, e.StackTrace); | 3890 | "[SCENE]: Exception verifying presence {0}{1}", e.Message, e.StackTrace); |
3851 | 3891 | ||
3852 | m_authenticateHandler.RemoveCircuit(acd.circuitcode); | 3892 | m_authenticateHandler.RemoveCircuit(acd.circuitcode); |
3853 | return false; | 3893 | return false; |
3854 | } | 3894 | } |
3855 | } | 3895 | } |
3856 | 3896 | ||
3857 | try | 3897 | try |
3858 | { | 3898 | { |
3859 | if (!AuthorizeUser(acd, (vialogin ? false : SeeIntoRegion), out reason)) | 3899 | if (!AuthorizeUser(acd, (vialogin ? false : SeeIntoRegion), out reason)) |
@@ -3865,17 +3905,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
3865 | catch (Exception e) | 3905 | catch (Exception e) |
3866 | { | 3906 | { |
3867 | m_log.ErrorFormat( | 3907 | m_log.ErrorFormat( |
3868 | "[SCENE]: Exception authorizing user {0}{1}", e.Message, e.StackTrace); | 3908 | "[SCENE]: Exception authorizing user {0}{1}", e.Message, e.StackTrace); |
3869 | 3909 | ||
3870 | m_authenticateHandler.RemoveCircuit(acd.circuitcode); | 3910 | m_authenticateHandler.RemoveCircuit(acd.circuitcode); |
3871 | return false; | 3911 | return false; |
3872 | } | 3912 | } |
3873 | 3913 | ||
3874 | m_log.InfoFormat( | 3914 | m_log.InfoFormat( |
3875 | "[SCENE]: Region {0} authenticated and authorized incoming {1} agent {2} {3} {4} (circuit code {5})", | 3915 | "[SCENE]: Region {0} authenticated and authorized incoming {1} agent {2} {3} {4} (circuit code {5})", |
3876 | Name, (acd.child ? "child" : "root"), acd.firstname, acd.lastname, | 3916 | Name, (acd.child ? "child" : "root"), acd.firstname, acd.lastname, |
3877 | acd.AgentID, acd.circuitcode); | 3917 | acd.AgentID, acd.circuitcode); |
3878 | 3918 | ||
3879 | if (CapsModule != null) | 3919 | if (CapsModule != null) |
3880 | { | 3920 | { |
3881 | CapsModule.SetAgentCapsSeeds(acd); | 3921 | CapsModule.SetAgentCapsSeeds(acd); |
@@ -3887,13 +3927,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
3887 | // Let the SP know how we got here. This has a lot of interesting | 3927 | // Let the SP know how we got here. This has a lot of interesting |
3888 | // uses down the line. | 3928 | // uses down the line. |
3889 | sp.TeleportFlags = (TPFlags)teleportFlags; | 3929 | sp.TeleportFlags = (TPFlags)teleportFlags; |
3890 | 3930 | ||
3891 | if (sp.IsChildAgent) | 3931 | if (sp.IsChildAgent) |
3892 | { | 3932 | { |
3893 | m_log.DebugFormat( | 3933 | m_log.DebugFormat( |
3894 | "[SCENE]: Adjusting known seeds for existing agent {0} in {1}", | 3934 | "[SCENE]: Adjusting known seeds for existing agent {0} in {1}", |
3895 | acd.AgentID, RegionInfo.RegionName); | 3935 | acd.AgentID, RegionInfo.RegionName); |
3896 | 3936 | ||
3897 | sp.AdjustKnownSeeds(); | 3937 | sp.AdjustKnownSeeds(); |
3898 | 3938 | ||
3899 | if (CapsModule != null) | 3939 | if (CapsModule != null) |
@@ -3912,7 +3952,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3912 | 3952 | ||
3913 | if (vialogin) | 3953 | if (vialogin) |
3914 | { | 3954 | { |
3915 | // CleanDroppedAttachments(); | 3955 | // CleanDroppedAttachments(); |
3916 | 3956 | ||
3917 | // Make sure avatar position is in the region (why it wouldn't be is a mystery but do sanity checking) | 3957 | // Make sure avatar position is in the region (why it wouldn't be is a mystery but do sanity checking) |
3918 | if (acd.startpos.X < 0) acd.startpos.X = 1f; | 3958 | if (acd.startpos.X < 0) acd.startpos.X = 1f; |
@@ -3920,14 +3960,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
3920 | if (acd.startpos.Y < 0) acd.startpos.Y = 1f; | 3960 | if (acd.startpos.Y < 0) acd.startpos.Y = 1f; |
3921 | if (acd.startpos.Y >= RegionInfo.RegionSizeY) acd.startpos.Y = RegionInfo.RegionSizeY - 1f; | 3961 | if (acd.startpos.Y >= RegionInfo.RegionSizeY) acd.startpos.Y = RegionInfo.RegionSizeY - 1f; |
3922 | 3962 | ||
3923 | // m_log.DebugFormat( | 3963 | // m_log.DebugFormat( |
3924 | // "[SCENE]: Found telehub object {0} for new user connection {1} to {2}", | 3964 | // "[SCENE]: Found telehub object {0} for new user connection {1} to {2}", |
3925 | // RegionInfo.RegionSettings.TelehubObject, acd.Name, Name); | 3965 | // RegionInfo.RegionSettings.TelehubObject, acd.Name, Name); |
3926 | 3966 | ||
3927 | // Honor Estate teleport routing via Telehubs excluding ViaHome and GodLike TeleportFlags | 3967 | // Honor Estate teleport routing via Telehubs excluding ViaHome and GodLike TeleportFlags |
3928 | if (RegionInfo.RegionSettings.TelehubObject != UUID.Zero && | 3968 | if (RegionInfo.RegionSettings.TelehubObject != UUID.Zero && |
3929 | RegionInfo.EstateSettings.AllowDirectTeleport == false && | 3969 | RegionInfo.EstateSettings.AllowDirectTeleport == false && |
3930 | !viahome && !godlike) | 3970 | !viahome && !godlike) |
3931 | { | 3971 | { |
3932 | SceneObjectGroup telehub = GetSceneObjectGroup(RegionInfo.RegionSettings.TelehubObject); | 3972 | SceneObjectGroup telehub = GetSceneObjectGroup(RegionInfo.RegionSettings.TelehubObject); |
3933 | 3973 | ||
@@ -3939,15 +3979,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
3939 | { | 3979 | { |
3940 | // We have multiple SpawnPoints, Route the agent to a random or sequential one | 3980 | // We have multiple SpawnPoints, Route the agent to a random or sequential one |
3941 | if (SpawnPointRouting == "random") | 3981 | if (SpawnPointRouting == "random") |
3942 | acd.startpos = spawnpoints[Util.RandomClass.Next(spawnpoints.Count) - 1].GetLocation( | 3982 | acd.startpos = spawnpoints[Util.RandomClass.Next(spawnpoints.Count) - 1].GetLocation( |
3943 | telehub.AbsolutePosition, | 3983 | telehub.AbsolutePosition, |
3944 | telehub.GroupRotation | 3984 | telehub.GroupRotation |
3945 | ); | 3985 | ); |
3946 | else | 3986 | else |
3947 | acd.startpos = spawnpoints[SpawnPoint()].GetLocation( | 3987 | acd.startpos = spawnpoints[SpawnPoint()].GetLocation( |
3948 | telehub.AbsolutePosition, | 3988 | telehub.AbsolutePosition, |
3949 | telehub.GroupRotation | 3989 | telehub.GroupRotation |
3950 | ); | 3990 | ); |
3951 | } | 3991 | } |
3952 | else if (spawnpoints.Count == 1) | 3992 | else if (spawnpoints.Count == 1) |
3953 | { | 3993 | { |
@@ -3957,15 +3997,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
3957 | else | 3997 | else |
3958 | { | 3998 | { |
3959 | m_log.DebugFormat( | 3999 | m_log.DebugFormat( |
3960 | "[SCENE]: No spawnpoints defined for telehub {0} for {1} in {2}. Continuing.", | 4000 | "[SCENE]: No spawnpoints defined for telehub {0} for {1} in {2}. Continuing.", |
3961 | RegionInfo.RegionSettings.TelehubObject, acd.Name, Name); | 4001 | RegionInfo.RegionSettings.TelehubObject, acd.Name, Name); |
3962 | } | 4002 | } |
3963 | } | 4003 | } |
3964 | else | 4004 | else |
3965 | { | 4005 | { |
3966 | m_log.DebugFormat( | 4006 | m_log.DebugFormat( |
3967 | "[SCENE]: No telehub {0} found to direct {1} in {2}. Continuing.", | 4007 | "[SCENE]: No telehub {0} found to direct {1} in {2}. Continuing.", |
3968 | RegionInfo.RegionSettings.TelehubObject, acd.Name, Name); | 4008 | RegionInfo.RegionSettings.TelehubObject, acd.Name, Name); |
3969 | } | 4009 | } |
3970 | 4010 | ||
3971 | // Final permissions check; this time we don't allow changing the position | 4011 | // Final permissions check; this time we don't allow changing the position |
@@ -4002,7 +4042,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4002 | { | 4042 | { |
4003 | ILandObject land = LandChannel.GetLandObject(pos); | 4043 | ILandObject land = LandChannel.GetLandObject(pos); |
4004 | if (land == null) | 4044 | if (land == null) |
4005 | return true; | 4045 | return true; |
4006 | 4046 | ||
4007 | if (land.IsBannedFromLand(agentID) || land.IsRestrictedFromLand(agentID)) | 4047 | if (land.IsBannedFromLand(agentID) || land.IsRestrictedFromLand(agentID)) |
4008 | { | 4048 | { |
@@ -4016,21 +4056,21 @@ namespace OpenSim.Region.Framework.Scenes | |||
4016 | public bool TestLandRestrictions(UUID agentID, out string reason, ref float posX, ref float posY) | 4056 | public bool TestLandRestrictions(UUID agentID, out string reason, ref float posX, ref float posY) |
4017 | { | 4057 | { |
4018 | if (posX < 0) | 4058 | if (posX < 0) |
4019 | posX = 0; | 4059 | posX = 0; |
4020 | else if (posX >= (float)RegionInfo.RegionSizeX) | 4060 | else if (posX >= (float)RegionInfo.RegionSizeX) |
4021 | posX = (float)RegionInfo.RegionSizeX - 0.001f; | 4061 | posX = (float)RegionInfo.RegionSizeX - 0.001f; |
4022 | if (posY < 0) | 4062 | if (posY < 0) |
4023 | posY = 0; | 4063 | posY = 0; |
4024 | else if (posY >= (float)RegionInfo.RegionSizeY) | 4064 | else if (posY >= (float)RegionInfo.RegionSizeY) |
4025 | posY = (float)RegionInfo.RegionSizeY - 0.001f; | 4065 | posY = (float)RegionInfo.RegionSizeY - 0.001f; |
4026 | 4066 | ||
4027 | reason = String.Empty; | 4067 | reason = String.Empty; |
4028 | if (Permissions.IsGod(agentID)) | 4068 | if (Permissions.IsGod(agentID)) |
4029 | return true; | 4069 | return true; |
4030 | 4070 | ||
4031 | ILandObject land = LandChannel.GetLandObject(posX, posY); | 4071 | ILandObject land = LandChannel.GetLandObject(posX, posY); |
4032 | if (land == null) | 4072 | if (land == null) |
4033 | return false; | 4073 | return false; |
4034 | 4074 | ||
4035 | bool banned = land.IsBannedFromLand(agentID); | 4075 | bool banned = land.IsBannedFromLand(agentID); |
4036 | bool restricted = land.IsRestrictedFromLand(agentID); | 4076 | bool restricted = land.IsRestrictedFromLand(agentID); |
@@ -4054,7 +4094,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4054 | else | 4094 | else |
4055 | { | 4095 | { |
4056 | reason = String.Format("Denied access to private region {0}: You are not on the access list for that region.", | 4096 | reason = String.Format("Denied access to private region {0}: You are not on the access list for that region.", |
4057 | RegionInfo.RegionName); | 4097 | RegionInfo.RegionName); |
4058 | } | 4098 | } |
4059 | return false; | 4099 | return false; |
4060 | } | 4100 | } |
@@ -4105,15 +4145,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
4105 | 4145 | ||
4106 | if (!m_strictAccessControl) return true; | 4146 | if (!m_strictAccessControl) return true; |
4107 | if (Permissions.IsGod(agent.AgentID)) return true; | 4147 | if (Permissions.IsGod(agent.AgentID)) return true; |
4108 | 4148 | ||
4109 | if (AuthorizationService != null) | 4149 | if (AuthorizationService != null) |
4110 | { | 4150 | { |
4111 | if (!AuthorizationService.IsAuthorizedForRegion( | 4151 | if (!AuthorizationService.IsAuthorizedForRegion( |
4112 | agent.AgentID.ToString(), agent.firstname, agent.lastname, RegionInfo.RegionID.ToString(), out reason)) | 4152 | agent.AgentID.ToString(), agent.firstname, agent.lastname, RegionInfo.RegionID.ToString(), out reason)) |
4113 | { | 4153 | { |
4114 | m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because: {4}", | 4154 | m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because: {4}", |
4115 | agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName, reason); | 4155 | agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName, reason); |
4116 | 4156 | ||
4117 | return false; | 4157 | return false; |
4118 | } | 4158 | } |
4119 | } | 4159 | } |
@@ -4129,9 +4169,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
4129 | if (RegionInfo.EstateSettings.IsBanned(agent.AgentID)) | 4169 | if (RegionInfo.EstateSettings.IsBanned(agent.AgentID)) |
4130 | { | 4170 | { |
4131 | m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the user is on the banlist", | 4171 | m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the user is on the banlist", |
4132 | agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName); | 4172 | agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName); |
4133 | reason = String.Format("Denied access to region {0}: You have been banned from that region.", | 4173 | reason = String.Format("Denied access to region {0}: You have been banned from that region.", |
4134 | RegionInfo.RegionName); | 4174 | RegionInfo.RegionName); |
4135 | return false; | 4175 | return false; |
4136 | } | 4176 | } |
4137 | } | 4177 | } |
@@ -4149,7 +4189,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4149 | if (GroupMembership != null) | 4189 | if (GroupMembership != null) |
4150 | { | 4190 | { |
4151 | for (int i = 0; i < GroupMembership.Length; i++) | 4191 | for (int i = 0; i < GroupMembership.Length; i++) |
4152 | agentGroups.Add(GroupMembership[i].GroupID); | 4192 | agentGroups.Add(GroupMembership[i].GroupID); |
4153 | } | 4193 | } |
4154 | else | 4194 | else |
4155 | { | 4195 | { |
@@ -4177,13 +4217,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
4177 | } | 4217 | } |
4178 | 4218 | ||
4179 | if (!RegionInfo.EstateSettings.PublicAccess && | 4219 | if (!RegionInfo.EstateSettings.PublicAccess && |
4180 | !RegionInfo.EstateSettings.HasAccess(agent.AgentID) && | 4220 | !RegionInfo.EstateSettings.HasAccess(agent.AgentID) && |
4181 | !groupAccess) | 4221 | !groupAccess) |
4182 | { | 4222 | { |
4183 | m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the user does not have access to the estate", | 4223 | m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the user does not have access to the estate", |
4184 | agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName); | 4224 | agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName); |
4185 | reason = String.Format("Denied access to private region {0}: You are not on the access list for that region.", | 4225 | reason = String.Format("Denied access to private region {0}: You are not on the access list for that region.", |
4186 | RegionInfo.RegionName); | 4226 | RegionInfo.RegionName); |
4187 | return false; | 4227 | return false; |
4188 | } | 4228 | } |
4189 | } | 4229 | } |
@@ -4239,69 +4279,69 @@ namespace OpenSim.Region.Framework.Scenes | |||
4239 | return m_authenticateHandler.TryChangeCiruitCode(oldcc, newcc); | 4279 | return m_authenticateHandler.TryChangeCiruitCode(oldcc, newcc); |
4240 | } | 4280 | } |
4241 | 4281 | ||
4242 | // /// <summary> | 4282 | // /// <summary> |
4243 | // /// The Grid has requested that we log-off a user. Log them off. | 4283 | // /// The Grid has requested that we log-off a user. Log them off. |
4244 | // /// </summary> | 4284 | // /// </summary> |
4245 | // /// <param name="AvatarID">Unique ID of the avatar to log-off</param> | 4285 | // /// <param name="AvatarID">Unique ID of the avatar to log-off</param> |
4246 | // /// <param name="RegionSecret">SecureSessionID of the user, or the RegionSecret text when logging on to the grid</param> | 4286 | // /// <param name="RegionSecret">SecureSessionID of the user, or the RegionSecret text when logging on to the grid</param> |
4247 | // /// <param name="message">message to display to the user. Reason for being logged off</param> | 4287 | // /// <param name="message">message to display to the user. Reason for being logged off</param> |
4248 | // public void HandleLogOffUserFromGrid(UUID AvatarID, UUID RegionSecret, string message) | 4288 | // public void HandleLogOffUserFromGrid(UUID AvatarID, UUID RegionSecret, string message) |
4249 | // { | 4289 | // { |
4250 | // ScenePresence loggingOffUser = GetScenePresence(AvatarID); | 4290 | // ScenePresence loggingOffUser = GetScenePresence(AvatarID); |
4251 | // if (loggingOffUser != null) | 4291 | // if (loggingOffUser != null) |
4252 | // { | 4292 | // { |
4253 | // UUID localRegionSecret = UUID.Zero; | 4293 | // UUID localRegionSecret = UUID.Zero; |
4254 | // bool parsedsecret = UUID.TryParse(RegionInfo.regionSecret, out localRegionSecret); | 4294 | // bool parsedsecret = UUID.TryParse(RegionInfo.regionSecret, out localRegionSecret); |
4255 | // | 4295 | // |
4256 | // // Region Secret is used here in case a new sessionid overwrites an old one on the user server. | 4296 | // // Region Secret is used here in case a new sessionid overwrites an old one on the user server. |
4257 | // // Will update the user server in a few revisions to use it. | 4297 | // // Will update the user server in a few revisions to use it. |
4258 | // | 4298 | // |
4259 | // if (RegionSecret == loggingOffUser.ControllingClient.SecureSessionId || (parsedsecret && RegionSecret == localRegionSecret)) | 4299 | // if (RegionSecret == loggingOffUser.ControllingClient.SecureSessionId || (parsedsecret && RegionSecret == localRegionSecret)) |
4260 | // { | 4300 | // { |
4261 | // m_sceneGridService.SendCloseChildAgentConnections(loggingOffUser.UUID, loggingOffUser.KnownRegionHandles); | 4301 | // m_sceneGridService.SendCloseChildAgentConnections(loggingOffUser.UUID, loggingOffUser.KnownRegionHandles); |
4262 | // loggingOffUser.ControllingClient.Kick(message); | 4302 | // loggingOffUser.ControllingClient.Kick(message); |
4263 | // // Give them a second to receive the message! | 4303 | // // Give them a second to receive the message! |
4264 | // Thread.Sleep(1000); | 4304 | // Thread.Sleep(1000); |
4265 | // loggingOffUser.ControllingClient.Close(); | 4305 | // loggingOffUser.ControllingClient.Close(); |
4266 | // } | 4306 | // } |
4267 | // else | 4307 | // else |
4268 | // { | 4308 | // { |
4269 | // m_log.Info("[USERLOGOFF]: System sending the LogOff user message failed to sucessfully authenticate"); | 4309 | // m_log.Info("[USERLOGOFF]: System sending the LogOff user message failed to sucessfully authenticate"); |
4270 | // } | 4310 | // } |
4271 | // } | 4311 | // } |
4272 | // else | 4312 | // else |
4273 | // { | 4313 | // { |
4274 | // m_log.InfoFormat("[USERLOGOFF]: Got a logoff request for {0} but the user isn't here. The user might already have been logged out", AvatarID.ToString()); | 4314 | // m_log.InfoFormat("[USERLOGOFF]: Got a logoff request for {0} but the user isn't here. The user might already have been logged out", AvatarID.ToString()); |
4275 | // } | 4315 | // } |
4276 | // } | 4316 | // } |
4277 | 4317 | ||
4278 | // /// <summary> | 4318 | // /// <summary> |
4279 | // /// Triggered when an agent crosses into this sim. Also happens on initial login. | 4319 | // /// Triggered when an agent crosses into this sim. Also happens on initial login. |
4280 | // /// </summary> | 4320 | // /// </summary> |
4281 | // /// <param name="agentID"></param> | 4321 | // /// <param name="agentID"></param> |
4282 | // /// <param name="position"></param> | 4322 | // /// <param name="position"></param> |
4283 | // /// <param name="isFlying"></param> | 4323 | // /// <param name="isFlying"></param> |
4284 | // public virtual void AgentCrossing(UUID agentID, Vector3 position, bool isFlying) | 4324 | // public virtual void AgentCrossing(UUID agentID, Vector3 position, bool isFlying) |
4285 | // { | 4325 | // { |
4286 | // ScenePresence presence = GetScenePresence(agentID); | 4326 | // ScenePresence presence = GetScenePresence(agentID); |
4287 | // if (presence != null) | 4327 | // if (presence != null) |
4288 | // { | 4328 | // { |
4289 | // try | 4329 | // try |
4290 | // { | 4330 | // { |
4291 | // presence.MakeRootAgent(position, isFlying); | 4331 | // presence.MakeRootAgent(position, isFlying); |
4292 | // } | 4332 | // } |
4293 | // catch (Exception e) | 4333 | // catch (Exception e) |
4294 | // { | 4334 | // { |
4295 | // m_log.ErrorFormat("[SCENE]: Unable to do agent crossing, exception {0}{1}", e.Message, e.StackTrace); | 4335 | // m_log.ErrorFormat("[SCENE]: Unable to do agent crossing, exception {0}{1}", e.Message, e.StackTrace); |
4296 | // } | 4336 | // } |
4297 | // } | 4337 | // } |
4298 | // else | 4338 | // else |
4299 | // { | 4339 | // { |
4300 | // m_log.ErrorFormat( | 4340 | // m_log.ErrorFormat( |
4301 | // "[SCENE]: Could not find presence for agent {0} crossing into scene {1}", | 4341 | // "[SCENE]: Could not find presence for agent {0} crossing into scene {1}", |
4302 | // agentID, RegionInfo.RegionName); | 4342 | // agentID, RegionInfo.RegionName); |
4303 | // } | 4343 | // } |
4304 | // } | 4344 | // } |
4305 | 4345 | ||
4306 | /// <summary> | 4346 | /// <summary> |
4307 | /// We've got an update about an agent that sees into this region, | 4347 | /// We've got an update about an agent that sees into this region, |
@@ -4313,15 +4353,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
4313 | public virtual bool IncomingUpdateChildAgent(AgentData cAgentData) | 4353 | public virtual bool IncomingUpdateChildAgent(AgentData cAgentData) |
4314 | { | 4354 | { |
4315 | m_log.DebugFormat( | 4355 | m_log.DebugFormat( |
4316 | "[SCENE]: Incoming child agent update for {0} in {1}", cAgentData.AgentID, RegionInfo.RegionName); | 4356 | "[SCENE]: Incoming child agent update for {0} in {1}", cAgentData.AgentID, RegionInfo.RegionName); |
4317 | 4357 | ||
4318 | // TODO: This check should probably be in QueryAccess(). | 4358 | // TODO: This check should probably be in QueryAccess(). |
4319 | ILandObject nearestParcel = GetNearestAllowedParcel(cAgentData.AgentID, RegionInfo.RegionSizeX / 2, RegionInfo.RegionSizeY / 2); | 4359 | ILandObject nearestParcel = GetNearestAllowedParcel(cAgentData.AgentID, RegionInfo.RegionSizeX / 2, RegionInfo.RegionSizeY / 2); |
4320 | if (nearestParcel == null) | 4360 | if (nearestParcel == null) |
4321 | { | 4361 | { |
4322 | m_log.InfoFormat( | 4362 | m_log.InfoFormat( |
4323 | "[SCENE]: Denying root agent entry to {0} in {1}: no allowed parcel", | 4363 | "[SCENE]: Denying root agent entry to {0} in {1}: no allowed parcel", |
4324 | cAgentData.AgentID, RegionInfo.RegionName); | 4364 | cAgentData.AgentID, RegionInfo.RegionName); |
4325 | 4365 | ||
4326 | return false; | 4366 | return false; |
4327 | } | 4367 | } |
@@ -4337,11 +4377,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
4337 | if (cAgentData.SessionID != sp.ControllingClient.SessionId) | 4377 | if (cAgentData.SessionID != sp.ControllingClient.SessionId) |
4338 | { | 4378 | { |
4339 | m_log.WarnFormat( | 4379 | m_log.WarnFormat( |
4340 | "[SCENE]: Attempt to update agent {0} with invalid session id {1} (possibly from simulator in older version; tell them to update).", | 4380 | "[SCENE]: Attempt to update agent {0} with invalid session id {1} (possibly from simulator in older version; tell them to update).", |
4341 | sp.UUID, cAgentData.SessionID); | 4381 | sp.UUID, cAgentData.SessionID); |
4342 | 4382 | ||
4343 | Console.WriteLine(String.Format("[SCENE]: Attempt to update agent {0} ({1}) with invalid session id {2}", | 4383 | Console.WriteLine(String.Format("[SCENE]: Attempt to update agent {0} ({1}) with invalid session id {2}", |
4344 | sp.UUID, sp.ControllingClient.SessionId, cAgentData.SessionID)); | 4384 | sp.UUID, sp.ControllingClient.SessionId, cAgentData.SessionID)); |
4345 | } | 4385 | } |
4346 | 4386 | ||
4347 | sp.UpdateChildAgent(cAgentData); | 4387 | sp.UpdateChildAgent(cAgentData); |
@@ -4350,19 +4390,19 @@ namespace OpenSim.Region.Framework.Scenes | |||
4350 | if (cAgentData.SenderWantsToWaitForRoot) | 4390 | if (cAgentData.SenderWantsToWaitForRoot) |
4351 | { | 4391 | { |
4352 | while (sp.IsChildAgent && ntimes-- > 0) | 4392 | while (sp.IsChildAgent && ntimes-- > 0) |
4353 | Thread.Sleep(1000); | 4393 | Thread.Sleep(1000); |
4354 | 4394 | ||
4355 | if (sp.IsChildAgent) | 4395 | if (sp.IsChildAgent) |
4356 | m_log.WarnFormat( | 4396 | m_log.WarnFormat( |
4357 | "[SCENE]: Found presence {0} {1} unexpectedly still child in {2}", | 4397 | "[SCENE]: Found presence {0} {1} unexpectedly still child in {2}", |
4358 | sp.Name, sp.UUID, Name); | 4398 | sp.Name, sp.UUID, Name); |
4359 | else | 4399 | else |
4360 | m_log.InfoFormat( | 4400 | m_log.InfoFormat( |
4361 | "[SCENE]: Found presence {0} {1} as root in {2} after {3} waits", | 4401 | "[SCENE]: Found presence {0} {1} as root in {2} after {3} waits", |
4362 | sp.Name, sp.UUID, Name, 20 - ntimes); | 4402 | sp.Name, sp.UUID, Name, 20 - ntimes); |
4363 | 4403 | ||
4364 | if (sp.IsChildAgent) | 4404 | if (sp.IsChildAgent) |
4365 | return false; | 4405 | return false; |
4366 | } | 4406 | } |
4367 | 4407 | ||
4368 | return true; | 4408 | return true; |
@@ -4379,17 +4419,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
4379 | /// <returns>true if we handled it.</returns> | 4419 | /// <returns>true if we handled it.</returns> |
4380 | public virtual bool IncomingUpdateChildAgent(AgentPosition cAgentData) | 4420 | public virtual bool IncomingUpdateChildAgent(AgentPosition cAgentData) |
4381 | { | 4421 | { |
4382 | // m_log.DebugFormat( | 4422 | // m_log.DebugFormat( |
4383 | // "[SCENE PRESENCE]: IncomingChildAgentDataUpdate POSITION for {0} in {1}, position {2}", | 4423 | // "[SCENE PRESENCE]: IncomingChildAgentDataUpdate POSITION for {0} in {1}, position {2}", |
4384 | // cAgentData.AgentID, Name, cAgentData.Position); | 4424 | // cAgentData.AgentID, Name, cAgentData.Position); |
4385 | 4425 | ||
4386 | ScenePresence childAgentUpdate = GetScenePresence(cAgentData.AgentID); | 4426 | ScenePresence childAgentUpdate = GetScenePresence(cAgentData.AgentID); |
4387 | if (childAgentUpdate != null) | 4427 | if (childAgentUpdate != null) |
4388 | { | 4428 | { |
4389 | // if (childAgentUpdate.ControllingClient.SessionId != cAgentData.SessionID) | 4429 | // if (childAgentUpdate.ControllingClient.SessionId != cAgentData.SessionID) |
4390 | // // Only warn for now | 4430 | // // Only warn for now |
4391 | // m_log.WarnFormat("[SCENE]: Attempt at updating position of agent {0} with invalid session id {1}. Neighbor running older version?", | 4431 | // m_log.WarnFormat("[SCENE]: Attempt at updating position of agent {0} with invalid session id {1}. Neighbor running older version?", |
4392 | // childAgentUpdate.UUID, cAgentData.SessionID); | 4432 | // childAgentUpdate.UUID, cAgentData.SessionID); |
4393 | 4433 | ||
4394 | // I can't imagine *yet* why we would get an update if the agent is a root agent.. | 4434 | // I can't imagine *yet* why we would get an update if the agent is a root agent.. |
4395 | // however to avoid a race condition crossing borders.. | 4435 | // however to avoid a race condition crossing borders.. |
@@ -4421,12 +4461,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
4421 | int ntimes = 20; | 4461 | int ntimes = 20; |
4422 | ScenePresence sp = null; | 4462 | ScenePresence sp = null; |
4423 | while ((sp = GetScenePresence(agentID)) == null && (ntimes-- > 0)) | 4463 | while ((sp = GetScenePresence(agentID)) == null && (ntimes-- > 0)) |
4424 | Thread.Sleep(1000); | 4464 | Thread.Sleep(1000); |
4425 | 4465 | ||
4426 | if (sp == null) | 4466 | if (sp == null) |
4427 | m_log.WarnFormat( | 4467 | m_log.WarnFormat( |
4428 | "[SCENE PRESENCE]: Did not find presence with id {0} in {1} before timeout", | 4468 | "[SCENE PRESENCE]: Did not find presence with id {0} in {1} before timeout", |
4429 | agentID, RegionInfo.RegionName); | 4469 | agentID, RegionInfo.RegionName); |
4430 | 4470 | ||
4431 | return sp; | 4471 | return sp; |
4432 | } | 4472 | } |
@@ -4448,8 +4488,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
4448 | if (acd == null) | 4488 | if (acd == null) |
4449 | { | 4489 | { |
4450 | m_log.DebugFormat( | 4490 | m_log.DebugFormat( |
4451 | "[SCENE]: Request to close agent {0} but no such agent in scene {1}. May have been closed previously.", | 4491 | "[SCENE]: Request to close agent {0} but no such agent in scene {1}. May have been closed previously.", |
4452 | agentID, Name); | 4492 | agentID, Name); |
4453 | 4493 | ||
4454 | return false; | 4494 | return false; |
4455 | } | 4495 | } |
@@ -4461,8 +4501,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
4461 | else | 4501 | else |
4462 | { | 4502 | { |
4463 | m_log.WarnFormat( | 4503 | m_log.WarnFormat( |
4464 | "[SCENE]: Request to close agent {0} with invalid authorization token {1} in {2}", | 4504 | "[SCENE]: Request to close agent {0} with invalid authorization token {1} in {2}", |
4465 | agentID, auth_token, Name); | 4505 | agentID, auth_token, Name); |
4466 | } | 4506 | } |
4467 | 4507 | ||
4468 | return false; | 4508 | return false; |
@@ -4488,8 +4528,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
4488 | if (sp.DoNotCloseAfterTeleport) | 4528 | if (sp.DoNotCloseAfterTeleport) |
4489 | { | 4529 | { |
4490 | m_log.DebugFormat( | 4530 | m_log.DebugFormat( |
4491 | "[SCENE]: Not pre-closing {0} agent {1} in {2} since another simulator has re-established the child connection", | 4531 | "[SCENE]: Not pre-closing {0} agent {1} in {2} since another simulator has re-established the child connection", |
4492 | sp.IsChildAgent ? "child" : "root", sp.Name, Name); | 4532 | sp.IsChildAgent ? "child" : "root", sp.Name, Name); |
4493 | 4533 | ||
4494 | // Need to reset the flag so that a subsequent close after another teleport can succeed. | 4534 | // Need to reset the flag so that a subsequent close after another teleport can succeed. |
4495 | sp.DoNotCloseAfterTeleport = false; | 4535 | sp.DoNotCloseAfterTeleport = false; |
@@ -4500,8 +4540,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
4500 | if (sp.LifecycleState != ScenePresenceState.Running) | 4540 | if (sp.LifecycleState != ScenePresenceState.Running) |
4501 | { | 4541 | { |
4502 | m_log.DebugFormat( | 4542 | m_log.DebugFormat( |
4503 | "[SCENE]: Called IncomingPreCloseAgent() for {0} in {1} but presence is already in state {2}", | 4543 | "[SCENE]: Called IncomingPreCloseAgent() for {0} in {1} but presence is already in state {2}", |
4504 | sp.Name, Name, sp.LifecycleState); | 4544 | sp.Name, Name, sp.LifecycleState); |
4505 | 4545 | ||
4506 | return false; | 4546 | return false; |
4507 | } | 4547 | } |
@@ -4527,21 +4567,21 @@ namespace OpenSim.Region.Framework.Scenes | |||
4527 | lock (m_removeClientLock) | 4567 | lock (m_removeClientLock) |
4528 | { | 4568 | { |
4529 | sp = GetScenePresence(agentID); | 4569 | sp = GetScenePresence(agentID); |
4530 | 4570 | ||
4531 | if (sp == null) | 4571 | if (sp == null) |
4532 | { | 4572 | { |
4533 | m_log.DebugFormat( | 4573 | m_log.DebugFormat( |
4534 | "[SCENE]: Called CloseClient() with agent ID {0} but no such presence is in {1}", | 4574 | "[SCENE]: Called CloseClient() with agent ID {0} but no such presence is in {1}", |
4535 | agentID, Name); | 4575 | agentID, Name); |
4536 | 4576 | ||
4537 | return false; | 4577 | return false; |
4538 | } | 4578 | } |
4539 | 4579 | ||
4540 | if (sp.LifecycleState != ScenePresenceState.Running && sp.LifecycleState != ScenePresenceState.PreRemove) | 4580 | if (sp.LifecycleState != ScenePresenceState.Running && sp.LifecycleState != ScenePresenceState.PreRemove) |
4541 | { | 4581 | { |
4542 | m_log.DebugFormat( | 4582 | m_log.DebugFormat( |
4543 | "[SCENE]: Called CloseClient() for {0} in {1} but presence is already in state {2}", | 4583 | "[SCENE]: Called CloseClient() for {0} in {1} but presence is already in state {2}", |
4544 | sp.Name, Name, sp.LifecycleState); | 4584 | sp.Name, Name, sp.LifecycleState); |
4545 | 4585 | ||
4546 | return false; | 4586 | return false; |
4547 | } | 4587 | } |
@@ -4552,8 +4592,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
4552 | if (sp.DoNotCloseAfterTeleport) | 4592 | if (sp.DoNotCloseAfterTeleport) |
4553 | { | 4593 | { |
4554 | m_log.DebugFormat( | 4594 | m_log.DebugFormat( |
4555 | "[SCENE]: Not closing {0} agent {1} in {2} since another simulator has re-established the child connection", | 4595 | "[SCENE]: Not closing {0} agent {1} in {2} since another simulator has re-established the child connection", |
4556 | sp.IsChildAgent ? "child" : "root", sp.Name, Name); | 4596 | sp.IsChildAgent ? "child" : "root", sp.Name, Name); |
4557 | 4597 | ||
4558 | // Need to reset the flag so that a subsequent close after another teleport can succeed. | 4598 | // Need to reset the flag so that a subsequent close after another teleport can succeed. |
4559 | sp.DoNotCloseAfterTeleport = false; | 4599 | sp.DoNotCloseAfterTeleport = false; |
@@ -4581,7 +4621,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4581 | /// <param name="lookAt"></param> | 4621 | /// <param name="lookAt"></param> |
4582 | /// <param name="teleportFlags"></param> | 4622 | /// <param name="teleportFlags"></param> |
4583 | public void RequestTeleportLocation(IClientAPI remoteClient, string regionName, Vector3 position, | 4623 | public void RequestTeleportLocation(IClientAPI remoteClient, string regionName, Vector3 position, |
4584 | Vector3 lookat, uint teleportFlags) | 4624 | Vector3 lookat, uint teleportFlags) |
4585 | { | 4625 | { |
4586 | GridRegion region = GridService.GetRegionByName(RegionInfo.ScopeID, regionName); | 4626 | GridRegion region = GridService.GetRegionByName(RegionInfo.ScopeID, regionName); |
4587 | 4627 | ||
@@ -4604,7 +4644,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4604 | /// <param name="lookAt"></param> | 4644 | /// <param name="lookAt"></param> |
4605 | /// <param name="teleportFlags"></param> | 4645 | /// <param name="teleportFlags"></param> |
4606 | public void RequestTeleportLocation(IClientAPI remoteClient, ulong regionHandle, Vector3 position, | 4646 | public void RequestTeleportLocation(IClientAPI remoteClient, ulong regionHandle, Vector3 position, |
4607 | Vector3 lookAt, uint teleportFlags) | 4647 | Vector3 lookAt, uint teleportFlags) |
4608 | { | 4648 | { |
4609 | ScenePresence sp = GetScenePresence(remoteClient.AgentId); | 4649 | ScenePresence sp = GetScenePresence(remoteClient.AgentId); |
4610 | if (sp != null) | 4650 | if (sp != null) |
@@ -4703,8 +4743,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
4703 | if (part.Name == cmdparams[2]) | 4743 | if (part.Name == cmdparams[2]) |
4704 | { | 4744 | { |
4705 | part.Resize( | 4745 | part.Resize( |
4706 | new Vector3(Convert.ToSingle(cmdparams[3]), Convert.ToSingle(cmdparams[4]), | 4746 | new Vector3(Convert.ToSingle(cmdparams[3]), Convert.ToSingle(cmdparams[4]), |
4707 | Convert.ToSingle(cmdparams[5]))); | 4747 | Convert.ToSingle(cmdparams[5]))); |
4708 | 4748 | ||
4709 | m_log.DebugFormat("Edited scale of Primitive: {0}", part.Name); | 4749 | m_log.DebugFormat("Edited scale of Primitive: {0}", part.Name); |
4710 | } | 4750 | } |
@@ -4749,7 +4789,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4749 | 4789 | ||
4750 | #region Script Engine | 4790 | #region Script Engine |
4751 | 4791 | ||
4752 | private bool ScriptDanger(SceneObjectPart part,Vector3 pos) | 4792 | private bool ScriptDanger(SceneObjectPart part, Vector3 pos) |
4753 | { | 4793 | { |
4754 | ILandObject parcel = LandChannel.GetLandObject(pos.X, pos.Y); | 4794 | ILandObject parcel = LandChannel.GetLandObject(pos.X, pos.Y); |
4755 | if (part != null) | 4795 | if (part != null) |
@@ -4765,7 +4805,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4765 | return true; | 4805 | return true; |
4766 | } | 4806 | } |
4767 | else if (((parcel.LandData.Flags & (uint)ParcelFlags.AllowGroupScripts) != 0) | 4807 | else if (((parcel.LandData.Flags & (uint)ParcelFlags.AllowGroupScripts) != 0) |
4768 | && (parcel.LandData.GroupID != UUID.Zero) && (parcel.LandData.GroupID == part.GroupID)) | 4808 | && (parcel.LandData.GroupID != UUID.Zero) && (parcel.LandData.GroupID == part.GroupID)) |
4769 | { | 4809 | { |
4770 | return true; | 4810 | return true; |
4771 | } | 4811 | } |
@@ -5107,15 +5147,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
5107 | #endregion | 5147 | #endregion |
5108 | 5148 | ||
5109 | 5149 | ||
5110 | // Commented pending deletion since this method no longer appears to do anything at all | 5150 | // Commented pending deletion since this method no longer appears to do anything at all |
5111 | // public bool NeedSceneCacheClear(UUID agentID) | 5151 | // public bool NeedSceneCacheClear(UUID agentID) |
5112 | // { | 5152 | // { |
5113 | // IInventoryTransferModule inv = RequestModuleInterface<IInventoryTransferModule>(); | 5153 | // IInventoryTransferModule inv = RequestModuleInterface<IInventoryTransferModule>(); |
5114 | // if (inv == null) | 5154 | // if (inv == null) |
5115 | // return true; | 5155 | // return true; |
5116 | // | 5156 | // |
5117 | // return inv.NeedSceneCacheClear(agentID, this); | 5157 | // return inv.NeedSceneCacheClear(agentID, this); |
5118 | // } | 5158 | // } |
5119 | 5159 | ||
5120 | public void CleanTempObjects() | 5160 | public void CleanTempObjects() |
5121 | { | 5161 | { |
@@ -5131,7 +5171,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
5131 | if ((grp.RootPart.Flags & PrimFlags.TemporaryOnRez) != 0) | 5171 | if ((grp.RootPart.Flags & PrimFlags.TemporaryOnRez) != 0) |
5132 | { | 5172 | { |
5133 | if (grp.RootPart.Expires <= DateTime.Now) | 5173 | if (grp.RootPart.Expires <= DateTime.Now) |
5134 | DeleteSceneObject(grp, false); | 5174 | DeleteSceneObject(grp, false); |
5135 | } | 5175 | } |
5136 | } | 5176 | } |
5137 | } | 5177 | } |
@@ -5157,21 +5197,21 @@ namespace OpenSim.Region.Framework.Scenes | |||
5157 | // 3 = We have seen a new user enter within the past 4 minutes | 5197 | // 3 = We have seen a new user enter within the past 4 minutes |
5158 | // which can be seen as positive confirmation of sim health | 5198 | // which can be seen as positive confirmation of sim health |
5159 | // | 5199 | // |
5160 | int health=1; // Start at 1, means we're up | 5200 | int health = 1; // Start at 1, means we're up |
5161 | 5201 | ||
5162 | if ((Util.EnvironmentTickCountSubtract(m_lastFrameTick)) < 1000) | 5202 | if ((Util.EnvironmentTickCountSubtract(m_lastFrameTick)) < 1000) |
5163 | health += 1; | 5203 | health += 1; |
5164 | else | 5204 | else |
5165 | return health; | 5205 | return health; |
5166 | 5206 | ||
5167 | // A login in the last 4 mins? We can't be doing too badly | 5207 | // A login in the last 4 mins? We can't be doing too badly |
5168 | // | 5208 | // |
5169 | if ((Util.EnvironmentTickCountSubtract(m_LastLogin)) < 240000) | 5209 | if ((Util.EnvironmentTickCountSubtract(m_LastLogin)) < 240000) |
5170 | health++; | 5210 | health++; |
5171 | else | 5211 | else |
5172 | return health; | 5212 | return health; |
5173 | 5213 | ||
5174 | // CheckHeartbeat(); | 5214 | // CheckHeartbeat(); |
5175 | 5215 | ||
5176 | return health; | 5216 | return health; |
5177 | } | 5217 | } |
@@ -5201,41 +5241,41 @@ namespace OpenSim.Region.Framework.Scenes | |||
5201 | jointProxyObject.AngularVelocity = trackedBody.AngularVelocity; | 5241 | jointProxyObject.AngularVelocity = trackedBody.AngularVelocity; |
5202 | switch (joint.Type) | 5242 | switch (joint.Type) |
5203 | { | 5243 | { |
5204 | case PhysicsJointType.Ball: | 5244 | case PhysicsJointType.Ball: |
5205 | { | 5245 | { |
5206 | Vector3 jointAnchor = PhysicsScene.GetJointAnchor(joint); | 5246 | Vector3 jointAnchor = PhysicsScene.GetJointAnchor(joint); |
5207 | Vector3 proxyPos = jointAnchor; | 5247 | Vector3 proxyPos = jointAnchor; |
5208 | jointProxyObject.ParentGroup.UpdateGroupPosition(proxyPos); // schedules the entire group for a terse update | 5248 | jointProxyObject.ParentGroup.UpdateGroupPosition(proxyPos); // schedules the entire group for a terse update |
5209 | } | 5249 | } |
5210 | break; | 5250 | break; |
5211 | 5251 | ||
5212 | case PhysicsJointType.Hinge: | 5252 | case PhysicsJointType.Hinge: |
5213 | { | 5253 | { |
5214 | Vector3 jointAnchor = PhysicsScene.GetJointAnchor(joint); | 5254 | Vector3 jointAnchor = PhysicsScene.GetJointAnchor(joint); |
5215 | 5255 | ||
5216 | // Normally, we would just ask the physics scene to return the axis for the joint. | 5256 | // Normally, we would just ask the physics scene to return the axis for the joint. |
5217 | // Unfortunately, ODE sometimes returns <0,0,0> for the joint axis, which should | 5257 | // Unfortunately, ODE sometimes returns <0,0,0> for the joint axis, which should |
5218 | // never occur. Therefore we cannot rely on ODE to always return a correct joint axis. | 5258 | // never occur. Therefore we cannot rely on ODE to always return a correct joint axis. |
5219 | // Therefore the following call does not always work: | 5259 | // Therefore the following call does not always work: |
5220 | //PhysicsVector phyJointAxis = _PhyScene.GetJointAxis(joint); | 5260 | //PhysicsVector phyJointAxis = _PhyScene.GetJointAxis(joint); |
5221 | 5261 | ||
5222 | // instead we compute the joint orientation by saving the original joint orientation | 5262 | // instead we compute the joint orientation by saving the original joint orientation |
5223 | // relative to one of the jointed bodies, and applying this transformation | 5263 | // relative to one of the jointed bodies, and applying this transformation |
5224 | // to the current position of the jointed bodies (the tracked body) to compute the | 5264 | // to the current position of the jointed bodies (the tracked body) to compute the |
5225 | // current joint orientation. | 5265 | // current joint orientation. |
5226 | 5266 | ||
5227 | if (joint.TrackedBodyName == null) | 5267 | if (joint.TrackedBodyName == null) |
5228 | { | 5268 | { |
5229 | jointErrorMessage(joint, "joint.TrackedBodyName is null, joint " + joint.ObjectNameInScene); | 5269 | jointErrorMessage(joint, "joint.TrackedBodyName is null, joint " + joint.ObjectNameInScene); |
5230 | } | 5270 | } |
5231 | 5271 | ||
5232 | Vector3 proxyPos = jointAnchor; | 5272 | Vector3 proxyPos = jointAnchor; |
5233 | Quaternion q = trackedBody.RotationOffset * joint.LocalRotation; | 5273 | Quaternion q = trackedBody.RotationOffset * joint.LocalRotation; |
5234 | 5274 | ||
5235 | jointProxyObject.ParentGroup.UpdateGroupPosition(proxyPos); // schedules the entire group for a terse update | 5275 | jointProxyObject.ParentGroup.UpdateGroupPosition(proxyPos); // schedules the entire group for a terse update |
5236 | jointProxyObject.ParentGroup.UpdateGroupRotationR(q); // schedules the entire group for a terse update | 5276 | jointProxyObject.ParentGroup.UpdateGroupRotationR(q); // schedules the entire group for a terse update |
5237 | } | 5277 | } |
5238 | break; | 5278 | break; |
5239 | } | 5279 | } |
5240 | } | 5280 | } |
5241 | 5281 | ||
@@ -5276,30 +5316,30 @@ namespace OpenSim.Region.Framework.Scenes | |||
5276 | if (joint != null) | 5316 | if (joint != null) |
5277 | { | 5317 | { |
5278 | if (joint.ErrorMessageCount > PhysicsJoint.maxErrorMessages) | 5318 | if (joint.ErrorMessageCount > PhysicsJoint.maxErrorMessages) |
5279 | return; | 5319 | return; |
5280 | 5320 | ||
5281 | SceneObjectPart jointProxyObject = GetSceneObjectPart(joint.ObjectNameInScene); | 5321 | SceneObjectPart jointProxyObject = GetSceneObjectPart(joint.ObjectNameInScene); |
5282 | if (jointProxyObject != null) | 5322 | if (jointProxyObject != null) |
5283 | { | 5323 | { |
5284 | SimChat(Utils.StringToBytes("[NINJA]: " + message), | 5324 | SimChat(Utils.StringToBytes("[NINJA]: " + message), |
5285 | ChatTypeEnum.DebugChannel, | 5325 | ChatTypeEnum.DebugChannel, |
5286 | 2147483647, | 5326 | 2147483647, |
5287 | jointProxyObject.AbsolutePosition, | 5327 | jointProxyObject.AbsolutePosition, |
5288 | jointProxyObject.Name, | 5328 | jointProxyObject.Name, |
5289 | jointProxyObject.UUID, | 5329 | jointProxyObject.UUID, |
5290 | false); | 5330 | false); |
5291 | 5331 | ||
5292 | joint.ErrorMessageCount++; | 5332 | joint.ErrorMessageCount++; |
5293 | 5333 | ||
5294 | if (joint.ErrorMessageCount > PhysicsJoint.maxErrorMessages) | 5334 | if (joint.ErrorMessageCount > PhysicsJoint.maxErrorMessages) |
5295 | { | 5335 | { |
5296 | SimChat(Utils.StringToBytes("[NINJA]: Too many messages for this joint, suppressing further messages."), | 5336 | SimChat(Utils.StringToBytes("[NINJA]: Too many messages for this joint, suppressing further messages."), |
5297 | ChatTypeEnum.DebugChannel, | 5337 | ChatTypeEnum.DebugChannel, |
5298 | 2147483647, | 5338 | 2147483647, |
5299 | jointProxyObject.AbsolutePosition, | 5339 | jointProxyObject.AbsolutePosition, |
5300 | jointProxyObject.Name, | 5340 | jointProxyObject.Name, |
5301 | jointProxyObject.UUID, | 5341 | jointProxyObject.UUID, |
5302 | false); | 5342 | false); |
5303 | } | 5343 | } |
5304 | } | 5344 | } |
5305 | else | 5345 | else |
@@ -5312,9 +5352,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
5312 | public Scene ConsoleScene() | 5352 | public Scene ConsoleScene() |
5313 | { | 5353 | { |
5314 | if (MainConsole.Instance == null) | 5354 | if (MainConsole.Instance == null) |
5315 | return null; | 5355 | return null; |
5316 | if (MainConsole.Instance.ConsoleScene is Scene) | 5356 | if (MainConsole.Instance.ConsoleScene is Scene) |
5317 | return (Scene)MainConsole.Instance.ConsoleScene; | 5357 | return (Scene)MainConsole.Instance.ConsoleScene; |
5318 | return null; | 5358 | return null; |
5319 | } | 5359 | } |
5320 | 5360 | ||
@@ -5325,13 +5365,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
5325 | public float GetGroundHeight(float x, float y) | 5365 | public float GetGroundHeight(float x, float y) |
5326 | { | 5366 | { |
5327 | if (x < 0) | 5367 | if (x < 0) |
5328 | x = 0; | 5368 | x = 0; |
5329 | if (x >= Heightmap.Width) | 5369 | if (x >= Heightmap.Width) |
5330 | x = Heightmap.Width - 1; | 5370 | x = Heightmap.Width - 1; |
5331 | if (y < 0) | 5371 | if (y < 0) |
5332 | y = 0; | 5372 | y = 0; |
5333 | if (y >= Heightmap.Height) | 5373 | if (y >= Heightmap.Height) |
5334 | y = Heightmap.Height - 1; | 5374 | y = Heightmap.Height - 1; |
5335 | 5375 | ||
5336 | Vector3 p0 = new Vector3(x, y, (float)Heightmap[(int)x, (int)y]); | 5376 | Vector3 p0 = new Vector3(x, y, (float)Heightmap[(int)x, (int)y]); |
5337 | Vector3 p1 = p0; | 5377 | Vector3 p1 = p0; |
@@ -5339,11 +5379,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
5339 | 5379 | ||
5340 | p1.X += 1.0f; | 5380 | p1.X += 1.0f; |
5341 | if (p1.X < Heightmap.Width) | 5381 | if (p1.X < Heightmap.Width) |
5342 | p1.Z = (float)Heightmap[(int)p1.X, (int)p1.Y]; | 5382 | p1.Z = (float)Heightmap[(int)p1.X, (int)p1.Y]; |
5343 | 5383 | ||
5344 | p2.Y += 1.0f; | 5384 | p2.Y += 1.0f; |
5345 | if (p2.Y < Heightmap.Height) | 5385 | if (p2.Y < Heightmap.Height) |
5346 | p2.Z = (float)Heightmap[(int)p2.X, (int)p2.Y]; | 5386 | p2.Z = (float)Heightmap[(int)p2.X, (int)p2.Y]; |
5347 | 5387 | ||
5348 | Vector3 v0 = new Vector3(p1.X - p0.X, p1.Y - p0.Y, p1.Z - p0.Z); | 5388 | Vector3 v0 = new Vector3(p1.X - p0.X, p1.Y - p0.Y, p1.Z - p0.Z); |
5349 | Vector3 v1 = new Vector3(p2.X - p0.X, p2.Y - p0.Y, p2.Z - p0.Z); | 5389 | Vector3 v1 = new Vector3(p2.X - p0.X, p2.Y - p0.Y, p2.Z - p0.Z); |
@@ -5363,14 +5403,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
5363 | return (((vsn.X * xdiff) + (vsn.Y * ydiff)) / (-1 * vsn.Z)) + p0.Z; | 5403 | return (((vsn.X * xdiff) + (vsn.Y * ydiff)) / (-1 * vsn.Z)) + p0.Z; |
5364 | } | 5404 | } |
5365 | 5405 | ||
5366 | // private void CheckHeartbeat() | 5406 | // private void CheckHeartbeat() |
5367 | // { | 5407 | // { |
5368 | // if (m_firstHeartbeat) | 5408 | // if (m_firstHeartbeat) |
5369 | // return; | 5409 | // return; |
5370 | // | 5410 | // |
5371 | // if (Util.EnvironmentTickCountSubtract(m_lastFrameTick) > 2000) | 5411 | // if (Util.EnvironmentTickCountSubtract(m_lastFrameTick) > 2000) |
5372 | // StartTimer(); | 5412 | // StartTimer(); |
5373 | // } | 5413 | // } |
5374 | 5414 | ||
5375 | public override ISceneObject DeserializeObject(string representation) | 5415 | public override ISceneObject DeserializeObject(string representation) |
5376 | { | 5416 | { |
@@ -5413,7 +5453,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
5413 | } | 5453 | } |
5414 | 5454 | ||
5415 | ILandObject dest = LandChannel.GetLandObject(avatar.lastKnownAllowedPosition.X, avatar.lastKnownAllowedPosition.Y); | 5455 | ILandObject dest = LandChannel.GetLandObject(avatar.lastKnownAllowedPosition.X, avatar.lastKnownAllowedPosition.Y); |
5416 | if (dest != excludeParcel) | 5456 | if (dest != excludeParcel) |
5417 | { | 5457 | { |
5418 | // Ultimate backup if we have no idea where they are and | 5458 | // Ultimate backup if we have no idea where they are and |
5419 | // the last allowed position was in another parcel | 5459 | // the last allowed position was in another parcel |
@@ -5523,9 +5563,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
5523 | private Vector3 GetNearestRegionEdgePosition(ScenePresence avatar) | 5563 | private Vector3 GetNearestRegionEdgePosition(ScenePresence avatar) |
5524 | { | 5564 | { |
5525 | float xdistance = avatar.AbsolutePosition.X < RegionInfo.RegionSizeX / 2 | 5565 | float xdistance = avatar.AbsolutePosition.X < RegionInfo.RegionSizeX / 2 |
5526 | ? avatar.AbsolutePosition.X : RegionInfo.RegionSizeX - avatar.AbsolutePosition.X; | 5566 | ? avatar.AbsolutePosition.X : RegionInfo.RegionSizeX - avatar.AbsolutePosition.X; |
5527 | float ydistance = avatar.AbsolutePosition.Y < RegionInfo.RegionSizeY / 2 | 5567 | float ydistance = avatar.AbsolutePosition.Y < RegionInfo.RegionSizeY / 2 |
5528 | ? avatar.AbsolutePosition.Y : RegionInfo.RegionSizeY - avatar.AbsolutePosition.Y; | 5568 | ? avatar.AbsolutePosition.Y : RegionInfo.RegionSizeY - avatar.AbsolutePosition.Y; |
5529 | 5569 | ||
5530 | //find out what vertical edge to go to | 5570 | //find out what vertical edge to go to |
5531 | if (xdistance < ydistance) | 5571 | if (xdistance < ydistance) |
@@ -5572,7 +5612,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
5572 | { | 5612 | { |
5573 | IEstateDataService estateDataService = EstateDataService; | 5613 | IEstateDataService estateDataService = EstateDataService; |
5574 | if (estateDataService == null) | 5614 | if (estateDataService == null) |
5575 | return new List<UUID>(0); | 5615 | return new List<UUID>(0); |
5576 | 5616 | ||
5577 | return estateDataService.GetRegions(estateID); | 5617 | return estateDataService.GetRegions(estateID); |
5578 | } | 5618 | } |
@@ -5595,8 +5635,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
5595 | private void HandleReloadEstate(string module, string[] cmd) | 5635 | private void HandleReloadEstate(string module, string[] cmd) |
5596 | { | 5636 | { |
5597 | if (MainConsole.Instance.ConsoleScene == null || | 5637 | if (MainConsole.Instance.ConsoleScene == null || |
5598 | (MainConsole.Instance.ConsoleScene is Scene && | 5638 | (MainConsole.Instance.ConsoleScene is Scene && |
5599 | (Scene)MainConsole.Instance.ConsoleScene == this)) | 5639 | (Scene)MainConsole.Instance.ConsoleScene == this)) |
5600 | { | 5640 | { |
5601 | ReloadEstateData(); | 5641 | ReloadEstateData(); |
5602 | } | 5642 | } |
@@ -5614,8 +5654,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
5614 | /// <param name="maxZ"></param> | 5654 | /// <param name="maxZ"></param> |
5615 | /// <returns></returns> | 5655 | /// <returns></returns> |
5616 | public static Vector3[] GetCombinedBoundingBox( | 5656 | public static Vector3[] GetCombinedBoundingBox( |
5617 | List<SceneObjectGroup> objects, | 5657 | List<SceneObjectGroup> objects, |
5618 | out float minX, out float maxX, out float minY, out float maxY, out float minZ, out float maxZ) | 5658 | out float minX, out float maxX, out float minY, out float maxY, out float minZ, out float maxZ) |
5619 | { | 5659 | { |
5620 | minX = float.MaxValue; | 5660 | minX = float.MaxValue; |
5621 | maxX = float.MinValue; | 5661 | maxX = float.MinValue; |
@@ -5633,10 +5673,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
5633 | Vector3 vec = g.AbsolutePosition; | 5673 | Vector3 vec = g.AbsolutePosition; |
5634 | 5674 | ||
5635 | g.GetAxisAlignedBoundingBoxRaw(out ominX, out omaxX, out ominY, out omaxY, out ominZ, out omaxZ); | 5675 | g.GetAxisAlignedBoundingBoxRaw(out ominX, out omaxX, out ominY, out omaxY, out ominZ, out omaxZ); |
5636 | 5676 | ||
5637 | // m_log.DebugFormat( | 5677 | // m_log.DebugFormat( |
5638 | // "[SCENE]: For {0} found AxisAlignedBoundingBoxRaw {1}, {2}", | 5678 | // "[SCENE]: For {0} found AxisAlignedBoundingBoxRaw {1}, {2}", |
5639 | // g.Name, new Vector3(ominX, ominY, ominZ), new Vector3(omaxX, omaxY, omaxZ)); | 5679 | // g.Name, new Vector3(ominX, ominY, ominZ), new Vector3(omaxX, omaxY, omaxZ)); |
5640 | 5680 | ||
5641 | ominX += vec.X; | 5681 | ominX += vec.X; |
5642 | omaxX += vec.X; | 5682 | omaxX += vec.X; |
@@ -5646,17 +5686,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
5646 | omaxZ += vec.Z; | 5686 | omaxZ += vec.Z; |
5647 | 5687 | ||
5648 | if (minX > ominX) | 5688 | if (minX > ominX) |
5649 | minX = ominX; | 5689 | minX = ominX; |
5650 | if (minY > ominY) | 5690 | if (minY > ominY) |
5651 | minY = ominY; | 5691 | minY = ominY; |
5652 | if (minZ > ominZ) | 5692 | if (minZ > ominZ) |
5653 | minZ = ominZ; | 5693 | minZ = ominZ; |
5654 | if (maxX < omaxX) | 5694 | if (maxX < omaxX) |
5655 | maxX = omaxX; | 5695 | maxX = omaxX; |
5656 | if (maxY < omaxY) | 5696 | if (maxY < omaxY) |
5657 | maxY = omaxY; | 5697 | maxY = omaxY; |
5658 | if (maxZ < omaxZ) | 5698 | if (maxZ < omaxZ) |
5659 | maxZ = omaxZ; | 5699 | maxZ = omaxZ; |
5660 | } | 5700 | } |
5661 | 5701 | ||
5662 | foreach (SceneObjectGroup g in objects) | 5702 | foreach (SceneObjectGroup g in objects) |
@@ -5681,7 +5721,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
5681 | { | 5721 | { |
5682 | IWorldMapModule mapModule = RequestModuleInterface<IWorldMapModule>(); | 5722 | IWorldMapModule mapModule = RequestModuleInterface<IWorldMapModule>(); |
5683 | if (mapModule != null) | 5723 | if (mapModule != null) |
5684 | mapModule.GenerateMaptile(); | 5724 | mapModule.GenerateMaptile(); |
5685 | } | 5725 | } |
5686 | 5726 | ||
5687 | private void RegenerateMaptileAndReregister(object sender, ElapsedEventArgs e) | 5727 | private void RegenerateMaptileAndReregister(object sender, ElapsedEventArgs e) |
@@ -5692,7 +5732,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
5692 | // so that all simulators can retrieve it | 5732 | // so that all simulators can retrieve it |
5693 | string error = GridService.RegisterRegion(RegionInfo.ScopeID, new GridRegion(RegionInfo)); | 5733 | string error = GridService.RegisterRegion(RegionInfo.ScopeID, new GridRegion(RegionInfo)); |
5694 | if (error != string.Empty) | 5734 | if (error != string.Empty) |
5695 | throw new Exception(error); | 5735 | throw new Exception(error); |
5696 | } | 5736 | } |
5697 | 5737 | ||
5698 | /// <summary> | 5738 | /// <summary> |
@@ -5722,7 +5762,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
5722 | } | 5762 | } |
5723 | 5763 | ||
5724 | if (!AllowAvatarCrossing && !viaTeleport) | 5764 | if (!AllowAvatarCrossing && !viaTeleport) |
5725 | return false; | 5765 | return false; |
5726 | 5766 | ||
5727 | // FIXME: Root agent count is currently known to be inaccurate. This forces a recount before we check. | 5767 | // FIXME: Root agent count is currently known to be inaccurate. This forces a recount before we check. |
5728 | // However, the long term fix is to make sure root agent count is always accurate. | 5768 | // However, the long term fix is to make sure root agent count is always accurate. |
@@ -5737,8 +5777,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
5737 | reason = "The region is full"; | 5777 | reason = "The region is full"; |
5738 | 5778 | ||
5739 | m_log.DebugFormat( | 5779 | m_log.DebugFormat( |
5740 | "[SCENE]: Denying presence with id {0} entry into {1} since region is at agent limit of {2}", | 5780 | "[SCENE]: Denying presence with id {0} entry into {1} since region is at agent limit of {2}", |
5741 | agentID, RegionInfo.RegionName, RegionInfo.RegionSettings.AgentLimit); | 5781 | agentID, RegionInfo.RegionName, RegionInfo.RegionSettings.AgentLimit); |
5742 | 5782 | ||
5743 | return false; | 5783 | return false; |
5744 | } | 5784 | } |
@@ -5752,7 +5792,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
5752 | { | 5792 | { |
5753 | client = presence.ControllingClient; | 5793 | client = presence.ControllingClient; |
5754 | if (client != null) | 5794 | if (client != null) |
5755 | aCircuit = client.RequestClientInfo(); | 5795 | aCircuit = client.RequestClientInfo(); |
5756 | } | 5796 | } |
5757 | 5797 | ||
5758 | // We may be called before there is a presence or a client. | 5798 | // We may be called before there is a presence or a client. |
@@ -5775,7 +5815,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
5775 | } | 5815 | } |
5776 | catch (Exception e) | 5816 | catch (Exception e) |
5777 | { | 5817 | { |
5778 | m_log.DebugFormat("[SCENE]: Exception authorizing agent: {0} "+ e.StackTrace, e.Message); | 5818 | m_log.DebugFormat("[SCENE]: Exception authorizing agent: {0} " + e.StackTrace, e.Message); |
5779 | reason = "Error authorizing agent: " + e.Message; | 5819 | reason = "Error authorizing agent: " + e.Message; |
5780 | return false; | 5820 | return false; |
5781 | } | 5821 | } |
@@ -5794,16 +5834,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
5794 | Vector3 spawnPoint = sp.GetLocation(telehub.AbsolutePosition, telehub.GroupRotation); | 5834 | Vector3 spawnPoint = sp.GetLocation(telehub.AbsolutePosition, telehub.GroupRotation); |
5795 | ILandObject land = LandChannel.GetLandObject(spawnPoint.X, spawnPoint.Y); | 5835 | ILandObject land = LandChannel.GetLandObject(spawnPoint.X, spawnPoint.Y); |
5796 | if (land == null) | 5836 | if (land == null) |
5797 | continue; | 5837 | continue; |
5798 | if (land.IsEitherBannedOrRestricted(agentID)) | 5838 | if (land.IsEitherBannedOrRestricted(agentID)) |
5799 | continue; | 5839 | continue; |
5800 | banned = false; | 5840 | banned = false; |
5801 | break; | 5841 | break; |
5802 | } | 5842 | } |
5803 | 5843 | ||
5804 | if (banned) | 5844 | if (banned) |
5805 | { | 5845 | { |
5806 | if(Permissions.IsAdministrator(agentID) == false || Permissions.IsGridGod(agentID) == false) | 5846 | if (Permissions.IsAdministrator(agentID) == false || Permissions.IsGridGod(agentID) == false) |
5807 | { | 5847 | { |
5808 | reason = "No suitable landing point found"; | 5848 | reason = "No suitable landing point found"; |
5809 | return false; | 5849 | return false; |
@@ -5839,9 +5879,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
5839 | if (banned || restricted) | 5879 | if (banned || restricted) |
5840 | { | 5880 | { |
5841 | if (banned) | 5881 | if (banned) |
5842 | reason = "You are banned from the parcel"; | 5882 | reason = "You are banned from the parcel"; |
5843 | else | 5883 | else |
5844 | reason = "The parcel is restricted"; | 5884 | reason = "The parcel is restricted"; |
5845 | return false; | 5885 | return false; |
5846 | } | 5886 | } |
5847 | } | 5887 | } |
@@ -5863,15 +5903,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
5863 | if (presence.MovingToTarget) | 5903 | if (presence.MovingToTarget) |
5864 | { | 5904 | { |
5865 | double distanceToTarget = Util.GetDistanceTo(presence.AbsolutePosition, presence.MoveToPositionTarget); | 5905 | double distanceToTarget = Util.GetDistanceTo(presence.AbsolutePosition, presence.MoveToPositionTarget); |
5866 | // m_log.DebugFormat( | 5906 | // m_log.DebugFormat( |
5867 | // "[SCENE]: Abs pos of {0} is {1}, target {2}, distance {3}", | 5907 | // "[SCENE]: Abs pos of {0} is {1}, target {2}, distance {3}", |
5868 | // presence.Name, presence.AbsolutePosition, presence.MoveToPositionTarget, distanceToTarget); | 5908 | // presence.Name, presence.AbsolutePosition, presence.MoveToPositionTarget, distanceToTarget); |
5869 | 5909 | ||
5870 | // Check the error term of the current position in relation to the target position | 5910 | // Check the error term of the current position in relation to the target position |
5871 | if (distanceToTarget <= ScenePresence.SIGNIFICANT_MOVEMENT) | 5911 | if (distanceToTarget <= ScenePresence.SIGNIFICANT_MOVEMENT) |
5872 | { | 5912 | { |
5873 | // We are close enough to the target | 5913 | // We are close enough to the target |
5874 | // m_log.DebugFormat("[SCENEE]: Stopping autopilot of {0}", presence.Name); | 5914 | // m_log.DebugFormat("[SCENEE]: Stopping autopilot of {0}", presence.Name); |
5875 | 5915 | ||
5876 | presence.Velocity = Vector3.Zero; | 5916 | presence.Velocity = Vector3.Zero; |
5877 | presence.AbsolutePosition = presence.MoveToPositionTarget; | 5917 | presence.AbsolutePosition = presence.MoveToPositionTarget; |
@@ -5885,28 +5925,28 @@ namespace OpenSim.Region.Framework.Scenes | |||
5885 | // least be able to set collision status once, rather than 5 times to give it enough | 5925 | // least be able to set collision status once, rather than 5 times to give it enough |
5886 | // weighting so that that PhysicsActor thinks it really is colliding. | 5926 | // weighting so that that PhysicsActor thinks it really is colliding. |
5887 | for (int i = 0; i < 5; i++) | 5927 | for (int i = 0; i < 5; i++) |
5888 | presence.IsColliding = true; | 5928 | presence.IsColliding = true; |
5889 | 5929 | ||
5890 | if (presence.LandAtTarget) | 5930 | if (presence.LandAtTarget) |
5891 | presence.Flying = false; | 5931 | presence.Flying = false; |
5892 | 5932 | ||
5893 | // Vector3 targetPos = presence.MoveToPositionTarget; | 5933 | // Vector3 targetPos = presence.MoveToPositionTarget; |
5894 | // float terrainHeight = (float)presence.Scene.Heightmap[(int)targetPos.X, (int)targetPos.Y]; | 5934 | // float terrainHeight = (float)presence.Scene.Heightmap[(int)targetPos.X, (int)targetPos.Y]; |
5895 | // if (targetPos.Z - terrainHeight < 0.2) | 5935 | // if (targetPos.Z - terrainHeight < 0.2) |
5896 | // { | 5936 | // { |
5897 | // presence.Flying = false; | 5937 | // presence.Flying = false; |
5898 | // } | 5938 | // } |
5899 | } | 5939 | } |
5900 | 5940 | ||
5901 | // m_log.DebugFormat( | 5941 | // m_log.DebugFormat( |
5902 | // "[SCENE]: AgentControlFlags {0}, MovementFlag {1} for {2}", | 5942 | // "[SCENE]: AgentControlFlags {0}, MovementFlag {1} for {2}", |
5903 | // presence.AgentControlFlags, presence.MovementFlag, presence.Name); | 5943 | // presence.AgentControlFlags, presence.MovementFlag, presence.Name); |
5904 | } | 5944 | } |
5905 | else | 5945 | else |
5906 | { | 5946 | { |
5907 | // m_log.DebugFormat( | 5947 | // m_log.DebugFormat( |
5908 | // "[SCENE]: Updating npc {0} at {1} for next movement to {2}", | 5948 | // "[SCENE]: Updating npc {0} at {1} for next movement to {2}", |
5909 | // presence.Name, presence.AbsolutePosition, presence.MoveToPositionTarget); | 5949 | // presence.Name, presence.AbsolutePosition, presence.MoveToPositionTarget); |
5910 | 5950 | ||
5911 | Vector3 agent_control_v3 = new Vector3(); | 5951 | Vector3 agent_control_v3 = new Vector3(); |
5912 | presence.HandleMoveToTargetUpdate(1, ref agent_control_v3); | 5952 | presence.HandleMoveToTargetUpdate(1, ref agent_control_v3); |
@@ -5921,11 +5961,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
5921 | int spawnpoints = RegionInfo.RegionSettings.SpawnPoints().Count; | 5961 | int spawnpoints = RegionInfo.RegionSettings.SpawnPoints().Count; |
5922 | 5962 | ||
5923 | if (spawnpoints == 0) | 5963 | if (spawnpoints == 0) |
5924 | return 0; | 5964 | return 0; |
5925 | 5965 | ||
5926 | m_SpawnPoint++; | 5966 | m_SpawnPoint++; |
5927 | if (m_SpawnPoint > spawnpoints) | 5967 | if (m_SpawnPoint > spawnpoints) |
5928 | m_SpawnPoint = 1; | 5968 | m_SpawnPoint = 1; |
5929 | return m_SpawnPoint - 1; | 5969 | return m_SpawnPoint - 1; |
5930 | } | 5970 | } |
5931 | 5971 | ||
@@ -5955,12 +5995,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
5955 | public string GetExtraSetting(string name) | 5995 | public string GetExtraSetting(string name) |
5956 | { | 5996 | { |
5957 | if (m_extraSettings == null) | 5997 | if (m_extraSettings == null) |
5958 | return String.Empty; | 5998 | return String.Empty; |
5959 | 5999 | ||
5960 | string val; | 6000 | string val; |
5961 | 6001 | ||
5962 | if (!m_extraSettings.TryGetValue(name, out val)) | 6002 | if (!m_extraSettings.TryGetValue(name, out val)) |
5963 | return String.Empty; | 6003 | return String.Empty; |
5964 | 6004 | ||
5965 | return val; | 6005 | return val; |
5966 | } | 6006 | } |
@@ -5968,14 +6008,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
5968 | public void StoreExtraSetting(string name, string val) | 6008 | public void StoreExtraSetting(string name, string val) |
5969 | { | 6009 | { |
5970 | if (m_extraSettings == null) | 6010 | if (m_extraSettings == null) |
5971 | return; | 6011 | return; |
5972 | 6012 | ||
5973 | string oldVal; | 6013 | string oldVal; |
5974 | 6014 | ||
5975 | if (m_extraSettings.TryGetValue(name, out oldVal)) | 6015 | if (m_extraSettings.TryGetValue(name, out oldVal)) |
5976 | { | 6016 | { |
5977 | if (oldVal == val) | 6017 | if (oldVal == val) |
5978 | return; | 6018 | return; |
5979 | } | 6019 | } |
5980 | 6020 | ||
5981 | m_extraSettings[name] = val; | 6021 | m_extraSettings[name] = val; |
@@ -5988,10 +6028,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
5988 | public void RemoveExtraSetting(string name) | 6028 | public void RemoveExtraSetting(string name) |
5989 | { | 6029 | { |
5990 | if (m_extraSettings == null) | 6030 | if (m_extraSettings == null) |
5991 | return; | 6031 | return; |
5992 | 6032 | ||
5993 | if (!m_extraSettings.ContainsKey(name)) | 6033 | if (!m_extraSettings.ContainsKey(name)) |
5994 | return; | 6034 | return; |
5995 | 6035 | ||
5996 | m_extraSettings.Remove(name); | 6036 | m_extraSettings.Remove(name); |
5997 | 6037 | ||
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index 51f50d9..c2e9b61 100644..100755 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs | |||
@@ -67,7 +67,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
67 | protected Scene m_parentScene; | 67 | protected Scene m_parentScene; |
68 | protected Dictionary<UUID, SceneObjectGroup> m_updateList = new Dictionary<UUID, SceneObjectGroup>(); | 68 | protected Dictionary<UUID, SceneObjectGroup> m_updateList = new Dictionary<UUID, SceneObjectGroup>(); |
69 | protected int m_numRootAgents = 0; | 69 | protected int m_numRootAgents = 0; |
70 | protected int m_numTotalPrim = 0; | ||
70 | protected int m_numPrim = 0; | 71 | protected int m_numPrim = 0; |
72 | protected int m_numMesh = 0; | ||
71 | protected int m_numChildAgents = 0; | 73 | protected int m_numChildAgents = 0; |
72 | protected int m_physicalPrim = 0; | 74 | protected int m_physicalPrim = 0; |
73 | 75 | ||
@@ -368,7 +370,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
368 | 370 | ||
369 | SceneObjectPart[] parts = sceneObject.Parts; | 371 | SceneObjectPart[] parts = sceneObject.Parts; |
370 | 372 | ||
371 | // Clamp child prim sizes and add child prims to the m_numPrim count | 373 | // Clamp the sizes (scales) of the child prims and add the child prims to the count of all primitives |
374 | // (meshes and geometric primitives) in the scene; add child prims to m_numTotalPrim count | ||
372 | if (m_parentScene.m_clampPrimSize) | 375 | if (m_parentScene.m_clampPrimSize) |
373 | { | 376 | { |
374 | foreach (SceneObjectPart part in parts) | 377 | foreach (SceneObjectPart part in parts) |
@@ -382,7 +385,19 @@ namespace OpenSim.Region.Framework.Scenes | |||
382 | part.Shape.Scale = scale; | 385 | part.Shape.Scale = scale; |
383 | } | 386 | } |
384 | } | 387 | } |
385 | m_numPrim += parts.Length; | 388 | m_numTotalPrim += parts.Length; |
389 | |||
390 | // Go through all parts (geometric primitives and meshes) of this Scene Object | ||
391 | foreach (SceneObjectPart part in parts) | ||
392 | { | ||
393 | // Keep track of the total number of meshes or geometric primitives now in the scene; | ||
394 | // determine which object this is based on its primitive type: sculpted (sculpt) prim refers to | ||
395 | // a mesh and all other prims (i.e. box, sphere, etc) are geometric primitives | ||
396 | if (part.GetPrimType() == PrimType.SCULPT) | ||
397 | m_numMesh++; | ||
398 | else | ||
399 | m_numPrim++; | ||
400 | } | ||
386 | 401 | ||
387 | sceneObject.AttachToScene(m_parentScene); | 402 | sceneObject.AttachToScene(m_parentScene); |
388 | 403 | ||
@@ -437,7 +452,21 @@ namespace OpenSim.Region.Framework.Scenes | |||
437 | 452 | ||
438 | if (!resultOfObjectLinked) | 453 | if (!resultOfObjectLinked) |
439 | { | 454 | { |
440 | m_numPrim -= grp.PrimCount; | 455 | // Decrement the total number of primitives (meshes and geometric primitives) |
456 | // that are part of the Scene Object being removed | ||
457 | m_numTotalPrim -= grp.PrimCount; | ||
458 | |||
459 | // Go through all parts (primitives and meshes) of this Scene Object | ||
460 | foreach (SceneObjectPart part in grp.Parts) | ||
461 | { | ||
462 | // Keep track of the total number of meshes or geometric primitives left in the scene; | ||
463 | // determine which object this is based on its primitive type: sculpted (sculpt) prim refers to | ||
464 | // a mesh and all other prims (i.e. box, sphere, etc) are geometric primitives | ||
465 | if (part.GetPrimType() == PrimType.SCULPT) | ||
466 | m_numMesh--; | ||
467 | else | ||
468 | m_numPrim--; | ||
469 | } | ||
441 | 470 | ||
442 | if ((grp.RootPart.Flags & PrimFlags.Physics) == PrimFlags.Physics) | 471 | if ((grp.RootPart.Flags & PrimFlags.Physics) == PrimFlags.Physics) |
443 | RemovePhysicalPrim(grp.PrimCount); | 472 | RemovePhysicalPrim(grp.PrimCount); |
@@ -687,9 +716,19 @@ namespace OpenSim.Region.Framework.Scenes | |||
687 | 716 | ||
688 | public int GetTotalObjectsCount() | 717 | public int GetTotalObjectsCount() |
689 | { | 718 | { |
719 | return m_numTotalPrim; | ||
720 | } | ||
721 | |||
722 | public int GetTotalPrimObjectsCount() | ||
723 | { | ||
690 | return m_numPrim; | 724 | return m_numPrim; |
691 | } | 725 | } |
692 | 726 | ||
727 | public int GetTotalMeshObjectsCount() | ||
728 | { | ||
729 | return m_numMesh; | ||
730 | } | ||
731 | |||
693 | public int GetActiveObjectsCount() | 732 | public int GetActiveObjectsCount() |
694 | { | 733 | { |
695 | return m_physicalPrim; | 734 | return m_physicalPrim; |
@@ -1970,7 +2009,19 @@ namespace OpenSim.Region.Framework.Scenes | |||
1970 | // think it's selected, so it will never send a deselect... | 2009 | // think it's selected, so it will never send a deselect... |
1971 | copy.IsSelected = false; | 2010 | copy.IsSelected = false; |
1972 | 2011 | ||
1973 | m_numPrim += copy.Parts.Length; | 2012 | m_numTotalPrim += copy.Parts.Length; |
2013 | |||
2014 | // Go through all parts (primitives and meshes) of this Scene Object | ||
2015 | foreach (SceneObjectPart part in copy.Parts) | ||
2016 | { | ||
2017 | // Keep track of the total number of meshes or geometric primitives now in the scene; | ||
2018 | // determine which object this is based on its primitive type: sculpted (sculpt) prim refers to | ||
2019 | // a mesh and all other prims (i.e. box, sphere, etc) are geometric primitives | ||
2020 | if (part.GetPrimType() == PrimType.SCULPT) | ||
2021 | m_numMesh++; | ||
2022 | else | ||
2023 | m_numPrim++; | ||
2024 | } | ||
1974 | 2025 | ||
1975 | if (rot != Quaternion.Identity) | 2026 | if (rot != Quaternion.Identity) |
1976 | { | 2027 | { |
diff --git a/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs b/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs index 6182bcd..8918c3b 100755 --- a/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs +++ b/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs | |||
@@ -61,6 +61,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
61 | 61 | ||
62 | private YourStatsAreWrong handlerStatsIncorrect; | 62 | private YourStatsAreWrong handlerStatsIncorrect; |
63 | 63 | ||
64 | // Determines the size of the array that is used to collect StatBlocks | ||
65 | // for sending to the SimStats and SimExtraStatsCollector | ||
66 | private const int m_statisticArraySize = 27; | ||
67 | |||
64 | /// <summary> | 68 | /// <summary> |
65 | /// These are the IDs of stats sent in the StatsPacket to the viewer. | 69 | /// These are the IDs of stats sent in the StatsPacket to the viewer. |
66 | /// </summary> | 70 | /// </summary> |
@@ -104,7 +108,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
104 | ScriptEps = 31, | 108 | ScriptEps = 31, |
105 | SimSpareMs = 32, | 109 | SimSpareMs = 32, |
106 | SimSleepMs = 33, | 110 | SimSleepMs = 33, |
107 | SimIoPumpTime = 34 | 111 | SimIoPumpTime = 34, |
112 | FrameDilation = 35, | ||
113 | UsersLoggingIn = 36, | ||
114 | TotalGeoPrim = 37, | ||
115 | TotalMesh = 38, | ||
116 | ThreadCount = 39 | ||
108 | } | 117 | } |
109 | 118 | ||
110 | /// <summary> | 119 | /// <summary> |
@@ -175,7 +184,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
175 | 184 | ||
176 | // saved last reported value so there is something available for llGetRegionFPS | 185 | // saved last reported value so there is something available for llGetRegionFPS |
177 | private float lastReportedSimFPS; | 186 | private float lastReportedSimFPS; |
178 | private float[] lastReportedSimStats = new float[22]; | 187 | private float[] lastReportedSimStats = new float[m_statisticArraySize]; |
179 | private float m_pfps; | 188 | private float m_pfps; |
180 | 189 | ||
181 | /// <summary> | 190 | /// <summary> |
@@ -202,6 +211,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
202 | private int m_rootAgents; | 211 | private int m_rootAgents; |
203 | private int m_childAgents; | 212 | private int m_childAgents; |
204 | private int m_numPrim; | 213 | private int m_numPrim; |
214 | private int m_numGeoPrim; | ||
215 | private int m_numMesh; | ||
205 | private int m_inPacketsPerSecond; | 216 | private int m_inPacketsPerSecond; |
206 | private int m_outPacketsPerSecond; | 217 | private int m_outPacketsPerSecond; |
207 | private int m_activePrim; | 218 | private int m_activePrim; |
@@ -214,26 +225,33 @@ namespace OpenSim.Region.Framework.Scenes | |||
214 | private int m_objectCapacity = 45000; | 225 | private int m_objectCapacity = 45000; |
215 | 226 | ||
216 | // This is the number of frames that will be stored and then averaged for | 227 | // This is the number of frames that will be stored and then averaged for |
217 | // the Total, Simulation, Physics, and Network Frame Time; It is set to | 228 | // the Total, Simulation, Physics, and Network Frame Time; It is set to |
218 | // 10 by default but can be changed by the OpenSim.ini configuration file | 229 | // 10 by default but can be changed by the OpenSim.ini configuration file |
219 | // NumberOfFrames parameter | 230 | // NumberOfFrames parameter |
220 | private int m_numberFramesStored = 10; | 231 | private int m_numberFramesStored = Scene.m_defaultNumberFramesStored; |
221 | 232 | ||
222 | // The arrays that will hold the time it took to run the past N frames, | 233 | // The arrays that will hold the time it took to run the past N frames, |
223 | // where N is the num_frames_to_average given by the configuration file | 234 | // where N is the num_frames_to_average given by the configuration file |
224 | private double[] m_totalFrameTimeMilliseconds; | 235 | private double[] m_totalFrameTimeMilliseconds; |
225 | private double[] m_simulationFrameTimeMilliseconds; | 236 | private double[] m_simulationFrameTimeMilliseconds; |
226 | private double[] m_physicsFrameTimeMilliseconds; | 237 | private double[] m_physicsFrameTimeMilliseconds; |
227 | private double[] m_networkFrameTimeMilliseconds; | 238 | private double[] m_networkFrameTimeMilliseconds; |
228 | 239 | ||
229 | // The location of the next time in milliseconds that will be | 240 | // The location of the next time in milliseconds that will be |
230 | // (over)written when the next frame completes | 241 | // (over)written when the next frame completes |
231 | private int m_nextLocation = 0; | 242 | private int m_nextLocation = 0; |
232 | 243 | ||
233 | // The correct number of frames that have completed since the last stats | 244 | // The correct number of frames that have completed since the last stats |
234 | // update for physics | 245 | // update for physics |
235 | private int m_numberPhysicsFrames; | 246 | private int m_numberPhysicsFrames; |
236 | 247 | ||
248 | // The current number of users attempting to login to the region | ||
249 | private int m_usersLoggingIn; | ||
250 | |||
251 | // The last reported value of threads from the SmartThreadPool inside of | ||
252 | // XEngine | ||
253 | private int m_inUseThreads; | ||
254 | |||
237 | private Scene m_scene; | 255 | private Scene m_scene; |
238 | 256 | ||
239 | private RegionInfo ReportingRegion; | 257 | private RegionInfo ReportingRegion; |
@@ -246,11 +264,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
246 | { | 264 | { |
247 | // Initialize the different frame time arrays to the correct sizes | 265 | // Initialize the different frame time arrays to the correct sizes |
248 | m_totalFrameTimeMilliseconds = new double[m_numberFramesStored]; | 266 | m_totalFrameTimeMilliseconds = new double[m_numberFramesStored]; |
249 | m_simulationFrameTimeMilliseconds = new | 267 | m_simulationFrameTimeMilliseconds = new double[m_numberFramesStored]; |
250 | double[m_numberFramesStored]; | ||
251 | m_physicsFrameTimeMilliseconds = new double[m_numberFramesStored]; | 268 | m_physicsFrameTimeMilliseconds = new double[m_numberFramesStored]; |
252 | m_networkFrameTimeMilliseconds = new double[m_numberFramesStored]; | 269 | m_networkFrameTimeMilliseconds = new double[m_numberFramesStored]; |
253 | 270 | ||
271 | // Initialize the current number of users logging into the region | ||
272 | m_usersLoggingIn = 0; | ||
273 | |||
254 | m_scene = scene; | 274 | m_scene = scene; |
255 | m_reportedFpsCorrectionFactor = scene.MinFrameSeconds * m_nominalReportedFps; | 275 | m_reportedFpsCorrectionFactor = scene.MinFrameSeconds * m_nominalReportedFps; |
256 | m_statsUpdateFactor = (float)(m_statsUpdatesEveryMS / 1000); | 276 | m_statsUpdateFactor = (float)(m_statsUpdatesEveryMS / 1000); |
@@ -284,13 +304,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
284 | StatsManager.RegisterStat(SlowFramesStat); | 304 | StatsManager.RegisterStat(SlowFramesStat); |
285 | } | 305 | } |
286 | 306 | ||
307 | |||
287 | public SimStatsReporter(Scene scene, int numberOfFrames) : this (scene) | 308 | public SimStatsReporter(Scene scene, int numberOfFrames) : this (scene) |
288 | { | 309 | { |
289 | // Store the number of frames from the OpenSim.ini configuration | 310 | // Store the number of frames from the OpenSim.ini configuration file |
290 | // file | 311 | m_numberFramesStored = numberOfFrames; |
291 | m_numberFramesStored = numberOfFrames; | ||
292 | } | 312 | } |
293 | 313 | ||
314 | |||
294 | public void Close() | 315 | public void Close() |
295 | { | 316 | { |
296 | m_report.Elapsed -= TriggerStatsHeartbeat; | 317 | m_report.Elapsed -= TriggerStatsHeartbeat; |
@@ -328,11 +349,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
328 | double simulationSumFrameTime; | 349 | double simulationSumFrameTime; |
329 | double physicsSumFrameTime; | 350 | double physicsSumFrameTime; |
330 | double networkSumFrameTime; | 351 | double networkSumFrameTime; |
331 | 352 | float frameDilation; | |
353 | int currentFrame; | ||
354 | |||
332 | if (!m_scene.Active) | 355 | if (!m_scene.Active) |
333 | return; | 356 | return; |
334 | 357 | ||
335 | SimStatsPacket.StatBlock[] sb = new SimStatsPacket.StatBlock[22]; | 358 | // Create arrays to hold the statistics for this current scene, |
359 | // these will be passed to the SimExtraStatsCollector, they are also | ||
360 | // sent to the SimStats class | ||
361 | SimStatsPacket.StatBlock[] sb = new | ||
362 | SimStatsPacket.StatBlock[m_statisticArraySize]; | ||
336 | SimStatsPacket.RegionBlock rb = new SimStatsPacket.RegionBlock(); | 363 | SimStatsPacket.RegionBlock rb = new SimStatsPacket.RegionBlock(); |
337 | 364 | ||
338 | // Know what's not thread safe in Mono... modifying timers. | 365 | // Know what's not thread safe in Mono... modifying timers. |
@@ -354,21 +381,21 @@ namespace OpenSim.Region.Framework.Scenes | |||
354 | 381 | ||
355 | #region various statistic googly moogly | 382 | #region various statistic googly moogly |
356 | 383 | ||
357 | // ORIGINAL code commented out until we have time to add our own | 384 | // ORIGINAL code commented out until we have time to add our own |
358 | // statistics to the statistics window, this will be done as a | 385 | // statistics to the statistics window, this will be done as a |
359 | // new section given the title of our current project | 386 | // new section given the title of our current project |
360 | // We're going to lie about the FPS because we've been lying since 2008. The actual FPS is currently | 387 | // We're going to lie about the FPS because we've been lying since 2008. The actual FPS is currently |
361 | // locked at a maximum of 11. Maybe at some point this can change so that we're not lying. | 388 | // locked at a maximum of 11. Maybe at some point this can change so that we're not lying. |
362 | //int reportedFPS = (int)(m_fps * m_reportedFpsCorrectionFactor); | 389 | //int reportedFPS = (int)(m_fps * m_reportedFpsCorrectionFactor); |
363 | int reportedFPS = m_fps; | 390 | int reportedFPS = m_fps; |
364 | 391 | ||
365 | // save the reported value so there is something available for llGetRegionFPS | 392 | // save the reported value so there is something available for llGetRegionFPS |
366 | lastReportedSimFPS = reportedFPS / m_statsUpdateFactor; | 393 | lastReportedSimFPS = reportedFPS / m_statsUpdateFactor; |
367 | 394 | ||
368 | // ORIGINAL code commented out until we have time to add our own | 395 | // ORIGINAL code commented out until we have time to add our own |
369 | // statistics to the statistics window | 396 | // statistics to the statistics window |
370 | //float physfps = ((m_pfps / 1000)); | 397 | //float physfps = ((m_pfps / 1000)); |
371 | float physfps = m_numberPhysicsFrames; | 398 | float physfps = m_numberPhysicsFrames; |
372 | 399 | ||
373 | //if (physfps > 600) | 400 | //if (physfps > 600) |
374 | //physfps = physfps - (physfps - 600); | 401 | //physfps = physfps - (physfps - 600); |
@@ -381,6 +408,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
381 | m_rootAgents = m_scene.SceneGraph.GetRootAgentCount(); | 408 | m_rootAgents = m_scene.SceneGraph.GetRootAgentCount(); |
382 | m_childAgents = m_scene.SceneGraph.GetChildAgentCount(); | 409 | m_childAgents = m_scene.SceneGraph.GetChildAgentCount(); |
383 | m_numPrim = m_scene.SceneGraph.GetTotalObjectsCount(); | 410 | m_numPrim = m_scene.SceneGraph.GetTotalObjectsCount(); |
411 | m_numGeoPrim = m_scene.SceneGraph.GetTotalPrimObjectsCount(); | ||
412 | m_numMesh = m_scene.SceneGraph.GetTotalMeshObjectsCount(); | ||
384 | m_activePrim = m_scene.SceneGraph.GetActiveObjectsCount(); | 413 | m_activePrim = m_scene.SceneGraph.GetActiveObjectsCount(); |
385 | m_activeScripts = m_scene.SceneGraph.GetActiveScriptsCount(); | 414 | m_activeScripts = m_scene.SceneGraph.GetActiveScriptsCount(); |
386 | 415 | ||
@@ -406,11 +435,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
406 | if (framesUpdated == 0) | 435 | if (framesUpdated == 0) |
407 | framesUpdated = 1; | 436 | framesUpdated = 1; |
408 | 437 | ||
409 | for (int i = 0; i < 22; i++) | 438 | for (int i = 0; i < m_statisticArraySize; i++) |
410 | { | 439 | { |
411 | sb[i] = new SimStatsPacket.StatBlock(); | 440 | sb[i] = new SimStatsPacket.StatBlock(); |
412 | } | 441 | } |
413 | 442 | ||
414 | // Resetting the sums of the frame times to prevent any errors | 443 | // Resetting the sums of the frame times to prevent any errors |
415 | // in calculating the moving average for frame time | 444 | // in calculating the moving average for frame time |
416 | totalSumFrameTime = 0; | 445 | totalSumFrameTime = 0; |
@@ -425,12 +454,25 @@ namespace OpenSim.Region.Framework.Scenes | |||
425 | // Sum up each frame time in order to calculate the moving | 454 | // Sum up each frame time in order to calculate the moving |
426 | // average of frame time | 455 | // average of frame time |
427 | totalSumFrameTime += m_totalFrameTimeMilliseconds[i]; | 456 | totalSumFrameTime += m_totalFrameTimeMilliseconds[i]; |
428 | simulationSumFrameTime += | 457 | simulationSumFrameTime += |
429 | m_simulationFrameTimeMilliseconds[i]; | 458 | m_simulationFrameTimeMilliseconds[i]; |
430 | physicsSumFrameTime += m_physicsFrameTimeMilliseconds[i]; | 459 | physicsSumFrameTime += m_physicsFrameTimeMilliseconds[i]; |
431 | networkSumFrameTime += m_networkFrameTimeMilliseconds[i]; | 460 | networkSumFrameTime += m_networkFrameTimeMilliseconds[i]; |
432 | } | 461 | } |
433 | 462 | ||
463 | // Get the index that represents the current frame based on the next one known; go back | ||
464 | // to the last index if next one is stated to restart at 0 | ||
465 | if (m_nextLocation == 0) | ||
466 | currentFrame = m_numberFramesStored - 1; | ||
467 | else | ||
468 | currentFrame = m_nextLocation - 1; | ||
469 | |||
470 | // Calculate the frame dilation; which is currently based on the ratio between the sum of the | ||
471 | // physics and simulation rate, and the set minimum time to run a scene's frame | ||
472 | frameDilation = (float)(m_simulationFrameTimeMilliseconds[currentFrame] + | ||
473 | m_physicsFrameTimeMilliseconds[currentFrame]) / m_scene.MinFrameTicks; | ||
474 | |||
475 | // ORIGINAL code commented out until we have time to add our own | ||
434 | sb[0].StatID = (uint) Stats.TimeDilation; | 476 | sb[0].StatID = (uint) Stats.TimeDilation; |
435 | sb[0].StatValue = (Single.IsNaN(m_timeDilation)) ? 0.1f : m_timeDilation ; //((((m_timeDilation + (0.10f * statsUpdateFactor)) /10) / statsUpdateFactor)); | 477 | sb[0].StatValue = (Single.IsNaN(m_timeDilation)) ? 0.1f : m_timeDilation ; //((((m_timeDilation + (0.10f * statsUpdateFactor)) /10) / statsUpdateFactor)); |
436 | 478 | ||
@@ -455,31 +497,28 @@ namespace OpenSim.Region.Framework.Scenes | |||
455 | sb[7].StatID = (uint) Stats.ActivePrim; | 497 | sb[7].StatID = (uint) Stats.ActivePrim; |
456 | sb[7].StatValue = m_activePrim; | 498 | sb[7].StatValue = m_activePrim; |
457 | 499 | ||
458 | // ORIGINAL code commented out until we have time to add our own | 500 | // ORIGINAL code commented out until we have time to add our own |
459 | // statistics to the statistics window | 501 | // statistics to the statistics window |
460 | sb[8].StatID = (uint)Stats.FrameMS; | 502 | sb[8].StatID = (uint)Stats.FrameMS; |
461 | //sb[8].StatValue = m_frameMS / framesUpdated; | 503 | //sb[8].StatValue = m_frameMS / framesUpdated; |
462 | sb[8].StatValue = (float) totalSumFrameTime / | 504 | sb[8].StatValue = (float) totalSumFrameTime / m_numberFramesStored; |
463 | m_numberFramesStored; | ||
464 | 505 | ||
465 | sb[9].StatID = (uint)Stats.NetMS; | 506 | sb[9].StatID = (uint)Stats.NetMS; |
466 | //sb[9].StatValue = m_netMS / framesUpdated; | 507 | //sb[9].StatValue = m_netMS / framesUpdated; |
467 | sb[9].StatValue = (float) networkSumFrameTime / | 508 | sb[9].StatValue = (float) networkSumFrameTime / m_numberFramesStored; |
468 | m_numberFramesStored; | ||
469 | 509 | ||
470 | sb[10].StatID = (uint)Stats.PhysicsMS; | 510 | sb[10].StatID = (uint)Stats.PhysicsMS; |
471 | //sb[10].StatValue = m_physicsMS / framesUpdated; | 511 | //sb[10].StatValue = m_physicsMS / framesUpdated; |
472 | sb[10].StatValue = (float) physicsSumFrameTime / | 512 | sb[10].StatValue = (float) physicsSumFrameTime / m_numberFramesStored; |
473 | m_numberFramesStored; | ||
474 | 513 | ||
475 | sb[11].StatID = (uint)Stats.ImageMS ; | 514 | sb[11].StatID = (uint)Stats.ImageMS ; |
476 | sb[11].StatValue = m_imageMS / framesUpdated; | 515 | sb[11].StatValue = m_imageMS / framesUpdated; |
477 | 516 | ||
478 | sb[12].StatID = (uint)Stats.OtherMS; | 517 | sb[12].StatID = (uint)Stats.OtherMS; |
479 | //sb[12].StatValue = m_otherMS / framesUpdated; | 518 | //sb[12].StatValue = m_otherMS / framesUpdated; |
480 | sb[12].StatValue = (float) simulationSumFrameTime / | 519 | sb[12].StatValue = (float) simulationSumFrameTime / |
481 | m_numberFramesStored; | 520 | m_numberFramesStored; |
482 | 521 | ||
483 | sb[13].StatID = (uint)Stats.InPacketsPerSecond; | 522 | sb[13].StatID = (uint)Stats.InPacketsPerSecond; |
484 | sb[13].StatValue = (m_inPacketsPerSecond / m_statsUpdateFactor); | 523 | sb[13].StatValue = (m_inPacketsPerSecond / m_statsUpdateFactor); |
485 | 524 | ||
@@ -507,7 +546,28 @@ namespace OpenSim.Region.Framework.Scenes | |||
507 | sb[21].StatID = (uint)Stats.SimSpareMs; | 546 | sb[21].StatID = (uint)Stats.SimSpareMs; |
508 | sb[21].StatValue = m_spareMS / framesUpdated; | 547 | sb[21].StatValue = m_spareMS / framesUpdated; |
509 | 548 | ||
510 | for (int i = 0; i < 22; i++) | 549 | // Current ratio between the sum of physics and sim rate, and the |
550 | // minimum time to run a scene's frame | ||
551 | sb[22].StatID = (uint)Stats.FrameDilation; | ||
552 | sb[22].StatValue = frameDilation; | ||
553 | |||
554 | // Current number of users currently attemptint to login to region | ||
555 | sb[23].StatID = (uint)Stats.UsersLoggingIn; | ||
556 | sb[23].StatValue = m_usersLoggingIn; | ||
557 | |||
558 | // Total number of geometric primitives in the scene | ||
559 | sb[24].StatID = (uint)Stats.TotalGeoPrim; | ||
560 | sb[24].StatValue = m_numGeoPrim; | ||
561 | |||
562 | // Total number of mesh objects in the scene | ||
563 | sb[25].StatID = (uint)Stats.TotalMesh; | ||
564 | sb[25].StatValue = m_numMesh; | ||
565 | |||
566 | // Current number of threads that XEngine is using | ||
567 | sb[26].StatID = (uint)Stats.ThreadCount; | ||
568 | sb[26].StatValue = m_inUseThreads; | ||
569 | |||
570 | for (int i = 0; i < m_statisticArraySize; i++) | ||
511 | { | 571 | { |
512 | lastReportedSimStats[i] = sb[i].StatValue; | 572 | lastReportedSimStats[i] = sb[i].StatValue; |
513 | } | 573 | } |
@@ -554,8 +614,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
554 | { | 614 | { |
555 | // Reset the number of frames that the physics library has | 615 | // Reset the number of frames that the physics library has |
556 | // processed since the last stats report | 616 | // processed since the last stats report |
557 | m_numberPhysicsFrames = 0; | 617 | m_numberPhysicsFrames = 0; |
558 | 618 | ||
559 | m_timeDilation = 0; | 619 | m_timeDilation = 0; |
560 | m_fps = 0; | 620 | m_fps = 0; |
561 | m_pfps = 0; | 621 | m_pfps = 0; |
@@ -686,32 +746,32 @@ namespace OpenSim.Region.Framework.Scenes | |||
686 | m_otherMS += ms; | 746 | m_otherMS += ms; |
687 | } | 747 | } |
688 | 748 | ||
689 | public void addPhysicsFrame(int frames) | 749 | public void addPhysicsFrame(int frames) |
690 | { | 750 | { |
691 | // Add the number of physics frames to the correct total physics | 751 | // Add the number of physics frames to the correct total physics |
692 | // frames | 752 | // frames |
693 | m_numberPhysicsFrames += frames; | 753 | m_numberPhysicsFrames += frames; |
694 | } | 754 | } |
695 | 755 | ||
696 | public void addFrameTimeMilliseconds(double total, double simulation, | 756 | public void addFrameTimeMilliseconds(double total, double simulation, |
697 | double physics, double network) | 757 | double physics, double network) |
698 | { | 758 | { |
699 | // Save the frame times from the current frame into the appropriate | 759 | // Save the frame times from the current frame into the appropriate |
700 | // arrays | 760 | // arrays |
701 | m_totalFrameTimeMilliseconds[m_nextLocation] = total; | 761 | m_totalFrameTimeMilliseconds[m_nextLocation] = total; |
702 | m_simulationFrameTimeMilliseconds[m_nextLocation] = simulation; | 762 | m_simulationFrameTimeMilliseconds[m_nextLocation] = simulation; |
703 | m_physicsFrameTimeMilliseconds[m_nextLocation] = physics; | 763 | m_physicsFrameTimeMilliseconds[m_nextLocation] = physics; |
704 | m_networkFrameTimeMilliseconds[m_nextLocation] = network; | 764 | m_networkFrameTimeMilliseconds[m_nextLocation] = network; |
705 | 765 | ||
706 | // Update to the next location in the list | 766 | // Update to the next location in the list |
707 | m_nextLocation++; | 767 | m_nextLocation++; |
768 | |||
769 | // Since the list will begin to overwrite the oldest frame values | ||
770 | // first, the next location needs to loop back to the beginning of the | ||
771 | // list whenever it reaches the end | ||
772 | m_nextLocation = m_nextLocation % m_numberFramesStored; | ||
773 | } | ||
708 | 774 | ||
709 | // Since the list will begin to overwrite the oldest frame values | ||
710 | // first, the next location needs to loop back to the beginning of the | ||
711 | // list whenever it reaches the end | ||
712 | m_nextLocation = m_nextLocation % m_numberFramesStored; | ||
713 | } | ||
714 | |||
715 | public void AddPendingDownloads(int count) | 775 | public void AddPendingDownloads(int count) |
716 | { | 776 | { |
717 | m_pendingDownloads += count; | 777 | m_pendingDownloads += count; |
@@ -734,6 +794,31 @@ namespace OpenSim.Region.Framework.Scenes | |||
734 | AddunAckedBytes(unAckedBytes); | 794 | AddunAckedBytes(unAckedBytes); |
735 | } | 795 | } |
736 | 796 | ||
797 | public void UpdateUsersLoggingIn(bool isLoggingIn) | ||
798 | { | ||
799 | // Determine whether the user has started logging in or has completed | ||
800 | // logging into the region | ||
801 | if (isLoggingIn) | ||
802 | { | ||
803 | // The user is starting to login to the region so increment the | ||
804 | // number of users attempting to login to the region | ||
805 | m_usersLoggingIn++; | ||
806 | } | ||
807 | else | ||
808 | { | ||
809 | // The user has finished logging into the region so decrement the | ||
810 | // number of users logging into the region | ||
811 | m_usersLoggingIn--; | ||
812 | } | ||
813 | } | ||
814 | |||
815 | public void SetThreadCount(int inUseThreads) | ||
816 | { | ||
817 | // Save the new number of threads to our member variable to send to | ||
818 | // the extra stats collector | ||
819 | m_inUseThreads = inUseThreads; | ||
820 | } | ||
821 | |||
737 | #endregion | 822 | #endregion |
738 | 823 | ||
739 | public Dictionary<string, float> GetExtraSimStats() | 824 | public Dictionary<string, float> GetExtraSimStats() |
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs index 54620d1..4e383f8 100644..100755 --- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | |||
@@ -1872,6 +1872,12 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
1872 | IScriptInstance instance = GetInstance(itemID); | 1872 | IScriptInstance instance = GetInstance(itemID); |
1873 | if (instance != null) | 1873 | if (instance != null) |
1874 | instance.ApiResetScript(); | 1874 | instance.ApiResetScript(); |
1875 | |||
1876 | // Send the new number of threads that are in use by the thread | ||
1877 | // pool, I believe that by adding them to the locations where the | ||
1878 | // script is changing states that I will catch all changes to the | ||
1879 | // thread pool | ||
1880 | m_Scene.setThreadCount(m_ThreadPool.InUseThreads); | ||
1875 | } | 1881 | } |
1876 | 1882 | ||
1877 | public void ResetScript(UUID itemID) | 1883 | public void ResetScript(UUID itemID) |
@@ -1879,6 +1885,12 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
1879 | IScriptInstance instance = GetInstance(itemID); | 1885 | IScriptInstance instance = GetInstance(itemID); |
1880 | if (instance != null) | 1886 | if (instance != null) |
1881 | instance.ResetScript(m_WaitForEventCompletionOnScriptStop); | 1887 | instance.ResetScript(m_WaitForEventCompletionOnScriptStop); |
1888 | |||
1889 | // Send the new number of threads that are in use by the thread | ||
1890 | // pool, I believe that by adding them to the locations where the | ||
1891 | // script is changing states that I will catch all changes to the | ||
1892 | // thread pool | ||
1893 | m_Scene.setThreadCount(m_ThreadPool.InUseThreads); | ||
1882 | } | 1894 | } |
1883 | 1895 | ||
1884 | public void StartScript(UUID itemID) | 1896 | public void StartScript(UUID itemID) |
@@ -1888,6 +1900,12 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
1888 | instance.Start(); | 1900 | instance.Start(); |
1889 | else | 1901 | else |
1890 | m_runFlags.AddOrUpdate(itemID, true, 240); | 1902 | m_runFlags.AddOrUpdate(itemID, true, 240); |
1903 | |||
1904 | // Send the new number of threads that are in use by the thread | ||
1905 | // pool, I believe that by adding them to the locations where the | ||
1906 | // script is changing states that I will catch all changes to the | ||
1907 | // thread pool | ||
1908 | m_Scene.setThreadCount(m_ThreadPool.InUseThreads); | ||
1891 | } | 1909 | } |
1892 | 1910 | ||
1893 | public void StopScript(UUID itemID) | 1911 | public void StopScript(UUID itemID) |
@@ -1903,6 +1921,12 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
1903 | // m_log.DebugFormat("[XENGINE]: Could not find script with ID {0} to stop in {1}", itemID, World.Name); | 1921 | // m_log.DebugFormat("[XENGINE]: Could not find script with ID {0} to stop in {1}", itemID, World.Name); |
1904 | m_runFlags.AddOrUpdate(itemID, false, 240); | 1922 | m_runFlags.AddOrUpdate(itemID, false, 240); |
1905 | } | 1923 | } |
1924 | |||
1925 | // Send the new number of threads that are in use by the thread | ||
1926 | // pool, I believe that by adding them to the locations where the | ||
1927 | // script is changing states that I will catch all changes to the | ||
1928 | // thread pool | ||
1929 | m_Scene.setThreadCount(m_ThreadPool.InUseThreads); | ||
1906 | } | 1930 | } |
1907 | 1931 | ||
1908 | public DetectParams GetDetectParams(UUID itemID, int idx) | 1932 | public DetectParams GetDetectParams(UUID itemID, int idx) |
@@ -2393,6 +2417,12 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
2393 | instance.Suspend(); | 2417 | instance.Suspend(); |
2394 | // else | 2418 | // else |
2395 | // m_log.DebugFormat("[XEngine]: Could not find script with ID {0} to resume", itemID); | 2419 | // m_log.DebugFormat("[XEngine]: Could not find script with ID {0} to resume", itemID); |
2420 | |||
2421 | // Send the new number of threads that are in use by the thread | ||
2422 | // pool, I believe that by adding them to the locations where the | ||
2423 | // script is changing states that I will catch all changes to the | ||
2424 | // thread pool | ||
2425 | m_Scene.setThreadCount(m_ThreadPool.InUseThreads); | ||
2396 | } | 2426 | } |
2397 | 2427 | ||
2398 | public void ResumeScript(UUID itemID) | 2428 | public void ResumeScript(UUID itemID) |
@@ -2404,6 +2434,12 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
2404 | instance.Resume(); | 2434 | instance.Resume(); |
2405 | // else | 2435 | // else |
2406 | // m_log.DebugFormat("[XEngine]: Could not find script with ID {0} to resume", itemID); | 2436 | // m_log.DebugFormat("[XEngine]: Could not find script with ID {0} to resume", itemID); |
2437 | |||
2438 | // Send the new number of threads that are in use by the thread | ||
2439 | // pool, I believe that by adding them to the locations where the | ||
2440 | // script is changing states that I will catch all changes to the | ||
2441 | // thread pool | ||
2442 | m_Scene.setThreadCount(m_ThreadPool.InUseThreads); | ||
2407 | } | 2443 | } |
2408 | 2444 | ||
2409 | public bool HasScript(UUID itemID, out bool running) | 2445 | public bool HasScript(UUID itemID, out bool running) |