diff options
-rwxr-xr-x[-rw-r--r--] | OpenSim/Framework/Monitoring/SimExtraStatsCollector.cs | 52 | ||||
-rwxr-xr-x | OpenSim/Region/Framework/Scenes/Scene.cs | 1399 | ||||
-rwxr-xr-x[-rw-r--r--] | OpenSim/Region/Framework/Scenes/SceneGraph.cs | 59 | ||||
-rwxr-xr-x | OpenSim/Region/Framework/Scenes/SimStatsReporter.cs | 219 | ||||
-rwxr-xr-x[-rw-r--r--] | OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | 36 | ||||
-rwxr-xr-x[-rw-r--r--] | bin/LukeSkywalker.IPNetwork.dll | bin | 18432 -> 18432 bytes | |||
-rwxr-xr-x[-rw-r--r--] | bin/OpenSimDefaults.ini | 2 |
7 files changed, 1014 insertions, 753 deletions
diff --git a/OpenSim/Framework/Monitoring/SimExtraStatsCollector.cs b/OpenSim/Framework/Monitoring/SimExtraStatsCollector.cs index f6f458d..e4df7ee 100644..100755 --- a/OpenSim/Framework/Monitoring/SimExtraStatsCollector.cs +++ b/OpenSim/Framework/Monitoring/SimExtraStatsCollector.cs | |||
@@ -27,6 +27,7 @@ | |||
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Diagnostics; | ||
30 | using System.Linq; | 31 | using System.Linq; |
31 | using System.Text; | 32 | using System.Text; |
32 | using OpenMetaverse; | 33 | using OpenMetaverse; |
@@ -71,6 +72,11 @@ namespace OpenSim.Framework.Monitoring | |||
71 | private volatile float pendingUploads; | 72 | private volatile float pendingUploads; |
72 | private volatile float activeScripts; | 73 | private volatile float activeScripts; |
73 | private volatile float scriptLinesPerSecond; | 74 | private volatile float scriptLinesPerSecond; |
75 | private volatile float m_frameDilation; | ||
76 | private volatile float m_usersLoggingIn; | ||
77 | private volatile float m_totalGeoPrims; | ||
78 | private volatile float m_totalMeshes; | ||
79 | private volatile float m_inUseThreads; | ||
74 | 80 | ||
75 | // /// <summary> | 81 | // /// <summary> |
76 | // /// These statistics are being collected by push rather than pull. Pull would be simpler, but I had the | 82 | // /// These statistics are being collected by push rather than pull. Pull would be simpler, but I had the |
@@ -249,6 +255,10 @@ namespace OpenSim.Framework.Monitoring | |||
249 | { | 255 | { |
250 | // FIXME: SimStats shouldn't allow an arbitrary stat packing order (which is inherited from the original | 256 | // FIXME: SimStats shouldn't allow an arbitrary stat packing order (which is inherited from the original |
251 | // SimStatsPacket that was being used). | 257 | // SimStatsPacket that was being used). |
258 | |||
259 | // For an unknown reason the original designers decided not to | ||
260 | // include the spare MS statistic inside of this class, this is | ||
261 | // located inside the StatsBlock at location 21, thus it is skipped | ||
252 | timeDilation = stats.StatsBlock[0].StatValue; | 262 | timeDilation = stats.StatsBlock[0].StatValue; |
253 | simFps = stats.StatsBlock[1].StatValue; | 263 | simFps = stats.StatsBlock[1].StatValue; |
254 | physicsFps = stats.StatsBlock[2].StatValue; | 264 | physicsFps = stats.StatsBlock[2].StatValue; |
@@ -270,6 +280,11 @@ namespace OpenSim.Framework.Monitoring | |||
270 | pendingUploads = stats.StatsBlock[18].StatValue; | 280 | pendingUploads = stats.StatsBlock[18].StatValue; |
271 | activeScripts = stats.StatsBlock[19].StatValue; | 281 | activeScripts = stats.StatsBlock[19].StatValue; |
272 | scriptLinesPerSecond = stats.StatsBlock[20].StatValue; | 282 | scriptLinesPerSecond = stats.StatsBlock[20].StatValue; |
283 | m_frameDilation = stats.StatsBlock[22].StatValue; | ||
284 | m_usersLoggingIn = stats.StatsBlock[23].StatValue; | ||
285 | m_totalGeoPrims = stats.StatsBlock[24].StatValue; | ||
286 | m_totalMeshes = stats.StatsBlock[25].StatValue; | ||
287 | m_inUseThreads = stats.StatsBlock[26].StatValue; | ||
273 | } | 288 | } |
274 | 289 | ||
275 | /// <summary> | 290 | /// <summary> |
@@ -407,6 +422,27 @@ Asset service request failures: {3}" + Environment.NewLine, | |||
407 | /// <returns></returns> | 422 | /// <returns></returns> |
408 | public override OSDMap OReport(string uptime, string version) | 423 | public override OSDMap OReport(string uptime, string version) |
409 | { | 424 | { |
425 | // Get the amount of physical memory, allocated with the instance of this program, in kilobytes; | ||
426 | // the working set is the set of memory pages currently visible to this program in physical RAM | ||
427 | // memory and includes both shared (e.g. system libraries) and private data | ||
428 | double memUsage = Process.GetCurrentProcess().WorkingSet64 / 1024.0; | ||
429 | |||
430 | // Get the number of threads from the system that are currently | ||
431 | // running | ||
432 | int numberThreadsRunning = 0; | ||
433 | foreach (ProcessThread currentThread in | ||
434 | Process.GetCurrentProcess().Threads) | ||
435 | { | ||
436 | // A known issue with the current process .Threads property is | ||
437 | // that it can return null threads, thus don't count those as | ||
438 | // running threads and prevent the program function from failing | ||
439 | if (currentThread != null && | ||
440 | currentThread.ThreadState == ThreadState.Running) | ||
441 | { | ||
442 | numberThreadsRunning++; | ||
443 | } | ||
444 | } | ||
445 | |||
410 | OSDMap args = new OSDMap(30); | 446 | OSDMap args = new OSDMap(30); |
411 | // args["AssetsInCache"] = OSD.FromString (String.Format ("{0:0.##}", AssetsInCache)); | 447 | // args["AssetsInCache"] = OSD.FromString (String.Format ("{0:0.##}", AssetsInCache)); |
412 | // args["TimeAfterCacheMiss"] = OSD.FromString (String.Format ("{0:0.##}", | 448 | // args["TimeAfterCacheMiss"] = OSD.FromString (String.Format ("{0:0.##}", |
@@ -443,6 +479,22 @@ Asset service request failures: {3}" + Environment.NewLine, | |||
443 | args["Memory"] = OSD.FromString (base.XReport (uptime, version)); | 479 | args["Memory"] = OSD.FromString (base.XReport (uptime, version)); |
444 | args["Uptime"] = OSD.FromString (uptime); | 480 | args["Uptime"] = OSD.FromString (uptime); |
445 | args["Version"] = OSD.FromString (version); | 481 | args["Version"] = OSD.FromString (version); |
482 | |||
483 | args["FrameDilatn"] = OSD.FromString(String.Format("{0:0.##}", m_frameDilation)); | ||
484 | args["Logging in Users"] = OSD.FromString(String.Format("{0:0.##}", | ||
485 | m_usersLoggingIn)); | ||
486 | args["GeoPrims"] = OSD.FromString(String.Format("{0:0.##}", | ||
487 | m_totalGeoPrims)); | ||
488 | args["Mesh Objects"] = OSD.FromString(String.Format("{0:0.##}", | ||
489 | m_totalMeshes)); | ||
490 | args["XEngine Thread Count"] = OSD.FromString(String.Format("{0:0.##}", | ||
491 | m_inUseThreads)); | ||
492 | args["Util Thread Count"] = OSD.FromString(String.Format("{0:0.##}", | ||
493 | Util.GetSmartThreadPoolInfo().InUseThreads)); | ||
494 | args["System Thread Count"] = OSD.FromString(String.Format( | ||
495 | "{0:0.##}", numberThreadsRunning)); | ||
496 | args["ProcMem"] = OSD.FromString(String.Format("{0:#,###,###.##}", | ||
497 | memUsage)); | ||
446 | 498 | ||
447 | return args; | 499 | return args; |
448 | } | 500 | } |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 438dce9..31900ec 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; |
@@ -64,6 +64,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
64 | 64 | ||
65 | public const int m_defaultNumberFramesStored = 10; | 65 | public const int m_defaultNumberFramesStored = 10; |
66 | 66 | ||
67 | public const int m_defaultNumberFramesStored = 10; | ||
68 | |||
67 | public delegate void SynchronizeSceneHandler(Scene scene); | 69 | public delegate void SynchronizeSceneHandler(Scene scene); |
68 | 70 | ||
69 | #region Fields | 71 | #region Fields |
@@ -105,9 +107,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
105 | /// <summary> | 107 | /// <summary> |
106 | /// 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. |
107 | /// </summary> | 109 | /// </summary> |
108 | public bool PhysicsEnabled | 110 | public bool PhysicsEnabled |
109 | { | 111 | { |
110 | get | 112 | get |
111 | { | 113 | { |
112 | return m_physicsEnabled; | 114 | return m_physicsEnabled; |
113 | } | 115 | } |
@@ -121,8 +123,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
121 | IPhysicsParameters physScene = PhysicsScene as IPhysicsParameters; | 123 | IPhysicsParameters physScene = PhysicsScene as IPhysicsParameters; |
122 | 124 | ||
123 | if (physScene != null) | 125 | if (physScene != null) |
124 | physScene.SetPhysicsParameter( | 126 | physScene.SetPhysicsParameter( |
125 | "Active", m_physicsEnabled.ToString(), PhysParameterEntry.APPLY_TO_NONE); | 127 | "Active", m_physicsEnabled.ToString(), PhysParameterEntry.APPLY_TO_NONE); |
126 | } | 128 | } |
127 | } | 129 | } |
128 | } | 130 | } |
@@ -132,10 +134,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
132 | /// <summary> | 134 | /// <summary> |
133 | /// If false then scripts are not enabled on the smiulator | 135 | /// If false then scripts are not enabled on the smiulator |
134 | /// </summary> | 136 | /// </summary> |
135 | public bool ScriptsEnabled | 137 | public bool ScriptsEnabled |
136 | { | 138 | { |
137 | get { return m_scripts_enabled; } | 139 | get { return m_scripts_enabled; } |
138 | set | 140 | set |
139 | { | 141 | { |
140 | if (m_scripts_enabled != value) | 142 | if (m_scripts_enabled != value) |
141 | { | 143 | { |
@@ -147,13 +149,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
147 | foreach (EntityBase ent in entities) | 149 | foreach (EntityBase ent in entities) |
148 | { | 150 | { |
149 | if (ent is SceneObjectGroup) | 151 | if (ent is SceneObjectGroup) |
150 | ((SceneObjectGroup)ent).RemoveScriptInstances(false); | 152 | ((SceneObjectGroup)ent).RemoveScriptInstances(false); |
151 | } | 153 | } |
152 | } | 154 | } |
153 | else | 155 | else |
154 | { | 156 | { |
155 | m_log.Info("Starting all Scripts in Scene"); | 157 | m_log.Info("Starting all Scripts in Scene"); |
156 | 158 | ||
157 | EntityBase[] entities = Entities.GetEntities(); | 159 | EntityBase[] entities = Entities.GetEntities(); |
158 | foreach (EntityBase ent in entities) | 160 | foreach (EntityBase ent in entities) |
159 | { | 161 | { |
@@ -238,8 +240,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
238 | /// <summary> | 240 | /// <summary> |
239 | /// Temporarily setting to trigger appearance resends at 60 second intervals. | 241 | /// Temporarily setting to trigger appearance resends at 60 second intervals. |
240 | /// </summary> | 242 | /// </summary> |
241 | public bool SendPeriodicAppearanceUpdates { get; set; } | 243 | public bool SendPeriodicAppearanceUpdates { get; set; } |
242 | 244 | ||
243 | /// <summary> | 245 | /// <summary> |
244 | /// 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. |
245 | /// </summary> | 247 | /// </summary> |
@@ -266,10 +268,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
266 | public int ChildTerseUpdatePeriod { get; set; } | 268 | public int ChildTerseUpdatePeriod { get; set; } |
267 | 269 | ||
268 | protected float m_defaultDrawDistance = 255.0f; | 270 | protected float m_defaultDrawDistance = 255.0f; |
269 | public float DefaultDrawDistance | 271 | public float DefaultDrawDistance |
270 | { | 272 | { |
271 | // get { return m_defaultDrawDistance; } | 273 | // get { return m_defaultDrawDistance; } |
272 | get { | 274 | get |
275 | { | ||
273 | if (RegionInfo != null) | 276 | if (RegionInfo != null) |
274 | { | 277 | { |
275 | float largestDimension = Math.Max(RegionInfo.RegionSizeX, RegionInfo.RegionSizeY); | 278 | float largestDimension = Math.Max(RegionInfo.RegionSizeX, RegionInfo.RegionSizeY); |
@@ -282,7 +285,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
282 | 285 | ||
283 | private List<string> m_AllowedViewers = new List<string>(); | 286 | private List<string> m_AllowedViewers = new List<string>(); |
284 | private List<string> m_BannedViewers = new List<string>(); | 287 | private List<string> m_BannedViewers = new List<string>(); |
285 | 288 | ||
286 | // TODO: need to figure out how allow client agents but deny | 289 | // TODO: need to figure out how allow client agents but deny |
287 | // root agents when ACL denies access to root agent | 290 | // root agents when ACL denies access to root agent |
288 | public bool m_strictAccessControl = true; | 291 | public bool m_strictAccessControl = true; |
@@ -369,15 +372,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
369 | /// 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 |
370 | /// 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). |
371 | /// </remarks> | 374 | /// </remarks> |
372 | public int MinFrameTicks | 375 | public int MinFrameTicks |
373 | { | 376 | { |
374 | get { return m_minFrameTicks; } | 377 | get { return m_minFrameTicks; } |
375 | private set | 378 | private set |
376 | { | 379 | { |
377 | m_minFrameTicks = value; | 380 | m_minFrameTicks = value; |
378 | MinFrameSeconds = (float)m_minFrameTicks / 1000; | 381 | MinFrameSeconds = (float)m_minFrameTicks / 1000; |
379 | } | 382 | } |
380 | } | 383 | } |
381 | private int m_minFrameTicks; | 384 | private int m_minFrameTicks; |
382 | 385 | ||
383 | /// <summary> | 386 | /// <summary> |
@@ -405,7 +408,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
405 | private int m_update_events = 1; | 408 | private int m_update_events = 1; |
406 | private int m_update_backup = 200; | 409 | private int m_update_backup = 200; |
407 | private int m_update_terrain = 50; | 410 | private int m_update_terrain = 50; |
408 | // private int m_update_land = 1; | 411 | // private int m_update_land = 1; |
409 | private int m_update_coarse_locations = 50; | 412 | private int m_update_coarse_locations = 50; |
410 | private int m_update_temp_cleaning = 180; | 413 | private int m_update_temp_cleaning = 180; |
411 | 414 | ||
@@ -436,7 +439,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
436 | /// asynchronously from the update loop. | 439 | /// asynchronously from the update loop. |
437 | /// </summary> | 440 | /// </summary> |
438 | private bool m_cleaningTemps = false; | 441 | private bool m_cleaningTemps = false; |
439 | 442 | ||
440 | /// <summary> | 443 | /// <summary> |
441 | /// 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. |
442 | /// </summary> | 445 | /// </summary> |
@@ -491,7 +494,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
491 | if (value) | 494 | if (value) |
492 | { | 495 | { |
493 | if (!m_active) | 496 | if (!m_active) |
494 | Start(false); | 497 | Start(false); |
495 | } | 498 | } |
496 | else | 499 | else |
497 | { | 500 | { |
@@ -528,6 +531,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
528 | get { return m_sceneGraph.PhysicsScene.TimeDilation; } | 531 | get { return m_sceneGraph.PhysicsScene.TimeDilation; } |
529 | } | 532 | } |
530 | 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 | |||
531 | public SceneCommunicationService SceneGridService | 541 | public SceneCommunicationService SceneGridService |
532 | { | 542 | { |
533 | get { return m_sceneGridService; } | 543 | get { return m_sceneGridService; } |
@@ -586,7 +596,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
586 | return m_AssetService; | 596 | return m_AssetService; |
587 | } | 597 | } |
588 | } | 598 | } |
589 | 599 | ||
590 | public IAuthorizationService AuthorizationService | 600 | public IAuthorizationService AuthorizationService |
591 | { | 601 | { |
592 | get | 602 | get |
@@ -647,7 +657,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
647 | get | 657 | get |
648 | { | 658 | { |
649 | if (m_LibraryService == null) | 659 | if (m_LibraryService == null) |
650 | m_LibraryService = RequestModuleInterface<ILibraryService>(); | 660 | m_LibraryService = RequestModuleInterface<ILibraryService>(); |
651 | 661 | ||
652 | return m_LibraryService; | 662 | return m_LibraryService; |
653 | } | 663 | } |
@@ -658,7 +668,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
658 | get | 668 | get |
659 | { | 669 | { |
660 | if (m_simulationService == null) | 670 | if (m_simulationService == null) |
661 | m_simulationService = RequestModuleInterface<ISimulationService>(); | 671 | m_simulationService = RequestModuleInterface<ISimulationService>(); |
662 | 672 | ||
663 | return m_simulationService; | 673 | return m_simulationService; |
664 | } | 674 | } |
@@ -669,7 +679,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
669 | get | 679 | get |
670 | { | 680 | { |
671 | if (m_AuthenticationService == null) | 681 | if (m_AuthenticationService == null) |
672 | m_AuthenticationService = RequestModuleInterface<IAuthenticationService>(); | 682 | m_AuthenticationService = RequestModuleInterface<IAuthenticationService>(); |
673 | return m_AuthenticationService; | 683 | return m_AuthenticationService; |
674 | } | 684 | } |
675 | } | 685 | } |
@@ -679,7 +689,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
679 | get | 689 | get |
680 | { | 690 | { |
681 | if (m_PresenceService == null) | 691 | if (m_PresenceService == null) |
682 | m_PresenceService = RequestModuleInterface<IPresenceService>(); | 692 | m_PresenceService = RequestModuleInterface<IPresenceService>(); |
683 | return m_PresenceService; | 693 | return m_PresenceService; |
684 | } | 694 | } |
685 | } | 695 | } |
@@ -689,7 +699,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
689 | get | 699 | get |
690 | { | 700 | { |
691 | if (m_UserAccountService == null) | 701 | if (m_UserAccountService == null) |
692 | m_UserAccountService = RequestModuleInterface<IUserAccountService>(); | 702 | m_UserAccountService = RequestModuleInterface<IUserAccountService>(); |
693 | return m_UserAccountService; | 703 | return m_UserAccountService; |
694 | } | 704 | } |
695 | } | 705 | } |
@@ -699,7 +709,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
699 | get | 709 | get |
700 | { | 710 | { |
701 | if (m_AvatarService == null) | 711 | if (m_AvatarService == null) |
702 | m_AvatarService = RequestModuleInterface<IAvatarService>(); | 712 | m_AvatarService = RequestModuleInterface<IAvatarService>(); |
703 | return m_AvatarService; | 713 | return m_AvatarService; |
704 | } | 714 | } |
705 | } | 715 | } |
@@ -709,7 +719,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
709 | get | 719 | get |
710 | { | 720 | { |
711 | if (m_GridUserService == null) | 721 | if (m_GridUserService == null) |
712 | m_GridUserService = RequestModuleInterface<IGridUserService>(); | 722 | m_GridUserService = RequestModuleInterface<IGridUserService>(); |
713 | return m_GridUserService; | 723 | return m_GridUserService; |
714 | } | 724 | } |
715 | } | 725 | } |
@@ -723,7 +733,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
723 | { | 733 | { |
724 | get { return m_AvatarFactory; } | 734 | get { return m_AvatarFactory; } |
725 | } | 735 | } |
726 | 736 | ||
727 | public ICapabilitiesModule CapsModule | 737 | public ICapabilitiesModule CapsModule |
728 | { | 738 | { |
729 | get { return m_capsModule; } | 739 | get { return m_capsModule; } |
@@ -789,18 +799,20 @@ namespace OpenSim.Region.Framework.Scenes | |||
789 | get { return m_sceneGraph.Entities; } | 799 | get { return m_sceneGraph.Entities; } |
790 | } | 800 | } |
791 | 801 | ||
792 | 802 | ||
793 | // used in sequence see: SpawnPoint() | 803 | // used in sequence see: SpawnPoint() |
794 | private int m_SpawnPoint; | 804 | private int m_SpawnPoint; |
795 | // can be closest/random/sequence | 805 | // can be closest/random/sequence |
796 | public string SpawnPointRouting | 806 | public string SpawnPointRouting |
797 | { | 807 | { |
798 | get; private set; | 808 | get; |
809 | private set; | ||
799 | } | 810 | } |
800 | // allow landmarks to pass | 811 | // allow landmarks to pass |
801 | public bool TelehubAllowLandmarks | 812 | public bool TelehubAllowLandmarks |
802 | { | 813 | { |
803 | get; private set; | 814 | get; |
815 | private set; | ||
804 | } | 816 | } |
805 | 817 | ||
806 | #endregion Properties | 818 | #endregion Properties |
@@ -808,10 +820,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
808 | #region Constructors | 820 | #region Constructors |
809 | 821 | ||
810 | public Scene(RegionInfo regInfo, AgentCircuitManager authen, PhysicsScene physicsScene, | 822 | public Scene(RegionInfo regInfo, AgentCircuitManager authen, PhysicsScene physicsScene, |
811 | SceneCommunicationService sceneGridService, | 823 | SceneCommunicationService sceneGridService, |
812 | ISimulationDataService simDataService, IEstateDataService estateDataService, | 824 | ISimulationDataService simDataService, IEstateDataService estateDataService, |
813 | IConfigSource config, string simulatorVersion) | 825 | IConfigSource config, string simulatorVersion) |
814 | : this(regInfo, physicsScene) | 826 | : this(regInfo, physicsScene) |
815 | { | 827 | { |
816 | m_config = config; | 828 | m_config = config; |
817 | MinFrameTicks = 89; | 829 | MinFrameTicks = 89; |
@@ -868,20 +880,20 @@ namespace OpenSim.Region.Framework.Scenes | |||
868 | } | 880 | } |
869 | 881 | ||
870 | if (updatedTerrainTextures) | 882 | if (updatedTerrainTextures) |
871 | rs.Save(); | 883 | rs.Save(); |
872 | 884 | ||
873 | RegionInfo.RegionSettings = rs; | 885 | RegionInfo.RegionSettings = rs; |
874 | 886 | ||
875 | if (estateDataService != null) | 887 | if (estateDataService != null) |
876 | RegionInfo.EstateSettings = estateDataService.LoadEstateSettings(RegionInfo.RegionID, false); | 888 | RegionInfo.EstateSettings = estateDataService.LoadEstateSettings(RegionInfo.RegionID, false); |
877 | 889 | ||
878 | #endregion Region Settings | 890 | #endregion Region Settings |
879 | 891 | ||
880 | //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 |
881 | EventManager.OnLandObjectAdded += | 893 | EventManager.OnLandObjectAdded += |
882 | new EventManager.LandObjectAdded(simDataService.StoreLandObject); | 894 | new EventManager.LandObjectAdded(simDataService.StoreLandObject); |
883 | EventManager.OnLandObjectRemoved += | 895 | EventManager.OnLandObjectRemoved += |
884 | new EventManager.LandObjectRemoved(simDataService.RemoveLandObject); | 896 | new EventManager.LandObjectRemoved(simDataService.RemoveLandObject); |
885 | 897 | ||
886 | RegisterDefaultSceneEvents(); | 898 | RegisterDefaultSceneEvents(); |
887 | 899 | ||
@@ -906,8 +918,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
906 | m_defaultDrawDistance = startupConfig.GetFloat("DefaultDrawDistance", m_defaultDrawDistance); | 918 | m_defaultDrawDistance = startupConfig.GetFloat("DefaultDrawDistance", m_defaultDrawDistance); |
907 | UseBackup = startupConfig.GetBoolean("UseSceneBackup", UseBackup); | 919 | UseBackup = startupConfig.GetBoolean("UseSceneBackup", UseBackup); |
908 | if (!UseBackup) | 920 | if (!UseBackup) |
909 | 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); |
910 | 922 | ||
911 | //Animation states | 923 | //Animation states |
912 | m_useFlySlow = startupConfig.GetBoolean("enableflyslow", false); | 924 | m_useFlySlow = startupConfig.GetBoolean("enableflyslow", false); |
913 | 925 | ||
@@ -961,10 +973,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
961 | m_trustBinaries = startupConfig.GetBoolean("TrustBinaries", m_trustBinaries); | 973 | m_trustBinaries = startupConfig.GetBoolean("TrustBinaries", m_trustBinaries); |
962 | m_allowScriptCrossings = startupConfig.GetBoolean("AllowScriptCrossing", m_allowScriptCrossings); | 974 | m_allowScriptCrossings = startupConfig.GetBoolean("AllowScriptCrossing", m_allowScriptCrossings); |
963 | m_dontPersistBefore = | 975 | m_dontPersistBefore = |
964 | startupConfig.GetLong("MinimumTimeBeforePersistenceConsidered", DEFAULT_MIN_TIME_FOR_PERSISTENCE); | 976 | startupConfig.GetLong("MinimumTimeBeforePersistenceConsidered", DEFAULT_MIN_TIME_FOR_PERSISTENCE); |
965 | m_dontPersistBefore *= 10000000; | 977 | m_dontPersistBefore *= 10000000; |
966 | m_persistAfter = | 978 | m_persistAfter = |
967 | startupConfig.GetLong("MaximumTimeBeforePersistenceConsidered", DEFAULT_MAX_TIME_FOR_PERSISTENCE); | 979 | startupConfig.GetLong("MaximumTimeBeforePersistenceConsidered", DEFAULT_MAX_TIME_FOR_PERSISTENCE); |
968 | m_persistAfter *= 10000000; | 980 | m_persistAfter *= 10000000; |
969 | 981 | ||
970 | m_defaultScriptEngine = startupConfig.GetString("DefaultScriptEngine", "XEngine"); | 982 | m_defaultScriptEngine = startupConfig.GetString("DefaultScriptEngine", "XEngine"); |
@@ -976,8 +988,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
976 | 988 | ||
977 | string[] possibleMapConfigSections = new string[] { "Map", "Startup" }; | 989 | string[] possibleMapConfigSections = new string[] { "Map", "Startup" }; |
978 | 990 | ||
979 | m_generateMaptiles | 991 | m_generateMaptiles |
980 | = Util.GetConfigVarFromSections<bool>(config, "GenerateMaptiles", possibleMapConfigSections, true); | 992 | = Util.GetConfigVarFromSections<bool>(config, "GenerateMaptiles", possibleMapConfigSections, true); |
981 | 993 | ||
982 | if (m_generateMaptiles) | 994 | if (m_generateMaptiles) |
983 | { | 995 | { |
@@ -993,9 +1005,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
993 | } | 1005 | } |
994 | else | 1006 | else |
995 | { | 1007 | { |
996 | string tile | 1008 | string tile |
997 | = Util.GetConfigVarFromSections<string>( | 1009 | = Util.GetConfigVarFromSections<string>( |
998 | config, "MaptileStaticUUID", possibleMapConfigSections, UUID.Zero.ToString()); | 1010 | config, "MaptileStaticUUID", possibleMapConfigSections, UUID.Zero.ToString()); |
999 | 1011 | ||
1000 | UUID tileID; | 1012 | UUID tileID; |
1001 | 1013 | ||
@@ -1012,9 +1024,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
1012 | 1024 | ||
1013 | string[] possibleAccessControlConfigSections = new string[] { "AccessControl", "Startup" }; | 1025 | string[] possibleAccessControlConfigSections = new string[] { "AccessControl", "Startup" }; |
1014 | 1026 | ||
1015 | string grant | 1027 | string grant |
1016 | = Util.GetConfigVarFromSections<string>( | 1028 | = Util.GetConfigVarFromSections<string>( |
1017 | config, "AllowedClients", possibleAccessControlConfigSections, ""); | 1029 | config, "AllowedClients", possibleAccessControlConfigSections, ""); |
1018 | 1030 | ||
1019 | if (grant.Length > 0) | 1031 | if (grant.Length > 0) |
1020 | { | 1032 | { |
@@ -1024,9 +1036,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
1024 | } | 1036 | } |
1025 | } | 1037 | } |
1026 | 1038 | ||
1027 | grant | 1039 | grant |
1028 | = Util.GetConfigVarFromSections<string>( | 1040 | = Util.GetConfigVarFromSections<string>( |
1029 | config, "BannedClients", possibleAccessControlConfigSections, ""); | 1041 | config, "BannedClients", possibleAccessControlConfigSections, ""); |
1030 | 1042 | ||
1031 | if (grant.Length > 0) | 1043 | if (grant.Length > 0) |
1032 | { | 1044 | { |
@@ -1037,27 +1049,27 @@ namespace OpenSim.Region.Framework.Scenes | |||
1037 | } | 1049 | } |
1038 | 1050 | ||
1039 | if (startupConfig.Contains("MinFrameTime")) | 1051 | if (startupConfig.Contains("MinFrameTime")) |
1040 | MinFrameTicks = (int)(startupConfig.GetFloat("MinFrameTime") * 1000); | 1052 | MinFrameTicks = (int)(startupConfig.GetFloat("MinFrameTime") * 1000); |
1041 | 1053 | ||
1042 | m_update_backup = startupConfig.GetInt( "UpdateStorageEveryNFrames", m_update_backup); | 1054 | m_update_backup = startupConfig.GetInt("UpdateStorageEveryNFrames", m_update_backup); |
1043 | m_update_coarse_locations = startupConfig.GetInt( "UpdateCoarseLocationsEveryNFrames", m_update_coarse_locations); | 1055 | m_update_coarse_locations = startupConfig.GetInt("UpdateCoarseLocationsEveryNFrames", m_update_coarse_locations); |
1044 | m_update_entitymovement = startupConfig.GetInt( "UpdateEntityMovementEveryNFrames", m_update_entitymovement); | 1056 | m_update_entitymovement = startupConfig.GetInt("UpdateEntityMovementEveryNFrames", m_update_entitymovement); |
1045 | m_update_events = startupConfig.GetInt( "UpdateEventsEveryNFrames", m_update_events); | 1057 | m_update_events = startupConfig.GetInt("UpdateEventsEveryNFrames", m_update_events); |
1046 | m_update_objects = startupConfig.GetInt( "UpdateObjectsEveryNFrames", m_update_objects); | 1058 | m_update_objects = startupConfig.GetInt("UpdateObjectsEveryNFrames", m_update_objects); |
1047 | m_update_physics = startupConfig.GetInt( "UpdatePhysicsEveryNFrames", m_update_physics); | 1059 | m_update_physics = startupConfig.GetInt("UpdatePhysicsEveryNFrames", m_update_physics); |
1048 | m_update_presences = startupConfig.GetInt( "UpdateAgentsEveryNFrames", m_update_presences); | 1060 | m_update_presences = startupConfig.GetInt("UpdateAgentsEveryNFrames", m_update_presences); |
1049 | m_update_terrain = startupConfig.GetInt( "UpdateTerrainEveryNFrames", m_update_terrain); | 1061 | m_update_terrain = startupConfig.GetInt("UpdateTerrainEveryNFrames", m_update_terrain); |
1050 | m_update_temp_cleaning = startupConfig.GetInt( "UpdateTempCleaningEveryNSeconds", m_update_temp_cleaning); | 1062 | m_update_temp_cleaning = startupConfig.GetInt("UpdateTempCleaningEveryNSeconds", m_update_temp_cleaning); |
1051 | } | 1063 | } |
1052 | 1064 | ||
1053 | // FIXME: Ultimately this should be in a module. | 1065 | // FIXME: Ultimately this should be in a module. |
1054 | SendPeriodicAppearanceUpdates = false; | 1066 | SendPeriodicAppearanceUpdates = false; |
1055 | 1067 | ||
1056 | IConfig appearanceConfig = m_config.Configs["Appearance"]; | 1068 | IConfig appearanceConfig = m_config.Configs["Appearance"]; |
1057 | if (appearanceConfig != null) | 1069 | if (appearanceConfig != null) |
1058 | { | 1070 | { |
1059 | SendPeriodicAppearanceUpdates | 1071 | SendPeriodicAppearanceUpdates |
1060 | = appearanceConfig.GetBoolean("ResendAppearanceUpdates", SendPeriodicAppearanceUpdates); | 1072 | = appearanceConfig.GetBoolean("ResendAppearanceUpdates", SendPeriodicAppearanceUpdates); |
1061 | } | 1073 | } |
1062 | 1074 | ||
1063 | #endregion Region Config | 1075 | #endregion Region Config |
@@ -1085,32 +1097,40 @@ namespace OpenSim.Region.Framework.Scenes | |||
1085 | UpdatePrioritizationScheme = UpdatePrioritizationSchemes.Time; | 1097 | UpdatePrioritizationScheme = UpdatePrioritizationSchemes.Time; |
1086 | } | 1098 | } |
1087 | 1099 | ||
1088 | IsReprioritizationEnabled | 1100 | IsReprioritizationEnabled |
1089 | = interestConfig.GetBoolean("ReprioritizationEnabled", IsReprioritizationEnabled); | 1101 | = interestConfig.GetBoolean("ReprioritizationEnabled", IsReprioritizationEnabled); |
1090 | ReprioritizationInterval | 1102 | ReprioritizationInterval |
1091 | = interestConfig.GetDouble("ReprioritizationInterval", ReprioritizationInterval); | 1103 | = interestConfig.GetDouble("ReprioritizationInterval", ReprioritizationInterval); |
1092 | RootReprioritizationDistance | 1104 | RootReprioritizationDistance |
1093 | = interestConfig.GetDouble("RootReprioritizationDistance", RootReprioritizationDistance); | 1105 | = interestConfig.GetDouble("RootReprioritizationDistance", RootReprioritizationDistance); |
1094 | ChildReprioritizationDistance | 1106 | ChildReprioritizationDistance |
1095 | = interestConfig.GetDouble("ChildReprioritizationDistance", ChildReprioritizationDistance); | 1107 | = interestConfig.GetDouble("ChildReprioritizationDistance", ChildReprioritizationDistance); |
1096 | 1108 | ||
1097 | RootTerseUpdatePeriod = interestConfig.GetInt("RootTerseUpdatePeriod", RootTerseUpdatePeriod); | 1109 | RootTerseUpdatePeriod = interestConfig.GetInt("RootTerseUpdatePeriod", RootTerseUpdatePeriod); |
1098 | ChildTerseUpdatePeriod = interestConfig.GetInt("ChildTerseUpdatePeriod", ChildTerseUpdatePeriod); | 1110 | ChildTerseUpdatePeriod = interestConfig.GetInt("ChildTerseUpdatePeriod", ChildTerseUpdatePeriod); |
1099 | 1111 | ||
1100 | RootPositionUpdateTolerance | 1112 | RootPositionUpdateTolerance |
1101 | = interestConfig.GetFloat("RootPositionUpdateTolerance", RootPositionUpdateTolerance); | 1113 | = interestConfig.GetFloat("RootPositionUpdateTolerance", RootPositionUpdateTolerance); |
1102 | RootRotationUpdateTolerance | 1114 | RootRotationUpdateTolerance |
1103 | = interestConfig.GetFloat("RootRotationUpdateTolerance", RootRotationUpdateTolerance); | 1115 | = interestConfig.GetFloat("RootRotationUpdateTolerance", RootRotationUpdateTolerance); |
1104 | RootVelocityUpdateTolerance | 1116 | RootVelocityUpdateTolerance |
1105 | = interestConfig.GetFloat("RootVelocityUpdateTolerance", RootVelocityUpdateTolerance); | 1117 | = interestConfig.GetFloat("RootVelocityUpdateTolerance", RootVelocityUpdateTolerance); |
1106 | } | 1118 | } |
1107 | 1119 | ||
1108 | m_log.DebugFormat("[SCENE]: Using the {0} prioritization scheme", UpdatePrioritizationScheme); | 1120 | m_log.DebugFormat("[SCENE]: Using the {0} prioritization scheme", UpdatePrioritizationScheme); |
1109 | 1121 | ||
1110 | #endregion Interest Management | 1122 | #endregion Interest Management |
1111 | 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 | |||
1112 | // Acquire the statistics section of the OpenSim.ini file located | 1132 | // Acquire the statistics section of the OpenSim.ini file located |
1113 | // in the bin directory | 1133 | // in the bin directory |
1114 | IConfig statisticsConfig = m_config.Configs["Statistics"]; | 1134 | IConfig statisticsConfig = m_config.Configs["Statistics"]; |
1115 | 1135 | ||
1116 | // Confirm that the statistics section existed in the configuration | 1136 | // Confirm that the statistics section existed in the configuration |
@@ -1118,9 +1138,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
1118 | if (statisticsConfig != null) | 1138 | if (statisticsConfig != null) |
1119 | { | 1139 | { |
1120 | // Create the StatsReporter using the number of frames to store | 1140 | // Create the StatsReporter using the number of frames to store |
1121 | // for the frame time statistics, or 10 frames if the config | 1141 | // for the frame time statistics, or 10 frames if the config |
1122 | // file doesn't contain a value | 1142 | // file doesn't contain a value |
1123 | StatsReporter = new SimStatsReporter(this, | 1143 | StatsReporter = new SimStatsReporter(this, |
1124 | statisticsConfig.GetInt("NumberOfFrames", | 1144 | statisticsConfig.GetInt("NumberOfFrames", |
1125 | m_defaultNumberFramesStored)); | 1145 | m_defaultNumberFramesStored)); |
1126 | } | 1146 | } |
@@ -1130,14 +1150,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
1130 | // 10 frames stored for the frame time statistics | 1150 | // 10 frames stored for the frame time statistics |
1131 | StatsReporter = new SimStatsReporter(this); | 1151 | StatsReporter = new SimStatsReporter(this); |
1132 | } | 1152 | } |
1133 | 1153 | ||
1134 | StatsReporter.OnSendStatsResult += SendSimStatsPackets; | 1154 | StatsReporter.OnSendStatsResult += SendSimStatsPackets; |
1135 | StatsReporter.OnStatsIncorrect += m_sceneGraph.RecalculateStats; | 1155 | StatsReporter.OnStatsIncorrect += m_sceneGraph.RecalculateStats; |
1136 | 1156 | ||
1137 | } | 1157 | } |
1138 | 1158 | ||
1139 | public Scene(RegionInfo regInfo, PhysicsScene physicsScene) : base(regInfo) | 1159 | public Scene(RegionInfo regInfo, PhysicsScene physicsScene) |
1140 | { | 1160 | : base(regInfo) |
1161 | { | ||
1141 | m_sceneGraph = new SceneGraph(this); | 1162 | m_sceneGraph = new SceneGraph(this); |
1142 | m_sceneGraph.PhysicsScene = physicsScene; | 1163 | m_sceneGraph.PhysicsScene = physicsScene; |
1143 | 1164 | ||
@@ -1147,11 +1168,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
1147 | // | 1168 | // |
1148 | // Out of memory | 1169 | // Out of memory |
1149 | // Operating system has killed the plugin | 1170 | // Operating system has killed the plugin |
1150 | m_sceneGraph.UnRecoverableError | 1171 | m_sceneGraph.UnRecoverableError |
1151 | += () => | 1172 | += () => |
1152 | { | 1173 | { |
1153 | 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); |
1154 | RestartNow(); | 1175 | RestartNow(); |
1155 | }; | 1176 | }; |
1156 | 1177 | ||
1157 | PhysicalPrims = true; | 1178 | PhysicalPrims = true; |
@@ -1196,7 +1217,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1196 | IDialogModule dm = RequestModuleInterface<IDialogModule>(); | 1217 | IDialogModule dm = RequestModuleInterface<IDialogModule>(); |
1197 | 1218 | ||
1198 | if (dm != null) | 1219 | if (dm != null) |
1199 | m_eventManager.OnPermissionError += dm.SendAlertToUser; | 1220 | m_eventManager.OnPermissionError += dm.SendAlertToUser; |
1200 | 1221 | ||
1201 | m_eventManager.OnSignificantClientMovement += HandleOnSignificantClientMovement; | 1222 | m_eventManager.OnSignificantClientMovement += HandleOnSignificantClientMovement; |
1202 | } | 1223 | } |
@@ -1226,7 +1247,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1226 | //int resultY = Math.Abs((int)ycell - (int)RegionInfo.RegionLocY); | 1247 | //int resultY = Math.Abs((int)ycell - (int)RegionInfo.RegionLocY); |
1227 | //if (resultX <= 1 && resultY <= 1) | 1248 | //if (resultX <= 1 && resultY <= 1) |
1228 | float dist = (float)Math.Max(DefaultDrawDistance, | 1249 | float dist = (float)Math.Max(DefaultDrawDistance, |
1229 | (float)Math.Max(RegionInfo.RegionSizeX, RegionInfo.RegionSizeY)); | 1250 | (float)Math.Max(RegionInfo.RegionSizeX, RegionInfo.RegionSizeY)); |
1230 | uint newRegionX, newRegionY, thisRegionX, thisRegionY; | 1251 | uint newRegionX, newRegionY, thisRegionX, thisRegionY; |
1231 | Util.RegionHandleToRegionLoc(otherRegion.RegionHandle, out newRegionX, out newRegionY); | 1252 | Util.RegionHandleToRegionLoc(otherRegion.RegionHandle, out newRegionX, out newRegionY); |
1232 | Util.RegionHandleToRegionLoc(RegionInfo.RegionHandle, out thisRegionX, out thisRegionY); | 1253 | Util.RegionHandleToRegionLoc(RegionInfo.RegionHandle, out thisRegionX, out thisRegionY); |
@@ -1250,7 +1271,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1250 | old.Add(otherRegion.RegionHandle); | 1271 | old.Add(otherRegion.RegionHandle); |
1251 | agent.DropOldNeighbours(old); | 1272 | agent.DropOldNeighbours(old); |
1252 | if (EntityTransferModule != null && agent.PresenceType != PresenceType.Npc) | 1273 | if (EntityTransferModule != null && agent.PresenceType != PresenceType.Npc) |
1253 | EntityTransferModule.EnableChildAgent(agent, otherRegion); | 1274 | EntityTransferModule.EnableChildAgent(agent, otherRegion); |
1254 | }); | 1275 | }); |
1255 | } | 1276 | } |
1256 | catch (NullReferenceException) | 1277 | catch (NullReferenceException) |
@@ -1263,8 +1284,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
1263 | else | 1284 | else |
1264 | { | 1285 | { |
1265 | m_log.InfoFormat( | 1286 | m_log.InfoFormat( |
1266 | "[SCENE]: Got notice about far away Region: {0} at ({1}, {2})", | 1287 | "[SCENE]: Got notice about far away Region: {0} at ({1}, {2})", |
1267 | otherRegion.RegionName, otherRegion.RegionLocX, otherRegion.RegionLocY); | 1288 | otherRegion.RegionName, otherRegion.RegionLocX, otherRegion.RegionLocY); |
1268 | } | 1289 | } |
1269 | } | 1290 | } |
1270 | } | 1291 | } |
@@ -1342,7 +1363,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1342 | ForEachRootScenePresence(delegate(ScenePresence agent) | 1363 | ForEachRootScenePresence(delegate(ScenePresence agent) |
1343 | { | 1364 | { |
1344 | if (EntityTransferModule != null && agent.PresenceType != PresenceType.Npc) | 1365 | if (EntityTransferModule != null && agent.PresenceType != PresenceType.Npc) |
1345 | EntityTransferModule.EnableChildAgent(agent, r); | 1366 | EntityTransferModule.EnableChildAgent(agent, r); |
1346 | }); | 1367 | }); |
1347 | } | 1368 | } |
1348 | catch (NullReferenceException) | 1369 | catch (NullReferenceException) |
@@ -1380,14 +1401,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
1380 | 1401 | ||
1381 | // 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' |
1382 | ForEachScenePresence(delegate(ScenePresence avatar) | 1403 | ForEachScenePresence(delegate(ScenePresence avatar) |
1383 | { | 1404 | { |
1384 | avatar.RemoveNeighbourRegion(RegionInfo.RegionHandle); | 1405 | avatar.RemoveNeighbourRegion(RegionInfo.RegionHandle); |
1385 | 1406 | ||
1386 | if (!avatar.IsChildAgent) | 1407 | if (!avatar.IsChildAgent) |
1387 | avatar.ControllingClient.Kick("The simulator is going down."); | 1408 | avatar.ControllingClient.Kick("The simulator is going down."); |
1388 | 1409 | ||
1389 | avatar.ControllingClient.SendShutdownConnectionNotice(); | 1410 | avatar.ControllingClient.SendShutdownConnectionNotice(); |
1390 | }); | 1411 | }); |
1391 | 1412 | ||
1392 | // Stop updating the scene objects and agents. | 1413 | // Stop updating the scene objects and agents. |
1393 | m_shuttingDown = true; | 1414 | m_shuttingDown = true; |
@@ -1406,7 +1427,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1406 | m_sceneGraph.Close(); | 1427 | m_sceneGraph.Close(); |
1407 | 1428 | ||
1408 | if (!GridService.DeregisterRegion(RegionInfo.RegionID)) | 1429 | if (!GridService.DeregisterRegion(RegionInfo.RegionID)) |
1409 | 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); |
1410 | 1431 | ||
1411 | base.Close(); | 1432 | base.Close(); |
1412 | 1433 | ||
@@ -1437,12 +1458,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
1437 | public void Start(bool startScripts) | 1458 | public void Start(bool startScripts) |
1438 | { | 1459 | { |
1439 | if (IsRunning) | 1460 | if (IsRunning) |
1440 | return; | 1461 | return; |
1441 | 1462 | ||
1442 | m_isRunning = true; | 1463 | m_isRunning = true; |
1443 | m_active = true; | 1464 | m_active = true; |
1444 | 1465 | ||
1445 | // m_log.DebugFormat("[SCENE]: Starting Heartbeat timer for {0}", RegionInfo.RegionName); | 1466 | // m_log.DebugFormat("[SCENE]: Starting Heartbeat timer for {0}", RegionInfo.RegionName); |
1446 | if (m_heartbeatThread != null) | 1467 | if (m_heartbeatThread != null) |
1447 | { | 1468 | { |
1448 | m_heartbeatThread.Abort(); | 1469 | m_heartbeatThread.Abort(); |
@@ -1450,8 +1471,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
1450 | } | 1471 | } |
1451 | 1472 | ||
1452 | m_heartbeatThread | 1473 | m_heartbeatThread |
1453 | = WorkManager.StartThread( | 1474 | = WorkManager.StartThread( |
1454 | 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); |
1455 | 1476 | ||
1456 | StartScripts(); | 1477 | StartScripts(); |
1457 | } | 1478 | } |
@@ -1492,7 +1513,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1492 | Update(1); | 1513 | Update(1); |
1493 | 1514 | ||
1494 | WorkManager.StartThread( | 1515 | WorkManager.StartThread( |
1495 | Maintenance, string.Format("Maintenance ({0})", RegionInfo.RegionName), ThreadPriority.Normal, false, true); | 1516 | Maintenance, string.Format("Maintenance ({0})", RegionInfo.RegionName), ThreadPriority.Normal, false, true); |
1496 | 1517 | ||
1497 | Watchdog.GetCurrentThreadInfo().AlarmIfTimeout = true; | 1518 | Watchdog.GetCurrentThreadInfo().AlarmIfTimeout = true; |
1498 | m_lastFrameTick = Util.EnvironmentTickCount(); | 1519 | m_lastFrameTick = Util.EnvironmentTickCount(); |
@@ -1516,15 +1537,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
1516 | private volatile bool m_isTimerUpdateRunning; | 1537 | private volatile bool m_isTimerUpdateRunning; |
1517 | 1538 | ||
1518 | private void Update(object sender, ElapsedEventArgs e) | 1539 | private void Update(object sender, ElapsedEventArgs e) |
1519 | { | 1540 | { |
1520 | if (m_isTimerUpdateRunning) | 1541 | if (m_isTimerUpdateRunning) |
1521 | return; | 1542 | return; |
1522 | 1543 | ||
1523 | m_isTimerUpdateRunning = true; | 1544 | m_isTimerUpdateRunning = true; |
1524 | 1545 | ||
1525 | // 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 |
1526 | // 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. |
1527 | while (!Update(1) && Active) {} | 1548 | while (!Update(1) && Active) { } |
1528 | 1549 | ||
1529 | if (!Active || m_shuttingDown) | 1550 | if (!Active || m_shuttingDown) |
1530 | { | 1551 | { |
@@ -1550,7 +1571,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1550 | int previousMaintenanceTick; | 1571 | int previousMaintenanceTick; |
1551 | 1572 | ||
1552 | if (runs >= 0) | 1573 | if (runs >= 0) |
1553 | endRun = MaintenanceRun + runs; | 1574 | endRun = MaintenanceRun + runs; |
1554 | 1575 | ||
1555 | List<Vector3> coarseLocations; | 1576 | List<Vector3> coarseLocations; |
1556 | List<UUID> avatarUUIDs; | 1577 | List<UUID> avatarUUIDs; |
@@ -1560,7 +1581,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1560 | runtc = Util.EnvironmentTickCount(); | 1581 | runtc = Util.EnvironmentTickCount(); |
1561 | ++MaintenanceRun; | 1582 | ++MaintenanceRun; |
1562 | 1583 | ||
1563 | // m_log.DebugFormat("[SCENE]: Maintenance run {0} in {1}", MaintenanceRun, Name); | 1584 | // m_log.DebugFormat("[SCENE]: Maintenance run {0} in {1}", MaintenanceRun, Name); |
1564 | 1585 | ||
1565 | // 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) |
1566 | if (MaintenanceRun % (m_update_coarse_locations / 10) == 0) | 1587 | if (MaintenanceRun % (m_update_coarse_locations / 10) == 0) |
@@ -1575,7 +1596,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1575 | 1596 | ||
1576 | if (SendPeriodicAppearanceUpdates && MaintenanceRun % 60 == 0) | 1597 | if (SendPeriodicAppearanceUpdates && MaintenanceRun % 60 == 0) |
1577 | { | 1598 | { |
1578 | // m_log.DebugFormat("[SCENE]: Sending periodic appearance updates"); | 1599 | // m_log.DebugFormat("[SCENE]: Sending periodic appearance updates"); |
1579 | 1600 | ||
1580 | if (AvatarFactory != null) | 1601 | if (AvatarFactory != null) |
1581 | { | 1602 | { |
@@ -1586,14 +1607,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
1586 | // Delete temp-on-rez stuff | 1607 | // Delete temp-on-rez stuff |
1587 | if (MaintenanceRun % m_update_temp_cleaning == 0 && !m_cleaningTemps) | 1608 | if (MaintenanceRun % m_update_temp_cleaning == 0 && !m_cleaningTemps) |
1588 | { | 1609 | { |
1589 | // 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); |
1590 | tmpMS = Util.EnvironmentTickCount(); | 1611 | tmpMS = Util.EnvironmentTickCount(); |
1591 | m_cleaningTemps = true; | 1612 | m_cleaningTemps = true; |
1592 | 1613 | ||
1593 | WorkManager.RunInThread( | 1614 | WorkManager.RunInThread( |
1594 | delegate { CleanTempObjects(); m_cleaningTemps = false; }, | 1615 | delegate { CleanTempObjects(); m_cleaningTemps = false; }, |
1595 | null, | 1616 | null, |
1596 | string.Format("CleanTempObjects ({0})", Name)); | 1617 | string.Format("CleanTempObjects ({0})", Name)); |
1597 | 1618 | ||
1598 | tempOnRezMS = Util.EnvironmentTickCountSubtract(tmpMS); | 1619 | tempOnRezMS = Util.EnvironmentTickCountSubtract(tmpMS); |
1599 | } | 1620 | } |
@@ -1604,19 +1625,19 @@ namespace OpenSim.Region.Framework.Scenes | |||
1604 | m_lastMaintenanceTick = Util.EnvironmentTickCount(); | 1625 | m_lastMaintenanceTick = Util.EnvironmentTickCount(); |
1605 | runtc = Util.EnvironmentTickCountSubtract(m_lastMaintenanceTick, runtc); | 1626 | runtc = Util.EnvironmentTickCountSubtract(m_lastMaintenanceTick, runtc); |
1606 | runtc = MinMaintenanceTicks - runtc; | 1627 | runtc = MinMaintenanceTicks - runtc; |
1607 | 1628 | ||
1608 | if (runtc > 0) | 1629 | if (runtc > 0) |
1609 | m_maintenanceWaitEvent.WaitOne(runtc); | 1630 | m_maintenanceWaitEvent.WaitOne(runtc); |
1610 | 1631 | ||
1611 | // 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. |
1612 | if (DebugUpdates | 1633 | if (DebugUpdates |
1613 | && Util.EnvironmentTickCountSubtract( | 1634 | && Util.EnvironmentTickCountSubtract( |
1614 | m_lastMaintenanceTick, previousMaintenanceTick) > MinMaintenanceTicks * 2) | 1635 | m_lastMaintenanceTick, previousMaintenanceTick) > MinMaintenanceTicks * 2) |
1615 | m_log.WarnFormat( | 1636 | m_log.WarnFormat( |
1616 | "[SCENE]: Maintenance took {0} ms (desired max {1} ms) in {2}", | 1637 | "[SCENE]: Maintenance took {0} ms (desired max {1} ms) in {2}", |
1617 | Util.EnvironmentTickCountSubtract(m_lastMaintenanceTick, previousMaintenanceTick), | 1638 | Util.EnvironmentTickCountSubtract(m_lastMaintenanceTick, previousMaintenanceTick), |
1618 | MinMaintenanceTicks, | 1639 | MinMaintenanceTicks, |
1619 | RegionInfo.RegionName); | 1640 | RegionInfo.RegionName); |
1620 | } | 1641 | } |
1621 | } | 1642 | } |
1622 | 1643 | ||
@@ -1625,14 +1646,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
1625 | long? endFrame = null; | 1646 | long? endFrame = null; |
1626 | 1647 | ||
1627 | if (frames >= 0) | 1648 | if (frames >= 0) |
1628 | endFrame = Frame + frames; | 1649 | endFrame = Frame + frames; |
1629 | 1650 | ||
1630 | float physicsFPS = 0f; | 1651 | float physicsFPS = 0f; |
1631 | int previousFrameTick, tmpMS; | 1652 | int previousFrameTick, tmpMS; |
1632 | 1653 | ||
1633 | // These variables will be used to save the precise frame time using the | 1654 | // These variables will be used to save the precise frame time using the |
1634 | // Stopwatch class of Microsoft SDK; the times are recorded at the start | 1655 | // Stopwatch class of Microsoft SDK; the times are recorded at the start |
1635 | // and end of a particular section of code, and then used to calculate | 1656 | // and end of a parcticular section of code, and then used to calculate |
1636 | // the frame times, which are the sums of the sections for each given name | 1657 | // the frame times, which are the sums of the sections for each given name |
1637 | double preciseTotalFrameTime = 0.0; | 1658 | double preciseTotalFrameTime = 0.0; |
1638 | double preciseSimFrameTime = 0.0; | 1659 | double preciseSimFrameTime = 0.0; |
@@ -1644,12 +1665,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
1644 | // 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 |
1645 | // started running to determine how long the frame took to complete | 1666 | // started running to determine how long the frame took to complete |
1646 | totalFrameStopwatch.Start(); | 1667 | totalFrameStopwatch.Start(); |
1647 | 1668 | ||
1648 | while (!m_shuttingDown && ((endFrame == null && Active) || Frame < endFrame)) | 1669 | while (!m_shuttingDown && ((endFrame == null && Active) || Frame < endFrame)) |
1649 | { | 1670 | { |
1650 | ++Frame; | 1671 | ++Frame; |
1651 | 1672 | ||
1652 | // 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); |
1653 | 1674 | ||
1654 | agentMS = eventMS = backupMS = terrainMS = landMS = spareMS = 0; | 1675 | agentMS = eventMS = backupMS = terrainMS = landMS = spareMS = 0; |
1655 | 1676 | ||
@@ -1670,48 +1691,56 @@ namespace OpenSim.Region.Framework.Scenes | |||
1670 | // at this point in time, the precise values all begin | 1691 | // at this point in time, the precise values all begin |
1671 | // with the keyword precise | 1692 | // with the keyword precise |
1672 | tmpMS = Util.EnvironmentTickCount(); | 1693 | tmpMS = Util.EnvironmentTickCount(); |
1673 | |||
1674 | simFrameStopwatch.Start(); | 1694 | simFrameStopwatch.Start(); |
1675 | UpdateTerrain(); | 1695 | UpdateTerrain(); |
1676 | 1696 | ||
1677 | // Get the simulation frame time that the avatar force | 1697 | // Get the simulation frame time that the avatar force |
1678 | // input took | 1698 | // input took |
1679 | simFrameStopwatch.Stop(); | 1699 | simFrameStopwatch.Stop(); |
1680 | preciseSimFrameTime = | 1700 | preciseSimFrameTime = |
1681 | simFrameStopwatch.Elapsed.TotalMilliseconds; | 1701 | simFrameStopwatch.Elapsed.TotalMilliseconds; |
1682 | terrainMS = Util.EnvironmentTickCountSubtract(tmpMS); | 1702 | terrainMS = Util.EnvironmentTickCountSubtract(tmpMS); |
1683 | } | 1703 | } |
1684 | 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 | |||
1685 | tmpMS = Util.EnvironmentTickCount(); | 1715 | tmpMS = Util.EnvironmentTickCount(); |
1686 | 1716 | ||
1687 | // Begin the stopwatch to track the time to prepare physics | 1717 | // Begin the stopwatch to track the time to prepare physics |
1688 | physicsFrameStopwatch.Start(); | 1718 | physicsFrameStopwatch.Start(); |
1689 | if (PhysicsEnabled && Frame % m_update_physics == 0) | 1719 | if (PhysicsEnabled && Frame % m_update_physics == 0) |
1690 | m_sceneGraph.UpdatePreparePhysics(); | 1720 | m_sceneGraph.UpdatePreparePhysics(); |
1691 | 1721 | ||
1692 | // Get the time it took to prepare the physics, this | 1722 | // Get the time it took to prepare the physics, this |
1693 | // would report the most precise time that physics was | 1723 | // would report the most precise time that physics was |
1694 | // running on the machine and should the physics not be | 1724 | // running on the machine and should the physics not be |
1695 | // enabled will report the time it took to check if physics | 1725 | // enabled will report the time it took to check if physics |
1696 | // was enabled | 1726 | // was enabled |
1697 | physicsFrameStopwatch.Stop(); | 1727 | physicsFrameStopwatch.Stop(); |
1698 | precisePhysicsFrameTime = | 1728 | precisePhysicsFrameTime = physicsFrameStopwatch.Elapsed.TotalMilliseconds; |
1699 | physicsFrameStopwatch.Elapsed.TotalMilliseconds; | ||
1700 | physicsMS2 = Util.EnvironmentTickCountSubtract(tmpMS); | 1729 | physicsMS2 = Util.EnvironmentTickCountSubtract(tmpMS); |
1701 | 1730 | ||
1702 | // Apply any pending avatar force input to the avatar's velocity | 1731 | // Apply any pending avatar force input to the avatar's velocity |
1703 | tmpMS = Util.EnvironmentTickCount(); | 1732 | tmpMS = Util.EnvironmentTickCount(); |
1704 | simFrameStopwatch.Restart(); | 1733 | simFrameStopwatch.Restart(); |
1705 | if (Frame % m_update_entitymovement == 0) | 1734 | if (Frame % m_update_entitymovement == 0) |
1706 | m_sceneGraph.UpdateScenePresenceMovement(); | 1735 | m_sceneGraph.UpdateScenePresenceMovement(); |
1707 | 1736 | ||
1708 | // Get the simulation frame time that the avatar force input | 1737 | // Get the simulation frame time that the avatar force input |
1709 | // took | 1738 | // took |
1710 | simFrameStopwatch.Stop(); | 1739 | simFrameStopwatch.Stop(); |
1711 | preciseSimFrameTime += | 1740 | preciseSimFrameTime += |
1712 | simFrameStopwatch.Elapsed.TotalMilliseconds; | 1741 | simFrameStopwatch.Elapsed.TotalMilliseconds; |
1713 | agentMS = Util.EnvironmentTickCountSubtract(tmpMS); | 1742 | agentMS = Util.EnvironmentTickCountSubtract(tmpMS); |
1714 | 1743 | ||
1715 | // 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 |
1716 | // velocity | 1745 | // velocity |
1717 | tmpMS = Util.EnvironmentTickCount(); | 1746 | tmpMS = Util.EnvironmentTickCount(); |
@@ -1719,63 +1748,61 @@ namespace OpenSim.Region.Framework.Scenes | |||
1719 | if (Frame % m_update_physics == 0) | 1748 | if (Frame % m_update_physics == 0) |
1720 | { | 1749 | { |
1721 | if (PhysicsEnabled) | 1750 | if (PhysicsEnabled) |
1722 | physicsFPS = m_sceneGraph.UpdatePhysics(MinFrameSeconds); | 1751 | physicsFPS = m_sceneGraph.UpdatePhysics(MinFrameSeconds); |
1723 | 1752 | ||
1724 | if (SynchronizeScene != null) | 1753 | if (SynchronizeScene != null) |
1725 | SynchronizeScene(this); | 1754 | SynchronizeScene(this); |
1726 | } | 1755 | } |
1727 | 1756 | ||
1728 | // Add the main physics update time to the prepare physics | 1757 | // Add the main physics update time to the prepare physics time |
1729 | // time | ||
1730 | physicsFrameStopwatch.Stop(); | 1758 | physicsFrameStopwatch.Stop(); |
1731 | precisePhysicsFrameTime += | 1759 | precisePhysicsFrameTime += physicsFrameStopwatch.Elapsed.TotalMilliseconds; |
1732 | physicsFrameStopwatch.Elapsed.TotalMilliseconds; | ||
1733 | physicsMS = Util.EnvironmentTickCountSubtract(tmpMS); | 1760 | physicsMS = Util.EnvironmentTickCountSubtract(tmpMS); |
1734 | 1761 | ||
1735 | // Start the stopwatch for the remainder of the simulation | 1762 | // Start the stopwatch for the remainder of the simulation |
1736 | simFrameStopwatch.Restart(); | 1763 | simFrameStopwatch.Restart(); |
1737 | tmpMS = Util.EnvironmentTickCount(); | 1764 | tmpMS = Util.EnvironmentTickCount(); |
1738 | 1765 | ||
1739 | // Check if any objects have reached their targets | 1766 | // Check if any objects have reached their targets |
1740 | CheckAtTargets(); | 1767 | CheckAtTargets(); |
1741 | 1768 | ||
1742 | // Update SceneObjectGroups that have scheduled themselves for updates | 1769 | // Update SceneObjectGroups that have scheduled themselves for updates |
1743 | // Objects queue their updates onto all scene presences | 1770 | // Objects queue their updates onto all scene presences |
1744 | if (Frame % m_update_objects == 0) | 1771 | if (Frame % m_update_objects == 0) |
1745 | m_sceneGraph.UpdateObjectGroups(); | 1772 | m_sceneGraph.UpdateObjectGroups(); |
1746 | 1773 | ||
1747 | // Run through all ScenePresences looking for updates | 1774 | // Run through all ScenePresences looking for updates |
1748 | // 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 |
1749 | if (Frame % m_update_presences == 0) | 1776 | if (Frame % m_update_presences == 0) |
1750 | m_sceneGraph.UpdatePresences(); | 1777 | m_sceneGraph.UpdatePresences(); |
1751 | 1778 | ||
1752 | agentMS += Util.EnvironmentTickCountSubtract(tmpMS); | 1779 | agentMS += Util.EnvironmentTickCountSubtract(tmpMS); |
1753 | 1780 | ||
1754 | if (Frame % m_update_events == 0) | 1781 | if (Frame % m_update_events == 0) |
1755 | { | 1782 | { |
1756 | tmpMS = Util.EnvironmentTickCount(); | 1783 | tmpMS = Util.EnvironmentTickCount(); |
1757 | UpdateEvents(); | 1784 | UpdateEvents(); |
1758 | eventMS = Util.EnvironmentTickCountSubtract(tmpMS); | 1785 | eventMS = Util.EnvironmentTickCountSubtract(tmpMS); |
1759 | } | 1786 | } |
1760 | 1787 | ||
1761 | if (PeriodicBackup && Frame % m_update_backup == 0) | 1788 | if (PeriodicBackup && Frame % m_update_backup == 0) |
1762 | { | 1789 | { |
1763 | tmpMS = Util.EnvironmentTickCount(); | 1790 | tmpMS = Util.EnvironmentTickCount(); |
1764 | UpdateStorageBackup(); | 1791 | UpdateStorageBackup(); |
1765 | backupMS = Util.EnvironmentTickCountSubtract(tmpMS); | 1792 | backupMS = Util.EnvironmentTickCountSubtract(tmpMS); |
1766 | } | 1793 | } |
1767 | 1794 | ||
1768 | //if (Frame % m_update_land == 0) | 1795 | //if (Frame % m_update_land == 0) |
1769 | //{ | 1796 | //{ |
1770 | // int ldMS = Util.EnvironmentTickCount(); | 1797 | // int ldMS = Util.EnvironmentTickCount(); |
1771 | // UpdateLand(); | 1798 | // UpdateLand(); |
1772 | // landMS = Util.EnvironmentTickCountSubtract(ldMS); | 1799 | // landMS = Util.EnvironmentTickCountSubtract(ldMS); |
1773 | //} | 1800 | //} |
1774 | 1801 | ||
1775 | if (!LoginsEnabled && Frame == 20) | 1802 | if (!LoginsEnabled && Frame == 20) |
1776 | { | 1803 | { |
1777 | // m_log.DebugFormat("{0} {1} {2}", LoginsDisabled, m_sceneGraph.GetActiveScriptsCount(), LoginLock); | 1804 | // m_log.DebugFormat("{0} {1} {2}", LoginsDisabled, m_sceneGraph.GetActiveScriptsCount(), LoginLock); |
1778 | 1805 | ||
1779 | // 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, |
1780 | // 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 |
1781 | // 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 |
@@ -1790,7 +1817,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1790 | } | 1817 | } |
1791 | 1818 | ||
1792 | m_sceneGridService.InformNeighborsThatRegionisUp( | 1819 | m_sceneGridService.InformNeighborsThatRegionisUp( |
1793 | RequestModuleInterface<INeighbourService>(), RegionInfo); | 1820 | RequestModuleInterface<INeighbourService>(), RegionInfo); |
1794 | 1821 | ||
1795 | // Region ready should always be set | 1822 | // Region ready should always be set |
1796 | Ready = true; | 1823 | Ready = true; |
@@ -1801,7 +1828,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1801 | if (m_sceneGraph.GetActiveScriptsCount() == 0) | 1828 | if (m_sceneGraph.GetActiveScriptsCount() == 0) |
1802 | { | 1829 | { |
1803 | // 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 |
1804 | 1831 | ||
1805 | // LoginLock can currently only be set by a region module implementation. | 1832 | // LoginLock can currently only be set by a region module implementation. |
1806 | // 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 |
1807 | // NullReferenceException | 1834 | // NullReferenceException |
@@ -1814,18 +1841,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
1814 | catch (Exception e) | 1841 | catch (Exception e) |
1815 | { | 1842 | { |
1816 | m_log.ErrorFormat( | 1843 | m_log.ErrorFormat( |
1817 | "[SCENE]: Failed on region {0} with exception {1}{2}", | 1844 | "[SCENE]: Failed on region {0} with exception {1}{2}", |
1818 | RegionInfo.RegionName, e.Message, e.StackTrace); | 1845 | RegionInfo.RegionName, e.Message, e.StackTrace); |
1819 | } | 1846 | } |
1820 | 1847 | ||
1821 | EventManager.TriggerRegionHeartbeatEnd(this); | 1848 | EventManager.TriggerRegionHeartbeatEnd(this); |
1822 | otherMS = eventMS + backupMS + terrainMS + landMS; | 1849 | otherMS = eventMS + backupMS + terrainMS + landMS; |
1823 | 1850 | ||
1824 | // Get the elapsed time for the simulation frame | 1851 | // Get the elapsed time for the simulation frame |
1825 | simFrameStopwatch.Stop(); | 1852 | simFrameStopwatch.Stop(); |
1826 | preciseSimFrameTime += | 1853 | preciseSimFrameTime += |
1827 | simFrameStopwatch.Elapsed.TotalMilliseconds; | 1854 | simFrameStopwatch.Elapsed.TotalMilliseconds; |
1828 | 1855 | ||
1829 | if (!UpdateOnTimer) | 1856 | if (!UpdateOnTimer) |
1830 | { | 1857 | { |
1831 | Watchdog.UpdateThread(); | 1858 | Watchdog.UpdateThread(); |
@@ -1833,9 +1860,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
1833 | spareMS = MinFrameTicks - Util.EnvironmentTickCountSubtract(m_lastFrameTick); | 1860 | spareMS = MinFrameTicks - Util.EnvironmentTickCountSubtract(m_lastFrameTick); |
1834 | 1861 | ||
1835 | if (spareMS > 0) | 1862 | if (spareMS > 0) |
1836 | m_updateWaitEvent.WaitOne(spareMS); | 1863 | m_updateWaitEvent.WaitOne(spareMS); |
1837 | else | 1864 | else |
1838 | spareMS = 0; | 1865 | spareMS = 0; |
1839 | } | 1866 | } |
1840 | else | 1867 | else |
1841 | { | 1868 | { |
@@ -1844,15 +1871,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
1844 | 1871 | ||
1845 | // Get the total frame time | 1872 | // Get the total frame time |
1846 | totalFrameStopwatch.Stop(); | 1873 | totalFrameStopwatch.Stop(); |
1847 | preciseTotalFrameTime = | 1874 | preciseTotalFrameTime = |
1848 | totalFrameStopwatch.Elapsed.TotalMilliseconds; | 1875 | totalFrameStopwatch.Elapsed.TotalMilliseconds; |
1849 | 1876 | ||
1850 | // Restart the stopwatch for the total time of the next frame | 1877 | // Restart the stopwatch for the total time of the next frame |
1851 | totalFrameStopwatch.Restart(); | 1878 | totalFrameStopwatch.Restart(); |
1852 | 1879 | ||
1853 | previousFrameTick = m_lastFrameTick; | 1880 | previousFrameTick = m_lastFrameTick; |
1854 | frameMS = Util.EnvironmentTickCountSubtract(m_lastFrameTick); | 1881 | frameMS = Util.EnvironmentTickCountSubtract(m_lastFrameTick); |
1855 | m_lastFrameTick = Util.EnvironmentTickCount(); | 1882 | m_lastFrameTick = Util.EnvironmentTickCount(); |
1856 | 1883 | ||
1857 | // if (Frame%m_update_avatars == 0) | 1884 | // if (Frame%m_update_avatars == 0) |
1858 | // UpdateInWorldTime(); | 1885 | // UpdateInWorldTime(); |
@@ -1869,37 +1896,40 @@ namespace OpenSim.Region.Framework.Scenes | |||
1869 | 1896 | ||
1870 | // Send the correct time values to the stats reporter for the | 1897 | // Send the correct time values to the stats reporter for the |
1871 | // frame times | 1898 | // frame times |
1872 | StatsReporter.addFrameTimeMilliseconds(preciseTotalFrameTime, | 1899 | StatsReporter.addFrameTimeMilliseconds(preciseTotalFrameTime, |
1873 | preciseSimFrameTime, precisePhysicsFrameTime, 0.0); | 1900 | preciseSimFrameTime, precisePhysicsFrameTime, 0.0); |
1874 | 1901 | ||
1875 | // Send the correct number of frames that the physics library | 1902 | // Send the correct number of frames that the physics library |
1876 | // has processed to the stats reporter | 1903 | // has processed to the stats reporter |
1877 | StatsReporter.addPhysicsFrame(1); | 1904 | StatsReporter.addPhysicsFrame(1); |
1878 | 1905 | ||
1879 | // 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. |
1880 | if (DebugUpdates | 1907 | if (DebugUpdates |
1881 | && Util.EnvironmentTickCountSubtract( | 1908 | && Util.EnvironmentTickCountSubtract( |
1882 | m_lastFrameTick, previousFrameTick) > MinFrameTicks * 2) | 1909 | m_lastFrameTick, previousFrameTick) > MinFrameTicks * 2) |
1883 | m_log.WarnFormat( | 1910 | m_log.WarnFormat( |
1884 | "[SCENE]: Frame took {0} ms (desired max {1} ms) in {2}", | 1911 | "[SCENE]: Frame took {0} ms (desired max {1} ms) in {2}", |
1885 | Util.EnvironmentTickCountSubtract(m_lastFrameTick, previousFrameTick), | 1912 | Util.EnvironmentTickCountSubtract(m_lastFrameTick, previousFrameTick), |
1886 | MinFrameTicks, | 1913 | MinFrameTicks, |
1887 | RegionInfo.RegionName); | 1914 | RegionInfo.RegionName); |
1888 | } | 1915 | } |
1889 | 1916 | ||
1917 | // Finished updating scene frame, so stop the total frame's Stopwatch | ||
1918 | totalFrameStopwatch.Stop(); | ||
1919 | |||
1890 | return spareMS >= 0; | 1920 | return spareMS >= 0; |
1891 | } | 1921 | } |
1892 | 1922 | ||
1893 | public void AddGroupTarget(SceneObjectGroup grp) | 1923 | public void AddGroupTarget(SceneObjectGroup grp) |
1894 | { | 1924 | { |
1895 | lock (m_groupsWithTargets) | 1925 | lock (m_groupsWithTargets) |
1896 | m_groupsWithTargets[grp.UUID] = grp; | 1926 | m_groupsWithTargets[grp.UUID] = grp; |
1897 | } | 1927 | } |
1898 | 1928 | ||
1899 | public void RemoveGroupTarget(SceneObjectGroup grp) | 1929 | public void RemoveGroupTarget(SceneObjectGroup grp) |
1900 | { | 1930 | { |
1901 | lock (m_groupsWithTargets) | 1931 | lock (m_groupsWithTargets) |
1902 | m_groupsWithTargets.Remove(grp.UUID); | 1932 | m_groupsWithTargets.Remove(grp.UUID); |
1903 | } | 1933 | } |
1904 | 1934 | ||
1905 | private void CheckAtTargets() | 1935 | private void CheckAtTargets() |
@@ -1909,13 +1939,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
1909 | lock (m_groupsWithTargets) | 1939 | lock (m_groupsWithTargets) |
1910 | { | 1940 | { |
1911 | if (m_groupsWithTargets.Count != 0) | 1941 | if (m_groupsWithTargets.Count != 0) |
1912 | objs = new List<SceneObjectGroup>(m_groupsWithTargets.Values); | 1942 | objs = new List<SceneObjectGroup>(m_groupsWithTargets.Values); |
1913 | } | 1943 | } |
1914 | 1944 | ||
1915 | if (objs != null) | 1945 | if (objs != null) |
1916 | { | 1946 | { |
1917 | foreach (SceneObjectGroup entry in objs) | 1947 | foreach (SceneObjectGroup entry in objs) |
1918 | entry.checkAtTargets(); | 1948 | entry.checkAtTargets(); |
1919 | } | 1949 | } |
1920 | } | 1950 | } |
1921 | 1951 | ||
@@ -1958,7 +1988,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1958 | { | 1988 | { |
1959 | m_eventManager.TriggerOnFrame(); | 1989 | m_eventManager.TriggerOnFrame(); |
1960 | } | 1990 | } |
1961 | 1991 | ||
1962 | /// <summary> | 1992 | /// <summary> |
1963 | /// Backup the scene. | 1993 | /// Backup the scene. |
1964 | /// </summary> | 1994 | /// </summary> |
@@ -1998,13 +2028,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
1998 | // 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. |
1999 | msg.binaryBucket = Util.StringToBytes256("\0"); | 2029 | msg.binaryBucket = Util.StringToBytes256("\0"); |
2000 | if (ret.Value.count > 1) | 2030 | if (ret.Value.count > 1) |
2001 | 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); |
2002 | else | 2032 | else |
2003 | 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); |
2004 | 2034 | ||
2005 | IMessageTransferModule tr = RequestModuleInterface<IMessageTransferModule>(); | 2035 | IMessageTransferModule tr = RequestModuleInterface<IMessageTransferModule>(); |
2006 | if (tr != null) | 2036 | if (tr != null) |
2007 | tr.SendInstantMessage(msg, delegate(bool success) {}); | 2037 | tr.SendInstantMessage(msg, delegate(bool success) { }); |
2008 | } | 2038 | } |
2009 | m_returns.Clear(); | 2039 | m_returns.Clear(); |
2010 | } | 2040 | } |
@@ -2095,7 +2125,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2095 | IConfig terrainConfig = m_config.Configs["Terrain"]; | 2125 | IConfig terrainConfig = m_config.Configs["Terrain"]; |
2096 | String m_InitialTerrain = "pinhead-island"; | 2126 | String m_InitialTerrain = "pinhead-island"; |
2097 | if (terrainConfig != null) | 2127 | if (terrainConfig != null) |
2098 | m_InitialTerrain = terrainConfig.GetString("InitialTerrain", m_InitialTerrain); | 2128 | m_InitialTerrain = terrainConfig.GetString("InitialTerrain", m_InitialTerrain); |
2099 | 2129 | ||
2100 | 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); |
2101 | 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); |
@@ -2110,11 +2140,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
2110 | catch (IOException e) | 2140 | catch (IOException e) |
2111 | { | 2141 | { |
2112 | m_log.WarnFormat( | 2142 | m_log.WarnFormat( |
2113 | "[TERRAIN]: Scene.cs: LoadWorldMap() - Regenerating as failed with exception {0}{1}", | 2143 | "[TERRAIN]: Scene.cs: LoadWorldMap() - Regenerating as failed with exception {0}{1}", |
2114 | e.Message, e.StackTrace); | 2144 | e.Message, e.StackTrace); |
2115 | 2145 | ||
2116 | // 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 |
2117 | #pragma warning disable 0162 | 2147 | #pragma warning disable 0162 |
2118 | if ((int)Constants.RegionSize != 256) | 2148 | if ((int)Constants.RegionSize != 256) |
2119 | { | 2149 | { |
2120 | Heightmap = new TerrainChannel(); | 2150 | Heightmap = new TerrainChannel(); |
@@ -2125,7 +2155,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2125 | catch (Exception e) | 2155 | catch (Exception e) |
2126 | { | 2156 | { |
2127 | m_log.WarnFormat( | 2157 | m_log.WarnFormat( |
2128 | "[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); |
2129 | } | 2159 | } |
2130 | } | 2160 | } |
2131 | 2161 | ||
@@ -2142,18 +2172,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
2142 | //// 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 |
2143 | //// 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... |
2144 | if (m_generateMaptiles) | 2174 | if (m_generateMaptiles) |
2145 | RegenerateMaptile(); | 2175 | RegenerateMaptile(); |
2146 | 2176 | ||
2147 | GridRegion region = new GridRegion(RegionInfo); | 2177 | GridRegion region = new GridRegion(RegionInfo); |
2148 | string error = GridService.RegisterRegion(RegionInfo.ScopeID, region); | 2178 | string error = GridService.RegisterRegion(RegionInfo.ScopeID, region); |
2149 | // 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}>", |
2150 | // m_regionName, | 2180 | // m_regionName, |
2151 | // RegionInfo.RegionID, | 2181 | // RegionInfo.RegionID, |
2152 | // RegionInfo.RegionLocX, RegionInfo.RegionLocY, | 2182 | // RegionInfo.RegionLocX, RegionInfo.RegionLocY, |
2153 | // RegionInfo.RegionSizeX, RegionInfo.RegionSizeY); | 2183 | // RegionInfo.RegionSizeX, RegionInfo.RegionSizeY); |
2154 | 2184 | ||
2155 | if (error != String.Empty) | 2185 | if (error != String.Empty) |
2156 | throw new Exception(error); | 2186 | throw new Exception(error); |
2157 | } | 2187 | } |
2158 | 2188 | ||
2159 | #endregion | 2189 | #endregion |
@@ -2212,7 +2242,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2212 | rootPart.TrimPermissions(); | 2242 | rootPart.TrimPermissions(); |
2213 | 2243 | ||
2214 | // 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. |
2215 | // group.CheckSculptAndLoad(); | 2245 | // group.CheckSculptAndLoad(); |
2216 | } | 2246 | } |
2217 | 2247 | ||
2218 | LoadingPrims = false; | 2248 | LoadingPrims = false; |
@@ -2222,15 +2252,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
2222 | public bool SupportsRayCastFiltered() | 2252 | public bool SupportsRayCastFiltered() |
2223 | { | 2253 | { |
2224 | if (PhysicsScene == null) | 2254 | if (PhysicsScene == null) |
2225 | return false; | 2255 | return false; |
2226 | return PhysicsScene.SupportsRaycastWorldFiltered(); | 2256 | return PhysicsScene.SupportsRaycastWorldFiltered(); |
2227 | } | 2257 | } |
2228 | 2258 | ||
2229 | 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) |
2230 | { | 2260 | { |
2231 | if (PhysicsScene == null) | 2261 | if (PhysicsScene == null) |
2232 | return null; | 2262 | return null; |
2233 | return PhysicsScene.RaycastWorld(position, direction, length, Count,filter); | 2263 | return PhysicsScene.RaycastWorld(position, direction, length, Count, filter); |
2234 | } | 2264 | } |
2235 | 2265 | ||
2236 | /// <summary> | 2266 | /// <summary> |
@@ -2298,7 +2328,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2298 | //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 |
2299 | // 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) |
2300 | //pos.Z -= 0.25F; | 2330 | //pos.Z -= 0.25F; |
2301 | 2331 | ||
2302 | } | 2332 | } |
2303 | 2333 | ||
2304 | return pos; | 2334 | return pos; |
@@ -2315,7 +2345,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2315 | if (ei.HitTF) | 2345 | if (ei.HitTF) |
2316 | { | 2346 | { |
2317 | pos = ei.ipoint; | 2347 | pos = ei.ipoint; |
2318 | } | 2348 | } |
2319 | else | 2349 | else |
2320 | { | 2350 | { |
2321 | // fall back to our stupid functionality | 2351 | // fall back to our stupid functionality |
@@ -2351,8 +2381,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2351 | /// <param name="RayTargetID"></param> | 2381 | /// <param name="RayTargetID"></param> |
2352 | /// <param name="RayEndIsIntersection"></param> | 2382 | /// <param name="RayEndIsIntersection"></param> |
2353 | 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, |
2354 | byte bypassRaycast, Vector3 RayStart, UUID RayTargetID, | 2384 | byte bypassRaycast, Vector3 RayStart, UUID RayTargetID, |
2355 | byte RayEndIsIntersection) | 2385 | byte RayEndIsIntersection) |
2356 | { | 2386 | { |
2357 | 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); |
2358 | 2388 | ||
@@ -2367,18 +2397,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
2367 | { | 2397 | { |
2368 | IClientAPI client = null; | 2398 | IClientAPI client = null; |
2369 | if (TryGetClient(ownerID, out client)) | 2399 | if (TryGetClient(ownerID, out client)) |
2370 | client.SendAlertMessage("You cannot create objects here."); | 2400 | client.SendAlertMessage("You cannot create objects here."); |
2371 | } | 2401 | } |
2372 | } | 2402 | } |
2373 | 2403 | ||
2374 | public virtual SceneObjectGroup AddNewPrim( | 2404 | public virtual SceneObjectGroup AddNewPrim( |
2375 | UUID ownerID, UUID groupID, Vector3 pos, Quaternion rot, PrimitiveBaseShape shape) | 2405 | UUID ownerID, UUID groupID, Vector3 pos, Quaternion rot, PrimitiveBaseShape shape) |
2376 | { | 2406 | { |
2377 | //m_log.DebugFormat( | 2407 | //m_log.DebugFormat( |
2378 | // "[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); |
2379 | 2409 | ||
2380 | SceneObjectGroup sceneObject = null; | 2410 | SceneObjectGroup sceneObject = null; |
2381 | 2411 | ||
2382 | // 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 |
2383 | if (m_entityCreators.ContainsKey((PCode)shape.PCode)) | 2413 | if (m_entityCreators.ContainsKey((PCode)shape.PCode)) |
2384 | { | 2414 | { |
@@ -2393,13 +2423,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
2393 | } | 2423 | } |
2394 | 2424 | ||
2395 | if (UserManagementModule != null) | 2425 | if (UserManagementModule != null) |
2396 | sceneObject.RootPart.CreatorIdentification = UserManagementModule.GetUserUUI(ownerID); | 2426 | sceneObject.RootPart.CreatorIdentification = UserManagementModule.GetUserUUI(ownerID); |
2397 | 2427 | ||
2398 | sceneObject.ScheduleGroupForFullUpdate(); | 2428 | sceneObject.ScheduleGroupForFullUpdate(); |
2399 | 2429 | ||
2400 | return sceneObject; | 2430 | return sceneObject; |
2401 | } | 2431 | } |
2402 | 2432 | ||
2403 | /// <summary> | 2433 | /// <summary> |
2404 | /// Add an object into the scene that has come from storage | 2434 | /// Add an object into the scene that has come from storage |
2405 | /// </summary> | 2435 | /// </summary> |
@@ -2421,7 +2451,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2421 | /// 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 |
2422 | /// </returns> | 2452 | /// </returns> |
2423 | public bool AddRestoredSceneObject( | 2453 | public bool AddRestoredSceneObject( |
2424 | SceneObjectGroup sceneObject, bool attachToBackup, bool alreadyPersisted, bool sendClientUpdates) | 2454 | SceneObjectGroup sceneObject, bool attachToBackup, bool alreadyPersisted, bool sendClientUpdates) |
2425 | { | 2455 | { |
2426 | if (m_sceneGraph.AddRestoredSceneObject(sceneObject, attachToBackup, alreadyPersisted, sendClientUpdates)) | 2456 | if (m_sceneGraph.AddRestoredSceneObject(sceneObject, attachToBackup, alreadyPersisted, sendClientUpdates)) |
2427 | { | 2457 | { |
@@ -2432,7 +2462,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2432 | return false; | 2462 | return false; |
2433 | 2463 | ||
2434 | } | 2464 | } |
2435 | 2465 | ||
2436 | /// <summary> | 2466 | /// <summary> |
2437 | /// Add an object into the scene that has come from storage | 2467 | /// Add an object into the scene that has come from storage |
2438 | /// </summary> | 2468 | /// </summary> |
@@ -2450,7 +2480,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2450 | /// 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 |
2451 | /// </returns> | 2481 | /// </returns> |
2452 | public bool AddRestoredSceneObject( | 2482 | public bool AddRestoredSceneObject( |
2453 | SceneObjectGroup sceneObject, bool attachToBackup, bool alreadyPersisted) | 2483 | SceneObjectGroup sceneObject, bool attachToBackup, bool alreadyPersisted) |
2454 | { | 2484 | { |
2455 | return AddRestoredSceneObject(sceneObject, attachToBackup, alreadyPersisted, true); | 2485 | return AddRestoredSceneObject(sceneObject, attachToBackup, alreadyPersisted, true); |
2456 | } | 2486 | } |
@@ -2468,7 +2498,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2468 | { | 2498 | { |
2469 | return AddNewSceneObject(sceneObject, attachToBackup, true); | 2499 | return AddNewSceneObject(sceneObject, attachToBackup, true); |
2470 | } | 2500 | } |
2471 | 2501 | ||
2472 | /// <summary> | 2502 | /// <summary> |
2473 | /// Add a newly created object to the scene | 2503 | /// Add a newly created object to the scene |
2474 | /// </summary> | 2504 | /// </summary> |
@@ -2483,16 +2513,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
2483 | /// </param> | 2513 | /// </param> |
2484 | /// <returns>true if the object was added. false if not</returns> | 2514 | /// <returns>true if the object was added. false if not</returns> |
2485 | public bool AddNewSceneObject(SceneObjectGroup sceneObject, bool attachToBackup, bool sendClientUpdates) | 2515 | public bool AddNewSceneObject(SceneObjectGroup sceneObject, bool attachToBackup, bool sendClientUpdates) |
2486 | { | 2516 | { |
2487 | if (m_sceneGraph.AddNewSceneObject(sceneObject, attachToBackup, sendClientUpdates)) | 2517 | if (m_sceneGraph.AddNewSceneObject(sceneObject, attachToBackup, sendClientUpdates)) |
2488 | { | 2518 | { |
2489 | EventManager.TriggerObjectAddedToScene(sceneObject); | 2519 | EventManager.TriggerObjectAddedToScene(sceneObject); |
2490 | return true; | 2520 | return true; |
2491 | } | 2521 | } |
2492 | 2522 | ||
2493 | return false; | 2523 | return false; |
2494 | } | 2524 | } |
2495 | 2525 | ||
2496 | /// <summary> | 2526 | /// <summary> |
2497 | /// Add a newly created object to the scene. | 2527 | /// Add a newly created object to the scene. |
2498 | /// </summary> | 2528 | /// </summary> |
@@ -2506,10 +2536,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
2506 | /// <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> |
2507 | /// <returns></returns> | 2537 | /// <returns></returns> |
2508 | public bool AddNewSceneObject( | 2538 | public bool AddNewSceneObject( |
2509 | SceneObjectGroup sceneObject, bool attachToBackup, Vector3? pos, Quaternion? rot, Vector3 vel) | 2539 | SceneObjectGroup sceneObject, bool attachToBackup, Vector3? pos, Quaternion? rot, Vector3 vel) |
2510 | { | 2540 | { |
2511 | if (m_sceneGraph.AddNewSceneObject(sceneObject, attachToBackup, pos, rot, vel)) | 2541 | if (m_sceneGraph.AddNewSceneObject(sceneObject, attachToBackup, pos, rot, vel)) |
2512 | { | 2542 | { |
2513 | EventManager.TriggerObjectAddedToScene(sceneObject); | 2543 | EventManager.TriggerObjectAddedToScene(sceneObject); |
2514 | return true; | 2544 | return true; |
2515 | } | 2545 | } |
@@ -2531,7 +2561,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2531 | { | 2561 | { |
2532 | SceneObjectGroup sog = (SceneObjectGroup)e; | 2562 | SceneObjectGroup sog = (SceneObjectGroup)e; |
2533 | if (!sog.IsAttachment) | 2563 | if (!sog.IsAttachment) |
2534 | DeleteSceneObject((SceneObjectGroup)e, false); | 2564 | DeleteSceneObject((SceneObjectGroup)e, false); |
2535 | } | 2565 | } |
2536 | } | 2566 | } |
2537 | } | 2567 | } |
@@ -2557,13 +2587,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
2557 | /// <param name="silent">Suppress broadcasting changes to other clients.</param> | 2587 | /// <param name="silent">Suppress broadcasting changes to other clients.</param> |
2558 | /// <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> |
2559 | public void DeleteSceneObject(SceneObjectGroup group, bool silent, bool removeScripts) | 2589 | public void DeleteSceneObject(SceneObjectGroup group, bool silent, bool removeScripts) |
2560 | { | 2590 | { |
2561 | // 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); |
2562 | 2592 | ||
2563 | if (removeScripts) | 2593 | if (removeScripts) |
2564 | group.RemoveScriptInstances(true); | 2594 | group.RemoveScriptInstances(true); |
2565 | else | 2595 | else |
2566 | group.StopScriptInstances(); | 2596 | group.StopScriptInstances(); |
2567 | 2597 | ||
2568 | SceneObjectPart[] partList = group.Parts; | 2598 | SceneObjectPart[] partList = group.Parts; |
2569 | 2599 | ||
@@ -2593,7 +2623,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2593 | 2623 | ||
2594 | group.DeleteGroupFromScene(silent); | 2624 | group.DeleteGroupFromScene(silent); |
2595 | 2625 | ||
2596 | // 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); |
2597 | } | 2627 | } |
2598 | 2628 | ||
2599 | /// <summary> | 2629 | /// <summary> |
@@ -2613,12 +2643,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
2613 | // database update, because RemoveObject() works by searching on the SceneGroupID. | 2643 | // database update, because RemoveObject() works by searching on the SceneGroupID. |
2614 | // 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. |
2615 | if (so.GroupContainsForeignPrims) | 2645 | if (so.GroupContainsForeignPrims) |
2616 | ForceSceneObjectBackup(so); | 2646 | ForceSceneObjectBackup(so); |
2617 | 2647 | ||
2618 | so.DetachFromBackup(); | 2648 | so.DetachFromBackup(); |
2619 | SimulationDataService.RemoveObject(so.UUID, RegionInfo.RegionID); | 2649 | SimulationDataService.RemoveObject(so.UUID, RegionInfo.RegionID); |
2620 | } | 2650 | } |
2621 | 2651 | ||
2622 | // 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. |
2623 | so.IsDeleted = true; | 2653 | so.IsDeleted = true; |
2624 | 2654 | ||
@@ -2638,9 +2668,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
2638 | public void CrossPrimGroupIntoNewRegion(Vector3 attemptedPosition, SceneObjectGroup grp, bool silent) | 2668 | public void CrossPrimGroupIntoNewRegion(Vector3 attemptedPosition, SceneObjectGroup grp, bool silent) |
2639 | { | 2669 | { |
2640 | if (grp == null) | 2670 | if (grp == null) |
2641 | return; | 2671 | return; |
2642 | if (grp.IsDeleted) | 2672 | if (grp.IsDeleted) |
2643 | return; | 2673 | return; |
2644 | 2674 | ||
2645 | if (grp.RootPart.DIE_AT_EDGE) | 2675 | if (grp.RootPart.DIE_AT_EDGE) |
2646 | { | 2676 | { |
@@ -2674,7 +2704,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2674 | } | 2704 | } |
2675 | 2705 | ||
2676 | if (EntityTransferModule != null) | 2706 | if (EntityTransferModule != null) |
2677 | EntityTransferModule.Cross(grp, attemptedPosition, silent); | 2707 | EntityTransferModule.Cross(grp, attemptedPosition, silent); |
2678 | } | 2708 | } |
2679 | 2709 | ||
2680 | // 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. |
@@ -2687,14 +2717,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
2687 | int xx = (int)Math.Floor(pos.X); | 2717 | int xx = (int)Math.Floor(pos.X); |
2688 | int yy = (int)Math.Floor(pos.Y); | 2718 | int yy = (int)Math.Floor(pos.Y); |
2689 | if (xx < 0 || yy < 0) | 2719 | if (xx < 0 || yy < 0) |
2690 | return false; | 2720 | return false; |
2691 | 2721 | ||
2692 | IRegionCombinerModule regionCombinerModule = RequestModuleInterface<IRegionCombinerModule>(); | 2722 | IRegionCombinerModule regionCombinerModule = RequestModuleInterface<IRegionCombinerModule>(); |
2693 | if (regionCombinerModule == null) | 2723 | if (regionCombinerModule == null) |
2694 | { | 2724 | { |
2695 | // Regular region. Just check for region size | 2725 | // Regular region. Just check for region size |
2696 | if (xx < RegionInfo.RegionSizeX && yy < RegionInfo.RegionSizeY ) | 2726 | if (xx < RegionInfo.RegionSizeX && yy < RegionInfo.RegionSizeY) |
2697 | ret = true; | 2727 | ret = true; |
2698 | } | 2728 | } |
2699 | else | 2729 | else |
2700 | { | 2730 | { |
@@ -2728,7 +2758,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2728 | } | 2758 | } |
2729 | 2759 | ||
2730 | if (!EntityTransferModule.HandleIncomingSceneObject(newObject, newPosition)) | 2760 | if (!EntityTransferModule.HandleIncomingSceneObject(newObject, newPosition)) |
2731 | return false; | 2761 | return false; |
2732 | 2762 | ||
2733 | // 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 |
2734 | EventManager.TriggerOnIncomingSceneObject(newObject); | 2764 | EventManager.TriggerOnIncomingSceneObject(newObject); |
@@ -2749,13 +2779,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
2749 | // | 2779 | // |
2750 | SceneObjectPart[] parts = sceneObject.Parts; | 2780 | SceneObjectPart[] parts = sceneObject.Parts; |
2751 | for (int i = 0; i < parts.Length; i++) | 2781 | for (int i = 0; i < parts.Length; i++) |
2752 | parts[i].LocalId = 0; | 2782 | parts[i].LocalId = 0; |
2753 | 2783 | ||
2754 | if (sceneObject.IsAttachmentCheckFull()) // Attachment | 2784 | if (sceneObject.IsAttachmentCheckFull()) // Attachment |
2755 | { | 2785 | { |
2756 | sceneObject.RootPart.AddFlag(PrimFlags.TemporaryOnRez); | 2786 | sceneObject.RootPart.AddFlag(PrimFlags.TemporaryOnRez); |
2757 | sceneObject.RootPart.AddFlag(PrimFlags.Phantom); | 2787 | sceneObject.RootPart.AddFlag(PrimFlags.Phantom); |
2758 | 2788 | ||
2759 | // 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 |
2760 | // attachments on region crossings, resulting in viewer glitches. | 2790 | // attachments on region crossings, resulting in viewer glitches. |
2761 | AddRestoredSceneObject(sceneObject, false, false, false); | 2791 | AddRestoredSceneObject(sceneObject, false, false, false); |
@@ -2770,10 +2800,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
2770 | { | 2800 | { |
2771 | SceneObjectGroup grp = sceneObject; | 2801 | SceneObjectGroup grp = sceneObject; |
2772 | 2802 | ||
2773 | // m_log.DebugFormat( | 2803 | // m_log.DebugFormat( |
2774 | // "[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); |
2775 | // m_log.DebugFormat( | 2805 | // m_log.DebugFormat( |
2776 | // "[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); |
2777 | 2807 | ||
2778 | RootPrim.RemFlag(PrimFlags.TemporaryOnRez); | 2808 | RootPrim.RemFlag(PrimFlags.TemporaryOnRez); |
2779 | 2809 | ||
@@ -2781,7 +2811,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2781 | // 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. |
2782 | // We currently do this in Scene.MakeRootAgent() instead. | 2812 | // We currently do this in Scene.MakeRootAgent() instead. |
2783 | if (AttachmentsModule != null) | 2813 | if (AttachmentsModule != null) |
2784 | AttachmentsModule.AttachObject(sp, grp, 0, false, false, true); | 2814 | AttachmentsModule.AttachObject(sp, grp, 0, false, false, true); |
2785 | } | 2815 | } |
2786 | else | 2816 | else |
2787 | { | 2817 | { |
@@ -2807,6 +2837,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
2807 | bool vialogin; | 2837 | bool vialogin; |
2808 | bool reallyNew = true; | 2838 | bool reallyNew = true; |
2809 | 2839 | ||
2840 | // Update the number of users attempting to login | ||
2841 | StatsReporter.UpdateUsersLoggingIn(true); | ||
2842 | |||
2810 | // Validation occurs in LLUDPServer | 2843 | // Validation occurs in LLUDPServer |
2811 | // | 2844 | // |
2812 | // 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 |
@@ -2827,11 +2860,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
2827 | lock (aCircuit) | 2860 | lock (aCircuit) |
2828 | { | 2861 | { |
2829 | vialogin | 2862 | vialogin |
2830 | = (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0 | 2863 | = (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0 |
2831 | || (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0; | 2864 | || (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0; |
2832 | 2865 | ||
2833 | // CheckHeartbeat(); | 2866 | // CheckHeartbeat(); |
2834 | 2867 | ||
2835 | sp = GetScenePresence(client.AgentId); | 2868 | sp = GetScenePresence(client.AgentId); |
2836 | 2869 | ||
2837 | // 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 |
@@ -2841,9 +2874,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
2841 | if (sp == null) | 2874 | if (sp == null) |
2842 | { | 2875 | { |
2843 | m_log.DebugFormat( | 2876 | m_log.DebugFormat( |
2844 | "[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}", |
2845 | client.Name, client.AgentId, RegionInfo.RegionName, client.StartPos); | 2878 | client.Name, client.AgentId, RegionInfo.RegionName, client.StartPos); |
2846 | 2879 | ||
2847 | sp = m_sceneGraph.CreateAndAddChildScenePresence(client, aCircuit.Appearance, type); | 2880 | sp = m_sceneGraph.CreateAndAddChildScenePresence(client, aCircuit.Appearance, type); |
2848 | 2881 | ||
2849 | // 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 |
@@ -2860,7 +2893,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2860 | m_clientManager.Add(client); | 2893 | m_clientManager.Add(client); |
2861 | SubscribeToClientEvents(client); | 2894 | SubscribeToClientEvents(client); |
2862 | m_eventManager.TriggerOnNewPresence(sp); | 2895 | m_eventManager.TriggerOnNewPresence(sp); |
2863 | 2896 | ||
2864 | sp.TeleportFlags = (TPFlags)aCircuit.teleportFlags; | 2897 | sp.TeleportFlags = (TPFlags)aCircuit.teleportFlags; |
2865 | } | 2898 | } |
2866 | else | 2899 | else |
@@ -2873,24 +2906,28 @@ namespace OpenSim.Region.Framework.Scenes | |||
2873 | client.SceneAgent = sp; | 2906 | client.SceneAgent = sp; |
2874 | 2907 | ||
2875 | m_log.WarnFormat( | 2908 | m_log.WarnFormat( |
2876 | "[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", |
2877 | sp.IsChildAgent ? "child" : "root", sp.Name, RegionInfo.RegionName); | 2910 | sp.IsChildAgent ? "child" : "root", sp.Name, RegionInfo.RegionName); |
2878 | 2911 | ||
2879 | reallyNew = false; | 2912 | reallyNew = false; |
2880 | } | 2913 | } |
2881 | 2914 | ||
2882 | // 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 |
2883 | // 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 |
2884 | // places. However, we still need to do it here for NPCs. | 2917 | // places. However, we still need to do it here for NPCs. |
2885 | CacheUserName(sp, aCircuit); | 2918 | CacheUserName(sp, aCircuit); |
2886 | 2919 | ||
2887 | if (reallyNew) | 2920 | if (reallyNew) |
2888 | EventManager.TriggerOnNewClient(client); | 2921 | EventManager.TriggerOnNewClient(client); |
2889 | 2922 | ||
2890 | if (vialogin) | 2923 | if (vialogin) |
2891 | EventManager.TriggerOnClientLogin(client); | 2924 | EventManager.TriggerOnClientLogin(client); |
2892 | } | 2925 | } |
2893 | 2926 | ||
2927 | // User has logged into the scene so update the list of users logging | ||
2928 | // in | ||
2929 | StatsReporter.UpdateUsersLoggingIn(false); | ||
2930 | |||
2894 | m_LastLogin = Util.EnvironmentTickCount(); | 2931 | m_LastLogin = Util.EnvironmentTickCount(); |
2895 | 2932 | ||
2896 | return sp; | 2933 | return sp; |
@@ -2903,9 +2940,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
2903 | { | 2940 | { |
2904 | AgentCircuitData circuit = AuthenticateHandler.GetAgentCircuitData(agentID); | 2941 | AgentCircuitData circuit = AuthenticateHandler.GetAgentCircuitData(agentID); |
2905 | if (circuit != null && circuit.ServiceURLs != null && circuit.ServiceURLs.ContainsKey("HomeURI")) | 2942 | if (circuit != null && circuit.ServiceURLs != null && circuit.ServiceURLs.ContainsKey("HomeURI")) |
2906 | return circuit.ServiceURLs["HomeURI"].ToString(); | 2943 | return circuit.ServiceURLs["HomeURI"].ToString(); |
2907 | else | 2944 | else |
2908 | return null; | 2945 | return null; |
2909 | } | 2946 | } |
2910 | 2947 | ||
2911 | /// <summary> | 2948 | /// <summary> |
@@ -2928,7 +2965,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2928 | string homeURL = string.Empty; | 2965 | string homeURL = string.Empty; |
2929 | 2966 | ||
2930 | if (aCircuit.ServiceURLs.ContainsKey("HomeURI")) | 2967 | if (aCircuit.ServiceURLs.ContainsKey("HomeURI")) |
2931 | homeURL = aCircuit.ServiceURLs["HomeURI"].ToString(); | 2968 | homeURL = aCircuit.ServiceURLs["HomeURI"].ToString(); |
2932 | 2969 | ||
2933 | if (aCircuit.lastname.StartsWith("@")) | 2970 | if (aCircuit.lastname.StartsWith("@")) |
2934 | { | 2971 | { |
@@ -2948,7 +2985,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2948 | 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) |
2949 | { | 2986 | { |
2950 | vialogin = false; | 2987 | vialogin = false; |
2951 | 2988 | ||
2952 | // Do the verification here | 2989 | // Do the verification here |
2953 | if ((aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0) | 2990 | if ((aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0) |
2954 | { | 2991 | { |
@@ -2964,7 +3001,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2964 | return false; | 3001 | return false; |
2965 | } | 3002 | } |
2966 | else | 3003 | else |
2967 | 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); |
2968 | 3005 | ||
2969 | } | 3006 | } |
2970 | } | 3007 | } |
@@ -2972,7 +3009,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2972 | else if ((aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0) | 3009 | else if ((aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0) |
2973 | { | 3010 | { |
2974 | 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.", |
2975 | aCircuit.firstname, aCircuit.lastname, RegionInfo.RegionName); | 3012 | aCircuit.firstname, aCircuit.lastname, RegionInfo.RegionName); |
2976 | vialogin = true; | 3013 | vialogin = true; |
2977 | } | 3014 | } |
2978 | 3015 | ||
@@ -3016,7 +3053,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3016 | } | 3053 | } |
3017 | } | 3054 | } |
3018 | else | 3055 | else |
3019 | return true; | 3056 | return true; |
3020 | } | 3057 | } |
3021 | 3058 | ||
3022 | return false; | 3059 | return false; |
@@ -3043,7 +3080,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3043 | { | 3080 | { |
3044 | client.OnRegionHandShakeReply += SendLayerData; | 3081 | client.OnRegionHandShakeReply += SendLayerData; |
3045 | } | 3082 | } |
3046 | 3083 | ||
3047 | public virtual void SubscribeToClientPrimEvents(IClientAPI client) | 3084 | public virtual void SubscribeToClientPrimEvents(IClientAPI client) |
3048 | { | 3085 | { |
3049 | client.OnUpdatePrimGroupPosition += m_sceneGraph.UpdatePrimGroupPosition; | 3086 | client.OnUpdatePrimGroupPosition += m_sceneGraph.UpdatePrimGroupPosition; |
@@ -3053,7 +3090,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3053 | client.OnUpdatePrimGroupMouseRotation += m_sceneGraph.UpdatePrimGroupRotation; | 3090 | client.OnUpdatePrimGroupMouseRotation += m_sceneGraph.UpdatePrimGroupRotation; |
3054 | client.OnUpdatePrimSingleRotation += m_sceneGraph.UpdatePrimSingleRotation; | 3091 | client.OnUpdatePrimSingleRotation += m_sceneGraph.UpdatePrimSingleRotation; |
3055 | client.OnUpdatePrimSingleRotationPosition += m_sceneGraph.UpdatePrimSingleRotationPosition; | 3092 | client.OnUpdatePrimSingleRotationPosition += m_sceneGraph.UpdatePrimSingleRotationPosition; |
3056 | 3093 | ||
3057 | client.OnUpdatePrimScale += m_sceneGraph.UpdatePrimScale; | 3094 | client.OnUpdatePrimScale += m_sceneGraph.UpdatePrimScale; |
3058 | client.OnUpdatePrimGroupScale += m_sceneGraph.UpdatePrimGroupScale; | 3095 | client.OnUpdatePrimGroupScale += m_sceneGraph.UpdatePrimGroupScale; |
3059 | client.OnUpdateExtraParams += m_sceneGraph.UpdateExtraParam; | 3096 | client.OnUpdateExtraParams += m_sceneGraph.UpdateExtraParam; |
@@ -3066,7 +3103,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3066 | client.OnSpinStart += m_sceneGraph.SpinStart; | 3103 | client.OnSpinStart += m_sceneGraph.SpinStart; |
3067 | client.OnSpinUpdate += m_sceneGraph.SpinObject; | 3104 | client.OnSpinUpdate += m_sceneGraph.SpinObject; |
3068 | client.OnDeRezObject += DeRezObjects; | 3105 | client.OnDeRezObject += DeRezObjects; |
3069 | 3106 | ||
3070 | client.OnObjectName += m_sceneGraph.PrimName; | 3107 | client.OnObjectName += m_sceneGraph.PrimName; |
3071 | client.OnObjectClickAction += m_sceneGraph.PrimClickAction; | 3108 | client.OnObjectClickAction += m_sceneGraph.PrimClickAction; |
3072 | client.OnObjectMaterial += m_sceneGraph.PrimMaterial; | 3109 | client.OnObjectMaterial += m_sceneGraph.PrimMaterial; |
@@ -3078,7 +3115,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3078 | client.OnRequestObjectPropertiesFamily += m_sceneGraph.RequestObjectPropertiesFamily; | 3115 | client.OnRequestObjectPropertiesFamily += m_sceneGraph.RequestObjectPropertiesFamily; |
3079 | client.OnObjectPermissions += HandleObjectPermissionsUpdate; | 3116 | client.OnObjectPermissions += HandleObjectPermissionsUpdate; |
3080 | client.OnGrabObject += ProcessObjectGrab; | 3117 | client.OnGrabObject += ProcessObjectGrab; |
3081 | client.OnGrabUpdate += ProcessObjectGrabUpdate; | 3118 | client.OnGrabUpdate += ProcessObjectGrabUpdate; |
3082 | client.OnDeGrabObject += ProcessObjectDeGrab; | 3119 | client.OnDeGrabObject += ProcessObjectDeGrab; |
3083 | client.OnUndo += m_sceneGraph.HandleUndo; | 3120 | client.OnUndo += m_sceneGraph.HandleUndo; |
3084 | client.OnRedo += m_sceneGraph.HandleRedo; | 3121 | client.OnRedo += m_sceneGraph.HandleRedo; |
@@ -3139,7 +3176,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3139 | //client.OnNameFromUUIDRequest += HandleUUIDNameRequest; | 3176 | //client.OnNameFromUUIDRequest += HandleUUIDNameRequest; |
3140 | client.OnMoneyTransferRequest += ProcessMoneyTransferRequest; | 3177 | client.OnMoneyTransferRequest += ProcessMoneyTransferRequest; |
3141 | } | 3178 | } |
3142 | 3179 | ||
3143 | public virtual void SubscribeToClientNetworkEvents(IClientAPI client) | 3180 | public virtual void SubscribeToClientNetworkEvents(IClientAPI client) |
3144 | { | 3181 | { |
3145 | client.OnNetworkStatsUpdate += StatsReporter.AddPacketsStats; | 3182 | client.OnNetworkStatsUpdate += StatsReporter.AddPacketsStats; |
@@ -3300,7 +3337,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3300 | { | 3337 | { |
3301 | SceneObjectGroup copy = SceneGraph.DuplicateObject(originalPrim, offset, flags, AgentID, GroupID, Quaternion.Identity); | 3338 | SceneObjectGroup copy = SceneGraph.DuplicateObject(originalPrim, offset, flags, AgentID, GroupID, Quaternion.Identity); |
3302 | if (copy != null) | 3339 | if (copy != null) |
3303 | EventManager.TriggerObjectAddedToScene(copy); | 3340 | EventManager.TriggerObjectAddedToScene(copy); |
3304 | } | 3341 | } |
3305 | 3342 | ||
3306 | /// <summary> | 3343 | /// <summary> |
@@ -3319,8 +3356,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
3319 | /// <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> |
3320 | /// <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> |
3321 | public void doObjectDuplicateOnRay(uint localID, uint dupeFlags, UUID AgentID, UUID GroupID, | 3358 | public void doObjectDuplicateOnRay(uint localID, uint dupeFlags, UUID AgentID, UUID GroupID, |
3322 | UUID RayTargetObj, Vector3 RayEnd, Vector3 RayStart, | 3359 | UUID RayTargetObj, Vector3 RayEnd, Vector3 RayStart, |
3323 | bool BypassRaycast, bool RayEndIsIntersection, bool CopyCenters, bool CopyRotates) | 3360 | bool BypassRaycast, bool RayEndIsIntersection, bool CopyCenters, bool CopyRotates) |
3324 | { | 3361 | { |
3325 | Vector3 pos; | 3362 | Vector3 pos; |
3326 | const bool frontFacesOnly = true; | 3363 | const bool frontFacesOnly = true; |
@@ -3381,7 +3418,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3381 | } | 3418 | } |
3382 | 3419 | ||
3383 | if (copy != null) | 3420 | if (copy != null) |
3384 | EventManager.TriggerObjectAddedToScene(copy); | 3421 | EventManager.TriggerObjectAddedToScene(copy); |
3385 | } | 3422 | } |
3386 | } | 3423 | } |
3387 | } | 3424 | } |
@@ -3432,25 +3469,25 @@ namespace OpenSim.Region.Framework.Scenes | |||
3432 | if (acd == null) | 3469 | if (acd == null) |
3433 | { | 3470 | { |
3434 | m_log.ErrorFormat( | 3471 | m_log.ErrorFormat( |
3435 | "[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); |
3436 | 3473 | ||
3437 | return; | 3474 | return; |
3438 | } | 3475 | } |
3439 | 3476 | ||
3440 | // TODO: Can we now remove this lock? | 3477 | // TODO: Can we now remove this lock? |
3441 | lock (acd) | 3478 | lock (acd) |
3442 | { | 3479 | { |
3443 | bool isChildAgent = false; | 3480 | bool isChildAgent = false; |
3444 | 3481 | ||
3445 | ScenePresence avatar = GetScenePresence(agentID); | 3482 | ScenePresence avatar = GetScenePresence(agentID); |
3446 | 3483 | ||
3447 | // 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 |
3448 | // 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 |
3449 | // However, will keep for now just in case. | 3486 | // However, will keep for now just in case. |
3450 | if (avatar == null) | 3487 | if (avatar == null) |
3451 | { | 3488 | { |
3452 | m_log.ErrorFormat( | 3489 | m_log.ErrorFormat( |
3453 | "[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); |
3454 | m_authenticateHandler.RemoveCircuit(agentID); | 3491 | m_authenticateHandler.RemoveCircuit(agentID); |
3455 | 3492 | ||
3456 | return; | 3493 | return; |
@@ -3461,9 +3498,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
3461 | isChildAgent = avatar.IsChildAgent; | 3498 | isChildAgent = avatar.IsChildAgent; |
3462 | 3499 | ||
3463 | m_log.DebugFormat( | 3500 | m_log.DebugFormat( |
3464 | "[SCENE]: Removing {0} agent {1} {2} from {3}", | 3501 | "[SCENE]: Removing {0} agent {1} {2} from {3}", |
3465 | isChildAgent ? "child" : "root", avatar.Name, agentID, Name); | 3502 | isChildAgent ? "child" : "root", avatar.Name, agentID, Name); |
3466 | 3503 | ||
3467 | // 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 |
3468 | if (closeChildAgents && isChildAgent) | 3505 | if (closeChildAgents && isChildAgent) |
3469 | { | 3506 | { |
@@ -3471,20 +3508,20 @@ namespace OpenSim.Region.Framework.Scenes | |||
3471 | // Let's do this via UDP | 3508 | // Let's do this via UDP |
3472 | avatar.ControllingClient.SendShutdownConnectionNotice(); | 3509 | avatar.ControllingClient.SendShutdownConnectionNotice(); |
3473 | } | 3510 | } |
3474 | 3511 | ||
3475 | // Only applies to root agents. | 3512 | // Only applies to root agents. |
3476 | if (avatar.ParentID != 0) | 3513 | if (avatar.ParentID != 0) |
3477 | { | 3514 | { |
3478 | avatar.StandUp(); | 3515 | avatar.StandUp(); |
3479 | } | 3516 | } |
3480 | 3517 | ||
3481 | m_sceneGraph.removeUserCount(!isChildAgent); | 3518 | m_sceneGraph.removeUserCount(!isChildAgent); |
3482 | 3519 | ||
3483 | // 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 |
3484 | // 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 |
3485 | if (closeChildAgents && CapsModule != null) | 3522 | if (closeChildAgents && CapsModule != null) |
3486 | CapsModule.RemoveCaps(agentID); | 3523 | CapsModule.RemoveCaps(agentID); |
3487 | 3524 | ||
3488 | if (closeChildAgents && !isChildAgent) | 3525 | if (closeChildAgents && !isChildAgent) |
3489 | { | 3526 | { |
3490 | List<ulong> regions = avatar.KnownRegionHandles; | 3527 | List<ulong> regions = avatar.KnownRegionHandles; |
@@ -3493,10 +3530,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
3493 | // 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. |
3494 | m_sceneGridService.SendCloseChildAgentConnections(agentID, acd.SessionID.ToString(), regions); | 3531 | m_sceneGridService.SendCloseChildAgentConnections(agentID, acd.SessionID.ToString(), regions); |
3495 | } | 3532 | } |
3496 | 3533 | ||
3497 | m_eventManager.TriggerClientClosed(agentID, this); | 3534 | m_eventManager.TriggerClientClosed(agentID, this); |
3498 | m_eventManager.TriggerOnRemovePresence(agentID); | 3535 | m_eventManager.TriggerOnRemovePresence(agentID); |
3499 | 3536 | ||
3500 | if (!isChildAgent) | 3537 | if (!isChildAgent) |
3501 | { | 3538 | { |
3502 | if (AttachmentsModule != null) | 3539 | if (AttachmentsModule != null) |
@@ -3505,22 +3542,22 @@ namespace OpenSim.Region.Framework.Scenes | |||
3505 | } | 3542 | } |
3506 | 3543 | ||
3507 | ForEachClient( | 3544 | ForEachClient( |
3508 | delegate(IClientAPI client) | 3545 | delegate(IClientAPI client) |
3509 | { | 3546 | { |
3510 | //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 |
3511 | try { client.SendKillObject(new List<uint> { avatar.LocalId }); } | 3548 | try { client.SendKillObject(new List<uint> { avatar.LocalId }); } |
3512 | catch (NullReferenceException) { } | 3549 | catch (NullReferenceException) { } |
3513 | }); | 3550 | }); |
3514 | } | 3551 | } |
3515 | 3552 | ||
3516 | // 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. |
3517 | if (AgentTransactionsModule != null) | 3554 | if (AgentTransactionsModule != null) |
3518 | AgentTransactionsModule.RemoveAgentAssetTransactions(agentID); | 3555 | AgentTransactionsModule.RemoveAgentAssetTransactions(agentID); |
3519 | } | 3556 | } |
3520 | catch (Exception e) | 3557 | catch (Exception e) |
3521 | { | 3558 | { |
3522 | m_log.Error( | 3559 | m_log.Error( |
3523 | 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); |
3524 | } | 3561 | } |
3525 | finally | 3562 | finally |
3526 | { | 3563 | { |
@@ -3532,13 +3569,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
3532 | m_authenticateHandler.RemoveCircuit(agentID); | 3569 | m_authenticateHandler.RemoveCircuit(agentID); |
3533 | m_sceneGraph.RemoveScenePresence(agentID); | 3570 | m_sceneGraph.RemoveScenePresence(agentID); |
3534 | m_clientManager.Remove(agentID); | 3571 | m_clientManager.Remove(agentID); |
3535 | 3572 | ||
3536 | avatar.Close(); | 3573 | avatar.Close(); |
3537 | } | 3574 | } |
3538 | catch (Exception e) | 3575 | catch (Exception e) |
3539 | { | 3576 | { |
3540 | m_log.Error( | 3577 | m_log.Error( |
3541 | 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); |
3542 | } | 3579 | } |
3543 | } | 3580 | } |
3544 | } | 3581 | } |
@@ -3584,7 +3621,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3584 | if (part.ParentGroup != null && !part.ParentGroup.IsDeleted) // Valid | 3621 | if (part.ParentGroup != null && !part.ParentGroup.IsDeleted) // Valid |
3585 | { | 3622 | { |
3586 | if (part.ParentGroup.RootPart != part) // Child part | 3623 | if (part.ParentGroup.RootPart != part) // Child part |
3587 | continue; | 3624 | continue; |
3588 | } | 3625 | } |
3589 | } | 3626 | } |
3590 | deleteIDs.Add(localID); | 3627 | deleteIDs.Add(localID); |
@@ -3637,7 +3674,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3637 | 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) |
3638 | { | 3675 | { |
3639 | bool vialogin = ((teleportFlags & (uint)TPFlags.ViaLogin) != 0 || | 3676 | bool vialogin = ((teleportFlags & (uint)TPFlags.ViaLogin) != 0 || |
3640 | (teleportFlags & (uint)TPFlags.ViaHGLogin) != 0); | 3677 | (teleportFlags & (uint)TPFlags.ViaHGLogin) != 0); |
3641 | bool viahome = ((teleportFlags & (uint)TPFlags.ViaHome) != 0); | 3678 | bool viahome = ((teleportFlags & (uint)TPFlags.ViaHome) != 0); |
3642 | bool godlike = ((teleportFlags & (uint)TPFlags.Godlike) != 0); | 3679 | bool godlike = ((teleportFlags & (uint)TPFlags.Godlike) != 0); |
3643 | 3680 | ||
@@ -3653,18 +3690,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
3653 | // Don't disable this log message - it's too helpful | 3690 | // Don't disable this log message - it's too helpful |
3654 | string curViewer = Util.GetViewerName(acd); | 3691 | string curViewer = Util.GetViewerName(acd); |
3655 | m_log.DebugFormat( | 3692 | m_log.DebugFormat( |
3656 | "[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}", |
3657 | RegionInfo.RegionName, | 3694 | RegionInfo.RegionName, |
3658 | (acd.child ? "child" : "root"), | 3695 | (acd.child ? "child" : "root"), |
3659 | acd.firstname, | 3696 | acd.firstname, |
3660 | acd.lastname, | 3697 | acd.lastname, |
3661 | acd.AgentID, | 3698 | acd.AgentID, |
3662 | acd.circuitcode, | 3699 | acd.circuitcode, |
3663 | acd.IPAddress, | 3700 | acd.IPAddress, |
3664 | curViewer, | 3701 | curViewer, |
3665 | ((TPFlags)teleportFlags).ToString(), | 3702 | ((TPFlags)teleportFlags).ToString(), |
3666 | acd.startpos, | 3703 | acd.startpos, |
3667 | (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) |
3668 | ); | 3705 | ); |
3669 | 3706 | ||
3670 | if (!LoginsEnabled) | 3707 | if (!LoginsEnabled) |
@@ -3710,8 +3747,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
3710 | if (ViewerDenied) | 3747 | if (ViewerDenied) |
3711 | { | 3748 | { |
3712 | m_log.DebugFormat( | 3749 | m_log.DebugFormat( |
3713 | "[SCENE]: Access denied for {0} {1} using {2}", | 3750 | "[SCENE]: Access denied for {0} {1} using {2}", |
3714 | acd.firstname, acd.lastname, curViewer); | 3751 | acd.firstname, acd.lastname, curViewer); |
3715 | reason = "Access denied, your viewer is banned by the region owner"; | 3752 | reason = "Access denied, your viewer is banned by the region owner"; |
3716 | return false; | 3753 | return false; |
3717 | } | 3754 | } |
@@ -3725,13 +3762,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
3725 | 3762 | ||
3726 | // 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 |
3727 | // closed. | 3764 | // closed. |
3728 | if (sp != null && sp.IsChildAgent | 3765 | if (sp != null && sp.IsChildAgent |
3729 | && (sp.LifecycleState == ScenePresenceState.Running | 3766 | && (sp.LifecycleState == ScenePresenceState.Running |
3730 | || sp.LifecycleState == ScenePresenceState.PreRemove)) | 3767 | || sp.LifecycleState == ScenePresenceState.PreRemove)) |
3731 | { | 3768 | { |
3732 | m_log.DebugFormat( | 3769 | m_log.DebugFormat( |
3733 | "[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}", |
3734 | sp.Name, sp.LifecycleState, Name); | 3771 | sp.Name, sp.LifecycleState, Name); |
3735 | 3772 | ||
3736 | // 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 |
3737 | // 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 |
@@ -3743,15 +3780,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
3743 | // 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 |
3744 | // 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 |
3745 | // 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). |
3746 | // if (!acd.ChildrenCapSeeds.ContainsKey(RegionInfo.RegionHandle)) | 3783 | // if (!acd.ChildrenCapSeeds.ContainsKey(RegionInfo.RegionHandle)) |
3747 | // { | 3784 | // { |
3748 | // m_log.DebugFormat( | 3785 | // m_log.DebugFormat( |
3749 | // "[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.", |
3750 | // sp.Name, Name); | 3787 | // sp.Name, Name); |
3751 | // | 3788 | // |
3752 | // sp.DoNotCloseAfterTeleport = true; | 3789 | // sp.DoNotCloseAfterTeleport = true; |
3753 | // } | 3790 | // } |
3754 | // else if (EntityTransferModule.IsInTransit(sp.UUID)) | 3791 | // else if (EntityTransferModule.IsInTransit(sp.UUID)) |
3755 | 3792 | ||
3756 | sp.LifecycleState = ScenePresenceState.Running; | 3793 | sp.LifecycleState = ScenePresenceState.Running; |
3757 | 3794 | ||
@@ -3760,8 +3797,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
3760 | sp.DoNotCloseAfterTeleport = true; | 3797 | sp.DoNotCloseAfterTeleport = true; |
3761 | 3798 | ||
3762 | m_log.DebugFormat( | 3799 | m_log.DebugFormat( |
3763 | "[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.", |
3764 | sp.Name, Name); | 3801 | sp.Name, Name); |
3765 | } | 3802 | } |
3766 | } | 3803 | } |
3767 | } | 3804 | } |
@@ -3775,21 +3812,21 @@ namespace OpenSim.Region.Framework.Scenes | |||
3775 | int pollsLeft = polls; | 3812 | int pollsLeft = polls; |
3776 | 3813 | ||
3777 | while (sp.LifecycleState == ScenePresenceState.Removing && pollsLeft-- > 0) | 3814 | while (sp.LifecycleState == ScenePresenceState.Removing && pollsLeft-- > 0) |
3778 | Thread.Sleep(pollInterval); | 3815 | Thread.Sleep(pollInterval); |
3779 | 3816 | ||
3780 | if (sp.LifecycleState == ScenePresenceState.Removing) | 3817 | if (sp.LifecycleState == ScenePresenceState.Removing) |
3781 | { | 3818 | { |
3782 | m_log.WarnFormat( | 3819 | m_log.WarnFormat( |
3783 | "[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.", |
3784 | sp.Name, Name, polls * pollInterval / 1000); | 3821 | sp.Name, Name, polls * pollInterval / 1000); |
3785 | 3822 | ||
3786 | return false; | 3823 | return false; |
3787 | } | 3824 | } |
3788 | else if (polls != pollsLeft) | 3825 | else if (polls != pollsLeft) |
3789 | { | 3826 | { |
3790 | m_log.DebugFormat( | 3827 | m_log.DebugFormat( |
3791 | "[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.", |
3792 | sp.Name, Name, polls * pollInterval / 1000); | 3829 | sp.Name, Name, polls * pollInterval / 1000); |
3793 | } | 3830 | } |
3794 | } | 3831 | } |
3795 | 3832 | ||
@@ -3805,11 +3842,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
3805 | // 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. |
3806 | // Kill it. | 3843 | // Kill it. |
3807 | m_log.WarnFormat( | 3844 | m_log.WarnFormat( |
3808 | "[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.", |
3809 | sp.Name, sp.UUID, RegionInfo.RegionName); | 3846 | sp.Name, sp.UUID, RegionInfo.RegionName); |
3810 | 3847 | ||
3811 | if (sp.ControllingClient != null) | 3848 | if (sp.ControllingClient != null) |
3812 | CloseAgent(sp.UUID, true); | 3849 | CloseAgent(sp.UUID, true); |
3813 | 3850 | ||
3814 | sp = null; | 3851 | sp = null; |
3815 | } | 3852 | } |
@@ -3824,7 +3861,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3824 | m_authenticateHandler.AddNewCircuit(acd.circuitcode, acd); | 3861 | m_authenticateHandler.AddNewCircuit(acd.circuitcode, acd); |
3825 | 3862 | ||
3826 | land = LandChannel.GetLandObject(acd.startpos.X, acd.startpos.Y); | 3863 | land = LandChannel.GetLandObject(acd.startpos.X, acd.startpos.Y); |
3827 | 3864 | ||
3828 | // On login test land permisions | 3865 | // On login test land permisions |
3829 | if (vialogin) | 3866 | if (vialogin) |
3830 | { | 3867 | { |
@@ -3834,7 +3871,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3834 | return false; | 3871 | return false; |
3835 | } | 3872 | } |
3836 | } | 3873 | } |
3837 | 3874 | ||
3838 | 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 |
3839 | { | 3876 | { |
3840 | if (requirePresenceLookup) | 3877 | if (requirePresenceLookup) |
@@ -3850,13 +3887,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
3850 | catch (Exception e) | 3887 | catch (Exception e) |
3851 | { | 3888 | { |
3852 | m_log.ErrorFormat( | 3889 | m_log.ErrorFormat( |
3853 | "[SCENE]: Exception verifying presence {0}{1}", e.Message, e.StackTrace); | 3890 | "[SCENE]: Exception verifying presence {0}{1}", e.Message, e.StackTrace); |
3854 | 3891 | ||
3855 | m_authenticateHandler.RemoveCircuit(acd.circuitcode); | 3892 | m_authenticateHandler.RemoveCircuit(acd.circuitcode); |
3856 | return false; | 3893 | return false; |
3857 | } | 3894 | } |
3858 | } | 3895 | } |
3859 | 3896 | ||
3860 | try | 3897 | try |
3861 | { | 3898 | { |
3862 | if (!AuthorizeUser(acd, (vialogin ? false : SeeIntoRegion), out reason)) | 3899 | if (!AuthorizeUser(acd, (vialogin ? false : SeeIntoRegion), out reason)) |
@@ -3868,17 +3905,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
3868 | catch (Exception e) | 3905 | catch (Exception e) |
3869 | { | 3906 | { |
3870 | m_log.ErrorFormat( | 3907 | m_log.ErrorFormat( |
3871 | "[SCENE]: Exception authorizing user {0}{1}", e.Message, e.StackTrace); | 3908 | "[SCENE]: Exception authorizing user {0}{1}", e.Message, e.StackTrace); |
3872 | 3909 | ||
3873 | m_authenticateHandler.RemoveCircuit(acd.circuitcode); | 3910 | m_authenticateHandler.RemoveCircuit(acd.circuitcode); |
3874 | return false; | 3911 | return false; |
3875 | } | 3912 | } |
3876 | 3913 | ||
3877 | m_log.InfoFormat( | 3914 | m_log.InfoFormat( |
3878 | "[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})", |
3879 | Name, (acd.child ? "child" : "root"), acd.firstname, acd.lastname, | 3916 | Name, (acd.child ? "child" : "root"), acd.firstname, acd.lastname, |
3880 | acd.AgentID, acd.circuitcode); | 3917 | acd.AgentID, acd.circuitcode); |
3881 | 3918 | ||
3882 | if (CapsModule != null) | 3919 | if (CapsModule != null) |
3883 | { | 3920 | { |
3884 | CapsModule.SetAgentCapsSeeds(acd); | 3921 | CapsModule.SetAgentCapsSeeds(acd); |
@@ -3890,13 +3927,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
3890 | // 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 |
3891 | // uses down the line. | 3928 | // uses down the line. |
3892 | sp.TeleportFlags = (TPFlags)teleportFlags; | 3929 | sp.TeleportFlags = (TPFlags)teleportFlags; |
3893 | 3930 | ||
3894 | if (sp.IsChildAgent) | 3931 | if (sp.IsChildAgent) |
3895 | { | 3932 | { |
3896 | m_log.DebugFormat( | 3933 | m_log.DebugFormat( |
3897 | "[SCENE]: Adjusting known seeds for existing agent {0} in {1}", | 3934 | "[SCENE]: Adjusting known seeds for existing agent {0} in {1}", |
3898 | acd.AgentID, RegionInfo.RegionName); | 3935 | acd.AgentID, RegionInfo.RegionName); |
3899 | 3936 | ||
3900 | sp.AdjustKnownSeeds(); | 3937 | sp.AdjustKnownSeeds(); |
3901 | 3938 | ||
3902 | if (CapsModule != null) | 3939 | if (CapsModule != null) |
@@ -3915,7 +3952,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3915 | 3952 | ||
3916 | if (vialogin) | 3953 | if (vialogin) |
3917 | { | 3954 | { |
3918 | // CleanDroppedAttachments(); | 3955 | // CleanDroppedAttachments(); |
3919 | 3956 | ||
3920 | // 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) |
3921 | if (acd.startpos.X < 0) acd.startpos.X = 1f; | 3958 | if (acd.startpos.X < 0) acd.startpos.X = 1f; |
@@ -3923,14 +3960,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
3923 | if (acd.startpos.Y < 0) acd.startpos.Y = 1f; | 3960 | if (acd.startpos.Y < 0) acd.startpos.Y = 1f; |
3924 | 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; |
3925 | 3962 | ||
3926 | // m_log.DebugFormat( | 3963 | // m_log.DebugFormat( |
3927 | // "[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}", |
3928 | // RegionInfo.RegionSettings.TelehubObject, acd.Name, Name); | 3965 | // RegionInfo.RegionSettings.TelehubObject, acd.Name, Name); |
3929 | 3966 | ||
3930 | // Honor Estate teleport routing via Telehubs excluding ViaHome and GodLike TeleportFlags | 3967 | // Honor Estate teleport routing via Telehubs excluding ViaHome and GodLike TeleportFlags |
3931 | if (RegionInfo.RegionSettings.TelehubObject != UUID.Zero && | 3968 | if (RegionInfo.RegionSettings.TelehubObject != UUID.Zero && |
3932 | RegionInfo.EstateSettings.AllowDirectTeleport == false && | 3969 | RegionInfo.EstateSettings.AllowDirectTeleport == false && |
3933 | !viahome && !godlike) | 3970 | !viahome && !godlike) |
3934 | { | 3971 | { |
3935 | SceneObjectGroup telehub = GetSceneObjectGroup(RegionInfo.RegionSettings.TelehubObject); | 3972 | SceneObjectGroup telehub = GetSceneObjectGroup(RegionInfo.RegionSettings.TelehubObject); |
3936 | 3973 | ||
@@ -3942,15 +3979,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
3942 | { | 3979 | { |
3943 | // 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 |
3944 | if (SpawnPointRouting == "random") | 3981 | if (SpawnPointRouting == "random") |
3945 | acd.startpos = spawnpoints[Util.RandomClass.Next(spawnpoints.Count) - 1].GetLocation( | 3982 | acd.startpos = spawnpoints[Util.RandomClass.Next(spawnpoints.Count) - 1].GetLocation( |
3946 | telehub.AbsolutePosition, | 3983 | telehub.AbsolutePosition, |
3947 | telehub.GroupRotation | 3984 | telehub.GroupRotation |
3948 | ); | 3985 | ); |
3949 | else | 3986 | else |
3950 | acd.startpos = spawnpoints[SpawnPoint()].GetLocation( | 3987 | acd.startpos = spawnpoints[SpawnPoint()].GetLocation( |
3951 | telehub.AbsolutePosition, | 3988 | telehub.AbsolutePosition, |
3952 | telehub.GroupRotation | 3989 | telehub.GroupRotation |
3953 | ); | 3990 | ); |
3954 | } | 3991 | } |
3955 | else if (spawnpoints.Count == 1) | 3992 | else if (spawnpoints.Count == 1) |
3956 | { | 3993 | { |
@@ -3960,15 +3997,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
3960 | else | 3997 | else |
3961 | { | 3998 | { |
3962 | m_log.DebugFormat( | 3999 | m_log.DebugFormat( |
3963 | "[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.", |
3964 | RegionInfo.RegionSettings.TelehubObject, acd.Name, Name); | 4001 | RegionInfo.RegionSettings.TelehubObject, acd.Name, Name); |
3965 | } | 4002 | } |
3966 | } | 4003 | } |
3967 | else | 4004 | else |
3968 | { | 4005 | { |
3969 | m_log.DebugFormat( | 4006 | m_log.DebugFormat( |
3970 | "[SCENE]: No telehub {0} found to direct {1} in {2}. Continuing.", | 4007 | "[SCENE]: No telehub {0} found to direct {1} in {2}. Continuing.", |
3971 | RegionInfo.RegionSettings.TelehubObject, acd.Name, Name); | 4008 | RegionInfo.RegionSettings.TelehubObject, acd.Name, Name); |
3972 | } | 4009 | } |
3973 | 4010 | ||
3974 | // 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 |
@@ -4005,7 +4042,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4005 | { | 4042 | { |
4006 | ILandObject land = LandChannel.GetLandObject(pos); | 4043 | ILandObject land = LandChannel.GetLandObject(pos); |
4007 | if (land == null) | 4044 | if (land == null) |
4008 | return true; | 4045 | return true; |
4009 | 4046 | ||
4010 | if (land.IsBannedFromLand(agentID) || land.IsRestrictedFromLand(agentID)) | 4047 | if (land.IsBannedFromLand(agentID) || land.IsRestrictedFromLand(agentID)) |
4011 | { | 4048 | { |
@@ -4019,21 +4056,21 @@ namespace OpenSim.Region.Framework.Scenes | |||
4019 | 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) |
4020 | { | 4057 | { |
4021 | if (posX < 0) | 4058 | if (posX < 0) |
4022 | posX = 0; | 4059 | posX = 0; |
4023 | else if (posX >= (float)RegionInfo.RegionSizeX) | 4060 | else if (posX >= (float)RegionInfo.RegionSizeX) |
4024 | posX = (float)RegionInfo.RegionSizeX - 0.001f; | 4061 | posX = (float)RegionInfo.RegionSizeX - 0.001f; |
4025 | if (posY < 0) | 4062 | if (posY < 0) |
4026 | posY = 0; | 4063 | posY = 0; |
4027 | else if (posY >= (float)RegionInfo.RegionSizeY) | 4064 | else if (posY >= (float)RegionInfo.RegionSizeY) |
4028 | posY = (float)RegionInfo.RegionSizeY - 0.001f; | 4065 | posY = (float)RegionInfo.RegionSizeY - 0.001f; |
4029 | 4066 | ||
4030 | reason = String.Empty; | 4067 | reason = String.Empty; |
4031 | if (Permissions.IsGod(agentID)) | 4068 | if (Permissions.IsGod(agentID)) |
4032 | return true; | 4069 | return true; |
4033 | 4070 | ||
4034 | ILandObject land = LandChannel.GetLandObject(posX, posY); | 4071 | ILandObject land = LandChannel.GetLandObject(posX, posY); |
4035 | if (land == null) | 4072 | if (land == null) |
4036 | return false; | 4073 | return false; |
4037 | 4074 | ||
4038 | bool banned = land.IsBannedFromLand(agentID); | 4075 | bool banned = land.IsBannedFromLand(agentID); |
4039 | bool restricted = land.IsRestrictedFromLand(agentID); | 4076 | bool restricted = land.IsRestrictedFromLand(agentID); |
@@ -4057,7 +4094,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4057 | else | 4094 | else |
4058 | { | 4095 | { |
4059 | 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.", |
4060 | RegionInfo.RegionName); | 4097 | RegionInfo.RegionName); |
4061 | } | 4098 | } |
4062 | return false; | 4099 | return false; |
4063 | } | 4100 | } |
@@ -4108,15 +4145,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
4108 | 4145 | ||
4109 | if (!m_strictAccessControl) return true; | 4146 | if (!m_strictAccessControl) return true; |
4110 | if (Permissions.IsGod(agent.AgentID)) return true; | 4147 | if (Permissions.IsGod(agent.AgentID)) return true; |
4111 | 4148 | ||
4112 | if (AuthorizationService != null) | 4149 | if (AuthorizationService != null) |
4113 | { | 4150 | { |
4114 | if (!AuthorizationService.IsAuthorizedForRegion( | 4151 | if (!AuthorizationService.IsAuthorizedForRegion( |
4115 | 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)) |
4116 | { | 4153 | { |
4117 | 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}", |
4118 | agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName, reason); | 4155 | agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName, reason); |
4119 | 4156 | ||
4120 | return false; | 4157 | return false; |
4121 | } | 4158 | } |
4122 | } | 4159 | } |
@@ -4132,9 +4169,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
4132 | if (RegionInfo.EstateSettings.IsBanned(agent.AgentID)) | 4169 | if (RegionInfo.EstateSettings.IsBanned(agent.AgentID)) |
4133 | { | 4170 | { |
4134 | 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", |
4135 | agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName); | 4172 | agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName); |
4136 | 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.", |
4137 | RegionInfo.RegionName); | 4174 | RegionInfo.RegionName); |
4138 | return false; | 4175 | return false; |
4139 | } | 4176 | } |
4140 | } | 4177 | } |
@@ -4152,7 +4189,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4152 | if (GroupMembership != null) | 4189 | if (GroupMembership != null) |
4153 | { | 4190 | { |
4154 | for (int i = 0; i < GroupMembership.Length; i++) | 4191 | for (int i = 0; i < GroupMembership.Length; i++) |
4155 | agentGroups.Add(GroupMembership[i].GroupID); | 4192 | agentGroups.Add(GroupMembership[i].GroupID); |
4156 | } | 4193 | } |
4157 | else | 4194 | else |
4158 | { | 4195 | { |
@@ -4180,13 +4217,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
4180 | } | 4217 | } |
4181 | 4218 | ||
4182 | if (!RegionInfo.EstateSettings.PublicAccess && | 4219 | if (!RegionInfo.EstateSettings.PublicAccess && |
4183 | !RegionInfo.EstateSettings.HasAccess(agent.AgentID) && | 4220 | !RegionInfo.EstateSettings.HasAccess(agent.AgentID) && |
4184 | !groupAccess) | 4221 | !groupAccess) |
4185 | { | 4222 | { |
4186 | 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", |
4187 | agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName); | 4224 | agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName); |
4188 | 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.", |
4189 | RegionInfo.RegionName); | 4226 | RegionInfo.RegionName); |
4190 | return false; | 4227 | return false; |
4191 | } | 4228 | } |
4192 | } | 4229 | } |
@@ -4242,69 +4279,69 @@ namespace OpenSim.Region.Framework.Scenes | |||
4242 | return m_authenticateHandler.TryChangeCiruitCode(oldcc, newcc); | 4279 | return m_authenticateHandler.TryChangeCiruitCode(oldcc, newcc); |
4243 | } | 4280 | } |
4244 | 4281 | ||
4245 | // /// <summary> | 4282 | // /// <summary> |
4246 | // /// 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. |
4247 | // /// </summary> | 4284 | // /// </summary> |
4248 | // /// <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> |
4249 | // /// <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> |
4250 | // /// <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> |
4251 | // public void HandleLogOffUserFromGrid(UUID AvatarID, UUID RegionSecret, string message) | 4288 | // public void HandleLogOffUserFromGrid(UUID AvatarID, UUID RegionSecret, string message) |
4252 | // { | 4289 | // { |
4253 | // ScenePresence loggingOffUser = GetScenePresence(AvatarID); | 4290 | // ScenePresence loggingOffUser = GetScenePresence(AvatarID); |
4254 | // if (loggingOffUser != null) | 4291 | // if (loggingOffUser != null) |
4255 | // { | 4292 | // { |
4256 | // UUID localRegionSecret = UUID.Zero; | 4293 | // UUID localRegionSecret = UUID.Zero; |
4257 | // bool parsedsecret = UUID.TryParse(RegionInfo.regionSecret, out localRegionSecret); | 4294 | // bool parsedsecret = UUID.TryParse(RegionInfo.regionSecret, out localRegionSecret); |
4258 | // | 4295 | // |
4259 | // // 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. |
4260 | // // 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. |
4261 | // | 4298 | // |
4262 | // if (RegionSecret == loggingOffUser.ControllingClient.SecureSessionId || (parsedsecret && RegionSecret == localRegionSecret)) | 4299 | // if (RegionSecret == loggingOffUser.ControllingClient.SecureSessionId || (parsedsecret && RegionSecret == localRegionSecret)) |
4263 | // { | 4300 | // { |
4264 | // m_sceneGridService.SendCloseChildAgentConnections(loggingOffUser.UUID, loggingOffUser.KnownRegionHandles); | 4301 | // m_sceneGridService.SendCloseChildAgentConnections(loggingOffUser.UUID, loggingOffUser.KnownRegionHandles); |
4265 | // loggingOffUser.ControllingClient.Kick(message); | 4302 | // loggingOffUser.ControllingClient.Kick(message); |
4266 | // // Give them a second to receive the message! | 4303 | // // Give them a second to receive the message! |
4267 | // Thread.Sleep(1000); | 4304 | // Thread.Sleep(1000); |
4268 | // loggingOffUser.ControllingClient.Close(); | 4305 | // loggingOffUser.ControllingClient.Close(); |
4269 | // } | 4306 | // } |
4270 | // else | 4307 | // else |
4271 | // { | 4308 | // { |
4272 | // 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"); |
4273 | // } | 4310 | // } |
4274 | // } | 4311 | // } |
4275 | // else | 4312 | // else |
4276 | // { | 4313 | // { |
4277 | // 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()); |
4278 | // } | 4315 | // } |
4279 | // } | 4316 | // } |
4280 | 4317 | ||
4281 | // /// <summary> | 4318 | // /// <summary> |
4282 | // /// 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. |
4283 | // /// </summary> | 4320 | // /// </summary> |
4284 | // /// <param name="agentID"></param> | 4321 | // /// <param name="agentID"></param> |
4285 | // /// <param name="position"></param> | 4322 | // /// <param name="position"></param> |
4286 | // /// <param name="isFlying"></param> | 4323 | // /// <param name="isFlying"></param> |
4287 | // public virtual void AgentCrossing(UUID agentID, Vector3 position, bool isFlying) | 4324 | // public virtual void AgentCrossing(UUID agentID, Vector3 position, bool isFlying) |
4288 | // { | 4325 | // { |
4289 | // ScenePresence presence = GetScenePresence(agentID); | 4326 | // ScenePresence presence = GetScenePresence(agentID); |
4290 | // if (presence != null) | 4327 | // if (presence != null) |
4291 | // { | 4328 | // { |
4292 | // try | 4329 | // try |
4293 | // { | 4330 | // { |
4294 | // presence.MakeRootAgent(position, isFlying); | 4331 | // presence.MakeRootAgent(position, isFlying); |
4295 | // } | 4332 | // } |
4296 | // catch (Exception e) | 4333 | // catch (Exception e) |
4297 | // { | 4334 | // { |
4298 | // 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); |
4299 | // } | 4336 | // } |
4300 | // } | 4337 | // } |
4301 | // else | 4338 | // else |
4302 | // { | 4339 | // { |
4303 | // m_log.ErrorFormat( | 4340 | // m_log.ErrorFormat( |
4304 | // "[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}", |
4305 | // agentID, RegionInfo.RegionName); | 4342 | // agentID, RegionInfo.RegionName); |
4306 | // } | 4343 | // } |
4307 | // } | 4344 | // } |
4308 | 4345 | ||
4309 | /// <summary> | 4346 | /// <summary> |
4310 | /// 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, |
@@ -4316,15 +4353,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
4316 | public virtual bool IncomingUpdateChildAgent(AgentData cAgentData) | 4353 | public virtual bool IncomingUpdateChildAgent(AgentData cAgentData) |
4317 | { | 4354 | { |
4318 | m_log.DebugFormat( | 4355 | m_log.DebugFormat( |
4319 | "[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); |
4320 | 4357 | ||
4321 | // TODO: This check should probably be in QueryAccess(). | 4358 | // TODO: This check should probably be in QueryAccess(). |
4322 | ILandObject nearestParcel = GetNearestAllowedParcel(cAgentData.AgentID, RegionInfo.RegionSizeX / 2, RegionInfo.RegionSizeY / 2); | 4359 | ILandObject nearestParcel = GetNearestAllowedParcel(cAgentData.AgentID, RegionInfo.RegionSizeX / 2, RegionInfo.RegionSizeY / 2); |
4323 | if (nearestParcel == null) | 4360 | if (nearestParcel == null) |
4324 | { | 4361 | { |
4325 | m_log.InfoFormat( | 4362 | m_log.InfoFormat( |
4326 | "[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", |
4327 | cAgentData.AgentID, RegionInfo.RegionName); | 4364 | cAgentData.AgentID, RegionInfo.RegionName); |
4328 | 4365 | ||
4329 | return false; | 4366 | return false; |
4330 | } | 4367 | } |
@@ -4340,11 +4377,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
4340 | if (cAgentData.SessionID != sp.ControllingClient.SessionId) | 4377 | if (cAgentData.SessionID != sp.ControllingClient.SessionId) |
4341 | { | 4378 | { |
4342 | m_log.WarnFormat( | 4379 | m_log.WarnFormat( |
4343 | "[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).", |
4344 | sp.UUID, cAgentData.SessionID); | 4381 | sp.UUID, cAgentData.SessionID); |
4345 | 4382 | ||
4346 | 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}", |
4347 | sp.UUID, sp.ControllingClient.SessionId, cAgentData.SessionID)); | 4384 | sp.UUID, sp.ControllingClient.SessionId, cAgentData.SessionID)); |
4348 | } | 4385 | } |
4349 | 4386 | ||
4350 | sp.UpdateChildAgent(cAgentData); | 4387 | sp.UpdateChildAgent(cAgentData); |
@@ -4353,19 +4390,19 @@ namespace OpenSim.Region.Framework.Scenes | |||
4353 | if (cAgentData.SenderWantsToWaitForRoot) | 4390 | if (cAgentData.SenderWantsToWaitForRoot) |
4354 | { | 4391 | { |
4355 | while (sp.IsChildAgent && ntimes-- > 0) | 4392 | while (sp.IsChildAgent && ntimes-- > 0) |
4356 | Thread.Sleep(1000); | 4393 | Thread.Sleep(1000); |
4357 | 4394 | ||
4358 | if (sp.IsChildAgent) | 4395 | if (sp.IsChildAgent) |
4359 | m_log.WarnFormat( | 4396 | m_log.WarnFormat( |
4360 | "[SCENE]: Found presence {0} {1} unexpectedly still child in {2}", | 4397 | "[SCENE]: Found presence {0} {1} unexpectedly still child in {2}", |
4361 | sp.Name, sp.UUID, Name); | 4398 | sp.Name, sp.UUID, Name); |
4362 | else | 4399 | else |
4363 | m_log.InfoFormat( | 4400 | m_log.InfoFormat( |
4364 | "[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", |
4365 | sp.Name, sp.UUID, Name, 20 - ntimes); | 4402 | sp.Name, sp.UUID, Name, 20 - ntimes); |
4366 | 4403 | ||
4367 | if (sp.IsChildAgent) | 4404 | if (sp.IsChildAgent) |
4368 | return false; | 4405 | return false; |
4369 | } | 4406 | } |
4370 | 4407 | ||
4371 | return true; | 4408 | return true; |
@@ -4382,17 +4419,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
4382 | /// <returns>true if we handled it.</returns> | 4419 | /// <returns>true if we handled it.</returns> |
4383 | public virtual bool IncomingUpdateChildAgent(AgentPosition cAgentData) | 4420 | public virtual bool IncomingUpdateChildAgent(AgentPosition cAgentData) |
4384 | { | 4421 | { |
4385 | // m_log.DebugFormat( | 4422 | // m_log.DebugFormat( |
4386 | // "[SCENE PRESENCE]: IncomingChildAgentDataUpdate POSITION for {0} in {1}, position {2}", | 4423 | // "[SCENE PRESENCE]: IncomingChildAgentDataUpdate POSITION for {0} in {1}, position {2}", |
4387 | // cAgentData.AgentID, Name, cAgentData.Position); | 4424 | // cAgentData.AgentID, Name, cAgentData.Position); |
4388 | 4425 | ||
4389 | ScenePresence childAgentUpdate = GetScenePresence(cAgentData.AgentID); | 4426 | ScenePresence childAgentUpdate = GetScenePresence(cAgentData.AgentID); |
4390 | if (childAgentUpdate != null) | 4427 | if (childAgentUpdate != null) |
4391 | { | 4428 | { |
4392 | // if (childAgentUpdate.ControllingClient.SessionId != cAgentData.SessionID) | 4429 | // if (childAgentUpdate.ControllingClient.SessionId != cAgentData.SessionID) |
4393 | // // Only warn for now | 4430 | // // Only warn for now |
4394 | // 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?", |
4395 | // childAgentUpdate.UUID, cAgentData.SessionID); | 4432 | // childAgentUpdate.UUID, cAgentData.SessionID); |
4396 | 4433 | ||
4397 | // 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.. |
4398 | // however to avoid a race condition crossing borders.. | 4435 | // however to avoid a race condition crossing borders.. |
@@ -4424,12 +4461,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
4424 | int ntimes = 20; | 4461 | int ntimes = 20; |
4425 | ScenePresence sp = null; | 4462 | ScenePresence sp = null; |
4426 | while ((sp = GetScenePresence(agentID)) == null && (ntimes-- > 0)) | 4463 | while ((sp = GetScenePresence(agentID)) == null && (ntimes-- > 0)) |
4427 | Thread.Sleep(1000); | 4464 | Thread.Sleep(1000); |
4428 | 4465 | ||
4429 | if (sp == null) | 4466 | if (sp == null) |
4430 | m_log.WarnFormat( | 4467 | m_log.WarnFormat( |
4431 | "[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", |
4432 | agentID, RegionInfo.RegionName); | 4469 | agentID, RegionInfo.RegionName); |
4433 | 4470 | ||
4434 | return sp; | 4471 | return sp; |
4435 | } | 4472 | } |
@@ -4451,8 +4488,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
4451 | if (acd == null) | 4488 | if (acd == null) |
4452 | { | 4489 | { |
4453 | m_log.DebugFormat( | 4490 | m_log.DebugFormat( |
4454 | "[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.", |
4455 | agentID, Name); | 4492 | agentID, Name); |
4456 | 4493 | ||
4457 | return false; | 4494 | return false; |
4458 | } | 4495 | } |
@@ -4464,8 +4501,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
4464 | else | 4501 | else |
4465 | { | 4502 | { |
4466 | m_log.WarnFormat( | 4503 | m_log.WarnFormat( |
4467 | "[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}", |
4468 | agentID, auth_token, Name); | 4505 | agentID, auth_token, Name); |
4469 | } | 4506 | } |
4470 | 4507 | ||
4471 | return false; | 4508 | return false; |
@@ -4491,8 +4528,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
4491 | if (sp.DoNotCloseAfterTeleport) | 4528 | if (sp.DoNotCloseAfterTeleport) |
4492 | { | 4529 | { |
4493 | m_log.DebugFormat( | 4530 | m_log.DebugFormat( |
4494 | "[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", |
4495 | sp.IsChildAgent ? "child" : "root", sp.Name, Name); | 4532 | sp.IsChildAgent ? "child" : "root", sp.Name, Name); |
4496 | 4533 | ||
4497 | // 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. |
4498 | sp.DoNotCloseAfterTeleport = false; | 4535 | sp.DoNotCloseAfterTeleport = false; |
@@ -4503,8 +4540,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
4503 | if (sp.LifecycleState != ScenePresenceState.Running) | 4540 | if (sp.LifecycleState != ScenePresenceState.Running) |
4504 | { | 4541 | { |
4505 | m_log.DebugFormat( | 4542 | m_log.DebugFormat( |
4506 | "[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}", |
4507 | sp.Name, Name, sp.LifecycleState); | 4544 | sp.Name, Name, sp.LifecycleState); |
4508 | 4545 | ||
4509 | return false; | 4546 | return false; |
4510 | } | 4547 | } |
@@ -4530,21 +4567,21 @@ namespace OpenSim.Region.Framework.Scenes | |||
4530 | lock (m_removeClientLock) | 4567 | lock (m_removeClientLock) |
4531 | { | 4568 | { |
4532 | sp = GetScenePresence(agentID); | 4569 | sp = GetScenePresence(agentID); |
4533 | 4570 | ||
4534 | if (sp == null) | 4571 | if (sp == null) |
4535 | { | 4572 | { |
4536 | m_log.DebugFormat( | 4573 | m_log.DebugFormat( |
4537 | "[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}", |
4538 | agentID, Name); | 4575 | agentID, Name); |
4539 | 4576 | ||
4540 | return false; | 4577 | return false; |
4541 | } | 4578 | } |
4542 | 4579 | ||
4543 | if (sp.LifecycleState != ScenePresenceState.Running && sp.LifecycleState != ScenePresenceState.PreRemove) | 4580 | if (sp.LifecycleState != ScenePresenceState.Running && sp.LifecycleState != ScenePresenceState.PreRemove) |
4544 | { | 4581 | { |
4545 | m_log.DebugFormat( | 4582 | m_log.DebugFormat( |
4546 | "[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}", |
4547 | sp.Name, Name, sp.LifecycleState); | 4584 | sp.Name, Name, sp.LifecycleState); |
4548 | 4585 | ||
4549 | return false; | 4586 | return false; |
4550 | } | 4587 | } |
@@ -4555,8 +4592,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
4555 | if (sp.DoNotCloseAfterTeleport) | 4592 | if (sp.DoNotCloseAfterTeleport) |
4556 | { | 4593 | { |
4557 | m_log.DebugFormat( | 4594 | m_log.DebugFormat( |
4558 | "[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", |
4559 | sp.IsChildAgent ? "child" : "root", sp.Name, Name); | 4596 | sp.IsChildAgent ? "child" : "root", sp.Name, Name); |
4560 | 4597 | ||
4561 | // 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. |
4562 | sp.DoNotCloseAfterTeleport = false; | 4599 | sp.DoNotCloseAfterTeleport = false; |
@@ -4584,7 +4621,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4584 | /// <param name="lookAt"></param> | 4621 | /// <param name="lookAt"></param> |
4585 | /// <param name="teleportFlags"></param> | 4622 | /// <param name="teleportFlags"></param> |
4586 | public void RequestTeleportLocation(IClientAPI remoteClient, string regionName, Vector3 position, | 4623 | public void RequestTeleportLocation(IClientAPI remoteClient, string regionName, Vector3 position, |
4587 | Vector3 lookat, uint teleportFlags) | 4624 | Vector3 lookat, uint teleportFlags) |
4588 | { | 4625 | { |
4589 | GridRegion region = GridService.GetRegionByName(RegionInfo.ScopeID, regionName); | 4626 | GridRegion region = GridService.GetRegionByName(RegionInfo.ScopeID, regionName); |
4590 | 4627 | ||
@@ -4607,7 +4644,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4607 | /// <param name="lookAt"></param> | 4644 | /// <param name="lookAt"></param> |
4608 | /// <param name="teleportFlags"></param> | 4645 | /// <param name="teleportFlags"></param> |
4609 | public void RequestTeleportLocation(IClientAPI remoteClient, ulong regionHandle, Vector3 position, | 4646 | public void RequestTeleportLocation(IClientAPI remoteClient, ulong regionHandle, Vector3 position, |
4610 | Vector3 lookAt, uint teleportFlags) | 4647 | Vector3 lookAt, uint teleportFlags) |
4611 | { | 4648 | { |
4612 | ScenePresence sp = GetScenePresence(remoteClient.AgentId); | 4649 | ScenePresence sp = GetScenePresence(remoteClient.AgentId); |
4613 | if (sp != null) | 4650 | if (sp != null) |
@@ -4706,8 +4743,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
4706 | if (part.Name == cmdparams[2]) | 4743 | if (part.Name == cmdparams[2]) |
4707 | { | 4744 | { |
4708 | part.Resize( | 4745 | part.Resize( |
4709 | new Vector3(Convert.ToSingle(cmdparams[3]), Convert.ToSingle(cmdparams[4]), | 4746 | new Vector3(Convert.ToSingle(cmdparams[3]), Convert.ToSingle(cmdparams[4]), |
4710 | Convert.ToSingle(cmdparams[5]))); | 4747 | Convert.ToSingle(cmdparams[5]))); |
4711 | 4748 | ||
4712 | m_log.DebugFormat("Edited scale of Primitive: {0}", part.Name); | 4749 | m_log.DebugFormat("Edited scale of Primitive: {0}", part.Name); |
4713 | } | 4750 | } |
@@ -4752,7 +4789,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4752 | 4789 | ||
4753 | #region Script Engine | 4790 | #region Script Engine |
4754 | 4791 | ||
4755 | private bool ScriptDanger(SceneObjectPart part,Vector3 pos) | 4792 | private bool ScriptDanger(SceneObjectPart part, Vector3 pos) |
4756 | { | 4793 | { |
4757 | ILandObject parcel = LandChannel.GetLandObject(pos.X, pos.Y); | 4794 | ILandObject parcel = LandChannel.GetLandObject(pos.X, pos.Y); |
4758 | if (part != null) | 4795 | if (part != null) |
@@ -4768,7 +4805,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4768 | return true; | 4805 | return true; |
4769 | } | 4806 | } |
4770 | else if (((parcel.LandData.Flags & (uint)ParcelFlags.AllowGroupScripts) != 0) | 4807 | else if (((parcel.LandData.Flags & (uint)ParcelFlags.AllowGroupScripts) != 0) |
4771 | && (parcel.LandData.GroupID != UUID.Zero) && (parcel.LandData.GroupID == part.GroupID)) | 4808 | && (parcel.LandData.GroupID != UUID.Zero) && (parcel.LandData.GroupID == part.GroupID)) |
4772 | { | 4809 | { |
4773 | return true; | 4810 | return true; |
4774 | } | 4811 | } |
@@ -5110,15 +5147,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
5110 | #endregion | 5147 | #endregion |
5111 | 5148 | ||
5112 | 5149 | ||
5113 | // 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 |
5114 | // public bool NeedSceneCacheClear(UUID agentID) | 5151 | // public bool NeedSceneCacheClear(UUID agentID) |
5115 | // { | 5152 | // { |
5116 | // IInventoryTransferModule inv = RequestModuleInterface<IInventoryTransferModule>(); | 5153 | // IInventoryTransferModule inv = RequestModuleInterface<IInventoryTransferModule>(); |
5117 | // if (inv == null) | 5154 | // if (inv == null) |
5118 | // return true; | 5155 | // return true; |
5119 | // | 5156 | // |
5120 | // return inv.NeedSceneCacheClear(agentID, this); | 5157 | // return inv.NeedSceneCacheClear(agentID, this); |
5121 | // } | 5158 | // } |
5122 | 5159 | ||
5123 | public void CleanTempObjects() | 5160 | public void CleanTempObjects() |
5124 | { | 5161 | { |
@@ -5134,7 +5171,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
5134 | if ((grp.RootPart.Flags & PrimFlags.TemporaryOnRez) != 0) | 5171 | if ((grp.RootPart.Flags & PrimFlags.TemporaryOnRez) != 0) |
5135 | { | 5172 | { |
5136 | if (grp.RootPart.Expires <= DateTime.Now) | 5173 | if (grp.RootPart.Expires <= DateTime.Now) |
5137 | DeleteSceneObject(grp, false); | 5174 | DeleteSceneObject(grp, false); |
5138 | } | 5175 | } |
5139 | } | 5176 | } |
5140 | } | 5177 | } |
@@ -5160,21 +5197,21 @@ namespace OpenSim.Region.Framework.Scenes | |||
5160 | // 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 |
5161 | // which can be seen as positive confirmation of sim health | 5198 | // which can be seen as positive confirmation of sim health |
5162 | // | 5199 | // |
5163 | int health=1; // Start at 1, means we're up | 5200 | int health = 1; // Start at 1, means we're up |
5164 | 5201 | ||
5165 | if ((Util.EnvironmentTickCountSubtract(m_lastFrameTick)) < 1000) | 5202 | if ((Util.EnvironmentTickCountSubtract(m_lastFrameTick)) < 1000) |
5166 | health += 1; | 5203 | health += 1; |
5167 | else | 5204 | else |
5168 | return health; | 5205 | return health; |
5169 | 5206 | ||
5170 | // 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 |
5171 | // | 5208 | // |
5172 | if ((Util.EnvironmentTickCountSubtract(m_LastLogin)) < 240000) | 5209 | if ((Util.EnvironmentTickCountSubtract(m_LastLogin)) < 240000) |
5173 | health++; | 5210 | health++; |
5174 | else | 5211 | else |
5175 | return health; | 5212 | return health; |
5176 | 5213 | ||
5177 | // CheckHeartbeat(); | 5214 | // CheckHeartbeat(); |
5178 | 5215 | ||
5179 | return health; | 5216 | return health; |
5180 | } | 5217 | } |
@@ -5204,41 +5241,41 @@ namespace OpenSim.Region.Framework.Scenes | |||
5204 | jointProxyObject.AngularVelocity = trackedBody.AngularVelocity; | 5241 | jointProxyObject.AngularVelocity = trackedBody.AngularVelocity; |
5205 | switch (joint.Type) | 5242 | switch (joint.Type) |
5206 | { | 5243 | { |
5207 | case PhysicsJointType.Ball: | 5244 | case PhysicsJointType.Ball: |
5208 | { | 5245 | { |
5209 | Vector3 jointAnchor = PhysicsScene.GetJointAnchor(joint); | 5246 | Vector3 jointAnchor = PhysicsScene.GetJointAnchor(joint); |
5210 | Vector3 proxyPos = jointAnchor; | 5247 | Vector3 proxyPos = jointAnchor; |
5211 | 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 |
5212 | } | 5249 | } |
5213 | break; | 5250 | break; |
5214 | 5251 | ||
5215 | case PhysicsJointType.Hinge: | 5252 | case PhysicsJointType.Hinge: |
5216 | { | 5253 | { |
5217 | Vector3 jointAnchor = PhysicsScene.GetJointAnchor(joint); | 5254 | Vector3 jointAnchor = PhysicsScene.GetJointAnchor(joint); |
5218 | 5255 | ||
5219 | // 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. |
5220 | // 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 |
5221 | // 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. |
5222 | // Therefore the following call does not always work: | 5259 | // Therefore the following call does not always work: |
5223 | //PhysicsVector phyJointAxis = _PhyScene.GetJointAxis(joint); | 5260 | //PhysicsVector phyJointAxis = _PhyScene.GetJointAxis(joint); |
5224 | 5261 | ||
5225 | // 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 |
5226 | // relative to one of the jointed bodies, and applying this transformation | 5263 | // relative to one of the jointed bodies, and applying this transformation |
5227 | // 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 |
5228 | // current joint orientation. | 5265 | // current joint orientation. |
5229 | 5266 | ||
5230 | if (joint.TrackedBodyName == null) | 5267 | if (joint.TrackedBodyName == null) |
5231 | { | 5268 | { |
5232 | jointErrorMessage(joint, "joint.TrackedBodyName is null, joint " + joint.ObjectNameInScene); | 5269 | jointErrorMessage(joint, "joint.TrackedBodyName is null, joint " + joint.ObjectNameInScene); |
5233 | } | 5270 | } |
5234 | 5271 | ||
5235 | Vector3 proxyPos = jointAnchor; | 5272 | Vector3 proxyPos = jointAnchor; |
5236 | Quaternion q = trackedBody.RotationOffset * joint.LocalRotation; | 5273 | Quaternion q = trackedBody.RotationOffset * joint.LocalRotation; |
5237 | 5274 | ||
5238 | 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 |
5239 | 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 |
5240 | } | 5277 | } |
5241 | break; | 5278 | break; |
5242 | } | 5279 | } |
5243 | } | 5280 | } |
5244 | 5281 | ||
@@ -5279,30 +5316,30 @@ namespace OpenSim.Region.Framework.Scenes | |||
5279 | if (joint != null) | 5316 | if (joint != null) |
5280 | { | 5317 | { |
5281 | if (joint.ErrorMessageCount > PhysicsJoint.maxErrorMessages) | 5318 | if (joint.ErrorMessageCount > PhysicsJoint.maxErrorMessages) |
5282 | return; | 5319 | return; |
5283 | 5320 | ||
5284 | SceneObjectPart jointProxyObject = GetSceneObjectPart(joint.ObjectNameInScene); | 5321 | SceneObjectPart jointProxyObject = GetSceneObjectPart(joint.ObjectNameInScene); |
5285 | if (jointProxyObject != null) | 5322 | if (jointProxyObject != null) |
5286 | { | 5323 | { |
5287 | SimChat(Utils.StringToBytes("[NINJA]: " + message), | 5324 | SimChat(Utils.StringToBytes("[NINJA]: " + message), |
5288 | ChatTypeEnum.DebugChannel, | 5325 | ChatTypeEnum.DebugChannel, |
5289 | 2147483647, | 5326 | 2147483647, |
5290 | jointProxyObject.AbsolutePosition, | 5327 | jointProxyObject.AbsolutePosition, |
5291 | jointProxyObject.Name, | 5328 | jointProxyObject.Name, |
5292 | jointProxyObject.UUID, | 5329 | jointProxyObject.UUID, |
5293 | false); | 5330 | false); |
5294 | 5331 | ||
5295 | joint.ErrorMessageCount++; | 5332 | joint.ErrorMessageCount++; |
5296 | 5333 | ||
5297 | if (joint.ErrorMessageCount > PhysicsJoint.maxErrorMessages) | 5334 | if (joint.ErrorMessageCount > PhysicsJoint.maxErrorMessages) |
5298 | { | 5335 | { |
5299 | 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."), |
5300 | ChatTypeEnum.DebugChannel, | 5337 | ChatTypeEnum.DebugChannel, |
5301 | 2147483647, | 5338 | 2147483647, |
5302 | jointProxyObject.AbsolutePosition, | 5339 | jointProxyObject.AbsolutePosition, |
5303 | jointProxyObject.Name, | 5340 | jointProxyObject.Name, |
5304 | jointProxyObject.UUID, | 5341 | jointProxyObject.UUID, |
5305 | false); | 5342 | false); |
5306 | } | 5343 | } |
5307 | } | 5344 | } |
5308 | else | 5345 | else |
@@ -5315,9 +5352,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
5315 | public Scene ConsoleScene() | 5352 | public Scene ConsoleScene() |
5316 | { | 5353 | { |
5317 | if (MainConsole.Instance == null) | 5354 | if (MainConsole.Instance == null) |
5318 | return null; | 5355 | return null; |
5319 | if (MainConsole.Instance.ConsoleScene is Scene) | 5356 | if (MainConsole.Instance.ConsoleScene is Scene) |
5320 | return (Scene)MainConsole.Instance.ConsoleScene; | 5357 | return (Scene)MainConsole.Instance.ConsoleScene; |
5321 | return null; | 5358 | return null; |
5322 | } | 5359 | } |
5323 | 5360 | ||
@@ -5328,13 +5365,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
5328 | public float GetGroundHeight(float x, float y) | 5365 | public float GetGroundHeight(float x, float y) |
5329 | { | 5366 | { |
5330 | if (x < 0) | 5367 | if (x < 0) |
5331 | x = 0; | 5368 | x = 0; |
5332 | if (x >= Heightmap.Width) | 5369 | if (x >= Heightmap.Width) |
5333 | x = Heightmap.Width - 1; | 5370 | x = Heightmap.Width - 1; |
5334 | if (y < 0) | 5371 | if (y < 0) |
5335 | y = 0; | 5372 | y = 0; |
5336 | if (y >= Heightmap.Height) | 5373 | if (y >= Heightmap.Height) |
5337 | y = Heightmap.Height - 1; | 5374 | y = Heightmap.Height - 1; |
5338 | 5375 | ||
5339 | 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]); |
5340 | Vector3 p1 = p0; | 5377 | Vector3 p1 = p0; |
@@ -5342,11 +5379,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
5342 | 5379 | ||
5343 | p1.X += 1.0f; | 5380 | p1.X += 1.0f; |
5344 | if (p1.X < Heightmap.Width) | 5381 | if (p1.X < Heightmap.Width) |
5345 | p1.Z = (float)Heightmap[(int)p1.X, (int)p1.Y]; | 5382 | p1.Z = (float)Heightmap[(int)p1.X, (int)p1.Y]; |
5346 | 5383 | ||
5347 | p2.Y += 1.0f; | 5384 | p2.Y += 1.0f; |
5348 | if (p2.Y < Heightmap.Height) | 5385 | if (p2.Y < Heightmap.Height) |
5349 | p2.Z = (float)Heightmap[(int)p2.X, (int)p2.Y]; | 5386 | p2.Z = (float)Heightmap[(int)p2.X, (int)p2.Y]; |
5350 | 5387 | ||
5351 | 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); |
5352 | 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); |
@@ -5366,14 +5403,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
5366 | 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; |
5367 | } | 5404 | } |
5368 | 5405 | ||
5369 | // private void CheckHeartbeat() | 5406 | // private void CheckHeartbeat() |
5370 | // { | 5407 | // { |
5371 | // if (m_firstHeartbeat) | 5408 | // if (m_firstHeartbeat) |
5372 | // return; | 5409 | // return; |
5373 | // | 5410 | // |
5374 | // if (Util.EnvironmentTickCountSubtract(m_lastFrameTick) > 2000) | 5411 | // if (Util.EnvironmentTickCountSubtract(m_lastFrameTick) > 2000) |
5375 | // StartTimer(); | 5412 | // StartTimer(); |
5376 | // } | 5413 | // } |
5377 | 5414 | ||
5378 | public override ISceneObject DeserializeObject(string representation) | 5415 | public override ISceneObject DeserializeObject(string representation) |
5379 | { | 5416 | { |
@@ -5416,7 +5453,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
5416 | } | 5453 | } |
5417 | 5454 | ||
5418 | ILandObject dest = LandChannel.GetLandObject(avatar.lastKnownAllowedPosition.X, avatar.lastKnownAllowedPosition.Y); | 5455 | ILandObject dest = LandChannel.GetLandObject(avatar.lastKnownAllowedPosition.X, avatar.lastKnownAllowedPosition.Y); |
5419 | if (dest != excludeParcel) | 5456 | if (dest != excludeParcel) |
5420 | { | 5457 | { |
5421 | // Ultimate backup if we have no idea where they are and | 5458 | // Ultimate backup if we have no idea where they are and |
5422 | // the last allowed position was in another parcel | 5459 | // the last allowed position was in another parcel |
@@ -5526,9 +5563,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
5526 | private Vector3 GetNearestRegionEdgePosition(ScenePresence avatar) | 5563 | private Vector3 GetNearestRegionEdgePosition(ScenePresence avatar) |
5527 | { | 5564 | { |
5528 | float xdistance = avatar.AbsolutePosition.X < RegionInfo.RegionSizeX / 2 | 5565 | float xdistance = avatar.AbsolutePosition.X < RegionInfo.RegionSizeX / 2 |
5529 | ? avatar.AbsolutePosition.X : RegionInfo.RegionSizeX - avatar.AbsolutePosition.X; | 5566 | ? avatar.AbsolutePosition.X : RegionInfo.RegionSizeX - avatar.AbsolutePosition.X; |
5530 | float ydistance = avatar.AbsolutePosition.Y < RegionInfo.RegionSizeY / 2 | 5567 | float ydistance = avatar.AbsolutePosition.Y < RegionInfo.RegionSizeY / 2 |
5531 | ? avatar.AbsolutePosition.Y : RegionInfo.RegionSizeY - avatar.AbsolutePosition.Y; | 5568 | ? avatar.AbsolutePosition.Y : RegionInfo.RegionSizeY - avatar.AbsolutePosition.Y; |
5532 | 5569 | ||
5533 | //find out what vertical edge to go to | 5570 | //find out what vertical edge to go to |
5534 | if (xdistance < ydistance) | 5571 | if (xdistance < ydistance) |
@@ -5575,7 +5612,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
5575 | { | 5612 | { |
5576 | IEstateDataService estateDataService = EstateDataService; | 5613 | IEstateDataService estateDataService = EstateDataService; |
5577 | if (estateDataService == null) | 5614 | if (estateDataService == null) |
5578 | return new List<UUID>(0); | 5615 | return new List<UUID>(0); |
5579 | 5616 | ||
5580 | return estateDataService.GetRegions(estateID); | 5617 | return estateDataService.GetRegions(estateID); |
5581 | } | 5618 | } |
@@ -5598,8 +5635,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
5598 | private void HandleReloadEstate(string module, string[] cmd) | 5635 | private void HandleReloadEstate(string module, string[] cmd) |
5599 | { | 5636 | { |
5600 | if (MainConsole.Instance.ConsoleScene == null || | 5637 | if (MainConsole.Instance.ConsoleScene == null || |
5601 | (MainConsole.Instance.ConsoleScene is Scene && | 5638 | (MainConsole.Instance.ConsoleScene is Scene && |
5602 | (Scene)MainConsole.Instance.ConsoleScene == this)) | 5639 | (Scene)MainConsole.Instance.ConsoleScene == this)) |
5603 | { | 5640 | { |
5604 | ReloadEstateData(); | 5641 | ReloadEstateData(); |
5605 | } | 5642 | } |
@@ -5617,8 +5654,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
5617 | /// <param name="maxZ"></param> | 5654 | /// <param name="maxZ"></param> |
5618 | /// <returns></returns> | 5655 | /// <returns></returns> |
5619 | public static Vector3[] GetCombinedBoundingBox( | 5656 | public static Vector3[] GetCombinedBoundingBox( |
5620 | List<SceneObjectGroup> objects, | 5657 | List<SceneObjectGroup> objects, |
5621 | 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) |
5622 | { | 5659 | { |
5623 | minX = float.MaxValue; | 5660 | minX = float.MaxValue; |
5624 | maxX = float.MinValue; | 5661 | maxX = float.MinValue; |
@@ -5636,10 +5673,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
5636 | Vector3 vec = g.AbsolutePosition; | 5673 | Vector3 vec = g.AbsolutePosition; |
5637 | 5674 | ||
5638 | 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); |
5639 | 5676 | ||
5640 | // m_log.DebugFormat( | 5677 | // m_log.DebugFormat( |
5641 | // "[SCENE]: For {0} found AxisAlignedBoundingBoxRaw {1}, {2}", | 5678 | // "[SCENE]: For {0} found AxisAlignedBoundingBoxRaw {1}, {2}", |
5642 | // 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)); |
5643 | 5680 | ||
5644 | ominX += vec.X; | 5681 | ominX += vec.X; |
5645 | omaxX += vec.X; | 5682 | omaxX += vec.X; |
@@ -5649,17 +5686,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
5649 | omaxZ += vec.Z; | 5686 | omaxZ += vec.Z; |
5650 | 5687 | ||
5651 | if (minX > ominX) | 5688 | if (minX > ominX) |
5652 | minX = ominX; | 5689 | minX = ominX; |
5653 | if (minY > ominY) | 5690 | if (minY > ominY) |
5654 | minY = ominY; | 5691 | minY = ominY; |
5655 | if (minZ > ominZ) | 5692 | if (minZ > ominZ) |
5656 | minZ = ominZ; | 5693 | minZ = ominZ; |
5657 | if (maxX < omaxX) | 5694 | if (maxX < omaxX) |
5658 | maxX = omaxX; | 5695 | maxX = omaxX; |
5659 | if (maxY < omaxY) | 5696 | if (maxY < omaxY) |
5660 | maxY = omaxY; | 5697 | maxY = omaxY; |
5661 | if (maxZ < omaxZ) | 5698 | if (maxZ < omaxZ) |
5662 | maxZ = omaxZ; | 5699 | maxZ = omaxZ; |
5663 | } | 5700 | } |
5664 | 5701 | ||
5665 | foreach (SceneObjectGroup g in objects) | 5702 | foreach (SceneObjectGroup g in objects) |
@@ -5684,7 +5721,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
5684 | { | 5721 | { |
5685 | IWorldMapModule mapModule = RequestModuleInterface<IWorldMapModule>(); | 5722 | IWorldMapModule mapModule = RequestModuleInterface<IWorldMapModule>(); |
5686 | if (mapModule != null) | 5723 | if (mapModule != null) |
5687 | mapModule.GenerateMaptile(); | 5724 | mapModule.GenerateMaptile(); |
5688 | } | 5725 | } |
5689 | 5726 | ||
5690 | private void RegenerateMaptileAndReregister(object sender, ElapsedEventArgs e) | 5727 | private void RegenerateMaptileAndReregister(object sender, ElapsedEventArgs e) |
@@ -5695,7 +5732,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
5695 | // so that all simulators can retrieve it | 5732 | // so that all simulators can retrieve it |
5696 | string error = GridService.RegisterRegion(RegionInfo.ScopeID, new GridRegion(RegionInfo)); | 5733 | string error = GridService.RegisterRegion(RegionInfo.ScopeID, new GridRegion(RegionInfo)); |
5697 | if (error != string.Empty) | 5734 | if (error != string.Empty) |
5698 | throw new Exception(error); | 5735 | throw new Exception(error); |
5699 | } | 5736 | } |
5700 | 5737 | ||
5701 | /// <summary> | 5738 | /// <summary> |
@@ -5725,7 +5762,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
5725 | } | 5762 | } |
5726 | 5763 | ||
5727 | if (!AllowAvatarCrossing && !viaTeleport) | 5764 | if (!AllowAvatarCrossing && !viaTeleport) |
5728 | return false; | 5765 | return false; |
5729 | 5766 | ||
5730 | // 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. |
5731 | // 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. |
@@ -5740,8 +5777,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
5740 | reason = "The region is full"; | 5777 | reason = "The region is full"; |
5741 | 5778 | ||
5742 | m_log.DebugFormat( | 5779 | m_log.DebugFormat( |
5743 | "[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}", |
5744 | agentID, RegionInfo.RegionName, RegionInfo.RegionSettings.AgentLimit); | 5781 | agentID, RegionInfo.RegionName, RegionInfo.RegionSettings.AgentLimit); |
5745 | 5782 | ||
5746 | return false; | 5783 | return false; |
5747 | } | 5784 | } |
@@ -5755,7 +5792,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
5755 | { | 5792 | { |
5756 | client = presence.ControllingClient; | 5793 | client = presence.ControllingClient; |
5757 | if (client != null) | 5794 | if (client != null) |
5758 | aCircuit = client.RequestClientInfo(); | 5795 | aCircuit = client.RequestClientInfo(); |
5759 | } | 5796 | } |
5760 | 5797 | ||
5761 | // 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. |
@@ -5778,7 +5815,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
5778 | } | 5815 | } |
5779 | catch (Exception e) | 5816 | catch (Exception e) |
5780 | { | 5817 | { |
5781 | 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); |
5782 | reason = "Error authorizing agent: " + e.Message; | 5819 | reason = "Error authorizing agent: " + e.Message; |
5783 | return false; | 5820 | return false; |
5784 | } | 5821 | } |
@@ -5797,16 +5834,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
5797 | Vector3 spawnPoint = sp.GetLocation(telehub.AbsolutePosition, telehub.GroupRotation); | 5834 | Vector3 spawnPoint = sp.GetLocation(telehub.AbsolutePosition, telehub.GroupRotation); |
5798 | ILandObject land = LandChannel.GetLandObject(spawnPoint.X, spawnPoint.Y); | 5835 | ILandObject land = LandChannel.GetLandObject(spawnPoint.X, spawnPoint.Y); |
5799 | if (land == null) | 5836 | if (land == null) |
5800 | continue; | 5837 | continue; |
5801 | if (land.IsEitherBannedOrRestricted(agentID)) | 5838 | if (land.IsEitherBannedOrRestricted(agentID)) |
5802 | continue; | 5839 | continue; |
5803 | banned = false; | 5840 | banned = false; |
5804 | break; | 5841 | break; |
5805 | } | 5842 | } |
5806 | 5843 | ||
5807 | if (banned) | 5844 | if (banned) |
5808 | { | 5845 | { |
5809 | if(Permissions.IsAdministrator(agentID) == false || Permissions.IsGridGod(agentID) == false) | 5846 | if (Permissions.IsAdministrator(agentID) == false || Permissions.IsGridGod(agentID) == false) |
5810 | { | 5847 | { |
5811 | reason = "No suitable landing point found"; | 5848 | reason = "No suitable landing point found"; |
5812 | return false; | 5849 | return false; |
@@ -5842,9 +5879,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
5842 | if (banned || restricted) | 5879 | if (banned || restricted) |
5843 | { | 5880 | { |
5844 | if (banned) | 5881 | if (banned) |
5845 | reason = "You are banned from the parcel"; | 5882 | reason = "You are banned from the parcel"; |
5846 | else | 5883 | else |
5847 | reason = "The parcel is restricted"; | 5884 | reason = "The parcel is restricted"; |
5848 | return false; | 5885 | return false; |
5849 | } | 5886 | } |
5850 | } | 5887 | } |
@@ -5866,15 +5903,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
5866 | if (presence.MovingToTarget) | 5903 | if (presence.MovingToTarget) |
5867 | { | 5904 | { |
5868 | double distanceToTarget = Util.GetDistanceTo(presence.AbsolutePosition, presence.MoveToPositionTarget); | 5905 | double distanceToTarget = Util.GetDistanceTo(presence.AbsolutePosition, presence.MoveToPositionTarget); |
5869 | // m_log.DebugFormat( | 5906 | // m_log.DebugFormat( |
5870 | // "[SCENE]: Abs pos of {0} is {1}, target {2}, distance {3}", | 5907 | // "[SCENE]: Abs pos of {0} is {1}, target {2}, distance {3}", |
5871 | // presence.Name, presence.AbsolutePosition, presence.MoveToPositionTarget, distanceToTarget); | 5908 | // presence.Name, presence.AbsolutePosition, presence.MoveToPositionTarget, distanceToTarget); |
5872 | 5909 | ||
5873 | // 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 |
5874 | if (distanceToTarget <= ScenePresence.SIGNIFICANT_MOVEMENT) | 5911 | if (distanceToTarget <= ScenePresence.SIGNIFICANT_MOVEMENT) |
5875 | { | 5912 | { |
5876 | // We are close enough to the target | 5913 | // We are close enough to the target |
5877 | // m_log.DebugFormat("[SCENEE]: Stopping autopilot of {0}", presence.Name); | 5914 | // m_log.DebugFormat("[SCENEE]: Stopping autopilot of {0}", presence.Name); |
5878 | 5915 | ||
5879 | presence.Velocity = Vector3.Zero; | 5916 | presence.Velocity = Vector3.Zero; |
5880 | presence.AbsolutePosition = presence.MoveToPositionTarget; | 5917 | presence.AbsolutePosition = presence.MoveToPositionTarget; |
@@ -5888,28 +5925,28 @@ namespace OpenSim.Region.Framework.Scenes | |||
5888 | // 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 |
5889 | // weighting so that that PhysicsActor thinks it really is colliding. | 5926 | // weighting so that that PhysicsActor thinks it really is colliding. |
5890 | for (int i = 0; i < 5; i++) | 5927 | for (int i = 0; i < 5; i++) |
5891 | presence.IsColliding = true; | 5928 | presence.IsColliding = true; |
5892 | 5929 | ||
5893 | if (presence.LandAtTarget) | 5930 | if (presence.LandAtTarget) |
5894 | presence.Flying = false; | 5931 | presence.Flying = false; |
5895 | 5932 | ||
5896 | // Vector3 targetPos = presence.MoveToPositionTarget; | 5933 | // Vector3 targetPos = presence.MoveToPositionTarget; |
5897 | // 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]; |
5898 | // if (targetPos.Z - terrainHeight < 0.2) | 5935 | // if (targetPos.Z - terrainHeight < 0.2) |
5899 | // { | 5936 | // { |
5900 | // presence.Flying = false; | 5937 | // presence.Flying = false; |
5901 | // } | 5938 | // } |
5902 | } | 5939 | } |
5903 | 5940 | ||
5904 | // m_log.DebugFormat( | 5941 | // m_log.DebugFormat( |
5905 | // "[SCENE]: AgentControlFlags {0}, MovementFlag {1} for {2}", | 5942 | // "[SCENE]: AgentControlFlags {0}, MovementFlag {1} for {2}", |
5906 | // presence.AgentControlFlags, presence.MovementFlag, presence.Name); | 5943 | // presence.AgentControlFlags, presence.MovementFlag, presence.Name); |
5907 | } | 5944 | } |
5908 | else | 5945 | else |
5909 | { | 5946 | { |
5910 | // m_log.DebugFormat( | 5947 | // m_log.DebugFormat( |
5911 | // "[SCENE]: Updating npc {0} at {1} for next movement to {2}", | 5948 | // "[SCENE]: Updating npc {0} at {1} for next movement to {2}", |
5912 | // presence.Name, presence.AbsolutePosition, presence.MoveToPositionTarget); | 5949 | // presence.Name, presence.AbsolutePosition, presence.MoveToPositionTarget); |
5913 | 5950 | ||
5914 | Vector3 agent_control_v3 = new Vector3(); | 5951 | Vector3 agent_control_v3 = new Vector3(); |
5915 | presence.HandleMoveToTargetUpdate(1, ref agent_control_v3); | 5952 | presence.HandleMoveToTargetUpdate(1, ref agent_control_v3); |
@@ -5924,11 +5961,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
5924 | int spawnpoints = RegionInfo.RegionSettings.SpawnPoints().Count; | 5961 | int spawnpoints = RegionInfo.RegionSettings.SpawnPoints().Count; |
5925 | 5962 | ||
5926 | if (spawnpoints == 0) | 5963 | if (spawnpoints == 0) |
5927 | return 0; | 5964 | return 0; |
5928 | 5965 | ||
5929 | m_SpawnPoint++; | 5966 | m_SpawnPoint++; |
5930 | if (m_SpawnPoint > spawnpoints) | 5967 | if (m_SpawnPoint > spawnpoints) |
5931 | m_SpawnPoint = 1; | 5968 | m_SpawnPoint = 1; |
5932 | return m_SpawnPoint - 1; | 5969 | return m_SpawnPoint - 1; |
5933 | } | 5970 | } |
5934 | 5971 | ||
@@ -5958,12 +5995,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
5958 | public string GetExtraSetting(string name) | 5995 | public string GetExtraSetting(string name) |
5959 | { | 5996 | { |
5960 | if (m_extraSettings == null) | 5997 | if (m_extraSettings == null) |
5961 | return String.Empty; | 5998 | return String.Empty; |
5962 | 5999 | ||
5963 | string val; | 6000 | string val; |
5964 | 6001 | ||
5965 | if (!m_extraSettings.TryGetValue(name, out val)) | 6002 | if (!m_extraSettings.TryGetValue(name, out val)) |
5966 | return String.Empty; | 6003 | return String.Empty; |
5967 | 6004 | ||
5968 | return val; | 6005 | return val; |
5969 | } | 6006 | } |
@@ -5971,14 +6008,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
5971 | public void StoreExtraSetting(string name, string val) | 6008 | public void StoreExtraSetting(string name, string val) |
5972 | { | 6009 | { |
5973 | if (m_extraSettings == null) | 6010 | if (m_extraSettings == null) |
5974 | return; | 6011 | return; |
5975 | 6012 | ||
5976 | string oldVal; | 6013 | string oldVal; |
5977 | 6014 | ||
5978 | if (m_extraSettings.TryGetValue(name, out oldVal)) | 6015 | if (m_extraSettings.TryGetValue(name, out oldVal)) |
5979 | { | 6016 | { |
5980 | if (oldVal == val) | 6017 | if (oldVal == val) |
5981 | return; | 6018 | return; |
5982 | } | 6019 | } |
5983 | 6020 | ||
5984 | m_extraSettings[name] = val; | 6021 | m_extraSettings[name] = val; |
@@ -5991,10 +6028,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
5991 | public void RemoveExtraSetting(string name) | 6028 | public void RemoveExtraSetting(string name) |
5992 | { | 6029 | { |
5993 | if (m_extraSettings == null) | 6030 | if (m_extraSettings == null) |
5994 | return; | 6031 | return; |
5995 | 6032 | ||
5996 | if (!m_extraSettings.ContainsKey(name)) | 6033 | if (!m_extraSettings.ContainsKey(name)) |
5997 | return; | 6034 | return; |
5998 | 6035 | ||
5999 | m_extraSettings.Remove(name); | 6036 | m_extraSettings.Remove(name); |
6000 | 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 0eab898..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 = Scene.m_defaultNumberFramesStored; | 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) |
diff --git a/bin/LukeSkywalker.IPNetwork.dll b/bin/LukeSkywalker.IPNetwork.dll index 25bcc2f..25bcc2f 100644..100755 --- a/bin/LukeSkywalker.IPNetwork.dll +++ b/bin/LukeSkywalker.IPNetwork.dll | |||
Binary files differ | |||
diff --git a/bin/OpenSimDefaults.ini b/bin/OpenSimDefaults.ini index af37ccc..3422996 100644..100755 --- a/bin/OpenSimDefaults.ini +++ b/bin/OpenSimDefaults.ini | |||
@@ -296,7 +296,7 @@ | |||
296 | ; Simulator Stats URI | 296 | ; Simulator Stats URI |
297 | ; Enable JSON simulator data by setting a URI name (case sensitive) | 297 | ; Enable JSON simulator data by setting a URI name (case sensitive) |
298 | ; Returns regular sim stats (SimFPS, ...) | 298 | ; Returns regular sim stats (SimFPS, ...) |
299 | ; Stats_URI = "jsonSimStats" | 299 | Stats_URI = "jsonSimStats" |
300 | 300 | ||
301 | ; Simulator StatsManager URI | 301 | ; Simulator StatsManager URI |
302 | ; Enable fetch of StatsManager registered stats. Fetch is query which can optionally | 302 | ; Enable fetch of StatsManager registered stats. Fetch is query which can optionally |