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 | 221 | ||||
-rwxr-xr-x[-rw-r--r--] | OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | 36 | ||||
-rw-r--r-- | bin/ICSharpCode.SharpZipLib.dll | bin | 131584 -> 188416 bytes | |||
-rwxr-xr-x[-rw-r--r--] | bin/LukeSkywalker.IPNetwork.dll | bin | 18432 -> 18432 bytes | |||
-rwxr-xr-x[-rw-r--r--] | bin/OpenSimDefaults.ini | 2 |
8 files changed, 1016 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 643dca3..c539f1f 100755 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -1,29 +1,29 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://opensimulator.org/ | 2 | * Copyright (c) Contributors, http://opensimulator.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyright | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSimulator Project nor the | 12 | * * Neither the name of the OpenSimulator Project nor the |
13 | * names of its contributors may be used to endorse or promote products | 13 | * names of its contributors may be used to endorse or promote products |
14 | * derived from this software without specific prior written permission. | 14 | * derived from this software without specific prior written permission. |
15 | * | 15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY |
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
@@ -48,7 +48,7 @@ using OpenSim.Region.Framework.Interfaces; | |||
48 | using OpenSim.Region.Framework.Scenes.Scripting; | 48 | using OpenSim.Region.Framework.Scenes.Scripting; |
49 | using OpenSim.Region.Framework.Scenes.Serialization; | 49 | using OpenSim.Region.Framework.Scenes.Serialization; |
50 | using OpenSim.Region.Physics.Manager; | 50 | using OpenSim.Region.Physics.Manager; |
51 | using Timer=System.Timers.Timer; | 51 | using Timer = System.Timers.Timer; |
52 | using TPFlags = OpenSim.Framework.Constants.TeleportFlags; | 52 | using TPFlags = OpenSim.Framework.Constants.TeleportFlags; |
53 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; | 53 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; |
54 | using PermissionMask = OpenSim.Framework.PermissionMask; | 54 | using PermissionMask = OpenSim.Framework.PermissionMask; |
@@ -61,6 +61,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
61 | { | 61 | { |
62 | private const long DEFAULT_MIN_TIME_FOR_PERSISTENCE = 60L; | 62 | private const long DEFAULT_MIN_TIME_FOR_PERSISTENCE = 60L; |
63 | private const long DEFAULT_MAX_TIME_FOR_PERSISTENCE = 600L; | 63 | private const long DEFAULT_MAX_TIME_FOR_PERSISTENCE = 600L; |
64 | |||
65 | public const int m_defaultNumberFramesStored = 10; | ||
64 | 66 | ||
65 | public delegate void SynchronizeSceneHandler(Scene scene); | 67 | public delegate void SynchronizeSceneHandler(Scene scene); |
66 | 68 | ||
@@ -103,9 +105,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
103 | /// <summary> | 105 | /// <summary> |
104 | /// If false then physical objects are disabled, though collisions will continue as normal. | 106 | /// If false then physical objects are disabled, though collisions will continue as normal. |
105 | /// </summary> | 107 | /// </summary> |
106 | public bool PhysicsEnabled | 108 | public bool PhysicsEnabled |
107 | { | 109 | { |
108 | get | 110 | get |
109 | { | 111 | { |
110 | return m_physicsEnabled; | 112 | return m_physicsEnabled; |
111 | } | 113 | } |
@@ -119,8 +121,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
119 | IPhysicsParameters physScene = PhysicsScene as IPhysicsParameters; | 121 | IPhysicsParameters physScene = PhysicsScene as IPhysicsParameters; |
120 | 122 | ||
121 | if (physScene != null) | 123 | if (physScene != null) |
122 | physScene.SetPhysicsParameter( | 124 | physScene.SetPhysicsParameter( |
123 | "Active", m_physicsEnabled.ToString(), PhysParameterEntry.APPLY_TO_NONE); | 125 | "Active", m_physicsEnabled.ToString(), PhysParameterEntry.APPLY_TO_NONE); |
124 | } | 126 | } |
125 | } | 127 | } |
126 | } | 128 | } |
@@ -130,10 +132,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
130 | /// <summary> | 132 | /// <summary> |
131 | /// If false then scripts are not enabled on the smiulator | 133 | /// If false then scripts are not enabled on the smiulator |
132 | /// </summary> | 134 | /// </summary> |
133 | public bool ScriptsEnabled | 135 | public bool ScriptsEnabled |
134 | { | 136 | { |
135 | get { return m_scripts_enabled; } | 137 | get { return m_scripts_enabled; } |
136 | set | 138 | set |
137 | { | 139 | { |
138 | if (m_scripts_enabled != value) | 140 | if (m_scripts_enabled != value) |
139 | { | 141 | { |
@@ -145,13 +147,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
145 | foreach (EntityBase ent in entities) | 147 | foreach (EntityBase ent in entities) |
146 | { | 148 | { |
147 | if (ent is SceneObjectGroup) | 149 | if (ent is SceneObjectGroup) |
148 | ((SceneObjectGroup)ent).RemoveScriptInstances(false); | 150 | ((SceneObjectGroup)ent).RemoveScriptInstances(false); |
149 | } | 151 | } |
150 | } | 152 | } |
151 | else | 153 | else |
152 | { | 154 | { |
153 | m_log.Info("Starting all Scripts in Scene"); | 155 | m_log.Info("Starting all Scripts in Scene"); |
154 | 156 | ||
155 | EntityBase[] entities = Entities.GetEntities(); | 157 | EntityBase[] entities = Entities.GetEntities(); |
156 | foreach (EntityBase ent in entities) | 158 | foreach (EntityBase ent in entities) |
157 | { | 159 | { |
@@ -236,8 +238,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
236 | /// <summary> | 238 | /// <summary> |
237 | /// Temporarily setting to trigger appearance resends at 60 second intervals. | 239 | /// Temporarily setting to trigger appearance resends at 60 second intervals. |
238 | /// </summary> | 240 | /// </summary> |
239 | public bool SendPeriodicAppearanceUpdates { get; set; } | 241 | public bool SendPeriodicAppearanceUpdates { get; set; } |
240 | 242 | ||
241 | /// <summary> | 243 | /// <summary> |
242 | /// How much a root agent has to change position before updates are sent to viewers. | 244 | /// How much a root agent has to change position before updates are sent to viewers. |
243 | /// </summary> | 245 | /// </summary> |
@@ -264,10 +266,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
264 | public int ChildTerseUpdatePeriod { get; set; } | 266 | public int ChildTerseUpdatePeriod { get; set; } |
265 | 267 | ||
266 | protected float m_defaultDrawDistance = 255.0f; | 268 | protected float m_defaultDrawDistance = 255.0f; |
267 | public float DefaultDrawDistance | 269 | public float DefaultDrawDistance |
268 | { | 270 | { |
269 | // get { return m_defaultDrawDistance; } | 271 | // get { return m_defaultDrawDistance; } |
270 | get { | 272 | get |
273 | { | ||
271 | if (RegionInfo != null) | 274 | if (RegionInfo != null) |
272 | { | 275 | { |
273 | float largestDimension = Math.Max(RegionInfo.RegionSizeX, RegionInfo.RegionSizeY); | 276 | float largestDimension = Math.Max(RegionInfo.RegionSizeX, RegionInfo.RegionSizeY); |
@@ -280,7 +283,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
280 | 283 | ||
281 | private List<string> m_AllowedViewers = new List<string>(); | 284 | private List<string> m_AllowedViewers = new List<string>(); |
282 | private List<string> m_BannedViewers = new List<string>(); | 285 | private List<string> m_BannedViewers = new List<string>(); |
283 | 286 | ||
284 | // TODO: need to figure out how allow client agents but deny | 287 | // TODO: need to figure out how allow client agents but deny |
285 | // root agents when ACL denies access to root agent | 288 | // root agents when ACL denies access to root agent |
286 | public bool m_strictAccessControl = true; | 289 | public bool m_strictAccessControl = true; |
@@ -367,15 +370,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
367 | /// One can tweak this number to experiment. One current effect of reducing it is to make avatar animations | 370 | /// One can tweak this number to experiment. One current effect of reducing it is to make avatar animations |
368 | /// occur too quickly (viewer 1) or with even more slide (viewer 2). | 371 | /// occur too quickly (viewer 1) or with even more slide (viewer 2). |
369 | /// </remarks> | 372 | /// </remarks> |
370 | public int MinFrameTicks | 373 | public int MinFrameTicks |
371 | { | 374 | { |
372 | get { return m_minFrameTicks; } | 375 | get { return m_minFrameTicks; } |
373 | private set | 376 | private set |
374 | { | 377 | { |
375 | m_minFrameTicks = value; | 378 | m_minFrameTicks = value; |
376 | MinFrameSeconds = (float)m_minFrameTicks / 1000; | 379 | MinFrameSeconds = (float)m_minFrameTicks / 1000; |
377 | } | 380 | } |
378 | } | 381 | } |
379 | private int m_minFrameTicks; | 382 | private int m_minFrameTicks; |
380 | 383 | ||
381 | /// <summary> | 384 | /// <summary> |
@@ -403,7 +406,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
403 | private int m_update_events = 1; | 406 | private int m_update_events = 1; |
404 | private int m_update_backup = 200; | 407 | private int m_update_backup = 200; |
405 | private int m_update_terrain = 50; | 408 | private int m_update_terrain = 50; |
406 | // private int m_update_land = 1; | 409 | // private int m_update_land = 1; |
407 | private int m_update_coarse_locations = 50; | 410 | private int m_update_coarse_locations = 50; |
408 | private int m_update_temp_cleaning = 180; | 411 | private int m_update_temp_cleaning = 180; |
409 | 412 | ||
@@ -434,7 +437,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
434 | /// asynchronously from the update loop. | 437 | /// asynchronously from the update loop. |
435 | /// </summary> | 438 | /// </summary> |
436 | private bool m_cleaningTemps = false; | 439 | private bool m_cleaningTemps = false; |
437 | 440 | ||
438 | /// <summary> | 441 | /// <summary> |
439 | /// Used to control main scene thread looping time when not updating via timer. | 442 | /// Used to control main scene thread looping time when not updating via timer. |
440 | /// </summary> | 443 | /// </summary> |
@@ -495,7 +498,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
495 | if (value) | 498 | if (value) |
496 | { | 499 | { |
497 | if (!m_active) | 500 | if (!m_active) |
498 | Start(false); | 501 | Start(false); |
499 | } | 502 | } |
500 | else | 503 | else |
501 | { | 504 | { |
@@ -532,6 +535,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
532 | get { return m_sceneGraph.PhysicsScene.TimeDilation; } | 535 | get { return m_sceneGraph.PhysicsScene.TimeDilation; } |
533 | } | 536 | } |
534 | 537 | ||
538 | public void setThreadCount(int inUseThreads) | ||
539 | { | ||
540 | // Just pass the thread count information on its way as the Scene | ||
541 | // does not require the value for anything at this time | ||
542 | StatsReporter.SetThreadCount(inUseThreads); | ||
543 | } | ||
544 | |||
535 | public SceneCommunicationService SceneGridService | 545 | public SceneCommunicationService SceneGridService |
536 | { | 546 | { |
537 | get { return m_sceneGridService; } | 547 | get { return m_sceneGridService; } |
@@ -590,7 +600,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
590 | return m_AssetService; | 600 | return m_AssetService; |
591 | } | 601 | } |
592 | } | 602 | } |
593 | 603 | ||
594 | public IAuthorizationService AuthorizationService | 604 | public IAuthorizationService AuthorizationService |
595 | { | 605 | { |
596 | get | 606 | get |
@@ -651,7 +661,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
651 | get | 661 | get |
652 | { | 662 | { |
653 | if (m_LibraryService == null) | 663 | if (m_LibraryService == null) |
654 | m_LibraryService = RequestModuleInterface<ILibraryService>(); | 664 | m_LibraryService = RequestModuleInterface<ILibraryService>(); |
655 | 665 | ||
656 | return m_LibraryService; | 666 | return m_LibraryService; |
657 | } | 667 | } |
@@ -662,7 +672,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
662 | get | 672 | get |
663 | { | 673 | { |
664 | if (m_simulationService == null) | 674 | if (m_simulationService == null) |
665 | m_simulationService = RequestModuleInterface<ISimulationService>(); | 675 | m_simulationService = RequestModuleInterface<ISimulationService>(); |
666 | 676 | ||
667 | return m_simulationService; | 677 | return m_simulationService; |
668 | } | 678 | } |
@@ -673,7 +683,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
673 | get | 683 | get |
674 | { | 684 | { |
675 | if (m_AuthenticationService == null) | 685 | if (m_AuthenticationService == null) |
676 | m_AuthenticationService = RequestModuleInterface<IAuthenticationService>(); | 686 | m_AuthenticationService = RequestModuleInterface<IAuthenticationService>(); |
677 | return m_AuthenticationService; | 687 | return m_AuthenticationService; |
678 | } | 688 | } |
679 | } | 689 | } |
@@ -683,7 +693,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
683 | get | 693 | get |
684 | { | 694 | { |
685 | if (m_PresenceService == null) | 695 | if (m_PresenceService == null) |
686 | m_PresenceService = RequestModuleInterface<IPresenceService>(); | 696 | m_PresenceService = RequestModuleInterface<IPresenceService>(); |
687 | return m_PresenceService; | 697 | return m_PresenceService; |
688 | } | 698 | } |
689 | } | 699 | } |
@@ -693,7 +703,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
693 | get | 703 | get |
694 | { | 704 | { |
695 | if (m_UserAccountService == null) | 705 | if (m_UserAccountService == null) |
696 | m_UserAccountService = RequestModuleInterface<IUserAccountService>(); | 706 | m_UserAccountService = RequestModuleInterface<IUserAccountService>(); |
697 | return m_UserAccountService; | 707 | return m_UserAccountService; |
698 | } | 708 | } |
699 | } | 709 | } |
@@ -703,7 +713,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
703 | get | 713 | get |
704 | { | 714 | { |
705 | if (m_AvatarService == null) | 715 | if (m_AvatarService == null) |
706 | m_AvatarService = RequestModuleInterface<IAvatarService>(); | 716 | m_AvatarService = RequestModuleInterface<IAvatarService>(); |
707 | return m_AvatarService; | 717 | return m_AvatarService; |
708 | } | 718 | } |
709 | } | 719 | } |
@@ -713,7 +723,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
713 | get | 723 | get |
714 | { | 724 | { |
715 | if (m_GridUserService == null) | 725 | if (m_GridUserService == null) |
716 | m_GridUserService = RequestModuleInterface<IGridUserService>(); | 726 | m_GridUserService = RequestModuleInterface<IGridUserService>(); |
717 | return m_GridUserService; | 727 | return m_GridUserService; |
718 | } | 728 | } |
719 | } | 729 | } |
@@ -727,7 +737,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
727 | { | 737 | { |
728 | get { return m_AvatarFactory; } | 738 | get { return m_AvatarFactory; } |
729 | } | 739 | } |
730 | 740 | ||
731 | public ICapabilitiesModule CapsModule | 741 | public ICapabilitiesModule CapsModule |
732 | { | 742 | { |
733 | get { return m_capsModule; } | 743 | get { return m_capsModule; } |
@@ -793,18 +803,20 @@ namespace OpenSim.Region.Framework.Scenes | |||
793 | get { return m_sceneGraph.Entities; } | 803 | get { return m_sceneGraph.Entities; } |
794 | } | 804 | } |
795 | 805 | ||
796 | 806 | ||
797 | // used in sequence see: SpawnPoint() | 807 | // used in sequence see: SpawnPoint() |
798 | private int m_SpawnPoint; | 808 | private int m_SpawnPoint; |
799 | // can be closest/random/sequence | 809 | // can be closest/random/sequence |
800 | public string SpawnPointRouting | 810 | public string SpawnPointRouting |
801 | { | 811 | { |
802 | get; private set; | 812 | get; |
813 | private set; | ||
803 | } | 814 | } |
804 | // allow landmarks to pass | 815 | // allow landmarks to pass |
805 | public bool TelehubAllowLandmarks | 816 | public bool TelehubAllowLandmarks |
806 | { | 817 | { |
807 | get; private set; | 818 | get; |
819 | private set; | ||
808 | } | 820 | } |
809 | 821 | ||
810 | #endregion Properties | 822 | #endregion Properties |
@@ -812,10 +824,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
812 | #region Constructors | 824 | #region Constructors |
813 | 825 | ||
814 | public Scene(RegionInfo regInfo, AgentCircuitManager authen, PhysicsScene physicsScene, | 826 | public Scene(RegionInfo regInfo, AgentCircuitManager authen, PhysicsScene physicsScene, |
815 | SceneCommunicationService sceneGridService, | 827 | SceneCommunicationService sceneGridService, |
816 | ISimulationDataService simDataService, IEstateDataService estateDataService, | 828 | ISimulationDataService simDataService, IEstateDataService estateDataService, |
817 | IConfigSource config, string simulatorVersion) | 829 | IConfigSource config, string simulatorVersion) |
818 | : this(regInfo, physicsScene) | 830 | : this(regInfo, physicsScene) |
819 | { | 831 | { |
820 | m_config = config; | 832 | m_config = config; |
821 | MinFrameTicks = 89; | 833 | MinFrameTicks = 89; |
@@ -872,20 +884,20 @@ namespace OpenSim.Region.Framework.Scenes | |||
872 | } | 884 | } |
873 | 885 | ||
874 | if (updatedTerrainTextures) | 886 | if (updatedTerrainTextures) |
875 | rs.Save(); | 887 | rs.Save(); |
876 | 888 | ||
877 | RegionInfo.RegionSettings = rs; | 889 | RegionInfo.RegionSettings = rs; |
878 | 890 | ||
879 | if (estateDataService != null) | 891 | if (estateDataService != null) |
880 | RegionInfo.EstateSettings = estateDataService.LoadEstateSettings(RegionInfo.RegionID, false); | 892 | RegionInfo.EstateSettings = estateDataService.LoadEstateSettings(RegionInfo.RegionID, false); |
881 | 893 | ||
882 | #endregion Region Settings | 894 | #endregion Region Settings |
883 | 895 | ||
884 | //Bind Storage Manager functions to some land manager functions for this scene | 896 | //Bind Storage Manager functions to some land manager functions for this scene |
885 | EventManager.OnLandObjectAdded += | 897 | EventManager.OnLandObjectAdded += |
886 | new EventManager.LandObjectAdded(simDataService.StoreLandObject); | 898 | new EventManager.LandObjectAdded(simDataService.StoreLandObject); |
887 | EventManager.OnLandObjectRemoved += | 899 | EventManager.OnLandObjectRemoved += |
888 | new EventManager.LandObjectRemoved(simDataService.RemoveLandObject); | 900 | new EventManager.LandObjectRemoved(simDataService.RemoveLandObject); |
889 | 901 | ||
890 | RegisterDefaultSceneEvents(); | 902 | RegisterDefaultSceneEvents(); |
891 | 903 | ||
@@ -910,8 +922,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
910 | m_defaultDrawDistance = startupConfig.GetFloat("DefaultDrawDistance", m_defaultDrawDistance); | 922 | m_defaultDrawDistance = startupConfig.GetFloat("DefaultDrawDistance", m_defaultDrawDistance); |
911 | UseBackup = startupConfig.GetBoolean("UseSceneBackup", UseBackup); | 923 | UseBackup = startupConfig.GetBoolean("UseSceneBackup", UseBackup); |
912 | if (!UseBackup) | 924 | if (!UseBackup) |
913 | m_log.InfoFormat("[SCENE]: Backup has been disabled for {0}", RegionInfo.RegionName); | 925 | m_log.InfoFormat("[SCENE]: Backup has been disabled for {0}", RegionInfo.RegionName); |
914 | 926 | ||
915 | //Animation states | 927 | //Animation states |
916 | m_useFlySlow = startupConfig.GetBoolean("enableflyslow", false); | 928 | m_useFlySlow = startupConfig.GetBoolean("enableflyslow", false); |
917 | 929 | ||
@@ -965,10 +977,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
965 | m_trustBinaries = startupConfig.GetBoolean("TrustBinaries", m_trustBinaries); | 977 | m_trustBinaries = startupConfig.GetBoolean("TrustBinaries", m_trustBinaries); |
966 | m_allowScriptCrossings = startupConfig.GetBoolean("AllowScriptCrossing", m_allowScriptCrossings); | 978 | m_allowScriptCrossings = startupConfig.GetBoolean("AllowScriptCrossing", m_allowScriptCrossings); |
967 | m_dontPersistBefore = | 979 | m_dontPersistBefore = |
968 | startupConfig.GetLong("MinimumTimeBeforePersistenceConsidered", DEFAULT_MIN_TIME_FOR_PERSISTENCE); | 980 | startupConfig.GetLong("MinimumTimeBeforePersistenceConsidered", DEFAULT_MIN_TIME_FOR_PERSISTENCE); |
969 | m_dontPersistBefore *= 10000000; | 981 | m_dontPersistBefore *= 10000000; |
970 | m_persistAfter = | 982 | m_persistAfter = |
971 | startupConfig.GetLong("MaximumTimeBeforePersistenceConsidered", DEFAULT_MAX_TIME_FOR_PERSISTENCE); | 983 | startupConfig.GetLong("MaximumTimeBeforePersistenceConsidered", DEFAULT_MAX_TIME_FOR_PERSISTENCE); |
972 | m_persistAfter *= 10000000; | 984 | m_persistAfter *= 10000000; |
973 | 985 | ||
974 | m_defaultScriptEngine = startupConfig.GetString("DefaultScriptEngine", "XEngine"); | 986 | m_defaultScriptEngine = startupConfig.GetString("DefaultScriptEngine", "XEngine"); |
@@ -980,8 +992,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
980 | 992 | ||
981 | string[] possibleMapConfigSections = new string[] { "Map", "Startup" }; | 993 | string[] possibleMapConfigSections = new string[] { "Map", "Startup" }; |
982 | 994 | ||
983 | m_generateMaptiles | 995 | m_generateMaptiles |
984 | = Util.GetConfigVarFromSections<bool>(config, "GenerateMaptiles", possibleMapConfigSections, true); | 996 | = Util.GetConfigVarFromSections<bool>(config, "GenerateMaptiles", possibleMapConfigSections, true); |
985 | 997 | ||
986 | if (m_generateMaptiles) | 998 | if (m_generateMaptiles) |
987 | { | 999 | { |
@@ -997,9 +1009,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
997 | } | 1009 | } |
998 | else | 1010 | else |
999 | { | 1011 | { |
1000 | string tile | 1012 | string tile |
1001 | = Util.GetConfigVarFromSections<string>( | 1013 | = Util.GetConfigVarFromSections<string>( |
1002 | config, "MaptileStaticUUID", possibleMapConfigSections, UUID.Zero.ToString()); | 1014 | config, "MaptileStaticUUID", possibleMapConfigSections, UUID.Zero.ToString()); |
1003 | 1015 | ||
1004 | UUID tileID; | 1016 | UUID tileID; |
1005 | 1017 | ||
@@ -1016,9 +1028,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
1016 | 1028 | ||
1017 | string[] possibleAccessControlConfigSections = new string[] { "AccessControl", "Startup" }; | 1029 | string[] possibleAccessControlConfigSections = new string[] { "AccessControl", "Startup" }; |
1018 | 1030 | ||
1019 | string grant | 1031 | string grant |
1020 | = Util.GetConfigVarFromSections<string>( | 1032 | = Util.GetConfigVarFromSections<string>( |
1021 | config, "AllowedClients", possibleAccessControlConfigSections, ""); | 1033 | config, "AllowedClients", possibleAccessControlConfigSections, ""); |
1022 | 1034 | ||
1023 | if (grant.Length > 0) | 1035 | if (grant.Length > 0) |
1024 | { | 1036 | { |
@@ -1028,9 +1040,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
1028 | } | 1040 | } |
1029 | } | 1041 | } |
1030 | 1042 | ||
1031 | grant | 1043 | grant |
1032 | = Util.GetConfigVarFromSections<string>( | 1044 | = Util.GetConfigVarFromSections<string>( |
1033 | config, "BannedClients", possibleAccessControlConfigSections, ""); | 1045 | config, "BannedClients", possibleAccessControlConfigSections, ""); |
1034 | 1046 | ||
1035 | if (grant.Length > 0) | 1047 | if (grant.Length > 0) |
1036 | { | 1048 | { |
@@ -1041,27 +1053,27 @@ namespace OpenSim.Region.Framework.Scenes | |||
1041 | } | 1053 | } |
1042 | 1054 | ||
1043 | if (startupConfig.Contains("MinFrameTime")) | 1055 | if (startupConfig.Contains("MinFrameTime")) |
1044 | MinFrameTicks = (int)(startupConfig.GetFloat("MinFrameTime") * 1000); | 1056 | MinFrameTicks = (int)(startupConfig.GetFloat("MinFrameTime") * 1000); |
1045 | 1057 | ||
1046 | m_update_backup = startupConfig.GetInt( "UpdateStorageEveryNFrames", m_update_backup); | 1058 | m_update_backup = startupConfig.GetInt("UpdateStorageEveryNFrames", m_update_backup); |
1047 | m_update_coarse_locations = startupConfig.GetInt( "UpdateCoarseLocationsEveryNFrames", m_update_coarse_locations); | 1059 | m_update_coarse_locations = startupConfig.GetInt("UpdateCoarseLocationsEveryNFrames", m_update_coarse_locations); |
1048 | m_update_entitymovement = startupConfig.GetInt( "UpdateEntityMovementEveryNFrames", m_update_entitymovement); | 1060 | m_update_entitymovement = startupConfig.GetInt("UpdateEntityMovementEveryNFrames", m_update_entitymovement); |
1049 | m_update_events = startupConfig.GetInt( "UpdateEventsEveryNFrames", m_update_events); | 1061 | m_update_events = startupConfig.GetInt("UpdateEventsEveryNFrames", m_update_events); |
1050 | m_update_objects = startupConfig.GetInt( "UpdateObjectsEveryNFrames", m_update_objects); | 1062 | m_update_objects = startupConfig.GetInt("UpdateObjectsEveryNFrames", m_update_objects); |
1051 | m_update_physics = startupConfig.GetInt( "UpdatePhysicsEveryNFrames", m_update_physics); | 1063 | m_update_physics = startupConfig.GetInt("UpdatePhysicsEveryNFrames", m_update_physics); |
1052 | m_update_presences = startupConfig.GetInt( "UpdateAgentsEveryNFrames", m_update_presences); | 1064 | m_update_presences = startupConfig.GetInt("UpdateAgentsEveryNFrames", m_update_presences); |
1053 | m_update_terrain = startupConfig.GetInt( "UpdateTerrainEveryNFrames", m_update_terrain); | 1065 | m_update_terrain = startupConfig.GetInt("UpdateTerrainEveryNFrames", m_update_terrain); |
1054 | m_update_temp_cleaning = startupConfig.GetInt( "UpdateTempCleaningEveryNSeconds", m_update_temp_cleaning); | 1066 | m_update_temp_cleaning = startupConfig.GetInt("UpdateTempCleaningEveryNSeconds", m_update_temp_cleaning); |
1055 | } | 1067 | } |
1056 | 1068 | ||
1057 | // FIXME: Ultimately this should be in a module. | 1069 | // FIXME: Ultimately this should be in a module. |
1058 | SendPeriodicAppearanceUpdates = false; | 1070 | SendPeriodicAppearanceUpdates = false; |
1059 | 1071 | ||
1060 | IConfig appearanceConfig = m_config.Configs["Appearance"]; | 1072 | IConfig appearanceConfig = m_config.Configs["Appearance"]; |
1061 | if (appearanceConfig != null) | 1073 | if (appearanceConfig != null) |
1062 | { | 1074 | { |
1063 | SendPeriodicAppearanceUpdates | 1075 | SendPeriodicAppearanceUpdates |
1064 | = appearanceConfig.GetBoolean("ResendAppearanceUpdates", SendPeriodicAppearanceUpdates); | 1076 | = appearanceConfig.GetBoolean("ResendAppearanceUpdates", SendPeriodicAppearanceUpdates); |
1065 | } | 1077 | } |
1066 | 1078 | ||
1067 | #endregion Region Config | 1079 | #endregion Region Config |
@@ -1089,58 +1101,68 @@ namespace OpenSim.Region.Framework.Scenes | |||
1089 | UpdatePrioritizationScheme = UpdatePrioritizationSchemes.Time; | 1101 | UpdatePrioritizationScheme = UpdatePrioritizationSchemes.Time; |
1090 | } | 1102 | } |
1091 | 1103 | ||
1092 | IsReprioritizationEnabled | 1104 | IsReprioritizationEnabled |
1093 | = interestConfig.GetBoolean("ReprioritizationEnabled", IsReprioritizationEnabled); | 1105 | = interestConfig.GetBoolean("ReprioritizationEnabled", IsReprioritizationEnabled); |
1094 | ReprioritizationInterval | 1106 | ReprioritizationInterval |
1095 | = interestConfig.GetDouble("ReprioritizationInterval", ReprioritizationInterval); | 1107 | = interestConfig.GetDouble("ReprioritizationInterval", ReprioritizationInterval); |
1096 | RootReprioritizationDistance | 1108 | RootReprioritizationDistance |
1097 | = interestConfig.GetDouble("RootReprioritizationDistance", RootReprioritizationDistance); | 1109 | = interestConfig.GetDouble("RootReprioritizationDistance", RootReprioritizationDistance); |
1098 | ChildReprioritizationDistance | 1110 | ChildReprioritizationDistance |
1099 | = interestConfig.GetDouble("ChildReprioritizationDistance", ChildReprioritizationDistance); | 1111 | = interestConfig.GetDouble("ChildReprioritizationDistance", ChildReprioritizationDistance); |
1100 | 1112 | ||
1101 | RootTerseUpdatePeriod = interestConfig.GetInt("RootTerseUpdatePeriod", RootTerseUpdatePeriod); | 1113 | RootTerseUpdatePeriod = interestConfig.GetInt("RootTerseUpdatePeriod", RootTerseUpdatePeriod); |
1102 | ChildTerseUpdatePeriod = interestConfig.GetInt("ChildTerseUpdatePeriod", ChildTerseUpdatePeriod); | 1114 | ChildTerseUpdatePeriod = interestConfig.GetInt("ChildTerseUpdatePeriod", ChildTerseUpdatePeriod); |
1103 | 1115 | ||
1104 | RootPositionUpdateTolerance | 1116 | RootPositionUpdateTolerance |
1105 | = interestConfig.GetFloat("RootPositionUpdateTolerance", RootPositionUpdateTolerance); | 1117 | = interestConfig.GetFloat("RootPositionUpdateTolerance", RootPositionUpdateTolerance); |
1106 | RootRotationUpdateTolerance | 1118 | RootRotationUpdateTolerance |
1107 | = interestConfig.GetFloat("RootRotationUpdateTolerance", RootRotationUpdateTolerance); | 1119 | = interestConfig.GetFloat("RootRotationUpdateTolerance", RootRotationUpdateTolerance); |
1108 | RootVelocityUpdateTolerance | 1120 | RootVelocityUpdateTolerance |
1109 | = interestConfig.GetFloat("RootVelocityUpdateTolerance", RootVelocityUpdateTolerance); | 1121 | = interestConfig.GetFloat("RootVelocityUpdateTolerance", RootVelocityUpdateTolerance); |
1110 | } | 1122 | } |
1111 | 1123 | ||
1112 | m_log.DebugFormat("[SCENE]: Using the {0} prioritization scheme", UpdatePrioritizationScheme); | 1124 | m_log.DebugFormat("[SCENE]: Using the {0} prioritization scheme", UpdatePrioritizationScheme); |
1113 | 1125 | ||
1114 | #endregion Interest Management | 1126 | #endregion Interest Management |
1115 | 1127 | ||
1128 | // The timer used by the Stopwatch class depends on the system hardware and operating system; inform | ||
1129 | // if the timer is based on a high-resolution performance counter or based on the system timer; | ||
1130 | // the performance counter will provide a more precise time than the system timer | ||
1131 | if (Stopwatch.IsHighResolution) | ||
1132 | m_log.InfoFormat("[SCENE]: Using high-resolution performance counter for statistics."); | ||
1133 | else | ||
1134 | m_log.InfoFormat("[SCENE]: Using system timer for statistics."); | ||
1135 | |||
1116 | // Acquire the statistics section of the OpenSim.ini file located | 1136 | // Acquire the statistics section of the OpenSim.ini file located |
1117 | // in the bin directory | 1137 | // in the bin directory |
1118 | IConfig statisticsConfig = m_config.Configs["Statistics"]; | 1138 | IConfig statisticsConfig = m_config.Configs["Statistics"]; |
1119 | 1139 | ||
1120 | // Confirm that the statistics section existed in the configuration | 1140 | // Confirm that the statistics section existed in the configuration |
1121 | // file | 1141 | // file |
1122 | if (statisticsConfig != null) | 1142 | if (statisticsConfig != null) |
1123 | { | 1143 | { |
1124 | // Create the StatsReporter using the number of frames to store | 1144 | // Create the StatsReporter using the number of frames to store |
1125 | // for the frame time statistics, or 10 frames if the config | 1145 | // for the frame time statistics, or 10 frames if the config |
1126 | // file doesn't contain a value | 1146 | // file doesn't contain a value |
1127 | StatsReporter = new SimStatsReporter(this, | 1147 | StatsReporter = new SimStatsReporter(this, |
1128 | statisticsConfig.GetInt("NumberOfFrames", 10)); | 1148 | statisticsConfig.GetInt("NumberOfFrames", |
1149 | m_defaultNumberFramesStored)); | ||
1129 | } | 1150 | } |
1130 | else | 1151 | else |
1131 | { | 1152 | { |
1132 | // Create a StatsReporter with the current scene and a default | 1153 | // Create a StatsReporter with the current scene and a default |
1133 | // 10 frames stored for the frame time statistics | 1154 | // 10 frames stored for the frame time statistics |
1134 | StatsReporter = new SimStatsReporter(this); | 1155 | StatsReporter = new SimStatsReporter(this); |
1135 | } | 1156 | } |
1136 | 1157 | ||
1137 | StatsReporter.OnSendStatsResult += SendSimStatsPackets; | 1158 | StatsReporter.OnSendStatsResult += SendSimStatsPackets; |
1138 | StatsReporter.OnStatsIncorrect += m_sceneGraph.RecalculateStats; | 1159 | StatsReporter.OnStatsIncorrect += m_sceneGraph.RecalculateStats; |
1139 | 1160 | ||
1140 | } | 1161 | } |
1141 | 1162 | ||
1142 | public Scene(RegionInfo regInfo, PhysicsScene physicsScene) : base(regInfo) | 1163 | public Scene(RegionInfo regInfo, PhysicsScene physicsScene) |
1143 | { | 1164 | : base(regInfo) |
1165 | { | ||
1144 | m_sceneGraph = new SceneGraph(this); | 1166 | m_sceneGraph = new SceneGraph(this); |
1145 | m_sceneGraph.PhysicsScene = physicsScene; | 1167 | m_sceneGraph.PhysicsScene = physicsScene; |
1146 | 1168 | ||
@@ -1150,11 +1172,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
1150 | // | 1172 | // |
1151 | // Out of memory | 1173 | // Out of memory |
1152 | // Operating system has killed the plugin | 1174 | // Operating system has killed the plugin |
1153 | m_sceneGraph.UnRecoverableError | 1175 | m_sceneGraph.UnRecoverableError |
1154 | += () => | 1176 | += () => |
1155 | { | 1177 | { |
1156 | m_log.ErrorFormat("[SCENE]: Restarting region {0} due to unrecoverable physics crash", Name); | 1178 | m_log.ErrorFormat("[SCENE]: Restarting region {0} due to unrecoverable physics crash", Name); |
1157 | RestartNow(); | 1179 | RestartNow(); |
1158 | }; | 1180 | }; |
1159 | 1181 | ||
1160 | PhysicalPrims = true; | 1182 | PhysicalPrims = true; |
@@ -1199,7 +1221,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1199 | IDialogModule dm = RequestModuleInterface<IDialogModule>(); | 1221 | IDialogModule dm = RequestModuleInterface<IDialogModule>(); |
1200 | 1222 | ||
1201 | if (dm != null) | 1223 | if (dm != null) |
1202 | m_eventManager.OnPermissionError += dm.SendAlertToUser; | 1224 | m_eventManager.OnPermissionError += dm.SendAlertToUser; |
1203 | 1225 | ||
1204 | m_eventManager.OnSignificantClientMovement += HandleOnSignificantClientMovement; | 1226 | m_eventManager.OnSignificantClientMovement += HandleOnSignificantClientMovement; |
1205 | } | 1227 | } |
@@ -1229,7 +1251,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1229 | //int resultY = Math.Abs((int)ycell - (int)RegionInfo.RegionLocY); | 1251 | //int resultY = Math.Abs((int)ycell - (int)RegionInfo.RegionLocY); |
1230 | //if (resultX <= 1 && resultY <= 1) | 1252 | //if (resultX <= 1 && resultY <= 1) |
1231 | float dist = (float)Math.Max(DefaultDrawDistance, | 1253 | float dist = (float)Math.Max(DefaultDrawDistance, |
1232 | (float)Math.Max(RegionInfo.RegionSizeX, RegionInfo.RegionSizeY)); | 1254 | (float)Math.Max(RegionInfo.RegionSizeX, RegionInfo.RegionSizeY)); |
1233 | uint newRegionX, newRegionY, thisRegionX, thisRegionY; | 1255 | uint newRegionX, newRegionY, thisRegionX, thisRegionY; |
1234 | Util.RegionHandleToRegionLoc(otherRegion.RegionHandle, out newRegionX, out newRegionY); | 1256 | Util.RegionHandleToRegionLoc(otherRegion.RegionHandle, out newRegionX, out newRegionY); |
1235 | Util.RegionHandleToRegionLoc(RegionInfo.RegionHandle, out thisRegionX, out thisRegionY); | 1257 | Util.RegionHandleToRegionLoc(RegionInfo.RegionHandle, out thisRegionX, out thisRegionY); |
@@ -1253,7 +1275,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1253 | old.Add(otherRegion.RegionHandle); | 1275 | old.Add(otherRegion.RegionHandle); |
1254 | agent.DropOldNeighbours(old); | 1276 | agent.DropOldNeighbours(old); |
1255 | if (EntityTransferModule != null && agent.PresenceType != PresenceType.Npc) | 1277 | if (EntityTransferModule != null && agent.PresenceType != PresenceType.Npc) |
1256 | EntityTransferModule.EnableChildAgent(agent, otherRegion); | 1278 | EntityTransferModule.EnableChildAgent(agent, otherRegion); |
1257 | }); | 1279 | }); |
1258 | } | 1280 | } |
1259 | catch (NullReferenceException) | 1281 | catch (NullReferenceException) |
@@ -1266,8 +1288,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
1266 | else | 1288 | else |
1267 | { | 1289 | { |
1268 | m_log.InfoFormat( | 1290 | m_log.InfoFormat( |
1269 | "[SCENE]: Got notice about far away Region: {0} at ({1}, {2})", | 1291 | "[SCENE]: Got notice about far away Region: {0} at ({1}, {2})", |
1270 | otherRegion.RegionName, otherRegion.RegionLocX, otherRegion.RegionLocY); | 1292 | otherRegion.RegionName, otherRegion.RegionLocX, otherRegion.RegionLocY); |
1271 | } | 1293 | } |
1272 | } | 1294 | } |
1273 | } | 1295 | } |
@@ -1345,7 +1367,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1345 | ForEachRootScenePresence(delegate(ScenePresence agent) | 1367 | ForEachRootScenePresence(delegate(ScenePresence agent) |
1346 | { | 1368 | { |
1347 | if (EntityTransferModule != null && agent.PresenceType != PresenceType.Npc) | 1369 | if (EntityTransferModule != null && agent.PresenceType != PresenceType.Npc) |
1348 | EntityTransferModule.EnableChildAgent(agent, r); | 1370 | EntityTransferModule.EnableChildAgent(agent, r); |
1349 | }); | 1371 | }); |
1350 | } | 1372 | } |
1351 | catch (NullReferenceException) | 1373 | catch (NullReferenceException) |
@@ -1383,14 +1405,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
1383 | 1405 | ||
1384 | // Kick all ROOT agents with the message, 'The simulator is going down' | 1406 | // Kick all ROOT agents with the message, 'The simulator is going down' |
1385 | ForEachScenePresence(delegate(ScenePresence avatar) | 1407 | ForEachScenePresence(delegate(ScenePresence avatar) |
1386 | { | 1408 | { |
1387 | avatar.RemoveNeighbourRegion(RegionInfo.RegionHandle); | 1409 | avatar.RemoveNeighbourRegion(RegionInfo.RegionHandle); |
1388 | 1410 | ||
1389 | if (!avatar.IsChildAgent) | 1411 | if (!avatar.IsChildAgent) |
1390 | avatar.ControllingClient.Kick("The simulator is going down."); | 1412 | avatar.ControllingClient.Kick("The simulator is going down."); |
1391 | 1413 | ||
1392 | avatar.ControllingClient.SendShutdownConnectionNotice(); | 1414 | avatar.ControllingClient.SendShutdownConnectionNotice(); |
1393 | }); | 1415 | }); |
1394 | 1416 | ||
1395 | // Stop updating the scene objects and agents. | 1417 | // Stop updating the scene objects and agents. |
1396 | m_shuttingDown = true; | 1418 | m_shuttingDown = true; |
@@ -1409,7 +1431,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1409 | m_sceneGraph.Close(); | 1431 | m_sceneGraph.Close(); |
1410 | 1432 | ||
1411 | if (!GridService.DeregisterRegion(RegionInfo.RegionID)) | 1433 | if (!GridService.DeregisterRegion(RegionInfo.RegionID)) |
1412 | m_log.WarnFormat("[SCENE]: Deregister from grid failed for region {0}", Name); | 1434 | m_log.WarnFormat("[SCENE]: Deregister from grid failed for region {0}", Name); |
1413 | 1435 | ||
1414 | base.Close(); | 1436 | base.Close(); |
1415 | 1437 | ||
@@ -1440,10 +1462,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
1440 | public void Start(bool startScripts) | 1462 | public void Start(bool startScripts) |
1441 | { | 1463 | { |
1442 | if (IsRunning) | 1464 | if (IsRunning) |
1443 | return; | 1465 | return; |
1444 | 1466 | ||
1445 | m_isRunning = true; | 1467 | m_isRunning = true; |
1446 | m_active = true; | 1468 | m_active = true; |
1469 | |||
1447 | m_unixStartTime = Util.UnixTimeSinceEpoch(); | 1470 | m_unixStartTime = Util.UnixTimeSinceEpoch(); |
1448 | // m_log.DebugFormat("[SCENE]: Starting Heartbeat timer for {0}", RegionInfo.RegionName); | 1471 | // m_log.DebugFormat("[SCENE]: Starting Heartbeat timer for {0}", RegionInfo.RegionName); |
1449 | if (m_heartbeatThread != null) | 1472 | if (m_heartbeatThread != null) |
@@ -1453,8 +1476,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
1453 | } | 1476 | } |
1454 | 1477 | ||
1455 | m_heartbeatThread | 1478 | m_heartbeatThread |
1456 | = WorkManager.StartThread( | 1479 | = WorkManager.StartThread( |
1457 | Heartbeat, string.Format("Heartbeat-({0})", RegionInfo.RegionName.Replace(" ", "_")), ThreadPriority.Normal, false, false); | 1480 | Heartbeat, string.Format("Heartbeat-({0})", RegionInfo.RegionName.Replace(" ", "_")), ThreadPriority.Normal, false, false); |
1458 | 1481 | ||
1459 | StartScripts(); | 1482 | StartScripts(); |
1460 | } | 1483 | } |
@@ -1495,7 +1518,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1495 | Update(1); | 1518 | Update(1); |
1496 | 1519 | ||
1497 | WorkManager.StartThread( | 1520 | WorkManager.StartThread( |
1498 | Maintenance, string.Format("Maintenance ({0})", RegionInfo.RegionName), ThreadPriority.Normal, false, true); | 1521 | Maintenance, string.Format("Maintenance ({0})", RegionInfo.RegionName), ThreadPriority.Normal, false, true); |
1499 | 1522 | ||
1500 | Watchdog.GetCurrentThreadInfo().AlarmIfTimeout = true; | 1523 | Watchdog.GetCurrentThreadInfo().AlarmIfTimeout = true; |
1501 | m_lastFrameTick = Util.EnvironmentTickCount(); | 1524 | m_lastFrameTick = Util.EnvironmentTickCount(); |
@@ -1519,15 +1542,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
1519 | private volatile bool m_isTimerUpdateRunning; | 1542 | private volatile bool m_isTimerUpdateRunning; |
1520 | 1543 | ||
1521 | private void Update(object sender, ElapsedEventArgs e) | 1544 | private void Update(object sender, ElapsedEventArgs e) |
1522 | { | 1545 | { |
1523 | if (m_isTimerUpdateRunning) | 1546 | if (m_isTimerUpdateRunning) |
1524 | return; | 1547 | return; |
1525 | 1548 | ||
1526 | m_isTimerUpdateRunning = true; | 1549 | m_isTimerUpdateRunning = true; |
1527 | 1550 | ||
1528 | // If the last frame did not complete on time, then immediately start the next update on the same thread | 1551 | // If the last frame did not complete on time, then immediately start the next update on the same thread |
1529 | // and ignore further timed updates until we have a frame that had spare time. | 1552 | // and ignore further timed updates until we have a frame that had spare time. |
1530 | while (!Update(1) && Active) {} | 1553 | while (!Update(1) && Active) { } |
1531 | 1554 | ||
1532 | if (!Active || m_shuttingDown) | 1555 | if (!Active || m_shuttingDown) |
1533 | { | 1556 | { |
@@ -1553,7 +1576,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1553 | int previousMaintenanceTick; | 1576 | int previousMaintenanceTick; |
1554 | 1577 | ||
1555 | if (runs >= 0) | 1578 | if (runs >= 0) |
1556 | endRun = MaintenanceRun + runs; | 1579 | endRun = MaintenanceRun + runs; |
1557 | 1580 | ||
1558 | List<Vector3> coarseLocations; | 1581 | List<Vector3> coarseLocations; |
1559 | List<UUID> avatarUUIDs; | 1582 | List<UUID> avatarUUIDs; |
@@ -1563,7 +1586,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1563 | runtc = Util.EnvironmentTickCount(); | 1586 | runtc = Util.EnvironmentTickCount(); |
1564 | ++MaintenanceRun; | 1587 | ++MaintenanceRun; |
1565 | 1588 | ||
1566 | // m_log.DebugFormat("[SCENE]: Maintenance run {0} in {1}", MaintenanceRun, Name); | 1589 | // m_log.DebugFormat("[SCENE]: Maintenance run {0} in {1}", MaintenanceRun, Name); |
1567 | 1590 | ||
1568 | // Coarse locations relate to positions of green dots on the mini-map (on a SecondLife client) | 1591 | // Coarse locations relate to positions of green dots on the mini-map (on a SecondLife client) |
1569 | if (MaintenanceRun % (m_update_coarse_locations / 10) == 0) | 1592 | if (MaintenanceRun % (m_update_coarse_locations / 10) == 0) |
@@ -1578,7 +1601,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1578 | 1601 | ||
1579 | if (SendPeriodicAppearanceUpdates && MaintenanceRun % 60 == 0) | 1602 | if (SendPeriodicAppearanceUpdates && MaintenanceRun % 60 == 0) |
1580 | { | 1603 | { |
1581 | // m_log.DebugFormat("[SCENE]: Sending periodic appearance updates"); | 1604 | // m_log.DebugFormat("[SCENE]: Sending periodic appearance updates"); |
1582 | 1605 | ||
1583 | if (AvatarFactory != null) | 1606 | if (AvatarFactory != null) |
1584 | { | 1607 | { |
@@ -1589,14 +1612,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
1589 | // Delete temp-on-rez stuff | 1612 | // Delete temp-on-rez stuff |
1590 | if (MaintenanceRun % m_update_temp_cleaning == 0 && !m_cleaningTemps) | 1613 | if (MaintenanceRun % m_update_temp_cleaning == 0 && !m_cleaningTemps) |
1591 | { | 1614 | { |
1592 | // m_log.DebugFormat("[SCENE]: Running temp-on-rez cleaning in {0}", Name); | 1615 | // m_log.DebugFormat("[SCENE]: Running temp-on-rez cleaning in {0}", Name); |
1593 | tmpMS = Util.EnvironmentTickCount(); | 1616 | tmpMS = Util.EnvironmentTickCount(); |
1594 | m_cleaningTemps = true; | 1617 | m_cleaningTemps = true; |
1595 | 1618 | ||
1596 | WorkManager.RunInThread( | 1619 | WorkManager.RunInThread( |
1597 | delegate { CleanTempObjects(); m_cleaningTemps = false; }, | 1620 | delegate { CleanTempObjects(); m_cleaningTemps = false; }, |
1598 | null, | 1621 | null, |
1599 | string.Format("CleanTempObjects ({0})", Name)); | 1622 | string.Format("CleanTempObjects ({0})", Name)); |
1600 | 1623 | ||
1601 | tempOnRezMS = Util.EnvironmentTickCountSubtract(tmpMS); | 1624 | tempOnRezMS = Util.EnvironmentTickCountSubtract(tmpMS); |
1602 | } | 1625 | } |
@@ -1607,19 +1630,19 @@ namespace OpenSim.Region.Framework.Scenes | |||
1607 | m_lastMaintenanceTick = Util.EnvironmentTickCount(); | 1630 | m_lastMaintenanceTick = Util.EnvironmentTickCount(); |
1608 | runtc = Util.EnvironmentTickCountSubtract(m_lastMaintenanceTick, runtc); | 1631 | runtc = Util.EnvironmentTickCountSubtract(m_lastMaintenanceTick, runtc); |
1609 | runtc = MinMaintenanceTicks - runtc; | 1632 | runtc = MinMaintenanceTicks - runtc; |
1610 | 1633 | ||
1611 | if (runtc > 0) | 1634 | if (runtc > 0) |
1612 | m_maintenanceWaitEvent.WaitOne(runtc); | 1635 | m_maintenanceWaitEvent.WaitOne(runtc); |
1613 | 1636 | ||
1614 | // Optionally warn if a frame takes double the amount of time that it should. | 1637 | // Optionally warn if a frame takes double the amount of time that it should. |
1615 | if (DebugUpdates | 1638 | if (DebugUpdates |
1616 | && Util.EnvironmentTickCountSubtract( | 1639 | && Util.EnvironmentTickCountSubtract( |
1617 | m_lastMaintenanceTick, previousMaintenanceTick) > MinMaintenanceTicks * 2) | 1640 | m_lastMaintenanceTick, previousMaintenanceTick) > MinMaintenanceTicks * 2) |
1618 | m_log.WarnFormat( | 1641 | m_log.WarnFormat( |
1619 | "[SCENE]: Maintenance took {0} ms (desired max {1} ms) in {2}", | 1642 | "[SCENE]: Maintenance took {0} ms (desired max {1} ms) in {2}", |
1620 | Util.EnvironmentTickCountSubtract(m_lastMaintenanceTick, previousMaintenanceTick), | 1643 | Util.EnvironmentTickCountSubtract(m_lastMaintenanceTick, previousMaintenanceTick), |
1621 | MinMaintenanceTicks, | 1644 | MinMaintenanceTicks, |
1622 | RegionInfo.RegionName); | 1645 | RegionInfo.RegionName); |
1623 | } | 1646 | } |
1624 | } | 1647 | } |
1625 | 1648 | ||
@@ -1628,7 +1651,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1628 | long? endFrame = null; | 1651 | long? endFrame = null; |
1629 | 1652 | ||
1630 | if (frames >= 0) | 1653 | if (frames >= 0) |
1631 | endFrame = Frame + frames; | 1654 | endFrame = Frame + frames; |
1632 | 1655 | ||
1633 | float physicsFPS = 0f; | 1656 | float physicsFPS = 0f; |
1634 | int previousFrameTick, tmpMS; | 1657 | int previousFrameTick, tmpMS; |
@@ -1647,12 +1670,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
1647 | // Begin the stopwatch to keep track of the time that the frame | 1670 | // Begin the stopwatch to keep track of the time that the frame |
1648 | // started running to determine how long the frame took to complete | 1671 | // started running to determine how long the frame took to complete |
1649 | totalFrameStopwatch.Start(); | 1672 | totalFrameStopwatch.Start(); |
1650 | 1673 | ||
1651 | while (!m_shuttingDown && ((endFrame == null && Active) || Frame < endFrame)) | 1674 | while (!m_shuttingDown && ((endFrame == null && Active) || Frame < endFrame)) |
1652 | { | 1675 | { |
1653 | ++Frame; | 1676 | ++Frame; |
1654 | 1677 | ||
1655 | // m_log.DebugFormat("[SCENE]: Processing frame {0} in {1}", Frame, RegionInfo.RegionName); | 1678 | // m_log.DebugFormat("[SCENE]: Processing frame {0} in {1}", Frame, RegionInfo.RegionName); |
1656 | 1679 | ||
1657 | agentMS = eventMS = backupMS = terrainMS = landMS = spareMS = 0; | 1680 | agentMS = eventMS = backupMS = terrainMS = landMS = spareMS = 0; |
1658 | 1681 | ||
@@ -1673,48 +1696,56 @@ namespace OpenSim.Region.Framework.Scenes | |||
1673 | // at this point in time, the precise values all begin | 1696 | // at this point in time, the precise values all begin |
1674 | // with the keyword precise | 1697 | // with the keyword precise |
1675 | tmpMS = Util.EnvironmentTickCount(); | 1698 | tmpMS = Util.EnvironmentTickCount(); |
1676 | |||
1677 | simFrameStopwatch.Start(); | 1699 | simFrameStopwatch.Start(); |
1678 | UpdateTerrain(); | 1700 | UpdateTerrain(); |
1679 | 1701 | ||
1680 | // Get the simulation frame time that the avatar force | 1702 | // Get the simulation frame time that the avatar force |
1681 | // input took | 1703 | // input took |
1682 | simFrameStopwatch.Stop(); | 1704 | simFrameStopwatch.Stop(); |
1683 | preciseSimFrameTime = | 1705 | preciseSimFrameTime = |
1684 | simFrameStopwatch.Elapsed.TotalMilliseconds; | 1706 | simFrameStopwatch.Elapsed.TotalMilliseconds; |
1685 | terrainMS = Util.EnvironmentTickCountSubtract(tmpMS); | 1707 | terrainMS = Util.EnvironmentTickCountSubtract(tmpMS); |
1686 | } | 1708 | } |
1687 | 1709 | ||
1710 | // At several points inside the code there was a need to | ||
1711 | // create a more precise measurement of time elapsed. This | ||
1712 | // led to the addition of variables that have a similar | ||
1713 | // function and thus remain tightly connected to their | ||
1714 | // original counterparts. However, the original code is | ||
1715 | // not receiving comments from our group because we don't | ||
1716 | // feel right modifying the code to that degree at this | ||
1717 | // point in time, the precise values all begin with the | ||
1718 | // keyword precise | ||
1719 | |||
1688 | tmpMS = Util.EnvironmentTickCount(); | 1720 | tmpMS = Util.EnvironmentTickCount(); |
1689 | 1721 | ||
1690 | // Begin the stopwatch to track the time to prepare physics | 1722 | // Begin the stopwatch to track the time to prepare physics |
1691 | physicsFrameStopwatch.Start(); | 1723 | physicsFrameStopwatch.Start(); |
1692 | if (PhysicsEnabled && Frame % m_update_physics == 0) | 1724 | if (PhysicsEnabled && Frame % m_update_physics == 0) |
1693 | m_sceneGraph.UpdatePreparePhysics(); | 1725 | m_sceneGraph.UpdatePreparePhysics(); |
1694 | 1726 | ||
1695 | // Get the time it took to prepare the physics, this | 1727 | // Get the time it took to prepare the physics, this |
1696 | // would report the most precise time that physics was | 1728 | // would report the most precise time that physics was |
1697 | // running on the machine and should the physics not be | 1729 | // running on the machine and should the physics not be |
1698 | // enabled will report the time it took to check if physics | 1730 | // enabled will report the time it took to check if physics |
1699 | // was enabled | 1731 | // was enabled |
1700 | physicsFrameStopwatch.Stop(); | 1732 | physicsFrameStopwatch.Stop(); |
1701 | precisePhysicsFrameTime = | 1733 | precisePhysicsFrameTime = physicsFrameStopwatch.Elapsed.TotalMilliseconds; |
1702 | physicsFrameStopwatch.Elapsed.TotalMilliseconds; | ||
1703 | physicsMS2 = Util.EnvironmentTickCountSubtract(tmpMS); | 1734 | physicsMS2 = Util.EnvironmentTickCountSubtract(tmpMS); |
1704 | 1735 | ||
1705 | // Apply any pending avatar force input to the avatar's velocity | 1736 | // Apply any pending avatar force input to the avatar's velocity |
1706 | tmpMS = Util.EnvironmentTickCount(); | 1737 | tmpMS = Util.EnvironmentTickCount(); |
1707 | simFrameStopwatch.Restart(); | 1738 | simFrameStopwatch.Restart(); |
1708 | if (Frame % m_update_entitymovement == 0) | 1739 | if (Frame % m_update_entitymovement == 0) |
1709 | m_sceneGraph.UpdateScenePresenceMovement(); | 1740 | m_sceneGraph.UpdateScenePresenceMovement(); |
1710 | 1741 | ||
1711 | // Get the simulation frame time that the avatar force input | 1742 | // Get the simulation frame time that the avatar force input |
1712 | // took | 1743 | // took |
1713 | simFrameStopwatch.Stop(); | 1744 | simFrameStopwatch.Stop(); |
1714 | preciseSimFrameTime += | 1745 | preciseSimFrameTime += |
1715 | simFrameStopwatch.Elapsed.TotalMilliseconds; | 1746 | simFrameStopwatch.Elapsed.TotalMilliseconds; |
1716 | agentMS = Util.EnvironmentTickCountSubtract(tmpMS); | 1747 | agentMS = Util.EnvironmentTickCountSubtract(tmpMS); |
1717 | 1748 | ||
1718 | // Perform the main physics update. This will do the actual work of moving objects and avatars according to their | 1749 | // Perform the main physics update. This will do the actual work of moving objects and avatars according to their |
1719 | // velocity | 1750 | // velocity |
1720 | tmpMS = Util.EnvironmentTickCount(); | 1751 | tmpMS = Util.EnvironmentTickCount(); |
@@ -1722,63 +1753,61 @@ namespace OpenSim.Region.Framework.Scenes | |||
1722 | if (Frame % m_update_physics == 0) | 1753 | if (Frame % m_update_physics == 0) |
1723 | { | 1754 | { |
1724 | if (PhysicsEnabled) | 1755 | if (PhysicsEnabled) |
1725 | physicsFPS = m_sceneGraph.UpdatePhysics(MinFrameSeconds); | 1756 | physicsFPS = m_sceneGraph.UpdatePhysics(MinFrameSeconds); |
1726 | 1757 | ||
1727 | if (SynchronizeScene != null) | 1758 | if (SynchronizeScene != null) |
1728 | SynchronizeScene(this); | 1759 | SynchronizeScene(this); |
1729 | } | 1760 | } |
1730 | 1761 | ||
1731 | // Add the main physics update time to the prepare physics | 1762 | // Add the main physics update time to the prepare physics time |
1732 | // time | ||
1733 | physicsFrameStopwatch.Stop(); | 1763 | physicsFrameStopwatch.Stop(); |
1734 | precisePhysicsFrameTime += | 1764 | precisePhysicsFrameTime += physicsFrameStopwatch.Elapsed.TotalMilliseconds; |
1735 | physicsFrameStopwatch.Elapsed.TotalMilliseconds; | ||
1736 | physicsMS = Util.EnvironmentTickCountSubtract(tmpMS); | 1765 | physicsMS = Util.EnvironmentTickCountSubtract(tmpMS); |
1737 | 1766 | ||
1738 | // Start the stopwatch for the remainder of the simulation | 1767 | // Start the stopwatch for the remainder of the simulation |
1739 | simFrameStopwatch.Restart(); | 1768 | simFrameStopwatch.Restart(); |
1740 | tmpMS = Util.EnvironmentTickCount(); | 1769 | tmpMS = Util.EnvironmentTickCount(); |
1741 | 1770 | ||
1742 | // Check if any objects have reached their targets | 1771 | // Check if any objects have reached their targets |
1743 | CheckAtTargets(); | 1772 | CheckAtTargets(); |
1744 | 1773 | ||
1745 | // Update SceneObjectGroups that have scheduled themselves for updates | 1774 | // Update SceneObjectGroups that have scheduled themselves for updates |
1746 | // Objects queue their updates onto all scene presences | 1775 | // Objects queue their updates onto all scene presences |
1747 | if (Frame % m_update_objects == 0) | 1776 | if (Frame % m_update_objects == 0) |
1748 | m_sceneGraph.UpdateObjectGroups(); | 1777 | m_sceneGraph.UpdateObjectGroups(); |
1749 | 1778 | ||
1750 | // Run through all ScenePresences looking for updates | 1779 | // Run through all ScenePresences looking for updates |
1751 | // Presence updates and queued object updates for each presence are sent to clients | 1780 | // Presence updates and queued object updates for each presence are sent to clients |
1752 | if (Frame % m_update_presences == 0) | 1781 | if (Frame % m_update_presences == 0) |
1753 | m_sceneGraph.UpdatePresences(); | 1782 | m_sceneGraph.UpdatePresences(); |
1754 | 1783 | ||
1755 | agentMS += Util.EnvironmentTickCountSubtract(tmpMS); | 1784 | agentMS += Util.EnvironmentTickCountSubtract(tmpMS); |
1756 | 1785 | ||
1757 | if (Frame % m_update_events == 0) | 1786 | if (Frame % m_update_events == 0) |
1758 | { | 1787 | { |
1759 | tmpMS = Util.EnvironmentTickCount(); | 1788 | tmpMS = Util.EnvironmentTickCount(); |
1760 | UpdateEvents(); | 1789 | UpdateEvents(); |
1761 | eventMS = Util.EnvironmentTickCountSubtract(tmpMS); | 1790 | eventMS = Util.EnvironmentTickCountSubtract(tmpMS); |
1762 | } | 1791 | } |
1763 | 1792 | ||
1764 | if (PeriodicBackup && Frame % m_update_backup == 0) | 1793 | if (PeriodicBackup && Frame % m_update_backup == 0) |
1765 | { | 1794 | { |
1766 | tmpMS = Util.EnvironmentTickCount(); | 1795 | tmpMS = Util.EnvironmentTickCount(); |
1767 | UpdateStorageBackup(); | 1796 | UpdateStorageBackup(); |
1768 | backupMS = Util.EnvironmentTickCountSubtract(tmpMS); | 1797 | backupMS = Util.EnvironmentTickCountSubtract(tmpMS); |
1769 | } | 1798 | } |
1770 | 1799 | ||
1771 | //if (Frame % m_update_land == 0) | 1800 | //if (Frame % m_update_land == 0) |
1772 | //{ | 1801 | //{ |
1773 | // int ldMS = Util.EnvironmentTickCount(); | 1802 | // int ldMS = Util.EnvironmentTickCount(); |
1774 | // UpdateLand(); | 1803 | // UpdateLand(); |
1775 | // landMS = Util.EnvironmentTickCountSubtract(ldMS); | 1804 | // landMS = Util.EnvironmentTickCountSubtract(ldMS); |
1776 | //} | 1805 | //} |
1777 | 1806 | ||
1778 | if (!LoginsEnabled && Frame == 20) | 1807 | if (!LoginsEnabled && Frame == 20) |
1779 | { | 1808 | { |
1780 | // m_log.DebugFormat("{0} {1} {2}", LoginsDisabled, m_sceneGraph.GetActiveScriptsCount(), LoginLock); | 1809 | // m_log.DebugFormat("{0} {1} {2}", LoginsDisabled, m_sceneGraph.GetActiveScriptsCount(), LoginLock); |
1781 | 1810 | ||
1782 | // In 99.9% of cases it is a bad idea to manually force garbage collection. However, | 1811 | // In 99.9% of cases it is a bad idea to manually force garbage collection. However, |
1783 | // this is a rare case where we know we have just went through a long cycle of heap | 1812 | // this is a rare case where we know we have just went through a long cycle of heap |
1784 | // allocations, and there is no more work to be done until someone logs in | 1813 | // allocations, and there is no more work to be done until someone logs in |
@@ -1793,7 +1822,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1793 | } | 1822 | } |
1794 | 1823 | ||
1795 | m_sceneGridService.InformNeighborsThatRegionisUp( | 1824 | m_sceneGridService.InformNeighborsThatRegionisUp( |
1796 | RequestModuleInterface<INeighbourService>(), RegionInfo); | 1825 | RequestModuleInterface<INeighbourService>(), RegionInfo); |
1797 | 1826 | ||
1798 | // Region ready should always be set | 1827 | // Region ready should always be set |
1799 | Ready = true; | 1828 | Ready = true; |
@@ -1804,7 +1833,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1804 | if (m_sceneGraph.GetActiveScriptsCount() == 0) | 1833 | if (m_sceneGraph.GetActiveScriptsCount() == 0) |
1805 | { | 1834 | { |
1806 | // In this case, we leave it to the IRegionReadyModule to enable logins | 1835 | // In this case, we leave it to the IRegionReadyModule to enable logins |
1807 | 1836 | ||
1808 | // LoginLock can currently only be set by a region module implementation. | 1837 | // LoginLock can currently only be set by a region module implementation. |
1809 | // If somehow this hasn't been done then the quickest way to bugfix is to see the | 1838 | // If somehow this hasn't been done then the quickest way to bugfix is to see the |
1810 | // NullReferenceException | 1839 | // NullReferenceException |
@@ -1817,18 +1846,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
1817 | catch (Exception e) | 1846 | catch (Exception e) |
1818 | { | 1847 | { |
1819 | m_log.ErrorFormat( | 1848 | m_log.ErrorFormat( |
1820 | "[SCENE]: Failed on region {0} with exception {1}{2}", | 1849 | "[SCENE]: Failed on region {0} with exception {1}{2}", |
1821 | RegionInfo.RegionName, e.Message, e.StackTrace); | 1850 | RegionInfo.RegionName, e.Message, e.StackTrace); |
1822 | } | 1851 | } |
1823 | 1852 | ||
1824 | EventManager.TriggerRegionHeartbeatEnd(this); | 1853 | EventManager.TriggerRegionHeartbeatEnd(this); |
1825 | otherMS = eventMS + backupMS + terrainMS + landMS; | 1854 | otherMS = eventMS + backupMS + terrainMS + landMS; |
1826 | 1855 | ||
1827 | // Get the elapsed time for the simulation frame | 1856 | // Get the elapsed time for the simulation frame |
1828 | simFrameStopwatch.Stop(); | 1857 | simFrameStopwatch.Stop(); |
1829 | preciseSimFrameTime += | 1858 | preciseSimFrameTime += |
1830 | simFrameStopwatch.Elapsed.TotalMilliseconds; | 1859 | simFrameStopwatch.Elapsed.TotalMilliseconds; |
1831 | 1860 | ||
1832 | if (!UpdateOnTimer) | 1861 | if (!UpdateOnTimer) |
1833 | { | 1862 | { |
1834 | Watchdog.UpdateThread(); | 1863 | Watchdog.UpdateThread(); |
@@ -1836,9 +1865,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
1836 | spareMS = MinFrameTicks - Util.EnvironmentTickCountSubtract(m_lastFrameTick); | 1865 | spareMS = MinFrameTicks - Util.EnvironmentTickCountSubtract(m_lastFrameTick); |
1837 | 1866 | ||
1838 | if (spareMS > 0) | 1867 | if (spareMS > 0) |
1839 | m_updateWaitEvent.WaitOne(spareMS); | 1868 | m_updateWaitEvent.WaitOne(spareMS); |
1840 | else | 1869 | else |
1841 | spareMS = 0; | 1870 | spareMS = 0; |
1842 | } | 1871 | } |
1843 | else | 1872 | else |
1844 | { | 1873 | { |
@@ -1847,15 +1876,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
1847 | 1876 | ||
1848 | // Get the total frame time | 1877 | // Get the total frame time |
1849 | totalFrameStopwatch.Stop(); | 1878 | totalFrameStopwatch.Stop(); |
1850 | preciseTotalFrameTime = | 1879 | preciseTotalFrameTime = |
1851 | totalFrameStopwatch.Elapsed.TotalMilliseconds; | 1880 | totalFrameStopwatch.Elapsed.TotalMilliseconds; |
1852 | 1881 | ||
1853 | // Restart the stopwatch for the total time of the next frame | 1882 | // Restart the stopwatch for the total time of the next frame |
1854 | totalFrameStopwatch.Restart(); | 1883 | totalFrameStopwatch.Restart(); |
1855 | 1884 | ||
1856 | previousFrameTick = m_lastFrameTick; | 1885 | previousFrameTick = m_lastFrameTick; |
1857 | frameMS = Util.EnvironmentTickCountSubtract(m_lastFrameTick); | 1886 | frameMS = Util.EnvironmentTickCountSubtract(m_lastFrameTick); |
1858 | m_lastFrameTick = Util.EnvironmentTickCount(); | 1887 | m_lastFrameTick = Util.EnvironmentTickCount(); |
1859 | 1888 | ||
1860 | // if (Frame%m_update_avatars == 0) | 1889 | // if (Frame%m_update_avatars == 0) |
1861 | // UpdateInWorldTime(); | 1890 | // UpdateInWorldTime(); |
@@ -1872,37 +1901,40 @@ namespace OpenSim.Region.Framework.Scenes | |||
1872 | 1901 | ||
1873 | // Send the correct time values to the stats reporter for the | 1902 | // Send the correct time values to the stats reporter for the |
1874 | // frame times | 1903 | // frame times |
1875 | StatsReporter.addFrameTimeMilliseconds(preciseTotalFrameTime, | 1904 | StatsReporter.addFrameTimeMilliseconds(preciseTotalFrameTime, |
1876 | preciseSimFrameTime, precisePhysicsFrameTime, 0.0); | 1905 | preciseSimFrameTime, precisePhysicsFrameTime, 0.0); |
1877 | 1906 | ||
1878 | // Send the correct number of frames that the physics library | 1907 | // Send the correct number of frames that the physics library |
1879 | // has processed to the stats reporter | 1908 | // has processed to the stats reporter |
1880 | StatsReporter.addPhysicsFrame(1); | 1909 | StatsReporter.addPhysicsFrame(1); |
1881 | 1910 | ||
1882 | // Optionally warn if a frame takes double the amount of time that it should. | 1911 | // Optionally warn if a frame takes double the amount of time that it should. |
1883 | if (DebugUpdates | 1912 | if (DebugUpdates |
1884 | && Util.EnvironmentTickCountSubtract( | 1913 | && Util.EnvironmentTickCountSubtract( |
1885 | m_lastFrameTick, previousFrameTick) > MinFrameTicks * 2) | 1914 | m_lastFrameTick, previousFrameTick) > MinFrameTicks * 2) |
1886 | m_log.WarnFormat( | 1915 | m_log.WarnFormat( |
1887 | "[SCENE]: Frame took {0} ms (desired max {1} ms) in {2}", | 1916 | "[SCENE]: Frame took {0} ms (desired max {1} ms) in {2}", |
1888 | Util.EnvironmentTickCountSubtract(m_lastFrameTick, previousFrameTick), | 1917 | Util.EnvironmentTickCountSubtract(m_lastFrameTick, previousFrameTick), |
1889 | MinFrameTicks, | 1918 | MinFrameTicks, |
1890 | RegionInfo.RegionName); | 1919 | RegionInfo.RegionName); |
1891 | } | 1920 | } |
1892 | 1921 | ||
1922 | // Finished updating scene frame, so stop the total frame's Stopwatch | ||
1923 | totalFrameStopwatch.Stop(); | ||
1924 | |||
1893 | return spareMS >= 0; | 1925 | return spareMS >= 0; |
1894 | } | 1926 | } |
1895 | 1927 | ||
1896 | public void AddGroupTarget(SceneObjectGroup grp) | 1928 | public void AddGroupTarget(SceneObjectGroup grp) |
1897 | { | 1929 | { |
1898 | lock (m_groupsWithTargets) | 1930 | lock (m_groupsWithTargets) |
1899 | m_groupsWithTargets[grp.UUID] = grp; | 1931 | m_groupsWithTargets[grp.UUID] = grp; |
1900 | } | 1932 | } |
1901 | 1933 | ||
1902 | public void RemoveGroupTarget(SceneObjectGroup grp) | 1934 | public void RemoveGroupTarget(SceneObjectGroup grp) |
1903 | { | 1935 | { |
1904 | lock (m_groupsWithTargets) | 1936 | lock (m_groupsWithTargets) |
1905 | m_groupsWithTargets.Remove(grp.UUID); | 1937 | m_groupsWithTargets.Remove(grp.UUID); |
1906 | } | 1938 | } |
1907 | 1939 | ||
1908 | private void CheckAtTargets() | 1940 | private void CheckAtTargets() |
@@ -1912,13 +1944,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
1912 | lock (m_groupsWithTargets) | 1944 | lock (m_groupsWithTargets) |
1913 | { | 1945 | { |
1914 | if (m_groupsWithTargets.Count != 0) | 1946 | if (m_groupsWithTargets.Count != 0) |
1915 | objs = new List<SceneObjectGroup>(m_groupsWithTargets.Values); | 1947 | objs = new List<SceneObjectGroup>(m_groupsWithTargets.Values); |
1916 | } | 1948 | } |
1917 | 1949 | ||
1918 | if (objs != null) | 1950 | if (objs != null) |
1919 | { | 1951 | { |
1920 | foreach (SceneObjectGroup entry in objs) | 1952 | foreach (SceneObjectGroup entry in objs) |
1921 | entry.checkAtTargets(); | 1953 | entry.checkAtTargets(); |
1922 | } | 1954 | } |
1923 | } | 1955 | } |
1924 | 1956 | ||
@@ -1961,7 +1993,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1961 | { | 1993 | { |
1962 | m_eventManager.TriggerOnFrame(); | 1994 | m_eventManager.TriggerOnFrame(); |
1963 | } | 1995 | } |
1964 | 1996 | ||
1965 | /// <summary> | 1997 | /// <summary> |
1966 | /// Backup the scene. | 1998 | /// Backup the scene. |
1967 | /// </summary> | 1999 | /// </summary> |
@@ -2001,13 +2033,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
2001 | // We must fill in a null-terminated 'empty' string here since bytes[0] will crash viewer 3. | 2033 | // We must fill in a null-terminated 'empty' string here since bytes[0] will crash viewer 3. |
2002 | msg.binaryBucket = Util.StringToBytes256("\0"); | 2034 | msg.binaryBucket = Util.StringToBytes256("\0"); |
2003 | if (ret.Value.count > 1) | 2035 | if (ret.Value.count > 1) |
2004 | 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); | 2036 | 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); |
2005 | else | 2037 | else |
2006 | 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); | 2038 | 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); |
2007 | 2039 | ||
2008 | IMessageTransferModule tr = RequestModuleInterface<IMessageTransferModule>(); | 2040 | IMessageTransferModule tr = RequestModuleInterface<IMessageTransferModule>(); |
2009 | if (tr != null) | 2041 | if (tr != null) |
2010 | tr.SendInstantMessage(msg, delegate(bool success) {}); | 2042 | tr.SendInstantMessage(msg, delegate(bool success) { }); |
2011 | } | 2043 | } |
2012 | m_returns.Clear(); | 2044 | m_returns.Clear(); |
2013 | } | 2045 | } |
@@ -2098,7 +2130,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2098 | IConfig terrainConfig = m_config.Configs["Terrain"]; | 2130 | IConfig terrainConfig = m_config.Configs["Terrain"]; |
2099 | String m_InitialTerrain = "pinhead-island"; | 2131 | String m_InitialTerrain = "pinhead-island"; |
2100 | if (terrainConfig != null) | 2132 | if (terrainConfig != null) |
2101 | m_InitialTerrain = terrainConfig.GetString("InitialTerrain", m_InitialTerrain); | 2133 | m_InitialTerrain = terrainConfig.GetString("InitialTerrain", m_InitialTerrain); |
2102 | 2134 | ||
2103 | m_log.InfoFormat("[TERRAIN]: No default terrain. Generating a new terrain {0}.", m_InitialTerrain); | 2135 | m_log.InfoFormat("[TERRAIN]: No default terrain. Generating a new terrain {0}.", m_InitialTerrain); |
2104 | Heightmap = new TerrainChannel(m_InitialTerrain, (int)RegionInfo.RegionSizeX, (int)RegionInfo.RegionSizeY, (int)RegionInfo.RegionSizeZ); | 2136 | Heightmap = new TerrainChannel(m_InitialTerrain, (int)RegionInfo.RegionSizeX, (int)RegionInfo.RegionSizeY, (int)RegionInfo.RegionSizeZ); |
@@ -2113,11 +2145,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
2113 | catch (IOException e) | 2145 | catch (IOException e) |
2114 | { | 2146 | { |
2115 | m_log.WarnFormat( | 2147 | m_log.WarnFormat( |
2116 | "[TERRAIN]: Scene.cs: LoadWorldMap() - Regenerating as failed with exception {0}{1}", | 2148 | "[TERRAIN]: Scene.cs: LoadWorldMap() - Regenerating as failed with exception {0}{1}", |
2117 | e.Message, e.StackTrace); | 2149 | e.Message, e.StackTrace); |
2118 | 2150 | ||
2119 | // Non standard region size. If there's an old terrain in the database, it might read past the buffer | 2151 | // Non standard region size. If there's an old terrain in the database, it might read past the buffer |
2120 | #pragma warning disable 0162 | 2152 | #pragma warning disable 0162 |
2121 | if ((int)Constants.RegionSize != 256) | 2153 | if ((int)Constants.RegionSize != 256) |
2122 | { | 2154 | { |
2123 | Heightmap = new TerrainChannel(); | 2155 | Heightmap = new TerrainChannel(); |
@@ -2128,7 +2160,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2128 | catch (Exception e) | 2160 | catch (Exception e) |
2129 | { | 2161 | { |
2130 | m_log.WarnFormat( | 2162 | m_log.WarnFormat( |
2131 | "[TERRAIN]: Scene.cs: LoadWorldMap() - Failed with exception {0}{1}", e.Message, e.StackTrace); | 2163 | "[TERRAIN]: Scene.cs: LoadWorldMap() - Failed with exception {0}{1}", e.Message, e.StackTrace); |
2132 | } | 2164 | } |
2133 | } | 2165 | } |
2134 | 2166 | ||
@@ -2145,18 +2177,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
2145 | //// stored in the GridService, because that's what the world map module uses | 2177 | //// stored in the GridService, because that's what the world map module uses |
2146 | //// to send the map image UUIDs (of other regions) to the viewer... | 2178 | //// to send the map image UUIDs (of other regions) to the viewer... |
2147 | if (m_generateMaptiles) | 2179 | if (m_generateMaptiles) |
2148 | RegenerateMaptile(); | 2180 | RegenerateMaptile(); |
2149 | 2181 | ||
2150 | GridRegion region = new GridRegion(RegionInfo); | 2182 | GridRegion region = new GridRegion(RegionInfo); |
2151 | string error = GridService.RegisterRegion(RegionInfo.ScopeID, region); | 2183 | string error = GridService.RegisterRegion(RegionInfo.ScopeID, region); |
2152 | // m_log.DebugFormat("[SCENE]: RegisterRegionWithGrid. name={0},id={1},loc=<{2},{3}>,size=<{4},{5}>", | 2184 | // m_log.DebugFormat("[SCENE]: RegisterRegionWithGrid. name={0},id={1},loc=<{2},{3}>,size=<{4},{5}>", |
2153 | // m_regionName, | 2185 | // m_regionName, |
2154 | // RegionInfo.RegionID, | 2186 | // RegionInfo.RegionID, |
2155 | // RegionInfo.RegionLocX, RegionInfo.RegionLocY, | 2187 | // RegionInfo.RegionLocX, RegionInfo.RegionLocY, |
2156 | // RegionInfo.RegionSizeX, RegionInfo.RegionSizeY); | 2188 | // RegionInfo.RegionSizeX, RegionInfo.RegionSizeY); |
2157 | 2189 | ||
2158 | if (error != String.Empty) | 2190 | if (error != String.Empty) |
2159 | throw new Exception(error); | 2191 | throw new Exception(error); |
2160 | } | 2192 | } |
2161 | 2193 | ||
2162 | #endregion | 2194 | #endregion |
@@ -2215,7 +2247,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2215 | rootPart.TrimPermissions(); | 2247 | rootPart.TrimPermissions(); |
2216 | 2248 | ||
2217 | // Don't do this here - it will get done later on when sculpt data is loaded. | 2249 | // Don't do this here - it will get done later on when sculpt data is loaded. |
2218 | // group.CheckSculptAndLoad(); | 2250 | // group.CheckSculptAndLoad(); |
2219 | } | 2251 | } |
2220 | 2252 | ||
2221 | LoadingPrims = false; | 2253 | LoadingPrims = false; |
@@ -2225,15 +2257,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
2225 | public bool SupportsRayCastFiltered() | 2257 | public bool SupportsRayCastFiltered() |
2226 | { | 2258 | { |
2227 | if (PhysicsScene == null) | 2259 | if (PhysicsScene == null) |
2228 | return false; | 2260 | return false; |
2229 | return PhysicsScene.SupportsRaycastWorldFiltered(); | 2261 | return PhysicsScene.SupportsRaycastWorldFiltered(); |
2230 | } | 2262 | } |
2231 | 2263 | ||
2232 | public object RayCastFiltered(Vector3 position, Vector3 direction, float length, int Count, RayFilterFlags filter) | 2264 | public object RayCastFiltered(Vector3 position, Vector3 direction, float length, int Count, RayFilterFlags filter) |
2233 | { | 2265 | { |
2234 | if (PhysicsScene == null) | 2266 | if (PhysicsScene == null) |
2235 | return null; | 2267 | return null; |
2236 | return PhysicsScene.RaycastWorld(position, direction, length, Count,filter); | 2268 | return PhysicsScene.RaycastWorld(position, direction, length, Count, filter); |
2237 | } | 2269 | } |
2238 | 2270 | ||
2239 | /// <summary> | 2271 | /// <summary> |
@@ -2301,7 +2333,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2301 | //And in cases when we weren't rezzing from inventory we were re-adding the 0.25 straight after calling this method | 2333 | //And in cases when we weren't rezzing from inventory we were re-adding the 0.25 straight after calling this method |
2302 | // Un-offset the prim (it gets offset later by the consumer method) | 2334 | // Un-offset the prim (it gets offset later by the consumer method) |
2303 | //pos.Z -= 0.25F; | 2335 | //pos.Z -= 0.25F; |
2304 | 2336 | ||
2305 | } | 2337 | } |
2306 | 2338 | ||
2307 | return pos; | 2339 | return pos; |
@@ -2318,7 +2350,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2318 | if (ei.HitTF) | 2350 | if (ei.HitTF) |
2319 | { | 2351 | { |
2320 | pos = ei.ipoint; | 2352 | pos = ei.ipoint; |
2321 | } | 2353 | } |
2322 | else | 2354 | else |
2323 | { | 2355 | { |
2324 | // fall back to our stupid functionality | 2356 | // fall back to our stupid functionality |
@@ -2354,8 +2386,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2354 | /// <param name="RayTargetID"></param> | 2386 | /// <param name="RayTargetID"></param> |
2355 | /// <param name="RayEndIsIntersection"></param> | 2387 | /// <param name="RayEndIsIntersection"></param> |
2356 | public virtual void AddNewPrim(UUID ownerID, UUID groupID, Vector3 RayEnd, Quaternion rot, PrimitiveBaseShape shape, | 2388 | public virtual void AddNewPrim(UUID ownerID, UUID groupID, Vector3 RayEnd, Quaternion rot, PrimitiveBaseShape shape, |
2357 | byte bypassRaycast, Vector3 RayStart, UUID RayTargetID, | 2389 | byte bypassRaycast, Vector3 RayStart, UUID RayTargetID, |
2358 | byte RayEndIsIntersection) | 2390 | byte RayEndIsIntersection) |
2359 | { | 2391 | { |
2360 | Vector3 pos = GetNewRezLocation(RayStart, RayEnd, RayTargetID, rot, bypassRaycast, RayEndIsIntersection, true, new Vector3(0.5f, 0.5f, 0.5f), false); | 2392 | Vector3 pos = GetNewRezLocation(RayStart, RayEnd, RayTargetID, rot, bypassRaycast, RayEndIsIntersection, true, new Vector3(0.5f, 0.5f, 0.5f), false); |
2361 | 2393 | ||
@@ -2370,18 +2402,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
2370 | { | 2402 | { |
2371 | IClientAPI client = null; | 2403 | IClientAPI client = null; |
2372 | if (TryGetClient(ownerID, out client)) | 2404 | if (TryGetClient(ownerID, out client)) |
2373 | client.SendAlertMessage("You cannot create objects here."); | 2405 | client.SendAlertMessage("You cannot create objects here."); |
2374 | } | 2406 | } |
2375 | } | 2407 | } |
2376 | 2408 | ||
2377 | public virtual SceneObjectGroup AddNewPrim( | 2409 | public virtual SceneObjectGroup AddNewPrim( |
2378 | UUID ownerID, UUID groupID, Vector3 pos, Quaternion rot, PrimitiveBaseShape shape) | 2410 | UUID ownerID, UUID groupID, Vector3 pos, Quaternion rot, PrimitiveBaseShape shape) |
2379 | { | 2411 | { |
2380 | //m_log.DebugFormat( | 2412 | //m_log.DebugFormat( |
2381 | // "[SCENE]: Scene.AddNewPrim() pcode {0} called for {1} in {2}", shape.PCode, ownerID, RegionInfo.RegionName); | 2413 | // "[SCENE]: Scene.AddNewPrim() pcode {0} called for {1} in {2}", shape.PCode, ownerID, RegionInfo.RegionName); |
2382 | 2414 | ||
2383 | SceneObjectGroup sceneObject = null; | 2415 | SceneObjectGroup sceneObject = null; |
2384 | 2416 | ||
2385 | // If an entity creator has been registered for this prim type then use that | 2417 | // If an entity creator has been registered for this prim type then use that |
2386 | if (m_entityCreators.ContainsKey((PCode)shape.PCode)) | 2418 | if (m_entityCreators.ContainsKey((PCode)shape.PCode)) |
2387 | { | 2419 | { |
@@ -2396,13 +2428,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
2396 | } | 2428 | } |
2397 | 2429 | ||
2398 | if (UserManagementModule != null) | 2430 | if (UserManagementModule != null) |
2399 | sceneObject.RootPart.CreatorIdentification = UserManagementModule.GetUserUUI(ownerID); | 2431 | sceneObject.RootPart.CreatorIdentification = UserManagementModule.GetUserUUI(ownerID); |
2400 | 2432 | ||
2401 | sceneObject.ScheduleGroupForFullUpdate(); | 2433 | sceneObject.ScheduleGroupForFullUpdate(); |
2402 | 2434 | ||
2403 | return sceneObject; | 2435 | return sceneObject; |
2404 | } | 2436 | } |
2405 | 2437 | ||
2406 | /// <summary> | 2438 | /// <summary> |
2407 | /// Add an object into the scene that has come from storage | 2439 | /// Add an object into the scene that has come from storage |
2408 | /// </summary> | 2440 | /// </summary> |
@@ -2424,7 +2456,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2424 | /// true if the object was added, false if an object with the same uuid was already in the scene | 2456 | /// true if the object was added, false if an object with the same uuid was already in the scene |
2425 | /// </returns> | 2457 | /// </returns> |
2426 | public bool AddRestoredSceneObject( | 2458 | public bool AddRestoredSceneObject( |
2427 | SceneObjectGroup sceneObject, bool attachToBackup, bool alreadyPersisted, bool sendClientUpdates) | 2459 | SceneObjectGroup sceneObject, bool attachToBackup, bool alreadyPersisted, bool sendClientUpdates) |
2428 | { | 2460 | { |
2429 | if (m_sceneGraph.AddRestoredSceneObject(sceneObject, attachToBackup, alreadyPersisted, sendClientUpdates)) | 2461 | if (m_sceneGraph.AddRestoredSceneObject(sceneObject, attachToBackup, alreadyPersisted, sendClientUpdates)) |
2430 | { | 2462 | { |
@@ -2435,7 +2467,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2435 | return false; | 2467 | return false; |
2436 | 2468 | ||
2437 | } | 2469 | } |
2438 | 2470 | ||
2439 | /// <summary> | 2471 | /// <summary> |
2440 | /// Add an object into the scene that has come from storage | 2472 | /// Add an object into the scene that has come from storage |
2441 | /// </summary> | 2473 | /// </summary> |
@@ -2453,7 +2485,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2453 | /// true if the object was added, false if an object with the same uuid was already in the scene | 2485 | /// true if the object was added, false if an object with the same uuid was already in the scene |
2454 | /// </returns> | 2486 | /// </returns> |
2455 | public bool AddRestoredSceneObject( | 2487 | public bool AddRestoredSceneObject( |
2456 | SceneObjectGroup sceneObject, bool attachToBackup, bool alreadyPersisted) | 2488 | SceneObjectGroup sceneObject, bool attachToBackup, bool alreadyPersisted) |
2457 | { | 2489 | { |
2458 | return AddRestoredSceneObject(sceneObject, attachToBackup, alreadyPersisted, true); | 2490 | return AddRestoredSceneObject(sceneObject, attachToBackup, alreadyPersisted, true); |
2459 | } | 2491 | } |
@@ -2471,7 +2503,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2471 | { | 2503 | { |
2472 | return AddNewSceneObject(sceneObject, attachToBackup, true); | 2504 | return AddNewSceneObject(sceneObject, attachToBackup, true); |
2473 | } | 2505 | } |
2474 | 2506 | ||
2475 | /// <summary> | 2507 | /// <summary> |
2476 | /// Add a newly created object to the scene | 2508 | /// Add a newly created object to the scene |
2477 | /// </summary> | 2509 | /// </summary> |
@@ -2486,16 +2518,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
2486 | /// </param> | 2518 | /// </param> |
2487 | /// <returns>true if the object was added. false if not</returns> | 2519 | /// <returns>true if the object was added. false if not</returns> |
2488 | public bool AddNewSceneObject(SceneObjectGroup sceneObject, bool attachToBackup, bool sendClientUpdates) | 2520 | public bool AddNewSceneObject(SceneObjectGroup sceneObject, bool attachToBackup, bool sendClientUpdates) |
2489 | { | 2521 | { |
2490 | if (m_sceneGraph.AddNewSceneObject(sceneObject, attachToBackup, sendClientUpdates)) | 2522 | if (m_sceneGraph.AddNewSceneObject(sceneObject, attachToBackup, sendClientUpdates)) |
2491 | { | 2523 | { |
2492 | EventManager.TriggerObjectAddedToScene(sceneObject); | 2524 | EventManager.TriggerObjectAddedToScene(sceneObject); |
2493 | return true; | 2525 | return true; |
2494 | } | 2526 | } |
2495 | 2527 | ||
2496 | return false; | 2528 | return false; |
2497 | } | 2529 | } |
2498 | 2530 | ||
2499 | /// <summary> | 2531 | /// <summary> |
2500 | /// Add a newly created object to the scene. | 2532 | /// Add a newly created object to the scene. |
2501 | /// </summary> | 2533 | /// </summary> |
@@ -2509,10 +2541,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
2509 | /// <param name="vel">Velocity of the object. This parameter only has an effect if the object is physical</param> | 2541 | /// <param name="vel">Velocity of the object. This parameter only has an effect if the object is physical</param> |
2510 | /// <returns></returns> | 2542 | /// <returns></returns> |
2511 | public bool AddNewSceneObject( | 2543 | public bool AddNewSceneObject( |
2512 | SceneObjectGroup sceneObject, bool attachToBackup, Vector3? pos, Quaternion? rot, Vector3 vel) | 2544 | SceneObjectGroup sceneObject, bool attachToBackup, Vector3? pos, Quaternion? rot, Vector3 vel) |
2513 | { | 2545 | { |
2514 | if (m_sceneGraph.AddNewSceneObject(sceneObject, attachToBackup, pos, rot, vel)) | 2546 | if (m_sceneGraph.AddNewSceneObject(sceneObject, attachToBackup, pos, rot, vel)) |
2515 | { | 2547 | { |
2516 | EventManager.TriggerObjectAddedToScene(sceneObject); | 2548 | EventManager.TriggerObjectAddedToScene(sceneObject); |
2517 | return true; | 2549 | return true; |
2518 | } | 2550 | } |
@@ -2534,7 +2566,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2534 | { | 2566 | { |
2535 | SceneObjectGroup sog = (SceneObjectGroup)e; | 2567 | SceneObjectGroup sog = (SceneObjectGroup)e; |
2536 | if (!sog.IsAttachment) | 2568 | if (!sog.IsAttachment) |
2537 | DeleteSceneObject((SceneObjectGroup)e, false); | 2569 | DeleteSceneObject((SceneObjectGroup)e, false); |
2538 | } | 2570 | } |
2539 | } | 2571 | } |
2540 | } | 2572 | } |
@@ -2560,13 +2592,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
2560 | /// <param name="silent">Suppress broadcasting changes to other clients.</param> | 2592 | /// <param name="silent">Suppress broadcasting changes to other clients.</param> |
2561 | /// <param name="removeScripts">If true, then scripts are removed. If false, then they are only stopped.</para> | 2593 | /// <param name="removeScripts">If true, then scripts are removed. If false, then they are only stopped.</para> |
2562 | public void DeleteSceneObject(SceneObjectGroup group, bool silent, bool removeScripts) | 2594 | public void DeleteSceneObject(SceneObjectGroup group, bool silent, bool removeScripts) |
2563 | { | 2595 | { |
2564 | // m_log.DebugFormat("[SCENE]: Deleting scene object {0} {1}", group.Name, group.UUID); | 2596 | // m_log.DebugFormat("[SCENE]: Deleting scene object {0} {1}", group.Name, group.UUID); |
2565 | 2597 | ||
2566 | if (removeScripts) | 2598 | if (removeScripts) |
2567 | group.RemoveScriptInstances(true); | 2599 | group.RemoveScriptInstances(true); |
2568 | else | 2600 | else |
2569 | group.StopScriptInstances(); | 2601 | group.StopScriptInstances(); |
2570 | 2602 | ||
2571 | SceneObjectPart[] partList = group.Parts; | 2603 | SceneObjectPart[] partList = group.Parts; |
2572 | 2604 | ||
@@ -2596,7 +2628,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2596 | 2628 | ||
2597 | group.DeleteGroupFromScene(silent); | 2629 | group.DeleteGroupFromScene(silent); |
2598 | 2630 | ||
2599 | // m_log.DebugFormat("[SCENE]: Exit DeleteSceneObject() for {0} {1}", group.Name, group.UUID); | 2631 | // m_log.DebugFormat("[SCENE]: Exit DeleteSceneObject() for {0} {1}", group.Name, group.UUID); |
2600 | } | 2632 | } |
2601 | 2633 | ||
2602 | /// <summary> | 2634 | /// <summary> |
@@ -2616,12 +2648,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
2616 | // database update, because RemoveObject() works by searching on the SceneGroupID. | 2648 | // database update, because RemoveObject() works by searching on the SceneGroupID. |
2617 | // This is an expensive thing to do so only do it if absolutely necessary. | 2649 | // This is an expensive thing to do so only do it if absolutely necessary. |
2618 | if (so.GroupContainsForeignPrims) | 2650 | if (so.GroupContainsForeignPrims) |
2619 | ForceSceneObjectBackup(so); | 2651 | ForceSceneObjectBackup(so); |
2620 | 2652 | ||
2621 | so.DetachFromBackup(); | 2653 | so.DetachFromBackup(); |
2622 | SimulationDataService.RemoveObject(so.UUID, RegionInfo.RegionID); | 2654 | SimulationDataService.RemoveObject(so.UUID, RegionInfo.RegionID); |
2623 | } | 2655 | } |
2624 | 2656 | ||
2625 | // We need to keep track of this state in case this group is still queued for further backup. | 2657 | // We need to keep track of this state in case this group is still queued for further backup. |
2626 | so.IsDeleted = true; | 2658 | so.IsDeleted = true; |
2627 | 2659 | ||
@@ -2641,9 +2673,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
2641 | public void CrossPrimGroupIntoNewRegion(Vector3 attemptedPosition, SceneObjectGroup grp, bool silent) | 2673 | public void CrossPrimGroupIntoNewRegion(Vector3 attemptedPosition, SceneObjectGroup grp, bool silent) |
2642 | { | 2674 | { |
2643 | if (grp == null) | 2675 | if (grp == null) |
2644 | return; | 2676 | return; |
2645 | if (grp.IsDeleted) | 2677 | if (grp.IsDeleted) |
2646 | return; | 2678 | return; |
2647 | 2679 | ||
2648 | if (grp.RootPart.DIE_AT_EDGE) | 2680 | if (grp.RootPart.DIE_AT_EDGE) |
2649 | { | 2681 | { |
@@ -2677,7 +2709,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2677 | } | 2709 | } |
2678 | 2710 | ||
2679 | if (EntityTransferModule != null) | 2711 | if (EntityTransferModule != null) |
2680 | EntityTransferModule.Cross(grp, attemptedPosition, silent); | 2712 | EntityTransferModule.Cross(grp, attemptedPosition, silent); |
2681 | } | 2713 | } |
2682 | 2714 | ||
2683 | // Simple test to see if a position is in the current region. | 2715 | // Simple test to see if a position is in the current region. |
@@ -2690,14 +2722,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
2690 | int xx = (int)Math.Floor(pos.X); | 2722 | int xx = (int)Math.Floor(pos.X); |
2691 | int yy = (int)Math.Floor(pos.Y); | 2723 | int yy = (int)Math.Floor(pos.Y); |
2692 | if (xx < 0 || yy < 0) | 2724 | if (xx < 0 || yy < 0) |
2693 | return false; | 2725 | return false; |
2694 | 2726 | ||
2695 | IRegionCombinerModule regionCombinerModule = RequestModuleInterface<IRegionCombinerModule>(); | 2727 | IRegionCombinerModule regionCombinerModule = RequestModuleInterface<IRegionCombinerModule>(); |
2696 | if (regionCombinerModule == null) | 2728 | if (regionCombinerModule == null) |
2697 | { | 2729 | { |
2698 | // Regular region. Just check for region size | 2730 | // Regular region. Just check for region size |
2699 | if (xx < RegionInfo.RegionSizeX && yy < RegionInfo.RegionSizeY ) | 2731 | if (xx < RegionInfo.RegionSizeX && yy < RegionInfo.RegionSizeY) |
2700 | ret = true; | 2732 | ret = true; |
2701 | } | 2733 | } |
2702 | else | 2734 | else |
2703 | { | 2735 | { |
@@ -2731,7 +2763,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2731 | } | 2763 | } |
2732 | 2764 | ||
2733 | if (!EntityTransferModule.HandleIncomingSceneObject(newObject, newPosition)) | 2765 | if (!EntityTransferModule.HandleIncomingSceneObject(newObject, newPosition)) |
2734 | return false; | 2766 | return false; |
2735 | 2767 | ||
2736 | // Do this as late as possible so that listeners have full access to the incoming object | 2768 | // Do this as late as possible so that listeners have full access to the incoming object |
2737 | EventManager.TriggerOnIncomingSceneObject(newObject); | 2769 | EventManager.TriggerOnIncomingSceneObject(newObject); |
@@ -2752,13 +2784,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
2752 | // | 2784 | // |
2753 | SceneObjectPart[] parts = sceneObject.Parts; | 2785 | SceneObjectPart[] parts = sceneObject.Parts; |
2754 | for (int i = 0; i < parts.Length; i++) | 2786 | for (int i = 0; i < parts.Length; i++) |
2755 | parts[i].LocalId = 0; | 2787 | parts[i].LocalId = 0; |
2756 | 2788 | ||
2757 | if (sceneObject.IsAttachmentCheckFull()) // Attachment | 2789 | if (sceneObject.IsAttachmentCheckFull()) // Attachment |
2758 | { | 2790 | { |
2759 | sceneObject.RootPart.AddFlag(PrimFlags.TemporaryOnRez); | 2791 | sceneObject.RootPart.AddFlag(PrimFlags.TemporaryOnRez); |
2760 | sceneObject.RootPart.AddFlag(PrimFlags.Phantom); | 2792 | sceneObject.RootPart.AddFlag(PrimFlags.Phantom); |
2761 | 2793 | ||
2762 | // Don't sent a full update here because this will cause full updates to be sent twice for | 2794 | // Don't sent a full update here because this will cause full updates to be sent twice for |
2763 | // attachments on region crossings, resulting in viewer glitches. | 2795 | // attachments on region crossings, resulting in viewer glitches. |
2764 | AddRestoredSceneObject(sceneObject, false, false, false); | 2796 | AddRestoredSceneObject(sceneObject, false, false, false); |
@@ -2773,10 +2805,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
2773 | { | 2805 | { |
2774 | SceneObjectGroup grp = sceneObject; | 2806 | SceneObjectGroup grp = sceneObject; |
2775 | 2807 | ||
2776 | // m_log.DebugFormat( | 2808 | // m_log.DebugFormat( |
2777 | // "[ATTACHMENT]: Received attachment {0}, inworld asset id {1}", grp.FromItemID, grp.UUID); | 2809 | // "[ATTACHMENT]: Received attachment {0}, inworld asset id {1}", grp.FromItemID, grp.UUID); |
2778 | // m_log.DebugFormat( | 2810 | // m_log.DebugFormat( |
2779 | // "[ATTACHMENT]: Attach to avatar {0} at position {1}", sp.UUID, grp.AbsolutePosition); | 2811 | // "[ATTACHMENT]: Attach to avatar {0} at position {1}", sp.UUID, grp.AbsolutePosition); |
2780 | 2812 | ||
2781 | RootPrim.RemFlag(PrimFlags.TemporaryOnRez); | 2813 | RootPrim.RemFlag(PrimFlags.TemporaryOnRez); |
2782 | 2814 | ||
@@ -2784,7 +2816,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2784 | // information that this is due to a teleport/border cross rather than an ordinary attachment. | 2816 | // information that this is due to a teleport/border cross rather than an ordinary attachment. |
2785 | // We currently do this in Scene.MakeRootAgent() instead. | 2817 | // We currently do this in Scene.MakeRootAgent() instead. |
2786 | if (AttachmentsModule != null) | 2818 | if (AttachmentsModule != null) |
2787 | AttachmentsModule.AttachObject(sp, grp, 0, false, false, true); | 2819 | AttachmentsModule.AttachObject(sp, grp, 0, false, false, true); |
2788 | } | 2820 | } |
2789 | else | 2821 | else |
2790 | { | 2822 | { |
@@ -2810,6 +2842,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
2810 | bool vialogin; | 2842 | bool vialogin; |
2811 | bool reallyNew = true; | 2843 | bool reallyNew = true; |
2812 | 2844 | ||
2845 | // Update the number of users attempting to login | ||
2846 | StatsReporter.UpdateUsersLoggingIn(true); | ||
2847 | |||
2813 | // Validation occurs in LLUDPServer | 2848 | // Validation occurs in LLUDPServer |
2814 | // | 2849 | // |
2815 | // XXX: A race condition exists here where two simultaneous calls to AddNewAgent can interfere with | 2850 | // XXX: A race condition exists here where two simultaneous calls to AddNewAgent can interfere with |
@@ -2830,11 +2865,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
2830 | lock (aCircuit) | 2865 | lock (aCircuit) |
2831 | { | 2866 | { |
2832 | vialogin | 2867 | vialogin |
2833 | = (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0 | 2868 | = (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0 |
2834 | || (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0; | 2869 | || (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0; |
2835 | 2870 | ||
2836 | // CheckHeartbeat(); | 2871 | // CheckHeartbeat(); |
2837 | 2872 | ||
2838 | sp = GetScenePresence(client.AgentId); | 2873 | sp = GetScenePresence(client.AgentId); |
2839 | 2874 | ||
2840 | // XXX: Not sure how good it is to add a new client if a scene presence already exists. Possibly this | 2875 | // XXX: Not sure how good it is to add a new client if a scene presence already exists. Possibly this |
@@ -2844,9 +2879,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
2844 | if (sp == null) | 2879 | if (sp == null) |
2845 | { | 2880 | { |
2846 | m_log.DebugFormat( | 2881 | m_log.DebugFormat( |
2847 | "[SCENE]: Adding new child scene presence {0} {1} to scene {2} at pos {3}", | 2882 | "[SCENE]: Adding new child scene presence {0} {1} to scene {2} at pos {3}", |
2848 | client.Name, client.AgentId, RegionInfo.RegionName, client.StartPos); | 2883 | client.Name, client.AgentId, RegionInfo.RegionName, client.StartPos); |
2849 | 2884 | ||
2850 | sp = m_sceneGraph.CreateAndAddChildScenePresence(client, aCircuit.Appearance, type); | 2885 | sp = m_sceneGraph.CreateAndAddChildScenePresence(client, aCircuit.Appearance, type); |
2851 | 2886 | ||
2852 | // We must set this here so that TriggerOnNewClient and TriggerOnClientLogin can determine whether the | 2887 | // We must set this here so that TriggerOnNewClient and TriggerOnClientLogin can determine whether the |
@@ -2863,7 +2898,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2863 | m_clientManager.Add(client); | 2898 | m_clientManager.Add(client); |
2864 | SubscribeToClientEvents(client); | 2899 | SubscribeToClientEvents(client); |
2865 | m_eventManager.TriggerOnNewPresence(sp); | 2900 | m_eventManager.TriggerOnNewPresence(sp); |
2866 | 2901 | ||
2867 | sp.TeleportFlags = (TPFlags)aCircuit.teleportFlags; | 2902 | sp.TeleportFlags = (TPFlags)aCircuit.teleportFlags; |
2868 | } | 2903 | } |
2869 | else | 2904 | else |
@@ -2876,24 +2911,28 @@ namespace OpenSim.Region.Framework.Scenes | |||
2876 | client.SceneAgent = sp; | 2911 | client.SceneAgent = sp; |
2877 | 2912 | ||
2878 | m_log.WarnFormat( | 2913 | m_log.WarnFormat( |
2879 | "[SCENE]: Already found {0} scene presence for {1} in {2} when asked to add new scene presence", | 2914 | "[SCENE]: Already found {0} scene presence for {1} in {2} when asked to add new scene presence", |
2880 | sp.IsChildAgent ? "child" : "root", sp.Name, RegionInfo.RegionName); | 2915 | sp.IsChildAgent ? "child" : "root", sp.Name, RegionInfo.RegionName); |
2881 | 2916 | ||
2882 | reallyNew = false; | 2917 | reallyNew = false; |
2883 | } | 2918 | } |
2884 | 2919 | ||
2885 | // This is currently also being done earlier in NewUserConnection for real users to see if this | 2920 | // This is currently also being done earlier in NewUserConnection for real users to see if this |
2886 | // resolves problems where HG agents are occasionally seen by others as "Unknown user" in chat and other | 2921 | // resolves problems where HG agents are occasionally seen by others as "Unknown user" in chat and other |
2887 | // places. However, we still need to do it here for NPCs. | 2922 | // places. However, we still need to do it here for NPCs. |
2888 | CacheUserName(sp, aCircuit); | 2923 | CacheUserName(sp, aCircuit); |
2889 | 2924 | ||
2890 | if (reallyNew) | 2925 | if (reallyNew) |
2891 | EventManager.TriggerOnNewClient(client); | 2926 | EventManager.TriggerOnNewClient(client); |
2892 | 2927 | ||
2893 | if (vialogin) | 2928 | if (vialogin) |
2894 | EventManager.TriggerOnClientLogin(client); | 2929 | EventManager.TriggerOnClientLogin(client); |
2895 | } | 2930 | } |
2896 | 2931 | ||
2932 | // User has logged into the scene so update the list of users logging | ||
2933 | // in | ||
2934 | StatsReporter.UpdateUsersLoggingIn(false); | ||
2935 | |||
2897 | m_LastLogin = Util.EnvironmentTickCount(); | 2936 | m_LastLogin = Util.EnvironmentTickCount(); |
2898 | 2937 | ||
2899 | return sp; | 2938 | return sp; |
@@ -2906,9 +2945,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
2906 | { | 2945 | { |
2907 | AgentCircuitData circuit = AuthenticateHandler.GetAgentCircuitData(agentID); | 2946 | AgentCircuitData circuit = AuthenticateHandler.GetAgentCircuitData(agentID); |
2908 | if (circuit != null && circuit.ServiceURLs != null && circuit.ServiceURLs.ContainsKey("HomeURI")) | 2947 | if (circuit != null && circuit.ServiceURLs != null && circuit.ServiceURLs.ContainsKey("HomeURI")) |
2909 | return circuit.ServiceURLs["HomeURI"].ToString(); | 2948 | return circuit.ServiceURLs["HomeURI"].ToString(); |
2910 | else | 2949 | else |
2911 | return null; | 2950 | return null; |
2912 | } | 2951 | } |
2913 | 2952 | ||
2914 | /// <summary> | 2953 | /// <summary> |
@@ -2931,7 +2970,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2931 | string homeURL = string.Empty; | 2970 | string homeURL = string.Empty; |
2932 | 2971 | ||
2933 | if (aCircuit.ServiceURLs.ContainsKey("HomeURI")) | 2972 | if (aCircuit.ServiceURLs.ContainsKey("HomeURI")) |
2934 | homeURL = aCircuit.ServiceURLs["HomeURI"].ToString(); | 2973 | homeURL = aCircuit.ServiceURLs["HomeURI"].ToString(); |
2935 | 2974 | ||
2936 | if (aCircuit.lastname.StartsWith("@")) | 2975 | if (aCircuit.lastname.StartsWith("@")) |
2937 | { | 2976 | { |
@@ -2951,7 +2990,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2951 | private bool VerifyClient(AgentCircuitData aCircuit, System.Net.IPEndPoint ep, out bool vialogin) | 2990 | private bool VerifyClient(AgentCircuitData aCircuit, System.Net.IPEndPoint ep, out bool vialogin) |
2952 | { | 2991 | { |
2953 | vialogin = false; | 2992 | vialogin = false; |
2954 | 2993 | ||
2955 | // Do the verification here | 2994 | // Do the verification here |
2956 | if ((aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0) | 2995 | if ((aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0) |
2957 | { | 2996 | { |
@@ -2967,7 +3006,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2967 | return false; | 3006 | return false; |
2968 | } | 3007 | } |
2969 | else | 3008 | else |
2970 | m_log.DebugFormat("[SCENE]: User Client Verification for {0} {1} in {2} returned true", aCircuit.firstname, aCircuit.lastname, RegionInfo.RegionName); | 3009 | m_log.DebugFormat("[SCENE]: User Client Verification for {0} {1} in {2} returned true", aCircuit.firstname, aCircuit.lastname, RegionInfo.RegionName); |
2971 | 3010 | ||
2972 | } | 3011 | } |
2973 | } | 3012 | } |
@@ -2975,7 +3014,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2975 | else if ((aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0) | 3014 | else if ((aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0) |
2976 | { | 3015 | { |
2977 | m_log.DebugFormat("[SCENE]: Incoming client {0} {1} in region {2} via regular login. Client IP verification not performed.", | 3016 | m_log.DebugFormat("[SCENE]: Incoming client {0} {1} in region {2} via regular login. Client IP verification not performed.", |
2978 | aCircuit.firstname, aCircuit.lastname, RegionInfo.RegionName); | 3017 | aCircuit.firstname, aCircuit.lastname, RegionInfo.RegionName); |
2979 | vialogin = true; | 3018 | vialogin = true; |
2980 | } | 3019 | } |
2981 | 3020 | ||
@@ -3019,7 +3058,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3019 | } | 3058 | } |
3020 | } | 3059 | } |
3021 | else | 3060 | else |
3022 | return true; | 3061 | return true; |
3023 | } | 3062 | } |
3024 | 3063 | ||
3025 | return false; | 3064 | return false; |
@@ -3046,7 +3085,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3046 | { | 3085 | { |
3047 | client.OnRegionHandShakeReply += SendLayerData; | 3086 | client.OnRegionHandShakeReply += SendLayerData; |
3048 | } | 3087 | } |
3049 | 3088 | ||
3050 | public virtual void SubscribeToClientPrimEvents(IClientAPI client) | 3089 | public virtual void SubscribeToClientPrimEvents(IClientAPI client) |
3051 | { | 3090 | { |
3052 | client.OnUpdatePrimGroupPosition += m_sceneGraph.UpdatePrimGroupPosition; | 3091 | client.OnUpdatePrimGroupPosition += m_sceneGraph.UpdatePrimGroupPosition; |
@@ -3056,7 +3095,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3056 | client.OnUpdatePrimGroupMouseRotation += m_sceneGraph.UpdatePrimGroupRotation; | 3095 | client.OnUpdatePrimGroupMouseRotation += m_sceneGraph.UpdatePrimGroupRotation; |
3057 | client.OnUpdatePrimSingleRotation += m_sceneGraph.UpdatePrimSingleRotation; | 3096 | client.OnUpdatePrimSingleRotation += m_sceneGraph.UpdatePrimSingleRotation; |
3058 | client.OnUpdatePrimSingleRotationPosition += m_sceneGraph.UpdatePrimSingleRotationPosition; | 3097 | client.OnUpdatePrimSingleRotationPosition += m_sceneGraph.UpdatePrimSingleRotationPosition; |
3059 | 3098 | ||
3060 | client.OnUpdatePrimScale += m_sceneGraph.UpdatePrimScale; | 3099 | client.OnUpdatePrimScale += m_sceneGraph.UpdatePrimScale; |
3061 | client.OnUpdatePrimGroupScale += m_sceneGraph.UpdatePrimGroupScale; | 3100 | client.OnUpdatePrimGroupScale += m_sceneGraph.UpdatePrimGroupScale; |
3062 | client.OnUpdateExtraParams += m_sceneGraph.UpdateExtraParam; | 3101 | client.OnUpdateExtraParams += m_sceneGraph.UpdateExtraParam; |
@@ -3069,7 +3108,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3069 | client.OnSpinStart += m_sceneGraph.SpinStart; | 3108 | client.OnSpinStart += m_sceneGraph.SpinStart; |
3070 | client.OnSpinUpdate += m_sceneGraph.SpinObject; | 3109 | client.OnSpinUpdate += m_sceneGraph.SpinObject; |
3071 | client.OnDeRezObject += DeRezObjects; | 3110 | client.OnDeRezObject += DeRezObjects; |
3072 | 3111 | ||
3073 | client.OnObjectName += m_sceneGraph.PrimName; | 3112 | client.OnObjectName += m_sceneGraph.PrimName; |
3074 | client.OnObjectClickAction += m_sceneGraph.PrimClickAction; | 3113 | client.OnObjectClickAction += m_sceneGraph.PrimClickAction; |
3075 | client.OnObjectMaterial += m_sceneGraph.PrimMaterial; | 3114 | client.OnObjectMaterial += m_sceneGraph.PrimMaterial; |
@@ -3081,7 +3120,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3081 | client.OnRequestObjectPropertiesFamily += m_sceneGraph.RequestObjectPropertiesFamily; | 3120 | client.OnRequestObjectPropertiesFamily += m_sceneGraph.RequestObjectPropertiesFamily; |
3082 | client.OnObjectPermissions += HandleObjectPermissionsUpdate; | 3121 | client.OnObjectPermissions += HandleObjectPermissionsUpdate; |
3083 | client.OnGrabObject += ProcessObjectGrab; | 3122 | client.OnGrabObject += ProcessObjectGrab; |
3084 | client.OnGrabUpdate += ProcessObjectGrabUpdate; | 3123 | client.OnGrabUpdate += ProcessObjectGrabUpdate; |
3085 | client.OnDeGrabObject += ProcessObjectDeGrab; | 3124 | client.OnDeGrabObject += ProcessObjectDeGrab; |
3086 | client.OnUndo += m_sceneGraph.HandleUndo; | 3125 | client.OnUndo += m_sceneGraph.HandleUndo; |
3087 | client.OnRedo += m_sceneGraph.HandleRedo; | 3126 | client.OnRedo += m_sceneGraph.HandleRedo; |
@@ -3142,7 +3181,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3142 | //client.OnNameFromUUIDRequest += HandleUUIDNameRequest; | 3181 | //client.OnNameFromUUIDRequest += HandleUUIDNameRequest; |
3143 | client.OnMoneyTransferRequest += ProcessMoneyTransferRequest; | 3182 | client.OnMoneyTransferRequest += ProcessMoneyTransferRequest; |
3144 | } | 3183 | } |
3145 | 3184 | ||
3146 | public virtual void SubscribeToClientNetworkEvents(IClientAPI client) | 3185 | public virtual void SubscribeToClientNetworkEvents(IClientAPI client) |
3147 | { | 3186 | { |
3148 | client.OnNetworkStatsUpdate += StatsReporter.AddPacketsStats; | 3187 | client.OnNetworkStatsUpdate += StatsReporter.AddPacketsStats; |
@@ -3303,7 +3342,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3303 | { | 3342 | { |
3304 | SceneObjectGroup copy = SceneGraph.DuplicateObject(originalPrim, offset, flags, AgentID, GroupID, Quaternion.Identity); | 3343 | SceneObjectGroup copy = SceneGraph.DuplicateObject(originalPrim, offset, flags, AgentID, GroupID, Quaternion.Identity); |
3305 | if (copy != null) | 3344 | if (copy != null) |
3306 | EventManager.TriggerObjectAddedToScene(copy); | 3345 | EventManager.TriggerObjectAddedToScene(copy); |
3307 | } | 3346 | } |
3308 | 3347 | ||
3309 | /// <summary> | 3348 | /// <summary> |
@@ -3322,8 +3361,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
3322 | /// <param name="CopyCenters">Position the object at the center of the face that it's colliding with</param> | 3361 | /// <param name="CopyCenters">Position the object at the center of the face that it's colliding with</param> |
3323 | /// <param name="CopyRotates">Rotate the object the same as the localID object</param> | 3362 | /// <param name="CopyRotates">Rotate the object the same as the localID object</param> |
3324 | public void doObjectDuplicateOnRay(uint localID, uint dupeFlags, UUID AgentID, UUID GroupID, | 3363 | public void doObjectDuplicateOnRay(uint localID, uint dupeFlags, UUID AgentID, UUID GroupID, |
3325 | UUID RayTargetObj, Vector3 RayEnd, Vector3 RayStart, | 3364 | UUID RayTargetObj, Vector3 RayEnd, Vector3 RayStart, |
3326 | bool BypassRaycast, bool RayEndIsIntersection, bool CopyCenters, bool CopyRotates) | 3365 | bool BypassRaycast, bool RayEndIsIntersection, bool CopyCenters, bool CopyRotates) |
3327 | { | 3366 | { |
3328 | Vector3 pos; | 3367 | Vector3 pos; |
3329 | const bool frontFacesOnly = true; | 3368 | const bool frontFacesOnly = true; |
@@ -3384,7 +3423,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3384 | } | 3423 | } |
3385 | 3424 | ||
3386 | if (copy != null) | 3425 | if (copy != null) |
3387 | EventManager.TriggerObjectAddedToScene(copy); | 3426 | EventManager.TriggerObjectAddedToScene(copy); |
3388 | } | 3427 | } |
3389 | } | 3428 | } |
3390 | } | 3429 | } |
@@ -3435,25 +3474,25 @@ namespace OpenSim.Region.Framework.Scenes | |||
3435 | if (acd == null) | 3474 | if (acd == null) |
3436 | { | 3475 | { |
3437 | m_log.ErrorFormat( | 3476 | m_log.ErrorFormat( |
3438 | "[SCENE]: No agent circuit found for {0} in {1}, aborting Scene.RemoveClient", agentID, Name); | 3477 | "[SCENE]: No agent circuit found for {0} in {1}, aborting Scene.RemoveClient", agentID, Name); |
3439 | 3478 | ||
3440 | return; | 3479 | return; |
3441 | } | 3480 | } |
3442 | 3481 | ||
3443 | // TODO: Can we now remove this lock? | 3482 | // TODO: Can we now remove this lock? |
3444 | lock (acd) | 3483 | lock (acd) |
3445 | { | 3484 | { |
3446 | bool isChildAgent = false; | 3485 | bool isChildAgent = false; |
3447 | 3486 | ||
3448 | ScenePresence avatar = GetScenePresence(agentID); | 3487 | ScenePresence avatar = GetScenePresence(agentID); |
3449 | 3488 | ||
3450 | // Shouldn't be necessary since RemoveClient() is currently only called by IClientAPI.Close() which | 3489 | // Shouldn't be necessary since RemoveClient() is currently only called by IClientAPI.Close() which |
3451 | // in turn is only called by Scene.IncomingCloseAgent() which checks whether the presence exists or not | 3490 | // in turn is only called by Scene.IncomingCloseAgent() which checks whether the presence exists or not |
3452 | // However, will keep for now just in case. | 3491 | // However, will keep for now just in case. |
3453 | if (avatar == null) | 3492 | if (avatar == null) |
3454 | { | 3493 | { |
3455 | m_log.ErrorFormat( | 3494 | m_log.ErrorFormat( |
3456 | "[SCENE]: Called RemoveClient() with agent ID {0} but no such presence is in the scene.", agentID); | 3495 | "[SCENE]: Called RemoveClient() with agent ID {0} but no such presence is in the scene.", agentID); |
3457 | m_authenticateHandler.RemoveCircuit(agentID); | 3496 | m_authenticateHandler.RemoveCircuit(agentID); |
3458 | 3497 | ||
3459 | return; | 3498 | return; |
@@ -3464,9 +3503,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
3464 | isChildAgent = avatar.IsChildAgent; | 3503 | isChildAgent = avatar.IsChildAgent; |
3465 | 3504 | ||
3466 | m_log.DebugFormat( | 3505 | m_log.DebugFormat( |
3467 | "[SCENE]: Removing {0} agent {1} {2} from {3}", | 3506 | "[SCENE]: Removing {0} agent {1} {2} from {3}", |
3468 | isChildAgent ? "child" : "root", avatar.Name, agentID, Name); | 3507 | isChildAgent ? "child" : "root", avatar.Name, agentID, Name); |
3469 | 3508 | ||
3470 | // Don't do this to root agents, it's not nice for the viewer | 3509 | // Don't do this to root agents, it's not nice for the viewer |
3471 | if (closeChildAgents && isChildAgent) | 3510 | if (closeChildAgents && isChildAgent) |
3472 | { | 3511 | { |
@@ -3474,20 +3513,20 @@ namespace OpenSim.Region.Framework.Scenes | |||
3474 | // Let's do this via UDP | 3513 | // Let's do this via UDP |
3475 | avatar.ControllingClient.SendShutdownConnectionNotice(); | 3514 | avatar.ControllingClient.SendShutdownConnectionNotice(); |
3476 | } | 3515 | } |
3477 | 3516 | ||
3478 | // Only applies to root agents. | 3517 | // Only applies to root agents. |
3479 | if (avatar.ParentID != 0) | 3518 | if (avatar.ParentID != 0) |
3480 | { | 3519 | { |
3481 | avatar.StandUp(); | 3520 | avatar.StandUp(); |
3482 | } | 3521 | } |
3483 | 3522 | ||
3484 | m_sceneGraph.removeUserCount(!isChildAgent); | 3523 | m_sceneGraph.removeUserCount(!isChildAgent); |
3485 | 3524 | ||
3486 | // TODO: We shouldn't use closeChildAgents here - it's being used by the NPC module to stop | 3525 | // TODO: We shouldn't use closeChildAgents here - it's being used by the NPC module to stop |
3487 | // unnecessary operations. This should go away once NPCs have no accompanying IClientAPI | 3526 | // unnecessary operations. This should go away once NPCs have no accompanying IClientAPI |
3488 | if (closeChildAgents && CapsModule != null) | 3527 | if (closeChildAgents && CapsModule != null) |
3489 | CapsModule.RemoveCaps(agentID); | 3528 | CapsModule.RemoveCaps(agentID); |
3490 | 3529 | ||
3491 | if (closeChildAgents && !isChildAgent) | 3530 | if (closeChildAgents && !isChildAgent) |
3492 | { | 3531 | { |
3493 | List<ulong> regions = avatar.KnownRegionHandles; | 3532 | List<ulong> regions = avatar.KnownRegionHandles; |
@@ -3496,10 +3535,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
3496 | // This ends up being done asynchronously so that a logout isn't held up where there are many present but unresponsive neighbours. | 3535 | // This ends up being done asynchronously so that a logout isn't held up where there are many present but unresponsive neighbours. |
3497 | m_sceneGridService.SendCloseChildAgentConnections(agentID, acd.SessionID.ToString(), regions); | 3536 | m_sceneGridService.SendCloseChildAgentConnections(agentID, acd.SessionID.ToString(), regions); |
3498 | } | 3537 | } |
3499 | 3538 | ||
3500 | m_eventManager.TriggerClientClosed(agentID, this); | 3539 | m_eventManager.TriggerClientClosed(agentID, this); |
3501 | m_eventManager.TriggerOnRemovePresence(agentID); | 3540 | m_eventManager.TriggerOnRemovePresence(agentID); |
3502 | 3541 | ||
3503 | if (!isChildAgent) | 3542 | if (!isChildAgent) |
3504 | { | 3543 | { |
3505 | if (AttachmentsModule != null) | 3544 | if (AttachmentsModule != null) |
@@ -3508,22 +3547,22 @@ namespace OpenSim.Region.Framework.Scenes | |||
3508 | } | 3547 | } |
3509 | 3548 | ||
3510 | ForEachClient( | 3549 | ForEachClient( |
3511 | delegate(IClientAPI client) | 3550 | delegate(IClientAPI client) |
3512 | { | 3551 | { |
3513 | //We can safely ignore null reference exceptions. It means the avatar is dead and cleaned up anyway | 3552 | //We can safely ignore null reference exceptions. It means the avatar is dead and cleaned up anyway |
3514 | try { client.SendKillObject(new List<uint> { avatar.LocalId }); } | 3553 | try { client.SendKillObject(new List<uint> { avatar.LocalId }); } |
3515 | catch (NullReferenceException) { } | 3554 | catch (NullReferenceException) { } |
3516 | }); | 3555 | }); |
3517 | } | 3556 | } |
3518 | 3557 | ||
3519 | // It's possible for child agents to have transactions if changes are being made cross-border. | 3558 | // It's possible for child agents to have transactions if changes are being made cross-border. |
3520 | if (AgentTransactionsModule != null) | 3559 | if (AgentTransactionsModule != null) |
3521 | AgentTransactionsModule.RemoveAgentAssetTransactions(agentID); | 3560 | AgentTransactionsModule.RemoveAgentAssetTransactions(agentID); |
3522 | } | 3561 | } |
3523 | catch (Exception e) | 3562 | catch (Exception e) |
3524 | { | 3563 | { |
3525 | m_log.Error( | 3564 | m_log.Error( |
3526 | string.Format("[SCENE]: Exception removing {0} from {1}. Cleaning up. Exception ", avatar.Name, Name), e); | 3565 | string.Format("[SCENE]: Exception removing {0} from {1}. Cleaning up. Exception ", avatar.Name, Name), e); |
3527 | } | 3566 | } |
3528 | finally | 3567 | finally |
3529 | { | 3568 | { |
@@ -3535,13 +3574,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
3535 | m_authenticateHandler.RemoveCircuit(agentID); | 3574 | m_authenticateHandler.RemoveCircuit(agentID); |
3536 | m_sceneGraph.RemoveScenePresence(agentID); | 3575 | m_sceneGraph.RemoveScenePresence(agentID); |
3537 | m_clientManager.Remove(agentID); | 3576 | m_clientManager.Remove(agentID); |
3538 | 3577 | ||
3539 | avatar.Close(); | 3578 | avatar.Close(); |
3540 | } | 3579 | } |
3541 | catch (Exception e) | 3580 | catch (Exception e) |
3542 | { | 3581 | { |
3543 | m_log.Error( | 3582 | m_log.Error( |
3544 | string.Format("[SCENE]: Exception in final clean up of {0} in {1}. Exception ", avatar.Name, Name), e); | 3583 | string.Format("[SCENE]: Exception in final clean up of {0} in {1}. Exception ", avatar.Name, Name), e); |
3545 | } | 3584 | } |
3546 | } | 3585 | } |
3547 | } | 3586 | } |
@@ -3587,7 +3626,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3587 | if (part.ParentGroup != null && !part.ParentGroup.IsDeleted) // Valid | 3626 | if (part.ParentGroup != null && !part.ParentGroup.IsDeleted) // Valid |
3588 | { | 3627 | { |
3589 | if (part.ParentGroup.RootPart != part) // Child part | 3628 | if (part.ParentGroup.RootPart != part) // Child part |
3590 | continue; | 3629 | continue; |
3591 | } | 3630 | } |
3592 | } | 3631 | } |
3593 | deleteIDs.Add(localID); | 3632 | deleteIDs.Add(localID); |
@@ -3640,7 +3679,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3640 | public bool NewUserConnection(AgentCircuitData acd, uint teleportFlags, GridRegion source, out string reason, bool requirePresenceLookup) | 3679 | public bool NewUserConnection(AgentCircuitData acd, uint teleportFlags, GridRegion source, out string reason, bool requirePresenceLookup) |
3641 | { | 3680 | { |
3642 | bool vialogin = ((teleportFlags & (uint)TPFlags.ViaLogin) != 0 || | 3681 | bool vialogin = ((teleportFlags & (uint)TPFlags.ViaLogin) != 0 || |
3643 | (teleportFlags & (uint)TPFlags.ViaHGLogin) != 0); | 3682 | (teleportFlags & (uint)TPFlags.ViaHGLogin) != 0); |
3644 | bool viahome = ((teleportFlags & (uint)TPFlags.ViaHome) != 0); | 3683 | bool viahome = ((teleportFlags & (uint)TPFlags.ViaHome) != 0); |
3645 | bool godlike = ((teleportFlags & (uint)TPFlags.Godlike) != 0); | 3684 | bool godlike = ((teleportFlags & (uint)TPFlags.Godlike) != 0); |
3646 | 3685 | ||
@@ -3656,18 +3695,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
3656 | // Don't disable this log message - it's too helpful | 3695 | // Don't disable this log message - it's too helpful |
3657 | string curViewer = Util.GetViewerName(acd); | 3696 | string curViewer = Util.GetViewerName(acd); |
3658 | m_log.DebugFormat( | 3697 | m_log.DebugFormat( |
3659 | "[SCENE]: Region {0} told of incoming {1} agent {2} {3} {4} (circuit code {5}, IP {6}, viewer {7}, teleportflags ({8}), position {9}. {10}", | 3698 | "[SCENE]: Region {0} told of incoming {1} agent {2} {3} {4} (circuit code {5}, IP {6}, viewer {7}, teleportflags ({8}), position {9}. {10}", |
3660 | RegionInfo.RegionName, | 3699 | RegionInfo.RegionName, |
3661 | (acd.child ? "child" : "root"), | 3700 | (acd.child ? "child" : "root"), |
3662 | acd.firstname, | 3701 | acd.firstname, |
3663 | acd.lastname, | 3702 | acd.lastname, |
3664 | acd.AgentID, | 3703 | acd.AgentID, |
3665 | acd.circuitcode, | 3704 | acd.circuitcode, |
3666 | acd.IPAddress, | 3705 | acd.IPAddress, |
3667 | curViewer, | 3706 | curViewer, |
3668 | ((TPFlags)teleportFlags).ToString(), | 3707 | ((TPFlags)teleportFlags).ToString(), |
3669 | acd.startpos, | 3708 | acd.startpos, |
3670 | (source == null) ? "" : string.Format("From region {0} ({1}){2}", source.RegionName, source.RegionID, (source.RawServerURI == null) ? "" : " @ " + source.ServerURI) | 3709 | (source == null) ? "" : string.Format("From region {0} ({1}){2}", source.RegionName, source.RegionID, (source.RawServerURI == null) ? "" : " @ " + source.ServerURI) |
3671 | ); | 3710 | ); |
3672 | 3711 | ||
3673 | if (!LoginsEnabled) | 3712 | if (!LoginsEnabled) |
@@ -3713,8 +3752,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
3713 | if (ViewerDenied) | 3752 | if (ViewerDenied) |
3714 | { | 3753 | { |
3715 | m_log.DebugFormat( | 3754 | m_log.DebugFormat( |
3716 | "[SCENE]: Access denied for {0} {1} using {2}", | 3755 | "[SCENE]: Access denied for {0} {1} using {2}", |
3717 | acd.firstname, acd.lastname, curViewer); | 3756 | acd.firstname, acd.lastname, curViewer); |
3718 | reason = "Access denied, your viewer is banned by the region owner"; | 3757 | reason = "Access denied, your viewer is banned by the region owner"; |
3719 | return false; | 3758 | return false; |
3720 | } | 3759 | } |
@@ -3728,13 +3767,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
3728 | 3767 | ||
3729 | // We need to ensure that we are not already removing the scene presence before we ask it not to be | 3768 | // We need to ensure that we are not already removing the scene presence before we ask it not to be |
3730 | // closed. | 3769 | // closed. |
3731 | if (sp != null && sp.IsChildAgent | 3770 | if (sp != null && sp.IsChildAgent |
3732 | && (sp.LifecycleState == ScenePresenceState.Running | 3771 | && (sp.LifecycleState == ScenePresenceState.Running |
3733 | || sp.LifecycleState == ScenePresenceState.PreRemove)) | 3772 | || sp.LifecycleState == ScenePresenceState.PreRemove)) |
3734 | { | 3773 | { |
3735 | m_log.DebugFormat( | 3774 | m_log.DebugFormat( |
3736 | "[SCENE]: Reusing existing child scene presence for {0}, state {1} in {2}", | 3775 | "[SCENE]: Reusing existing child scene presence for {0}, state {1} in {2}", |
3737 | sp.Name, sp.LifecycleState, Name); | 3776 | sp.Name, sp.LifecycleState, Name); |
3738 | 3777 | ||
3739 | // In the case where, for example, an A B C D region layout, an avatar may | 3778 | // In the case where, for example, an A B C D region layout, an avatar may |
3740 | // teleport from A -> D, but then -> C before A has asked B to close its old child agent. When C | 3779 | // teleport from A -> D, but then -> C before A has asked B to close its old child agent. When C |
@@ -3746,15 +3785,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
3746 | // vulnerable to an issue when a viewer quits a region without sending a proper logout but then | 3785 | // vulnerable to an issue when a viewer quits a region without sending a proper logout but then |
3747 | // re-establishes the connection on a relogin. This could wrongly set the DoNotCloseAfterTeleport | 3786 | // re-establishes the connection on a relogin. This could wrongly set the DoNotCloseAfterTeleport |
3748 | // flag when no teleport had taken place (and hence no close was going to come). | 3787 | // flag when no teleport had taken place (and hence no close was going to come). |
3749 | // if (!acd.ChildrenCapSeeds.ContainsKey(RegionInfo.RegionHandle)) | 3788 | // if (!acd.ChildrenCapSeeds.ContainsKey(RegionInfo.RegionHandle)) |
3750 | // { | 3789 | // { |
3751 | // m_log.DebugFormat( | 3790 | // m_log.DebugFormat( |
3752 | // "[SCENE]: Setting DoNotCloseAfterTeleport for child scene presence {0} in {1} because source will attempt close.", | 3791 | // "[SCENE]: Setting DoNotCloseAfterTeleport for child scene presence {0} in {1} because source will attempt close.", |
3753 | // sp.Name, Name); | 3792 | // sp.Name, Name); |
3754 | // | 3793 | // |
3755 | // sp.DoNotCloseAfterTeleport = true; | 3794 | // sp.DoNotCloseAfterTeleport = true; |
3756 | // } | 3795 | // } |
3757 | // else if (EntityTransferModule.IsInTransit(sp.UUID)) | 3796 | // else if (EntityTransferModule.IsInTransit(sp.UUID)) |
3758 | 3797 | ||
3759 | sp.LifecycleState = ScenePresenceState.Running; | 3798 | sp.LifecycleState = ScenePresenceState.Running; |
3760 | 3799 | ||
@@ -3763,8 +3802,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
3763 | sp.DoNotCloseAfterTeleport = true; | 3802 | sp.DoNotCloseAfterTeleport = true; |
3764 | 3803 | ||
3765 | m_log.DebugFormat( | 3804 | m_log.DebugFormat( |
3766 | "[SCENE]: Set DoNotCloseAfterTeleport for child scene presence {0} in {1} because this region will attempt end-of-teleport close from a previous close.", | 3805 | "[SCENE]: Set DoNotCloseAfterTeleport for child scene presence {0} in {1} because this region will attempt end-of-teleport close from a previous close.", |
3767 | sp.Name, Name); | 3806 | sp.Name, Name); |
3768 | } | 3807 | } |
3769 | } | 3808 | } |
3770 | } | 3809 | } |
@@ -3778,21 +3817,21 @@ namespace OpenSim.Region.Framework.Scenes | |||
3778 | int pollsLeft = polls; | 3817 | int pollsLeft = polls; |
3779 | 3818 | ||
3780 | while (sp.LifecycleState == ScenePresenceState.Removing && pollsLeft-- > 0) | 3819 | while (sp.LifecycleState == ScenePresenceState.Removing && pollsLeft-- > 0) |
3781 | Thread.Sleep(pollInterval); | 3820 | Thread.Sleep(pollInterval); |
3782 | 3821 | ||
3783 | if (sp.LifecycleState == ScenePresenceState.Removing) | 3822 | if (sp.LifecycleState == ScenePresenceState.Removing) |
3784 | { | 3823 | { |
3785 | m_log.WarnFormat( | 3824 | m_log.WarnFormat( |
3786 | "[SCENE]: Agent {0} in {1} was still being removed after {2}s. Aborting NewUserConnection.", | 3825 | "[SCENE]: Agent {0} in {1} was still being removed after {2}s. Aborting NewUserConnection.", |
3787 | sp.Name, Name, polls * pollInterval / 1000); | 3826 | sp.Name, Name, polls * pollInterval / 1000); |
3788 | 3827 | ||
3789 | return false; | 3828 | return false; |
3790 | } | 3829 | } |
3791 | else if (polls != pollsLeft) | 3830 | else if (polls != pollsLeft) |
3792 | { | 3831 | { |
3793 | m_log.DebugFormat( | 3832 | m_log.DebugFormat( |
3794 | "[SCENE]: NewUserConnection for agent {0} in {1} had to wait {2}s for in-progress removal to complete on an old presence.", | 3833 | "[SCENE]: NewUserConnection for agent {0} in {1} had to wait {2}s for in-progress removal to complete on an old presence.", |
3795 | sp.Name, Name, polls * pollInterval / 1000); | 3834 | sp.Name, Name, polls * pollInterval / 1000); |
3796 | } | 3835 | } |
3797 | } | 3836 | } |
3798 | 3837 | ||
@@ -3808,11 +3847,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
3808 | // Or the same user is trying to be root twice here, won't work. | 3847 | // Or the same user is trying to be root twice here, won't work. |
3809 | // Kill it. | 3848 | // Kill it. |
3810 | m_log.WarnFormat( | 3849 | m_log.WarnFormat( |
3811 | "[SCENE]: Existing root scene presence detected for {0} {1} in {2} when connecting. Removing existing presence.", | 3850 | "[SCENE]: Existing root scene presence detected for {0} {1} in {2} when connecting. Removing existing presence.", |
3812 | sp.Name, sp.UUID, RegionInfo.RegionName); | 3851 | sp.Name, sp.UUID, RegionInfo.RegionName); |
3813 | 3852 | ||
3814 | if (sp.ControllingClient != null) | 3853 | if (sp.ControllingClient != null) |
3815 | CloseAgent(sp.UUID, true); | 3854 | CloseAgent(sp.UUID, true); |
3816 | 3855 | ||
3817 | sp = null; | 3856 | sp = null; |
3818 | } | 3857 | } |
@@ -3827,7 +3866,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3827 | m_authenticateHandler.AddNewCircuit(acd.circuitcode, acd); | 3866 | m_authenticateHandler.AddNewCircuit(acd.circuitcode, acd); |
3828 | 3867 | ||
3829 | land = LandChannel.GetLandObject(acd.startpos.X, acd.startpos.Y); | 3868 | land = LandChannel.GetLandObject(acd.startpos.X, acd.startpos.Y); |
3830 | 3869 | ||
3831 | // On login test land permisions | 3870 | // On login test land permisions |
3832 | if (vialogin) | 3871 | if (vialogin) |
3833 | { | 3872 | { |
@@ -3837,7 +3876,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3837 | return false; | 3876 | return false; |
3838 | } | 3877 | } |
3839 | } | 3878 | } |
3840 | 3879 | ||
3841 | if (sp == null) // We don't have an [child] agent here already | 3880 | if (sp == null) // We don't have an [child] agent here already |
3842 | { | 3881 | { |
3843 | if (requirePresenceLookup) | 3882 | if (requirePresenceLookup) |
@@ -3853,13 +3892,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
3853 | catch (Exception e) | 3892 | catch (Exception e) |
3854 | { | 3893 | { |
3855 | m_log.ErrorFormat( | 3894 | m_log.ErrorFormat( |
3856 | "[SCENE]: Exception verifying presence {0}{1}", e.Message, e.StackTrace); | 3895 | "[SCENE]: Exception verifying presence {0}{1}", e.Message, e.StackTrace); |
3857 | 3896 | ||
3858 | m_authenticateHandler.RemoveCircuit(acd.circuitcode); | 3897 | m_authenticateHandler.RemoveCircuit(acd.circuitcode); |
3859 | return false; | 3898 | return false; |
3860 | } | 3899 | } |
3861 | } | 3900 | } |
3862 | 3901 | ||
3863 | try | 3902 | try |
3864 | { | 3903 | { |
3865 | if (!AuthorizeUser(acd, (vialogin ? false : SeeIntoRegion), out reason)) | 3904 | if (!AuthorizeUser(acd, (vialogin ? false : SeeIntoRegion), out reason)) |
@@ -3871,17 +3910,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
3871 | catch (Exception e) | 3910 | catch (Exception e) |
3872 | { | 3911 | { |
3873 | m_log.ErrorFormat( | 3912 | m_log.ErrorFormat( |
3874 | "[SCENE]: Exception authorizing user {0}{1}", e.Message, e.StackTrace); | 3913 | "[SCENE]: Exception authorizing user {0}{1}", e.Message, e.StackTrace); |
3875 | 3914 | ||
3876 | m_authenticateHandler.RemoveCircuit(acd.circuitcode); | 3915 | m_authenticateHandler.RemoveCircuit(acd.circuitcode); |
3877 | return false; | 3916 | return false; |
3878 | } | 3917 | } |
3879 | 3918 | ||
3880 | m_log.InfoFormat( | 3919 | m_log.InfoFormat( |
3881 | "[SCENE]: Region {0} authenticated and authorized incoming {1} agent {2} {3} {4} (circuit code {5})", | 3920 | "[SCENE]: Region {0} authenticated and authorized incoming {1} agent {2} {3} {4} (circuit code {5})", |
3882 | Name, (acd.child ? "child" : "root"), acd.firstname, acd.lastname, | 3921 | Name, (acd.child ? "child" : "root"), acd.firstname, acd.lastname, |
3883 | acd.AgentID, acd.circuitcode); | 3922 | acd.AgentID, acd.circuitcode); |
3884 | 3923 | ||
3885 | if (CapsModule != null) | 3924 | if (CapsModule != null) |
3886 | { | 3925 | { |
3887 | CapsModule.SetAgentCapsSeeds(acd); | 3926 | CapsModule.SetAgentCapsSeeds(acd); |
@@ -3893,13 +3932,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
3893 | // Let the SP know how we got here. This has a lot of interesting | 3932 | // Let the SP know how we got here. This has a lot of interesting |
3894 | // uses down the line. | 3933 | // uses down the line. |
3895 | sp.TeleportFlags = (TPFlags)teleportFlags; | 3934 | sp.TeleportFlags = (TPFlags)teleportFlags; |
3896 | 3935 | ||
3897 | if (sp.IsChildAgent) | 3936 | if (sp.IsChildAgent) |
3898 | { | 3937 | { |
3899 | m_log.DebugFormat( | 3938 | m_log.DebugFormat( |
3900 | "[SCENE]: Adjusting known seeds for existing agent {0} in {1}", | 3939 | "[SCENE]: Adjusting known seeds for existing agent {0} in {1}", |
3901 | acd.AgentID, RegionInfo.RegionName); | 3940 | acd.AgentID, RegionInfo.RegionName); |
3902 | 3941 | ||
3903 | sp.AdjustKnownSeeds(); | 3942 | sp.AdjustKnownSeeds(); |
3904 | 3943 | ||
3905 | if (CapsModule != null) | 3944 | if (CapsModule != null) |
@@ -3918,7 +3957,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3918 | 3957 | ||
3919 | if (vialogin) | 3958 | if (vialogin) |
3920 | { | 3959 | { |
3921 | // CleanDroppedAttachments(); | 3960 | // CleanDroppedAttachments(); |
3922 | 3961 | ||
3923 | // Make sure avatar position is in the region (why it wouldn't be is a mystery but do sanity checking) | 3962 | // Make sure avatar position is in the region (why it wouldn't be is a mystery but do sanity checking) |
3924 | if (acd.startpos.X < 0) acd.startpos.X = 1f; | 3963 | if (acd.startpos.X < 0) acd.startpos.X = 1f; |
@@ -3926,14 +3965,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
3926 | if (acd.startpos.Y < 0) acd.startpos.Y = 1f; | 3965 | if (acd.startpos.Y < 0) acd.startpos.Y = 1f; |
3927 | if (acd.startpos.Y >= RegionInfo.RegionSizeY) acd.startpos.Y = RegionInfo.RegionSizeY - 1f; | 3966 | if (acd.startpos.Y >= RegionInfo.RegionSizeY) acd.startpos.Y = RegionInfo.RegionSizeY - 1f; |
3928 | 3967 | ||
3929 | // m_log.DebugFormat( | 3968 | // m_log.DebugFormat( |
3930 | // "[SCENE]: Found telehub object {0} for new user connection {1} to {2}", | 3969 | // "[SCENE]: Found telehub object {0} for new user connection {1} to {2}", |
3931 | // RegionInfo.RegionSettings.TelehubObject, acd.Name, Name); | 3970 | // RegionInfo.RegionSettings.TelehubObject, acd.Name, Name); |
3932 | 3971 | ||
3933 | // Honor Estate teleport routing via Telehubs excluding ViaHome and GodLike TeleportFlags | 3972 | // Honor Estate teleport routing via Telehubs excluding ViaHome and GodLike TeleportFlags |
3934 | if (RegionInfo.RegionSettings.TelehubObject != UUID.Zero && | 3973 | if (RegionInfo.RegionSettings.TelehubObject != UUID.Zero && |
3935 | RegionInfo.EstateSettings.AllowDirectTeleport == false && | 3974 | RegionInfo.EstateSettings.AllowDirectTeleport == false && |
3936 | !viahome && !godlike) | 3975 | !viahome && !godlike) |
3937 | { | 3976 | { |
3938 | SceneObjectGroup telehub = GetSceneObjectGroup(RegionInfo.RegionSettings.TelehubObject); | 3977 | SceneObjectGroup telehub = GetSceneObjectGroup(RegionInfo.RegionSettings.TelehubObject); |
3939 | 3978 | ||
@@ -3945,15 +3984,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
3945 | { | 3984 | { |
3946 | // We have multiple SpawnPoints, Route the agent to a random or sequential one | 3985 | // We have multiple SpawnPoints, Route the agent to a random or sequential one |
3947 | if (SpawnPointRouting == "random") | 3986 | if (SpawnPointRouting == "random") |
3948 | acd.startpos = spawnpoints[Util.RandomClass.Next(spawnpoints.Count) - 1].GetLocation( | 3987 | acd.startpos = spawnpoints[Util.RandomClass.Next(spawnpoints.Count) - 1].GetLocation( |
3949 | telehub.AbsolutePosition, | 3988 | telehub.AbsolutePosition, |
3950 | telehub.GroupRotation | 3989 | telehub.GroupRotation |
3951 | ); | 3990 | ); |
3952 | else | 3991 | else |
3953 | acd.startpos = spawnpoints[SpawnPoint()].GetLocation( | 3992 | acd.startpos = spawnpoints[SpawnPoint()].GetLocation( |
3954 | telehub.AbsolutePosition, | 3993 | telehub.AbsolutePosition, |
3955 | telehub.GroupRotation | 3994 | telehub.GroupRotation |
3956 | ); | 3995 | ); |
3957 | } | 3996 | } |
3958 | else if (spawnpoints.Count == 1) | 3997 | else if (spawnpoints.Count == 1) |
3959 | { | 3998 | { |
@@ -3963,15 +4002,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
3963 | else | 4002 | else |
3964 | { | 4003 | { |
3965 | m_log.DebugFormat( | 4004 | m_log.DebugFormat( |
3966 | "[SCENE]: No spawnpoints defined for telehub {0} for {1} in {2}. Continuing.", | 4005 | "[SCENE]: No spawnpoints defined for telehub {0} for {1} in {2}. Continuing.", |
3967 | RegionInfo.RegionSettings.TelehubObject, acd.Name, Name); | 4006 | RegionInfo.RegionSettings.TelehubObject, acd.Name, Name); |
3968 | } | 4007 | } |
3969 | } | 4008 | } |
3970 | else | 4009 | else |
3971 | { | 4010 | { |
3972 | m_log.DebugFormat( | 4011 | m_log.DebugFormat( |
3973 | "[SCENE]: No telehub {0} found to direct {1} in {2}. Continuing.", | 4012 | "[SCENE]: No telehub {0} found to direct {1} in {2}. Continuing.", |
3974 | RegionInfo.RegionSettings.TelehubObject, acd.Name, Name); | 4013 | RegionInfo.RegionSettings.TelehubObject, acd.Name, Name); |
3975 | } | 4014 | } |
3976 | 4015 | ||
3977 | // Final permissions check; this time we don't allow changing the position | 4016 | // Final permissions check; this time we don't allow changing the position |
@@ -4008,7 +4047,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4008 | { | 4047 | { |
4009 | ILandObject land = LandChannel.GetLandObject(pos); | 4048 | ILandObject land = LandChannel.GetLandObject(pos); |
4010 | if (land == null) | 4049 | if (land == null) |
4011 | return true; | 4050 | return true; |
4012 | 4051 | ||
4013 | if (land.IsBannedFromLand(agentID) || land.IsRestrictedFromLand(agentID)) | 4052 | if (land.IsBannedFromLand(agentID) || land.IsRestrictedFromLand(agentID)) |
4014 | { | 4053 | { |
@@ -4022,21 +4061,21 @@ namespace OpenSim.Region.Framework.Scenes | |||
4022 | public bool TestLandRestrictions(UUID agentID, out string reason, ref float posX, ref float posY) | 4061 | public bool TestLandRestrictions(UUID agentID, out string reason, ref float posX, ref float posY) |
4023 | { | 4062 | { |
4024 | if (posX < 0) | 4063 | if (posX < 0) |
4025 | posX = 0; | 4064 | posX = 0; |
4026 | else if (posX >= (float)RegionInfo.RegionSizeX) | 4065 | else if (posX >= (float)RegionInfo.RegionSizeX) |
4027 | posX = (float)RegionInfo.RegionSizeX - 0.001f; | 4066 | posX = (float)RegionInfo.RegionSizeX - 0.001f; |
4028 | if (posY < 0) | 4067 | if (posY < 0) |
4029 | posY = 0; | 4068 | posY = 0; |
4030 | else if (posY >= (float)RegionInfo.RegionSizeY) | 4069 | else if (posY >= (float)RegionInfo.RegionSizeY) |
4031 | posY = (float)RegionInfo.RegionSizeY - 0.001f; | 4070 | posY = (float)RegionInfo.RegionSizeY - 0.001f; |
4032 | 4071 | ||
4033 | reason = String.Empty; | 4072 | reason = String.Empty; |
4034 | if (Permissions.IsGod(agentID)) | 4073 | if (Permissions.IsGod(agentID)) |
4035 | return true; | 4074 | return true; |
4036 | 4075 | ||
4037 | ILandObject land = LandChannel.GetLandObject(posX, posY); | 4076 | ILandObject land = LandChannel.GetLandObject(posX, posY); |
4038 | if (land == null) | 4077 | if (land == null) |
4039 | return false; | 4078 | return false; |
4040 | 4079 | ||
4041 | bool banned = land.IsBannedFromLand(agentID); | 4080 | bool banned = land.IsBannedFromLand(agentID); |
4042 | bool restricted = land.IsRestrictedFromLand(agentID); | 4081 | bool restricted = land.IsRestrictedFromLand(agentID); |
@@ -4060,7 +4099,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4060 | else | 4099 | else |
4061 | { | 4100 | { |
4062 | reason = String.Format("Denied access to private region {0}: You are not on the access list for that region.", | 4101 | reason = String.Format("Denied access to private region {0}: You are not on the access list for that region.", |
4063 | RegionInfo.RegionName); | 4102 | RegionInfo.RegionName); |
4064 | } | 4103 | } |
4065 | return false; | 4104 | return false; |
4066 | } | 4105 | } |
@@ -4111,15 +4150,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
4111 | 4150 | ||
4112 | if (!m_strictAccessControl) return true; | 4151 | if (!m_strictAccessControl) return true; |
4113 | if (Permissions.IsGod(agent.AgentID)) return true; | 4152 | if (Permissions.IsGod(agent.AgentID)) return true; |
4114 | 4153 | ||
4115 | if (AuthorizationService != null) | 4154 | if (AuthorizationService != null) |
4116 | { | 4155 | { |
4117 | if (!AuthorizationService.IsAuthorizedForRegion( | 4156 | if (!AuthorizationService.IsAuthorizedForRegion( |
4118 | agent.AgentID.ToString(), agent.firstname, agent.lastname, RegionInfo.RegionID.ToString(), out reason)) | 4157 | agent.AgentID.ToString(), agent.firstname, agent.lastname, RegionInfo.RegionID.ToString(), out reason)) |
4119 | { | 4158 | { |
4120 | m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because: {4}", | 4159 | m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because: {4}", |
4121 | agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName, reason); | 4160 | agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName, reason); |
4122 | 4161 | ||
4123 | return false; | 4162 | return false; |
4124 | } | 4163 | } |
4125 | } | 4164 | } |
@@ -4135,9 +4174,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
4135 | if (RegionInfo.EstateSettings.IsBanned(agent.AgentID)) | 4174 | if (RegionInfo.EstateSettings.IsBanned(agent.AgentID)) |
4136 | { | 4175 | { |
4137 | m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the user is on the banlist", | 4176 | m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the user is on the banlist", |
4138 | agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName); | 4177 | agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName); |
4139 | reason = String.Format("Denied access to region {0}: You have been banned from that region.", | 4178 | reason = String.Format("Denied access to region {0}: You have been banned from that region.", |
4140 | RegionInfo.RegionName); | 4179 | RegionInfo.RegionName); |
4141 | return false; | 4180 | return false; |
4142 | } | 4181 | } |
4143 | } | 4182 | } |
@@ -4155,7 +4194,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4155 | if (GroupMembership != null) | 4194 | if (GroupMembership != null) |
4156 | { | 4195 | { |
4157 | for (int i = 0; i < GroupMembership.Length; i++) | 4196 | for (int i = 0; i < GroupMembership.Length; i++) |
4158 | agentGroups.Add(GroupMembership[i].GroupID); | 4197 | agentGroups.Add(GroupMembership[i].GroupID); |
4159 | } | 4198 | } |
4160 | else | 4199 | else |
4161 | { | 4200 | { |
@@ -4183,13 +4222,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
4183 | } | 4222 | } |
4184 | 4223 | ||
4185 | if (!RegionInfo.EstateSettings.PublicAccess && | 4224 | if (!RegionInfo.EstateSettings.PublicAccess && |
4186 | !RegionInfo.EstateSettings.HasAccess(agent.AgentID) && | 4225 | !RegionInfo.EstateSettings.HasAccess(agent.AgentID) && |
4187 | !groupAccess) | 4226 | !groupAccess) |
4188 | { | 4227 | { |
4189 | m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the user does not have access to the estate", | 4228 | m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the user does not have access to the estate", |
4190 | agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName); | 4229 | agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName); |
4191 | reason = String.Format("Denied access to private region {0}: You are not on the access list for that region.", | 4230 | reason = String.Format("Denied access to private region {0}: You are not on the access list for that region.", |
4192 | RegionInfo.RegionName); | 4231 | RegionInfo.RegionName); |
4193 | return false; | 4232 | return false; |
4194 | } | 4233 | } |
4195 | } | 4234 | } |
@@ -4245,69 +4284,69 @@ namespace OpenSim.Region.Framework.Scenes | |||
4245 | return m_authenticateHandler.TryChangeCiruitCode(oldcc, newcc); | 4284 | return m_authenticateHandler.TryChangeCiruitCode(oldcc, newcc); |
4246 | } | 4285 | } |
4247 | 4286 | ||
4248 | // /// <summary> | 4287 | // /// <summary> |
4249 | // /// The Grid has requested that we log-off a user. Log them off. | 4288 | // /// The Grid has requested that we log-off a user. Log them off. |
4250 | // /// </summary> | 4289 | // /// </summary> |
4251 | // /// <param name="AvatarID">Unique ID of the avatar to log-off</param> | 4290 | // /// <param name="AvatarID">Unique ID of the avatar to log-off</param> |
4252 | // /// <param name="RegionSecret">SecureSessionID of the user, or the RegionSecret text when logging on to the grid</param> | 4291 | // /// <param name="RegionSecret">SecureSessionID of the user, or the RegionSecret text when logging on to the grid</param> |
4253 | // /// <param name="message">message to display to the user. Reason for being logged off</param> | 4292 | // /// <param name="message">message to display to the user. Reason for being logged off</param> |
4254 | // public void HandleLogOffUserFromGrid(UUID AvatarID, UUID RegionSecret, string message) | 4293 | // public void HandleLogOffUserFromGrid(UUID AvatarID, UUID RegionSecret, string message) |
4255 | // { | 4294 | // { |
4256 | // ScenePresence loggingOffUser = GetScenePresence(AvatarID); | 4295 | // ScenePresence loggingOffUser = GetScenePresence(AvatarID); |
4257 | // if (loggingOffUser != null) | 4296 | // if (loggingOffUser != null) |
4258 | // { | 4297 | // { |
4259 | // UUID localRegionSecret = UUID.Zero; | 4298 | // UUID localRegionSecret = UUID.Zero; |
4260 | // bool parsedsecret = UUID.TryParse(RegionInfo.regionSecret, out localRegionSecret); | 4299 | // bool parsedsecret = UUID.TryParse(RegionInfo.regionSecret, out localRegionSecret); |
4261 | // | 4300 | // |
4262 | // // Region Secret is used here in case a new sessionid overwrites an old one on the user server. | 4301 | // // Region Secret is used here in case a new sessionid overwrites an old one on the user server. |
4263 | // // Will update the user server in a few revisions to use it. | 4302 | // // Will update the user server in a few revisions to use it. |
4264 | // | 4303 | // |
4265 | // if (RegionSecret == loggingOffUser.ControllingClient.SecureSessionId || (parsedsecret && RegionSecret == localRegionSecret)) | 4304 | // if (RegionSecret == loggingOffUser.ControllingClient.SecureSessionId || (parsedsecret && RegionSecret == localRegionSecret)) |
4266 | // { | 4305 | // { |
4267 | // m_sceneGridService.SendCloseChildAgentConnections(loggingOffUser.UUID, loggingOffUser.KnownRegionHandles); | 4306 | // m_sceneGridService.SendCloseChildAgentConnections(loggingOffUser.UUID, loggingOffUser.KnownRegionHandles); |
4268 | // loggingOffUser.ControllingClient.Kick(message); | 4307 | // loggingOffUser.ControllingClient.Kick(message); |
4269 | // // Give them a second to receive the message! | 4308 | // // Give them a second to receive the message! |
4270 | // Thread.Sleep(1000); | 4309 | // Thread.Sleep(1000); |
4271 | // loggingOffUser.ControllingClient.Close(); | 4310 | // loggingOffUser.ControllingClient.Close(); |
4272 | // } | 4311 | // } |
4273 | // else | 4312 | // else |
4274 | // { | 4313 | // { |
4275 | // m_log.Info("[USERLOGOFF]: System sending the LogOff user message failed to sucessfully authenticate"); | 4314 | // m_log.Info("[USERLOGOFF]: System sending the LogOff user message failed to sucessfully authenticate"); |
4276 | // } | 4315 | // } |
4277 | // } | 4316 | // } |
4278 | // else | 4317 | // else |
4279 | // { | 4318 | // { |
4280 | // 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()); | 4319 | // 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()); |
4281 | // } | 4320 | // } |
4282 | // } | 4321 | // } |
4283 | 4322 | ||
4284 | // /// <summary> | 4323 | // /// <summary> |
4285 | // /// Triggered when an agent crosses into this sim. Also happens on initial login. | 4324 | // /// Triggered when an agent crosses into this sim. Also happens on initial login. |
4286 | // /// </summary> | 4325 | // /// </summary> |
4287 | // /// <param name="agentID"></param> | 4326 | // /// <param name="agentID"></param> |
4288 | // /// <param name="position"></param> | 4327 | // /// <param name="position"></param> |
4289 | // /// <param name="isFlying"></param> | 4328 | // /// <param name="isFlying"></param> |
4290 | // public virtual void AgentCrossing(UUID agentID, Vector3 position, bool isFlying) | 4329 | // public virtual void AgentCrossing(UUID agentID, Vector3 position, bool isFlying) |
4291 | // { | 4330 | // { |
4292 | // ScenePresence presence = GetScenePresence(agentID); | 4331 | // ScenePresence presence = GetScenePresence(agentID); |
4293 | // if (presence != null) | 4332 | // if (presence != null) |
4294 | // { | 4333 | // { |
4295 | // try | 4334 | // try |
4296 | // { | 4335 | // { |
4297 | // presence.MakeRootAgent(position, isFlying); | 4336 | // presence.MakeRootAgent(position, isFlying); |
4298 | // } | 4337 | // } |
4299 | // catch (Exception e) | 4338 | // catch (Exception e) |
4300 | // { | 4339 | // { |
4301 | // m_log.ErrorFormat("[SCENE]: Unable to do agent crossing, exception {0}{1}", e.Message, e.StackTrace); | 4340 | // m_log.ErrorFormat("[SCENE]: Unable to do agent crossing, exception {0}{1}", e.Message, e.StackTrace); |
4302 | // } | 4341 | // } |
4303 | // } | 4342 | // } |
4304 | // else | 4343 | // else |
4305 | // { | 4344 | // { |
4306 | // m_log.ErrorFormat( | 4345 | // m_log.ErrorFormat( |
4307 | // "[SCENE]: Could not find presence for agent {0} crossing into scene {1}", | 4346 | // "[SCENE]: Could not find presence for agent {0} crossing into scene {1}", |
4308 | // agentID, RegionInfo.RegionName); | 4347 | // agentID, RegionInfo.RegionName); |
4309 | // } | 4348 | // } |
4310 | // } | 4349 | // } |
4311 | 4350 | ||
4312 | /// <summary> | 4351 | /// <summary> |
4313 | /// We've got an update about an agent that sees into this region, | 4352 | /// We've got an update about an agent that sees into this region, |
@@ -4319,15 +4358,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
4319 | public virtual bool IncomingUpdateChildAgent(AgentData cAgentData) | 4358 | public virtual bool IncomingUpdateChildAgent(AgentData cAgentData) |
4320 | { | 4359 | { |
4321 | m_log.DebugFormat( | 4360 | m_log.DebugFormat( |
4322 | "[SCENE]: Incoming child agent update for {0} in {1}", cAgentData.AgentID, RegionInfo.RegionName); | 4361 | "[SCENE]: Incoming child agent update for {0} in {1}", cAgentData.AgentID, RegionInfo.RegionName); |
4323 | 4362 | ||
4324 | // TODO: This check should probably be in QueryAccess(). | 4363 | // TODO: This check should probably be in QueryAccess(). |
4325 | ILandObject nearestParcel = GetNearestAllowedParcel(cAgentData.AgentID, RegionInfo.RegionSizeX / 2, RegionInfo.RegionSizeY / 2); | 4364 | ILandObject nearestParcel = GetNearestAllowedParcel(cAgentData.AgentID, RegionInfo.RegionSizeX / 2, RegionInfo.RegionSizeY / 2); |
4326 | if (nearestParcel == null) | 4365 | if (nearestParcel == null) |
4327 | { | 4366 | { |
4328 | m_log.InfoFormat( | 4367 | m_log.InfoFormat( |
4329 | "[SCENE]: Denying root agent entry to {0} in {1}: no allowed parcel", | 4368 | "[SCENE]: Denying root agent entry to {0} in {1}: no allowed parcel", |
4330 | cAgentData.AgentID, RegionInfo.RegionName); | 4369 | cAgentData.AgentID, RegionInfo.RegionName); |
4331 | 4370 | ||
4332 | return false; | 4371 | return false; |
4333 | } | 4372 | } |
@@ -4343,11 +4382,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
4343 | if (cAgentData.SessionID != sp.ControllingClient.SessionId) | 4382 | if (cAgentData.SessionID != sp.ControllingClient.SessionId) |
4344 | { | 4383 | { |
4345 | m_log.WarnFormat( | 4384 | m_log.WarnFormat( |
4346 | "[SCENE]: Attempt to update agent {0} with invalid session id {1} (possibly from simulator in older version; tell them to update).", | 4385 | "[SCENE]: Attempt to update agent {0} with invalid session id {1} (possibly from simulator in older version; tell them to update).", |
4347 | sp.UUID, cAgentData.SessionID); | 4386 | sp.UUID, cAgentData.SessionID); |
4348 | 4387 | ||
4349 | Console.WriteLine(String.Format("[SCENE]: Attempt to update agent {0} ({1}) with invalid session id {2}", | 4388 | Console.WriteLine(String.Format("[SCENE]: Attempt to update agent {0} ({1}) with invalid session id {2}", |
4350 | sp.UUID, sp.ControllingClient.SessionId, cAgentData.SessionID)); | 4389 | sp.UUID, sp.ControllingClient.SessionId, cAgentData.SessionID)); |
4351 | } | 4390 | } |
4352 | 4391 | ||
4353 | sp.UpdateChildAgent(cAgentData); | 4392 | sp.UpdateChildAgent(cAgentData); |
@@ -4356,19 +4395,19 @@ namespace OpenSim.Region.Framework.Scenes | |||
4356 | if (cAgentData.SenderWantsToWaitForRoot) | 4395 | if (cAgentData.SenderWantsToWaitForRoot) |
4357 | { | 4396 | { |
4358 | while (sp.IsChildAgent && ntimes-- > 0) | 4397 | while (sp.IsChildAgent && ntimes-- > 0) |
4359 | Thread.Sleep(1000); | 4398 | Thread.Sleep(1000); |
4360 | 4399 | ||
4361 | if (sp.IsChildAgent) | 4400 | if (sp.IsChildAgent) |
4362 | m_log.WarnFormat( | 4401 | m_log.WarnFormat( |
4363 | "[SCENE]: Found presence {0} {1} unexpectedly still child in {2}", | 4402 | "[SCENE]: Found presence {0} {1} unexpectedly still child in {2}", |
4364 | sp.Name, sp.UUID, Name); | 4403 | sp.Name, sp.UUID, Name); |
4365 | else | 4404 | else |
4366 | m_log.InfoFormat( | 4405 | m_log.InfoFormat( |
4367 | "[SCENE]: Found presence {0} {1} as root in {2} after {3} waits", | 4406 | "[SCENE]: Found presence {0} {1} as root in {2} after {3} waits", |
4368 | sp.Name, sp.UUID, Name, 20 - ntimes); | 4407 | sp.Name, sp.UUID, Name, 20 - ntimes); |
4369 | 4408 | ||
4370 | if (sp.IsChildAgent) | 4409 | if (sp.IsChildAgent) |
4371 | return false; | 4410 | return false; |
4372 | } | 4411 | } |
4373 | 4412 | ||
4374 | return true; | 4413 | return true; |
@@ -4385,17 +4424,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
4385 | /// <returns>true if we handled it.</returns> | 4424 | /// <returns>true if we handled it.</returns> |
4386 | public virtual bool IncomingUpdateChildAgent(AgentPosition cAgentData) | 4425 | public virtual bool IncomingUpdateChildAgent(AgentPosition cAgentData) |
4387 | { | 4426 | { |
4388 | // m_log.DebugFormat( | 4427 | // m_log.DebugFormat( |
4389 | // "[SCENE PRESENCE]: IncomingChildAgentDataUpdate POSITION for {0} in {1}, position {2}", | 4428 | // "[SCENE PRESENCE]: IncomingChildAgentDataUpdate POSITION for {0} in {1}, position {2}", |
4390 | // cAgentData.AgentID, Name, cAgentData.Position); | 4429 | // cAgentData.AgentID, Name, cAgentData.Position); |
4391 | 4430 | ||
4392 | ScenePresence childAgentUpdate = GetScenePresence(cAgentData.AgentID); | 4431 | ScenePresence childAgentUpdate = GetScenePresence(cAgentData.AgentID); |
4393 | if (childAgentUpdate != null) | 4432 | if (childAgentUpdate != null) |
4394 | { | 4433 | { |
4395 | // if (childAgentUpdate.ControllingClient.SessionId != cAgentData.SessionID) | 4434 | // if (childAgentUpdate.ControllingClient.SessionId != cAgentData.SessionID) |
4396 | // // Only warn for now | 4435 | // // Only warn for now |
4397 | // m_log.WarnFormat("[SCENE]: Attempt at updating position of agent {0} with invalid session id {1}. Neighbor running older version?", | 4436 | // m_log.WarnFormat("[SCENE]: Attempt at updating position of agent {0} with invalid session id {1}. Neighbor running older version?", |
4398 | // childAgentUpdate.UUID, cAgentData.SessionID); | 4437 | // childAgentUpdate.UUID, cAgentData.SessionID); |
4399 | 4438 | ||
4400 | // I can't imagine *yet* why we would get an update if the agent is a root agent.. | 4439 | // I can't imagine *yet* why we would get an update if the agent is a root agent.. |
4401 | // however to avoid a race condition crossing borders.. | 4440 | // however to avoid a race condition crossing borders.. |
@@ -4427,12 +4466,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
4427 | int ntimes = 20; | 4466 | int ntimes = 20; |
4428 | ScenePresence sp = null; | 4467 | ScenePresence sp = null; |
4429 | while ((sp = GetScenePresence(agentID)) == null && (ntimes-- > 0)) | 4468 | while ((sp = GetScenePresence(agentID)) == null && (ntimes-- > 0)) |
4430 | Thread.Sleep(1000); | 4469 | Thread.Sleep(1000); |
4431 | 4470 | ||
4432 | if (sp == null) | 4471 | if (sp == null) |
4433 | m_log.WarnFormat( | 4472 | m_log.WarnFormat( |
4434 | "[SCENE PRESENCE]: Did not find presence with id {0} in {1} before timeout", | 4473 | "[SCENE PRESENCE]: Did not find presence with id {0} in {1} before timeout", |
4435 | agentID, RegionInfo.RegionName); | 4474 | agentID, RegionInfo.RegionName); |
4436 | 4475 | ||
4437 | return sp; | 4476 | return sp; |
4438 | } | 4477 | } |
@@ -4454,8 +4493,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
4454 | if (acd == null) | 4493 | if (acd == null) |
4455 | { | 4494 | { |
4456 | m_log.DebugFormat( | 4495 | m_log.DebugFormat( |
4457 | "[SCENE]: Request to close agent {0} but no such agent in scene {1}. May have been closed previously.", | 4496 | "[SCENE]: Request to close agent {0} but no such agent in scene {1}. May have been closed previously.", |
4458 | agentID, Name); | 4497 | agentID, Name); |
4459 | 4498 | ||
4460 | return false; | 4499 | return false; |
4461 | } | 4500 | } |
@@ -4467,8 +4506,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
4467 | else | 4506 | else |
4468 | { | 4507 | { |
4469 | m_log.WarnFormat( | 4508 | m_log.WarnFormat( |
4470 | "[SCENE]: Request to close agent {0} with invalid authorization token {1} in {2}", | 4509 | "[SCENE]: Request to close agent {0} with invalid authorization token {1} in {2}", |
4471 | agentID, auth_token, Name); | 4510 | agentID, auth_token, Name); |
4472 | } | 4511 | } |
4473 | 4512 | ||
4474 | return false; | 4513 | return false; |
@@ -4494,8 +4533,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
4494 | if (sp.DoNotCloseAfterTeleport) | 4533 | if (sp.DoNotCloseAfterTeleport) |
4495 | { | 4534 | { |
4496 | m_log.DebugFormat( | 4535 | m_log.DebugFormat( |
4497 | "[SCENE]: Not pre-closing {0} agent {1} in {2} since another simulator has re-established the child connection", | 4536 | "[SCENE]: Not pre-closing {0} agent {1} in {2} since another simulator has re-established the child connection", |
4498 | sp.IsChildAgent ? "child" : "root", sp.Name, Name); | 4537 | sp.IsChildAgent ? "child" : "root", sp.Name, Name); |
4499 | 4538 | ||
4500 | // Need to reset the flag so that a subsequent close after another teleport can succeed. | 4539 | // Need to reset the flag so that a subsequent close after another teleport can succeed. |
4501 | sp.DoNotCloseAfterTeleport = false; | 4540 | sp.DoNotCloseAfterTeleport = false; |
@@ -4506,8 +4545,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
4506 | if (sp.LifecycleState != ScenePresenceState.Running) | 4545 | if (sp.LifecycleState != ScenePresenceState.Running) |
4507 | { | 4546 | { |
4508 | m_log.DebugFormat( | 4547 | m_log.DebugFormat( |
4509 | "[SCENE]: Called IncomingPreCloseAgent() for {0} in {1} but presence is already in state {2}", | 4548 | "[SCENE]: Called IncomingPreCloseAgent() for {0} in {1} but presence is already in state {2}", |
4510 | sp.Name, Name, sp.LifecycleState); | 4549 | sp.Name, Name, sp.LifecycleState); |
4511 | 4550 | ||
4512 | return false; | 4551 | return false; |
4513 | } | 4552 | } |
@@ -4533,21 +4572,21 @@ namespace OpenSim.Region.Framework.Scenes | |||
4533 | lock (m_removeClientLock) | 4572 | lock (m_removeClientLock) |
4534 | { | 4573 | { |
4535 | sp = GetScenePresence(agentID); | 4574 | sp = GetScenePresence(agentID); |
4536 | 4575 | ||
4537 | if (sp == null) | 4576 | if (sp == null) |
4538 | { | 4577 | { |
4539 | m_log.DebugFormat( | 4578 | m_log.DebugFormat( |
4540 | "[SCENE]: Called CloseClient() with agent ID {0} but no such presence is in {1}", | 4579 | "[SCENE]: Called CloseClient() with agent ID {0} but no such presence is in {1}", |
4541 | agentID, Name); | 4580 | agentID, Name); |
4542 | 4581 | ||
4543 | return false; | 4582 | return false; |
4544 | } | 4583 | } |
4545 | 4584 | ||
4546 | if (sp.LifecycleState != ScenePresenceState.Running && sp.LifecycleState != ScenePresenceState.PreRemove) | 4585 | if (sp.LifecycleState != ScenePresenceState.Running && sp.LifecycleState != ScenePresenceState.PreRemove) |
4547 | { | 4586 | { |
4548 | m_log.DebugFormat( | 4587 | m_log.DebugFormat( |
4549 | "[SCENE]: Called CloseClient() for {0} in {1} but presence is already in state {2}", | 4588 | "[SCENE]: Called CloseClient() for {0} in {1} but presence is already in state {2}", |
4550 | sp.Name, Name, sp.LifecycleState); | 4589 | sp.Name, Name, sp.LifecycleState); |
4551 | 4590 | ||
4552 | return false; | 4591 | return false; |
4553 | } | 4592 | } |
@@ -4558,8 +4597,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
4558 | if (sp.DoNotCloseAfterTeleport) | 4597 | if (sp.DoNotCloseAfterTeleport) |
4559 | { | 4598 | { |
4560 | m_log.DebugFormat( | 4599 | m_log.DebugFormat( |
4561 | "[SCENE]: Not closing {0} agent {1} in {2} since another simulator has re-established the child connection", | 4600 | "[SCENE]: Not closing {0} agent {1} in {2} since another simulator has re-established the child connection", |
4562 | sp.IsChildAgent ? "child" : "root", sp.Name, Name); | 4601 | sp.IsChildAgent ? "child" : "root", sp.Name, Name); |
4563 | 4602 | ||
4564 | // Need to reset the flag so that a subsequent close after another teleport can succeed. | 4603 | // Need to reset the flag so that a subsequent close after another teleport can succeed. |
4565 | sp.DoNotCloseAfterTeleport = false; | 4604 | sp.DoNotCloseAfterTeleport = false; |
@@ -4587,7 +4626,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4587 | /// <param name="lookAt"></param> | 4626 | /// <param name="lookAt"></param> |
4588 | /// <param name="teleportFlags"></param> | 4627 | /// <param name="teleportFlags"></param> |
4589 | public void RequestTeleportLocation(IClientAPI remoteClient, string regionName, Vector3 position, | 4628 | public void RequestTeleportLocation(IClientAPI remoteClient, string regionName, Vector3 position, |
4590 | Vector3 lookat, uint teleportFlags) | 4629 | Vector3 lookat, uint teleportFlags) |
4591 | { | 4630 | { |
4592 | GridRegion region = GridService.GetRegionByName(RegionInfo.ScopeID, regionName); | 4631 | GridRegion region = GridService.GetRegionByName(RegionInfo.ScopeID, regionName); |
4593 | 4632 | ||
@@ -4610,7 +4649,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4610 | /// <param name="lookAt"></param> | 4649 | /// <param name="lookAt"></param> |
4611 | /// <param name="teleportFlags"></param> | 4650 | /// <param name="teleportFlags"></param> |
4612 | public void RequestTeleportLocation(IClientAPI remoteClient, ulong regionHandle, Vector3 position, | 4651 | public void RequestTeleportLocation(IClientAPI remoteClient, ulong regionHandle, Vector3 position, |
4613 | Vector3 lookAt, uint teleportFlags) | 4652 | Vector3 lookAt, uint teleportFlags) |
4614 | { | 4653 | { |
4615 | ScenePresence sp = GetScenePresence(remoteClient.AgentId); | 4654 | ScenePresence sp = GetScenePresence(remoteClient.AgentId); |
4616 | if (sp != null) | 4655 | if (sp != null) |
@@ -4709,8 +4748,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
4709 | if (part.Name == cmdparams[2]) | 4748 | if (part.Name == cmdparams[2]) |
4710 | { | 4749 | { |
4711 | part.Resize( | 4750 | part.Resize( |
4712 | new Vector3(Convert.ToSingle(cmdparams[3]), Convert.ToSingle(cmdparams[4]), | 4751 | new Vector3(Convert.ToSingle(cmdparams[3]), Convert.ToSingle(cmdparams[4]), |
4713 | Convert.ToSingle(cmdparams[5]))); | 4752 | Convert.ToSingle(cmdparams[5]))); |
4714 | 4753 | ||
4715 | m_log.DebugFormat("Edited scale of Primitive: {0}", part.Name); | 4754 | m_log.DebugFormat("Edited scale of Primitive: {0}", part.Name); |
4716 | } | 4755 | } |
@@ -4755,7 +4794,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4755 | 4794 | ||
4756 | #region Script Engine | 4795 | #region Script Engine |
4757 | 4796 | ||
4758 | private bool ScriptDanger(SceneObjectPart part,Vector3 pos) | 4797 | private bool ScriptDanger(SceneObjectPart part, Vector3 pos) |
4759 | { | 4798 | { |
4760 | ILandObject parcel = LandChannel.GetLandObject(pos.X, pos.Y); | 4799 | ILandObject parcel = LandChannel.GetLandObject(pos.X, pos.Y); |
4761 | if (part != null) | 4800 | if (part != null) |
@@ -4771,7 +4810,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4771 | return true; | 4810 | return true; |
4772 | } | 4811 | } |
4773 | else if (((parcel.LandData.Flags & (uint)ParcelFlags.AllowGroupScripts) != 0) | 4812 | else if (((parcel.LandData.Flags & (uint)ParcelFlags.AllowGroupScripts) != 0) |
4774 | && (parcel.LandData.GroupID != UUID.Zero) && (parcel.LandData.GroupID == part.GroupID)) | 4813 | && (parcel.LandData.GroupID != UUID.Zero) && (parcel.LandData.GroupID == part.GroupID)) |
4775 | { | 4814 | { |
4776 | return true; | 4815 | return true; |
4777 | } | 4816 | } |
@@ -5113,15 +5152,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
5113 | #endregion | 5152 | #endregion |
5114 | 5153 | ||
5115 | 5154 | ||
5116 | // Commented pending deletion since this method no longer appears to do anything at all | 5155 | // Commented pending deletion since this method no longer appears to do anything at all |
5117 | // public bool NeedSceneCacheClear(UUID agentID) | 5156 | // public bool NeedSceneCacheClear(UUID agentID) |
5118 | // { | 5157 | // { |
5119 | // IInventoryTransferModule inv = RequestModuleInterface<IInventoryTransferModule>(); | 5158 | // IInventoryTransferModule inv = RequestModuleInterface<IInventoryTransferModule>(); |
5120 | // if (inv == null) | 5159 | // if (inv == null) |
5121 | // return true; | 5160 | // return true; |
5122 | // | 5161 | // |
5123 | // return inv.NeedSceneCacheClear(agentID, this); | 5162 | // return inv.NeedSceneCacheClear(agentID, this); |
5124 | // } | 5163 | // } |
5125 | 5164 | ||
5126 | public void CleanTempObjects() | 5165 | public void CleanTempObjects() |
5127 | { | 5166 | { |
@@ -5137,7 +5176,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
5137 | if ((grp.RootPart.Flags & PrimFlags.TemporaryOnRez) != 0) | 5176 | if ((grp.RootPart.Flags & PrimFlags.TemporaryOnRez) != 0) |
5138 | { | 5177 | { |
5139 | if (grp.RootPart.Expires <= DateTime.Now) | 5178 | if (grp.RootPart.Expires <= DateTime.Now) |
5140 | DeleteSceneObject(grp, false); | 5179 | DeleteSceneObject(grp, false); |
5141 | } | 5180 | } |
5142 | } | 5181 | } |
5143 | } | 5182 | } |
@@ -5163,21 +5202,21 @@ namespace OpenSim.Region.Framework.Scenes | |||
5163 | // 3 = We have seen a new user enter within the past 4 minutes | 5202 | // 3 = We have seen a new user enter within the past 4 minutes |
5164 | // which can be seen as positive confirmation of sim health | 5203 | // which can be seen as positive confirmation of sim health |
5165 | // | 5204 | // |
5166 | int health=1; // Start at 1, means we're up | 5205 | int health = 1; // Start at 1, means we're up |
5167 | 5206 | ||
5168 | if ((Util.EnvironmentTickCountSubtract(m_lastFrameTick)) < 1000) | 5207 | if ((Util.EnvironmentTickCountSubtract(m_lastFrameTick)) < 1000) |
5169 | health += 1; | 5208 | health += 1; |
5170 | else | 5209 | else |
5171 | return health; | 5210 | return health; |
5172 | 5211 | ||
5173 | // A login in the last 4 mins? We can't be doing too badly | 5212 | // A login in the last 4 mins? We can't be doing too badly |
5174 | // | 5213 | // |
5175 | if ((Util.EnvironmentTickCountSubtract(m_LastLogin)) < 240000) | 5214 | if ((Util.EnvironmentTickCountSubtract(m_LastLogin)) < 240000) |
5176 | health++; | 5215 | health++; |
5177 | else | 5216 | else |
5178 | return health; | 5217 | return health; |
5179 | 5218 | ||
5180 | // CheckHeartbeat(); | 5219 | // CheckHeartbeat(); |
5181 | 5220 | ||
5182 | return health; | 5221 | return health; |
5183 | } | 5222 | } |
@@ -5207,41 +5246,41 @@ namespace OpenSim.Region.Framework.Scenes | |||
5207 | jointProxyObject.AngularVelocity = trackedBody.AngularVelocity; | 5246 | jointProxyObject.AngularVelocity = trackedBody.AngularVelocity; |
5208 | switch (joint.Type) | 5247 | switch (joint.Type) |
5209 | { | 5248 | { |
5210 | case PhysicsJointType.Ball: | 5249 | case PhysicsJointType.Ball: |
5211 | { | 5250 | { |
5212 | Vector3 jointAnchor = PhysicsScene.GetJointAnchor(joint); | 5251 | Vector3 jointAnchor = PhysicsScene.GetJointAnchor(joint); |
5213 | Vector3 proxyPos = jointAnchor; | 5252 | Vector3 proxyPos = jointAnchor; |
5214 | jointProxyObject.ParentGroup.UpdateGroupPosition(proxyPos); // schedules the entire group for a terse update | 5253 | jointProxyObject.ParentGroup.UpdateGroupPosition(proxyPos); // schedules the entire group for a terse update |
5215 | } | 5254 | } |
5216 | break; | 5255 | break; |
5217 | 5256 | ||
5218 | case PhysicsJointType.Hinge: | 5257 | case PhysicsJointType.Hinge: |
5219 | { | 5258 | { |
5220 | Vector3 jointAnchor = PhysicsScene.GetJointAnchor(joint); | 5259 | Vector3 jointAnchor = PhysicsScene.GetJointAnchor(joint); |
5221 | 5260 | ||
5222 | // Normally, we would just ask the physics scene to return the axis for the joint. | 5261 | // Normally, we would just ask the physics scene to return the axis for the joint. |
5223 | // Unfortunately, ODE sometimes returns <0,0,0> for the joint axis, which should | 5262 | // Unfortunately, ODE sometimes returns <0,0,0> for the joint axis, which should |
5224 | // never occur. Therefore we cannot rely on ODE to always return a correct joint axis. | 5263 | // never occur. Therefore we cannot rely on ODE to always return a correct joint axis. |
5225 | // Therefore the following call does not always work: | 5264 | // Therefore the following call does not always work: |
5226 | //PhysicsVector phyJointAxis = _PhyScene.GetJointAxis(joint); | 5265 | //PhysicsVector phyJointAxis = _PhyScene.GetJointAxis(joint); |
5227 | 5266 | ||
5228 | // instead we compute the joint orientation by saving the original joint orientation | 5267 | // instead we compute the joint orientation by saving the original joint orientation |
5229 | // relative to one of the jointed bodies, and applying this transformation | 5268 | // relative to one of the jointed bodies, and applying this transformation |
5230 | // to the current position of the jointed bodies (the tracked body) to compute the | 5269 | // to the current position of the jointed bodies (the tracked body) to compute the |
5231 | // current joint orientation. | 5270 | // current joint orientation. |
5232 | 5271 | ||
5233 | if (joint.TrackedBodyName == null) | 5272 | if (joint.TrackedBodyName == null) |
5234 | { | 5273 | { |
5235 | jointErrorMessage(joint, "joint.TrackedBodyName is null, joint " + joint.ObjectNameInScene); | 5274 | jointErrorMessage(joint, "joint.TrackedBodyName is null, joint " + joint.ObjectNameInScene); |
5236 | } | 5275 | } |
5237 | 5276 | ||
5238 | Vector3 proxyPos = jointAnchor; | 5277 | Vector3 proxyPos = jointAnchor; |
5239 | Quaternion q = trackedBody.RotationOffset * joint.LocalRotation; | 5278 | Quaternion q = trackedBody.RotationOffset * joint.LocalRotation; |
5240 | 5279 | ||
5241 | jointProxyObject.ParentGroup.UpdateGroupPosition(proxyPos); // schedules the entire group for a terse update | 5280 | jointProxyObject.ParentGroup.UpdateGroupPosition(proxyPos); // schedules the entire group for a terse update |
5242 | jointProxyObject.ParentGroup.UpdateGroupRotationR(q); // schedules the entire group for a terse update | 5281 | jointProxyObject.ParentGroup.UpdateGroupRotationR(q); // schedules the entire group for a terse update |
5243 | } | 5282 | } |
5244 | break; | 5283 | break; |
5245 | } | 5284 | } |
5246 | } | 5285 | } |
5247 | 5286 | ||
@@ -5282,30 +5321,30 @@ namespace OpenSim.Region.Framework.Scenes | |||
5282 | if (joint != null) | 5321 | if (joint != null) |
5283 | { | 5322 | { |
5284 | if (joint.ErrorMessageCount > PhysicsJoint.maxErrorMessages) | 5323 | if (joint.ErrorMessageCount > PhysicsJoint.maxErrorMessages) |
5285 | return; | 5324 | return; |
5286 | 5325 | ||
5287 | SceneObjectPart jointProxyObject = GetSceneObjectPart(joint.ObjectNameInScene); | 5326 | SceneObjectPart jointProxyObject = GetSceneObjectPart(joint.ObjectNameInScene); |
5288 | if (jointProxyObject != null) | 5327 | if (jointProxyObject != null) |
5289 | { | 5328 | { |
5290 | SimChat(Utils.StringToBytes("[NINJA]: " + message), | 5329 | SimChat(Utils.StringToBytes("[NINJA]: " + message), |
5291 | ChatTypeEnum.DebugChannel, | 5330 | ChatTypeEnum.DebugChannel, |
5292 | 2147483647, | 5331 | 2147483647, |
5293 | jointProxyObject.AbsolutePosition, | 5332 | jointProxyObject.AbsolutePosition, |
5294 | jointProxyObject.Name, | 5333 | jointProxyObject.Name, |
5295 | jointProxyObject.UUID, | 5334 | jointProxyObject.UUID, |
5296 | false); | 5335 | false); |
5297 | 5336 | ||
5298 | joint.ErrorMessageCount++; | 5337 | joint.ErrorMessageCount++; |
5299 | 5338 | ||
5300 | if (joint.ErrorMessageCount > PhysicsJoint.maxErrorMessages) | 5339 | if (joint.ErrorMessageCount > PhysicsJoint.maxErrorMessages) |
5301 | { | 5340 | { |
5302 | SimChat(Utils.StringToBytes("[NINJA]: Too many messages for this joint, suppressing further messages."), | 5341 | SimChat(Utils.StringToBytes("[NINJA]: Too many messages for this joint, suppressing further messages."), |
5303 | ChatTypeEnum.DebugChannel, | 5342 | ChatTypeEnum.DebugChannel, |
5304 | 2147483647, | 5343 | 2147483647, |
5305 | jointProxyObject.AbsolutePosition, | 5344 | jointProxyObject.AbsolutePosition, |
5306 | jointProxyObject.Name, | 5345 | jointProxyObject.Name, |
5307 | jointProxyObject.UUID, | 5346 | jointProxyObject.UUID, |
5308 | false); | 5347 | false); |
5309 | } | 5348 | } |
5310 | } | 5349 | } |
5311 | else | 5350 | else |
@@ -5318,9 +5357,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
5318 | public Scene ConsoleScene() | 5357 | public Scene ConsoleScene() |
5319 | { | 5358 | { |
5320 | if (MainConsole.Instance == null) | 5359 | if (MainConsole.Instance == null) |
5321 | return null; | 5360 | return null; |
5322 | if (MainConsole.Instance.ConsoleScene is Scene) | 5361 | if (MainConsole.Instance.ConsoleScene is Scene) |
5323 | return (Scene)MainConsole.Instance.ConsoleScene; | 5362 | return (Scene)MainConsole.Instance.ConsoleScene; |
5324 | return null; | 5363 | return null; |
5325 | } | 5364 | } |
5326 | 5365 | ||
@@ -5331,13 +5370,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
5331 | public float GetGroundHeight(float x, float y) | 5370 | public float GetGroundHeight(float x, float y) |
5332 | { | 5371 | { |
5333 | if (x < 0) | 5372 | if (x < 0) |
5334 | x = 0; | 5373 | x = 0; |
5335 | if (x >= Heightmap.Width) | 5374 | if (x >= Heightmap.Width) |
5336 | x = Heightmap.Width - 1; | 5375 | x = Heightmap.Width - 1; |
5337 | if (y < 0) | 5376 | if (y < 0) |
5338 | y = 0; | 5377 | y = 0; |
5339 | if (y >= Heightmap.Height) | 5378 | if (y >= Heightmap.Height) |
5340 | y = Heightmap.Height - 1; | 5379 | y = Heightmap.Height - 1; |
5341 | 5380 | ||
5342 | Vector3 p0 = new Vector3(x, y, (float)Heightmap[(int)x, (int)y]); | 5381 | Vector3 p0 = new Vector3(x, y, (float)Heightmap[(int)x, (int)y]); |
5343 | Vector3 p1 = p0; | 5382 | Vector3 p1 = p0; |
@@ -5345,11 +5384,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
5345 | 5384 | ||
5346 | p1.X += 1.0f; | 5385 | p1.X += 1.0f; |
5347 | if (p1.X < Heightmap.Width) | 5386 | if (p1.X < Heightmap.Width) |
5348 | p1.Z = (float)Heightmap[(int)p1.X, (int)p1.Y]; | 5387 | p1.Z = (float)Heightmap[(int)p1.X, (int)p1.Y]; |
5349 | 5388 | ||
5350 | p2.Y += 1.0f; | 5389 | p2.Y += 1.0f; |
5351 | if (p2.Y < Heightmap.Height) | 5390 | if (p2.Y < Heightmap.Height) |
5352 | p2.Z = (float)Heightmap[(int)p2.X, (int)p2.Y]; | 5391 | p2.Z = (float)Heightmap[(int)p2.X, (int)p2.Y]; |
5353 | 5392 | ||
5354 | Vector3 v0 = new Vector3(p1.X - p0.X, p1.Y - p0.Y, p1.Z - p0.Z); | 5393 | Vector3 v0 = new Vector3(p1.X - p0.X, p1.Y - p0.Y, p1.Z - p0.Z); |
5355 | Vector3 v1 = new Vector3(p2.X - p0.X, p2.Y - p0.Y, p2.Z - p0.Z); | 5394 | Vector3 v1 = new Vector3(p2.X - p0.X, p2.Y - p0.Y, p2.Z - p0.Z); |
@@ -5369,14 +5408,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
5369 | return (((vsn.X * xdiff) + (vsn.Y * ydiff)) / (-1 * vsn.Z)) + p0.Z; | 5408 | return (((vsn.X * xdiff) + (vsn.Y * ydiff)) / (-1 * vsn.Z)) + p0.Z; |
5370 | } | 5409 | } |
5371 | 5410 | ||
5372 | // private void CheckHeartbeat() | 5411 | // private void CheckHeartbeat() |
5373 | // { | 5412 | // { |
5374 | // if (m_firstHeartbeat) | 5413 | // if (m_firstHeartbeat) |
5375 | // return; | 5414 | // return; |
5376 | // | 5415 | // |
5377 | // if (Util.EnvironmentTickCountSubtract(m_lastFrameTick) > 2000) | 5416 | // if (Util.EnvironmentTickCountSubtract(m_lastFrameTick) > 2000) |
5378 | // StartTimer(); | 5417 | // StartTimer(); |
5379 | // } | 5418 | // } |
5380 | 5419 | ||
5381 | public override ISceneObject DeserializeObject(string representation) | 5420 | public override ISceneObject DeserializeObject(string representation) |
5382 | { | 5421 | { |
@@ -5419,7 +5458,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
5419 | } | 5458 | } |
5420 | 5459 | ||
5421 | ILandObject dest = LandChannel.GetLandObject(avatar.lastKnownAllowedPosition.X, avatar.lastKnownAllowedPosition.Y); | 5460 | ILandObject dest = LandChannel.GetLandObject(avatar.lastKnownAllowedPosition.X, avatar.lastKnownAllowedPosition.Y); |
5422 | if (dest != excludeParcel) | 5461 | if (dest != excludeParcel) |
5423 | { | 5462 | { |
5424 | // Ultimate backup if we have no idea where they are and | 5463 | // Ultimate backup if we have no idea where they are and |
5425 | // the last allowed position was in another parcel | 5464 | // the last allowed position was in another parcel |
@@ -5529,9 +5568,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
5529 | private Vector3 GetNearestRegionEdgePosition(ScenePresence avatar) | 5568 | private Vector3 GetNearestRegionEdgePosition(ScenePresence avatar) |
5530 | { | 5569 | { |
5531 | float xdistance = avatar.AbsolutePosition.X < RegionInfo.RegionSizeX / 2 | 5570 | float xdistance = avatar.AbsolutePosition.X < RegionInfo.RegionSizeX / 2 |
5532 | ? avatar.AbsolutePosition.X : RegionInfo.RegionSizeX - avatar.AbsolutePosition.X; | 5571 | ? avatar.AbsolutePosition.X : RegionInfo.RegionSizeX - avatar.AbsolutePosition.X; |
5533 | float ydistance = avatar.AbsolutePosition.Y < RegionInfo.RegionSizeY / 2 | 5572 | float ydistance = avatar.AbsolutePosition.Y < RegionInfo.RegionSizeY / 2 |
5534 | ? avatar.AbsolutePosition.Y : RegionInfo.RegionSizeY - avatar.AbsolutePosition.Y; | 5573 | ? avatar.AbsolutePosition.Y : RegionInfo.RegionSizeY - avatar.AbsolutePosition.Y; |
5535 | 5574 | ||
5536 | //find out what vertical edge to go to | 5575 | //find out what vertical edge to go to |
5537 | if (xdistance < ydistance) | 5576 | if (xdistance < ydistance) |
@@ -5578,7 +5617,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
5578 | { | 5617 | { |
5579 | IEstateDataService estateDataService = EstateDataService; | 5618 | IEstateDataService estateDataService = EstateDataService; |
5580 | if (estateDataService == null) | 5619 | if (estateDataService == null) |
5581 | return new List<UUID>(0); | 5620 | return new List<UUID>(0); |
5582 | 5621 | ||
5583 | return estateDataService.GetRegions(estateID); | 5622 | return estateDataService.GetRegions(estateID); |
5584 | } | 5623 | } |
@@ -5601,8 +5640,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
5601 | private void HandleReloadEstate(string module, string[] cmd) | 5640 | private void HandleReloadEstate(string module, string[] cmd) |
5602 | { | 5641 | { |
5603 | if (MainConsole.Instance.ConsoleScene == null || | 5642 | if (MainConsole.Instance.ConsoleScene == null || |
5604 | (MainConsole.Instance.ConsoleScene is Scene && | 5643 | (MainConsole.Instance.ConsoleScene is Scene && |
5605 | (Scene)MainConsole.Instance.ConsoleScene == this)) | 5644 | (Scene)MainConsole.Instance.ConsoleScene == this)) |
5606 | { | 5645 | { |
5607 | ReloadEstateData(); | 5646 | ReloadEstateData(); |
5608 | } | 5647 | } |
@@ -5620,8 +5659,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
5620 | /// <param name="maxZ"></param> | 5659 | /// <param name="maxZ"></param> |
5621 | /// <returns></returns> | 5660 | /// <returns></returns> |
5622 | public static Vector3[] GetCombinedBoundingBox( | 5661 | public static Vector3[] GetCombinedBoundingBox( |
5623 | List<SceneObjectGroup> objects, | 5662 | List<SceneObjectGroup> objects, |
5624 | out float minX, out float maxX, out float minY, out float maxY, out float minZ, out float maxZ) | 5663 | out float minX, out float maxX, out float minY, out float maxY, out float minZ, out float maxZ) |
5625 | { | 5664 | { |
5626 | minX = float.MaxValue; | 5665 | minX = float.MaxValue; |
5627 | maxX = float.MinValue; | 5666 | maxX = float.MinValue; |
@@ -5639,10 +5678,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
5639 | Vector3 vec = g.AbsolutePosition; | 5678 | Vector3 vec = g.AbsolutePosition; |
5640 | 5679 | ||
5641 | g.GetAxisAlignedBoundingBoxRaw(out ominX, out omaxX, out ominY, out omaxY, out ominZ, out omaxZ); | 5680 | g.GetAxisAlignedBoundingBoxRaw(out ominX, out omaxX, out ominY, out omaxY, out ominZ, out omaxZ); |
5642 | 5681 | ||
5643 | // m_log.DebugFormat( | 5682 | // m_log.DebugFormat( |
5644 | // "[SCENE]: For {0} found AxisAlignedBoundingBoxRaw {1}, {2}", | 5683 | // "[SCENE]: For {0} found AxisAlignedBoundingBoxRaw {1}, {2}", |
5645 | // g.Name, new Vector3(ominX, ominY, ominZ), new Vector3(omaxX, omaxY, omaxZ)); | 5684 | // g.Name, new Vector3(ominX, ominY, ominZ), new Vector3(omaxX, omaxY, omaxZ)); |
5646 | 5685 | ||
5647 | ominX += vec.X; | 5686 | ominX += vec.X; |
5648 | omaxX += vec.X; | 5687 | omaxX += vec.X; |
@@ -5652,17 +5691,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
5652 | omaxZ += vec.Z; | 5691 | omaxZ += vec.Z; |
5653 | 5692 | ||
5654 | if (minX > ominX) | 5693 | if (minX > ominX) |
5655 | minX = ominX; | 5694 | minX = ominX; |
5656 | if (minY > ominY) | 5695 | if (minY > ominY) |
5657 | minY = ominY; | 5696 | minY = ominY; |
5658 | if (minZ > ominZ) | 5697 | if (minZ > ominZ) |
5659 | minZ = ominZ; | 5698 | minZ = ominZ; |
5660 | if (maxX < omaxX) | 5699 | if (maxX < omaxX) |
5661 | maxX = omaxX; | 5700 | maxX = omaxX; |
5662 | if (maxY < omaxY) | 5701 | if (maxY < omaxY) |
5663 | maxY = omaxY; | 5702 | maxY = omaxY; |
5664 | if (maxZ < omaxZ) | 5703 | if (maxZ < omaxZ) |
5665 | maxZ = omaxZ; | 5704 | maxZ = omaxZ; |
5666 | } | 5705 | } |
5667 | 5706 | ||
5668 | foreach (SceneObjectGroup g in objects) | 5707 | foreach (SceneObjectGroup g in objects) |
@@ -5687,7 +5726,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
5687 | { | 5726 | { |
5688 | IWorldMapModule mapModule = RequestModuleInterface<IWorldMapModule>(); | 5727 | IWorldMapModule mapModule = RequestModuleInterface<IWorldMapModule>(); |
5689 | if (mapModule != null) | 5728 | if (mapModule != null) |
5690 | mapModule.GenerateMaptile(); | 5729 | mapModule.GenerateMaptile(); |
5691 | } | 5730 | } |
5692 | 5731 | ||
5693 | private void RegenerateMaptileAndReregister(object sender, ElapsedEventArgs e) | 5732 | private void RegenerateMaptileAndReregister(object sender, ElapsedEventArgs e) |
@@ -5698,7 +5737,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
5698 | // so that all simulators can retrieve it | 5737 | // so that all simulators can retrieve it |
5699 | string error = GridService.RegisterRegion(RegionInfo.ScopeID, new GridRegion(RegionInfo)); | 5738 | string error = GridService.RegisterRegion(RegionInfo.ScopeID, new GridRegion(RegionInfo)); |
5700 | if (error != string.Empty) | 5739 | if (error != string.Empty) |
5701 | throw new Exception(error); | 5740 | throw new Exception(error); |
5702 | } | 5741 | } |
5703 | 5742 | ||
5704 | /// <summary> | 5743 | /// <summary> |
@@ -5728,7 +5767,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
5728 | } | 5767 | } |
5729 | 5768 | ||
5730 | if (!AllowAvatarCrossing && !viaTeleport) | 5769 | if (!AllowAvatarCrossing && !viaTeleport) |
5731 | return false; | 5770 | return false; |
5732 | 5771 | ||
5733 | // FIXME: Root agent count is currently known to be inaccurate. This forces a recount before we check. | 5772 | // FIXME: Root agent count is currently known to be inaccurate. This forces a recount before we check. |
5734 | // However, the long term fix is to make sure root agent count is always accurate. | 5773 | // However, the long term fix is to make sure root agent count is always accurate. |
@@ -5743,8 +5782,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
5743 | reason = "The region is full"; | 5782 | reason = "The region is full"; |
5744 | 5783 | ||
5745 | m_log.DebugFormat( | 5784 | m_log.DebugFormat( |
5746 | "[SCENE]: Denying presence with id {0} entry into {1} since region is at agent limit of {2}", | 5785 | "[SCENE]: Denying presence with id {0} entry into {1} since region is at agent limit of {2}", |
5747 | agentID, RegionInfo.RegionName, RegionInfo.RegionSettings.AgentLimit); | 5786 | agentID, RegionInfo.RegionName, RegionInfo.RegionSettings.AgentLimit); |
5748 | 5787 | ||
5749 | return false; | 5788 | return false; |
5750 | } | 5789 | } |
@@ -5758,7 +5797,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
5758 | { | 5797 | { |
5759 | client = presence.ControllingClient; | 5798 | client = presence.ControllingClient; |
5760 | if (client != null) | 5799 | if (client != null) |
5761 | aCircuit = client.RequestClientInfo(); | 5800 | aCircuit = client.RequestClientInfo(); |
5762 | } | 5801 | } |
5763 | 5802 | ||
5764 | // We may be called before there is a presence or a client. | 5803 | // We may be called before there is a presence or a client. |
@@ -5781,7 +5820,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
5781 | } | 5820 | } |
5782 | catch (Exception e) | 5821 | catch (Exception e) |
5783 | { | 5822 | { |
5784 | m_log.DebugFormat("[SCENE]: Exception authorizing agent: {0} "+ e.StackTrace, e.Message); | 5823 | m_log.DebugFormat("[SCENE]: Exception authorizing agent: {0} " + e.StackTrace, e.Message); |
5785 | reason = "Error authorizing agent: " + e.Message; | 5824 | reason = "Error authorizing agent: " + e.Message; |
5786 | return false; | 5825 | return false; |
5787 | } | 5826 | } |
@@ -5800,16 +5839,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
5800 | Vector3 spawnPoint = sp.GetLocation(telehub.AbsolutePosition, telehub.GroupRotation); | 5839 | Vector3 spawnPoint = sp.GetLocation(telehub.AbsolutePosition, telehub.GroupRotation); |
5801 | ILandObject land = LandChannel.GetLandObject(spawnPoint.X, spawnPoint.Y); | 5840 | ILandObject land = LandChannel.GetLandObject(spawnPoint.X, spawnPoint.Y); |
5802 | if (land == null) | 5841 | if (land == null) |
5803 | continue; | 5842 | continue; |
5804 | if (land.IsEitherBannedOrRestricted(agentID)) | 5843 | if (land.IsEitherBannedOrRestricted(agentID)) |
5805 | continue; | 5844 | continue; |
5806 | banned = false; | 5845 | banned = false; |
5807 | break; | 5846 | break; |
5808 | } | 5847 | } |
5809 | 5848 | ||
5810 | if (banned) | 5849 | if (banned) |
5811 | { | 5850 | { |
5812 | if(Permissions.IsAdministrator(agentID) == false || Permissions.IsGridGod(agentID) == false) | 5851 | if (Permissions.IsAdministrator(agentID) == false || Permissions.IsGridGod(agentID) == false) |
5813 | { | 5852 | { |
5814 | reason = "No suitable landing point found"; | 5853 | reason = "No suitable landing point found"; |
5815 | return false; | 5854 | return false; |
@@ -5845,9 +5884,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
5845 | if (banned || restricted) | 5884 | if (banned || restricted) |
5846 | { | 5885 | { |
5847 | if (banned) | 5886 | if (banned) |
5848 | reason = "You are banned from the parcel"; | 5887 | reason = "You are banned from the parcel"; |
5849 | else | 5888 | else |
5850 | reason = "The parcel is restricted"; | 5889 | reason = "The parcel is restricted"; |
5851 | return false; | 5890 | return false; |
5852 | } | 5891 | } |
5853 | } | 5892 | } |
@@ -5869,15 +5908,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
5869 | if (presence.MovingToTarget) | 5908 | if (presence.MovingToTarget) |
5870 | { | 5909 | { |
5871 | double distanceToTarget = Util.GetDistanceTo(presence.AbsolutePosition, presence.MoveToPositionTarget); | 5910 | double distanceToTarget = Util.GetDistanceTo(presence.AbsolutePosition, presence.MoveToPositionTarget); |
5872 | // m_log.DebugFormat( | 5911 | // m_log.DebugFormat( |
5873 | // "[SCENE]: Abs pos of {0} is {1}, target {2}, distance {3}", | 5912 | // "[SCENE]: Abs pos of {0} is {1}, target {2}, distance {3}", |
5874 | // presence.Name, presence.AbsolutePosition, presence.MoveToPositionTarget, distanceToTarget); | 5913 | // presence.Name, presence.AbsolutePosition, presence.MoveToPositionTarget, distanceToTarget); |
5875 | 5914 | ||
5876 | // Check the error term of the current position in relation to the target position | 5915 | // Check the error term of the current position in relation to the target position |
5877 | if (distanceToTarget <= ScenePresence.SIGNIFICANT_MOVEMENT) | 5916 | if (distanceToTarget <= ScenePresence.SIGNIFICANT_MOVEMENT) |
5878 | { | 5917 | { |
5879 | // We are close enough to the target | 5918 | // We are close enough to the target |
5880 | // m_log.DebugFormat("[SCENEE]: Stopping autopilot of {0}", presence.Name); | 5919 | // m_log.DebugFormat("[SCENEE]: Stopping autopilot of {0}", presence.Name); |
5881 | 5920 | ||
5882 | presence.Velocity = Vector3.Zero; | 5921 | presence.Velocity = Vector3.Zero; |
5883 | presence.AbsolutePosition = presence.MoveToPositionTarget; | 5922 | presence.AbsolutePosition = presence.MoveToPositionTarget; |
@@ -5891,28 +5930,28 @@ namespace OpenSim.Region.Framework.Scenes | |||
5891 | // least be able to set collision status once, rather than 5 times to give it enough | 5930 | // least be able to set collision status once, rather than 5 times to give it enough |
5892 | // weighting so that that PhysicsActor thinks it really is colliding. | 5931 | // weighting so that that PhysicsActor thinks it really is colliding. |
5893 | for (int i = 0; i < 5; i++) | 5932 | for (int i = 0; i < 5; i++) |
5894 | presence.IsColliding = true; | 5933 | presence.IsColliding = true; |
5895 | 5934 | ||
5896 | if (presence.LandAtTarget) | 5935 | if (presence.LandAtTarget) |
5897 | presence.Flying = false; | 5936 | presence.Flying = false; |
5898 | 5937 | ||
5899 | // Vector3 targetPos = presence.MoveToPositionTarget; | 5938 | // Vector3 targetPos = presence.MoveToPositionTarget; |
5900 | // float terrainHeight = (float)presence.Scene.Heightmap[(int)targetPos.X, (int)targetPos.Y]; | 5939 | // float terrainHeight = (float)presence.Scene.Heightmap[(int)targetPos.X, (int)targetPos.Y]; |
5901 | // if (targetPos.Z - terrainHeight < 0.2) | 5940 | // if (targetPos.Z - terrainHeight < 0.2) |
5902 | // { | 5941 | // { |
5903 | // presence.Flying = false; | 5942 | // presence.Flying = false; |
5904 | // } | 5943 | // } |
5905 | } | 5944 | } |
5906 | 5945 | ||
5907 | // m_log.DebugFormat( | 5946 | // m_log.DebugFormat( |
5908 | // "[SCENE]: AgentControlFlags {0}, MovementFlag {1} for {2}", | 5947 | // "[SCENE]: AgentControlFlags {0}, MovementFlag {1} for {2}", |
5909 | // presence.AgentControlFlags, presence.MovementFlag, presence.Name); | 5948 | // presence.AgentControlFlags, presence.MovementFlag, presence.Name); |
5910 | } | 5949 | } |
5911 | else | 5950 | else |
5912 | { | 5951 | { |
5913 | // m_log.DebugFormat( | 5952 | // m_log.DebugFormat( |
5914 | // "[SCENE]: Updating npc {0} at {1} for next movement to {2}", | 5953 | // "[SCENE]: Updating npc {0} at {1} for next movement to {2}", |
5915 | // presence.Name, presence.AbsolutePosition, presence.MoveToPositionTarget); | 5954 | // presence.Name, presence.AbsolutePosition, presence.MoveToPositionTarget); |
5916 | 5955 | ||
5917 | Vector3 agent_control_v3 = new Vector3(); | 5956 | Vector3 agent_control_v3 = new Vector3(); |
5918 | presence.HandleMoveToTargetUpdate(1, ref agent_control_v3); | 5957 | presence.HandleMoveToTargetUpdate(1, ref agent_control_v3); |
@@ -5927,11 +5966,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
5927 | int spawnpoints = RegionInfo.RegionSettings.SpawnPoints().Count; | 5966 | int spawnpoints = RegionInfo.RegionSettings.SpawnPoints().Count; |
5928 | 5967 | ||
5929 | if (spawnpoints == 0) | 5968 | if (spawnpoints == 0) |
5930 | return 0; | 5969 | return 0; |
5931 | 5970 | ||
5932 | m_SpawnPoint++; | 5971 | m_SpawnPoint++; |
5933 | if (m_SpawnPoint > spawnpoints) | 5972 | if (m_SpawnPoint > spawnpoints) |
5934 | m_SpawnPoint = 1; | 5973 | m_SpawnPoint = 1; |
5935 | return m_SpawnPoint - 1; | 5974 | return m_SpawnPoint - 1; |
5936 | } | 5975 | } |
5937 | 5976 | ||
@@ -5961,12 +6000,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
5961 | public string GetExtraSetting(string name) | 6000 | public string GetExtraSetting(string name) |
5962 | { | 6001 | { |
5963 | if (m_extraSettings == null) | 6002 | if (m_extraSettings == null) |
5964 | return String.Empty; | 6003 | return String.Empty; |
5965 | 6004 | ||
5966 | string val; | 6005 | string val; |
5967 | 6006 | ||
5968 | if (!m_extraSettings.TryGetValue(name, out val)) | 6007 | if (!m_extraSettings.TryGetValue(name, out val)) |
5969 | return String.Empty; | 6008 | return String.Empty; |
5970 | 6009 | ||
5971 | return val; | 6010 | return val; |
5972 | } | 6011 | } |
@@ -5974,14 +6013,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
5974 | public void StoreExtraSetting(string name, string val) | 6013 | public void StoreExtraSetting(string name, string val) |
5975 | { | 6014 | { |
5976 | if (m_extraSettings == null) | 6015 | if (m_extraSettings == null) |
5977 | return; | 6016 | return; |
5978 | 6017 | ||
5979 | string oldVal; | 6018 | string oldVal; |
5980 | 6019 | ||
5981 | if (m_extraSettings.TryGetValue(name, out oldVal)) | 6020 | if (m_extraSettings.TryGetValue(name, out oldVal)) |
5982 | { | 6021 | { |
5983 | if (oldVal == val) | 6022 | if (oldVal == val) |
5984 | return; | 6023 | return; |
5985 | } | 6024 | } |
5986 | 6025 | ||
5987 | m_extraSettings[name] = val; | 6026 | m_extraSettings[name] = val; |
@@ -5994,10 +6033,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
5994 | public void RemoveExtraSetting(string name) | 6033 | public void RemoveExtraSetting(string name) |
5995 | { | 6034 | { |
5996 | if (m_extraSettings == null) | 6035 | if (m_extraSettings == null) |
5997 | return; | 6036 | return; |
5998 | 6037 | ||
5999 | if (!m_extraSettings.ContainsKey(name)) | 6038 | if (!m_extraSettings.ContainsKey(name)) |
6000 | return; | 6039 | return; |
6001 | 6040 | ||
6002 | m_extraSettings.Remove(name); | 6041 | m_extraSettings.Remove(name); |
6003 | 6042 | ||
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index 51f50d9..c2e9b61 100644..100755 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs | |||
@@ -67,7 +67,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
67 | protected Scene m_parentScene; | 67 | protected Scene m_parentScene; |
68 | protected Dictionary<UUID, SceneObjectGroup> m_updateList = new Dictionary<UUID, SceneObjectGroup>(); | 68 | protected Dictionary<UUID, SceneObjectGroup> m_updateList = new Dictionary<UUID, SceneObjectGroup>(); |
69 | protected int m_numRootAgents = 0; | 69 | protected int m_numRootAgents = 0; |
70 | protected int m_numTotalPrim = 0; | ||
70 | protected int m_numPrim = 0; | 71 | protected int m_numPrim = 0; |
72 | protected int m_numMesh = 0; | ||
71 | protected int m_numChildAgents = 0; | 73 | protected int m_numChildAgents = 0; |
72 | protected int m_physicalPrim = 0; | 74 | protected int m_physicalPrim = 0; |
73 | 75 | ||
@@ -368,7 +370,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
368 | 370 | ||
369 | SceneObjectPart[] parts = sceneObject.Parts; | 371 | SceneObjectPart[] parts = sceneObject.Parts; |
370 | 372 | ||
371 | // Clamp child prim sizes and add child prims to the m_numPrim count | 373 | // Clamp the sizes (scales) of the child prims and add the child prims to the count of all primitives |
374 | // (meshes and geometric primitives) in the scene; add child prims to m_numTotalPrim count | ||
372 | if (m_parentScene.m_clampPrimSize) | 375 | if (m_parentScene.m_clampPrimSize) |
373 | { | 376 | { |
374 | foreach (SceneObjectPart part in parts) | 377 | foreach (SceneObjectPart part in parts) |
@@ -382,7 +385,19 @@ namespace OpenSim.Region.Framework.Scenes | |||
382 | part.Shape.Scale = scale; | 385 | part.Shape.Scale = scale; |
383 | } | 386 | } |
384 | } | 387 | } |
385 | m_numPrim += parts.Length; | 388 | m_numTotalPrim += parts.Length; |
389 | |||
390 | // Go through all parts (geometric primitives and meshes) of this Scene Object | ||
391 | foreach (SceneObjectPart part in parts) | ||
392 | { | ||
393 | // Keep track of the total number of meshes or geometric primitives now in the scene; | ||
394 | // determine which object this is based on its primitive type: sculpted (sculpt) prim refers to | ||
395 | // a mesh and all other prims (i.e. box, sphere, etc) are geometric primitives | ||
396 | if (part.GetPrimType() == PrimType.SCULPT) | ||
397 | m_numMesh++; | ||
398 | else | ||
399 | m_numPrim++; | ||
400 | } | ||
386 | 401 | ||
387 | sceneObject.AttachToScene(m_parentScene); | 402 | sceneObject.AttachToScene(m_parentScene); |
388 | 403 | ||
@@ -437,7 +452,21 @@ namespace OpenSim.Region.Framework.Scenes | |||
437 | 452 | ||
438 | if (!resultOfObjectLinked) | 453 | if (!resultOfObjectLinked) |
439 | { | 454 | { |
440 | m_numPrim -= grp.PrimCount; | 455 | // Decrement the total number of primitives (meshes and geometric primitives) |
456 | // that are part of the Scene Object being removed | ||
457 | m_numTotalPrim -= grp.PrimCount; | ||
458 | |||
459 | // Go through all parts (primitives and meshes) of this Scene Object | ||
460 | foreach (SceneObjectPart part in grp.Parts) | ||
461 | { | ||
462 | // Keep track of the total number of meshes or geometric primitives left in the scene; | ||
463 | // determine which object this is based on its primitive type: sculpted (sculpt) prim refers to | ||
464 | // a mesh and all other prims (i.e. box, sphere, etc) are geometric primitives | ||
465 | if (part.GetPrimType() == PrimType.SCULPT) | ||
466 | m_numMesh--; | ||
467 | else | ||
468 | m_numPrim--; | ||
469 | } | ||
441 | 470 | ||
442 | if ((grp.RootPart.Flags & PrimFlags.Physics) == PrimFlags.Physics) | 471 | if ((grp.RootPart.Flags & PrimFlags.Physics) == PrimFlags.Physics) |
443 | RemovePhysicalPrim(grp.PrimCount); | 472 | RemovePhysicalPrim(grp.PrimCount); |
@@ -687,9 +716,19 @@ namespace OpenSim.Region.Framework.Scenes | |||
687 | 716 | ||
688 | public int GetTotalObjectsCount() | 717 | public int GetTotalObjectsCount() |
689 | { | 718 | { |
719 | return m_numTotalPrim; | ||
720 | } | ||
721 | |||
722 | public int GetTotalPrimObjectsCount() | ||
723 | { | ||
690 | return m_numPrim; | 724 | return m_numPrim; |
691 | } | 725 | } |
692 | 726 | ||
727 | public int GetTotalMeshObjectsCount() | ||
728 | { | ||
729 | return m_numMesh; | ||
730 | } | ||
731 | |||
693 | public int GetActiveObjectsCount() | 732 | public int GetActiveObjectsCount() |
694 | { | 733 | { |
695 | return m_physicalPrim; | 734 | return m_physicalPrim; |
@@ -1970,7 +2009,19 @@ namespace OpenSim.Region.Framework.Scenes | |||
1970 | // think it's selected, so it will never send a deselect... | 2009 | // think it's selected, so it will never send a deselect... |
1971 | copy.IsSelected = false; | 2010 | copy.IsSelected = false; |
1972 | 2011 | ||
1973 | m_numPrim += copy.Parts.Length; | 2012 | m_numTotalPrim += copy.Parts.Length; |
2013 | |||
2014 | // Go through all parts (primitives and meshes) of this Scene Object | ||
2015 | foreach (SceneObjectPart part in copy.Parts) | ||
2016 | { | ||
2017 | // Keep track of the total number of meshes or geometric primitives now in the scene; | ||
2018 | // determine which object this is based on its primitive type: sculpted (sculpt) prim refers to | ||
2019 | // a mesh and all other prims (i.e. box, sphere, etc) are geometric primitives | ||
2020 | if (part.GetPrimType() == PrimType.SCULPT) | ||
2021 | m_numMesh++; | ||
2022 | else | ||
2023 | m_numPrim++; | ||
2024 | } | ||
1974 | 2025 | ||
1975 | if (rot != Quaternion.Identity) | 2026 | if (rot != Quaternion.Identity) |
1976 | { | 2027 | { |
diff --git a/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs b/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs index 6182bcd..8918c3b 100755 --- a/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs +++ b/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs | |||
@@ -61,6 +61,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
61 | 61 | ||
62 | private YourStatsAreWrong handlerStatsIncorrect; | 62 | private YourStatsAreWrong handlerStatsIncorrect; |
63 | 63 | ||
64 | // Determines the size of the array that is used to collect StatBlocks | ||
65 | // for sending to the SimStats and SimExtraStatsCollector | ||
66 | private const int m_statisticArraySize = 27; | ||
67 | |||
64 | /// <summary> | 68 | /// <summary> |
65 | /// These are the IDs of stats sent in the StatsPacket to the viewer. | 69 | /// These are the IDs of stats sent in the StatsPacket to the viewer. |
66 | /// </summary> | 70 | /// </summary> |
@@ -104,7 +108,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
104 | ScriptEps = 31, | 108 | ScriptEps = 31, |
105 | SimSpareMs = 32, | 109 | SimSpareMs = 32, |
106 | SimSleepMs = 33, | 110 | SimSleepMs = 33, |
107 | SimIoPumpTime = 34 | 111 | SimIoPumpTime = 34, |
112 | FrameDilation = 35, | ||
113 | UsersLoggingIn = 36, | ||
114 | TotalGeoPrim = 37, | ||
115 | TotalMesh = 38, | ||
116 | ThreadCount = 39 | ||
108 | } | 117 | } |
109 | 118 | ||
110 | /// <summary> | 119 | /// <summary> |
@@ -175,7 +184,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
175 | 184 | ||
176 | // saved last reported value so there is something available for llGetRegionFPS | 185 | // saved last reported value so there is something available for llGetRegionFPS |
177 | private float lastReportedSimFPS; | 186 | private float lastReportedSimFPS; |
178 | private float[] lastReportedSimStats = new float[22]; | 187 | private float[] lastReportedSimStats = new float[m_statisticArraySize]; |
179 | private float m_pfps; | 188 | private float m_pfps; |
180 | 189 | ||
181 | /// <summary> | 190 | /// <summary> |
@@ -202,6 +211,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
202 | private int m_rootAgents; | 211 | private int m_rootAgents; |
203 | private int m_childAgents; | 212 | private int m_childAgents; |
204 | private int m_numPrim; | 213 | private int m_numPrim; |
214 | private int m_numGeoPrim; | ||
215 | private int m_numMesh; | ||
205 | private int m_inPacketsPerSecond; | 216 | private int m_inPacketsPerSecond; |
206 | private int m_outPacketsPerSecond; | 217 | private int m_outPacketsPerSecond; |
207 | private int m_activePrim; | 218 | private int m_activePrim; |
@@ -214,26 +225,33 @@ namespace OpenSim.Region.Framework.Scenes | |||
214 | private int m_objectCapacity = 45000; | 225 | private int m_objectCapacity = 45000; |
215 | 226 | ||
216 | // This is the number of frames that will be stored and then averaged for | 227 | // This is the number of frames that will be stored and then averaged for |
217 | // the Total, Simulation, Physics, and Network Frame Time; It is set to | 228 | // the Total, Simulation, Physics, and Network Frame Time; It is set to |
218 | // 10 by default but can be changed by the OpenSim.ini configuration file | 229 | // 10 by default but can be changed by the OpenSim.ini configuration file |
219 | // NumberOfFrames parameter | 230 | // NumberOfFrames parameter |
220 | private int m_numberFramesStored = 10; | 231 | private int m_numberFramesStored = Scene.m_defaultNumberFramesStored; |
221 | 232 | ||
222 | // The arrays that will hold the time it took to run the past N frames, | 233 | // The arrays that will hold the time it took to run the past N frames, |
223 | // where N is the num_frames_to_average given by the configuration file | 234 | // where N is the num_frames_to_average given by the configuration file |
224 | private double[] m_totalFrameTimeMilliseconds; | 235 | private double[] m_totalFrameTimeMilliseconds; |
225 | private double[] m_simulationFrameTimeMilliseconds; | 236 | private double[] m_simulationFrameTimeMilliseconds; |
226 | private double[] m_physicsFrameTimeMilliseconds; | 237 | private double[] m_physicsFrameTimeMilliseconds; |
227 | private double[] m_networkFrameTimeMilliseconds; | 238 | private double[] m_networkFrameTimeMilliseconds; |
228 | 239 | ||
229 | // The location of the next time in milliseconds that will be | 240 | // The location of the next time in milliseconds that will be |
230 | // (over)written when the next frame completes | 241 | // (over)written when the next frame completes |
231 | private int m_nextLocation = 0; | 242 | private int m_nextLocation = 0; |
232 | 243 | ||
233 | // The correct number of frames that have completed since the last stats | 244 | // The correct number of frames that have completed since the last stats |
234 | // update for physics | 245 | // update for physics |
235 | private int m_numberPhysicsFrames; | 246 | private int m_numberPhysicsFrames; |
236 | 247 | ||
248 | // The current number of users attempting to login to the region | ||
249 | private int m_usersLoggingIn; | ||
250 | |||
251 | // The last reported value of threads from the SmartThreadPool inside of | ||
252 | // XEngine | ||
253 | private int m_inUseThreads; | ||
254 | |||
237 | private Scene m_scene; | 255 | private Scene m_scene; |
238 | 256 | ||
239 | private RegionInfo ReportingRegion; | 257 | private RegionInfo ReportingRegion; |
@@ -246,11 +264,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
246 | { | 264 | { |
247 | // Initialize the different frame time arrays to the correct sizes | 265 | // Initialize the different frame time arrays to the correct sizes |
248 | m_totalFrameTimeMilliseconds = new double[m_numberFramesStored]; | 266 | m_totalFrameTimeMilliseconds = new double[m_numberFramesStored]; |
249 | m_simulationFrameTimeMilliseconds = new | 267 | m_simulationFrameTimeMilliseconds = new double[m_numberFramesStored]; |
250 | double[m_numberFramesStored]; | ||
251 | m_physicsFrameTimeMilliseconds = new double[m_numberFramesStored]; | 268 | m_physicsFrameTimeMilliseconds = new double[m_numberFramesStored]; |
252 | m_networkFrameTimeMilliseconds = new double[m_numberFramesStored]; | 269 | m_networkFrameTimeMilliseconds = new double[m_numberFramesStored]; |
253 | 270 | ||
271 | // Initialize the current number of users logging into the region | ||
272 | m_usersLoggingIn = 0; | ||
273 | |||
254 | m_scene = scene; | 274 | m_scene = scene; |
255 | m_reportedFpsCorrectionFactor = scene.MinFrameSeconds * m_nominalReportedFps; | 275 | m_reportedFpsCorrectionFactor = scene.MinFrameSeconds * m_nominalReportedFps; |
256 | m_statsUpdateFactor = (float)(m_statsUpdatesEveryMS / 1000); | 276 | m_statsUpdateFactor = (float)(m_statsUpdatesEveryMS / 1000); |
@@ -284,13 +304,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
284 | StatsManager.RegisterStat(SlowFramesStat); | 304 | StatsManager.RegisterStat(SlowFramesStat); |
285 | } | 305 | } |
286 | 306 | ||
307 | |||
287 | public SimStatsReporter(Scene scene, int numberOfFrames) : this (scene) | 308 | public SimStatsReporter(Scene scene, int numberOfFrames) : this (scene) |
288 | { | 309 | { |
289 | // Store the number of frames from the OpenSim.ini configuration | 310 | // Store the number of frames from the OpenSim.ini configuration file |
290 | // file | 311 | m_numberFramesStored = numberOfFrames; |
291 | m_numberFramesStored = numberOfFrames; | ||
292 | } | 312 | } |
293 | 313 | ||
314 | |||
294 | public void Close() | 315 | public void Close() |
295 | { | 316 | { |
296 | m_report.Elapsed -= TriggerStatsHeartbeat; | 317 | m_report.Elapsed -= TriggerStatsHeartbeat; |
@@ -328,11 +349,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
328 | double simulationSumFrameTime; | 349 | double simulationSumFrameTime; |
329 | double physicsSumFrameTime; | 350 | double physicsSumFrameTime; |
330 | double networkSumFrameTime; | 351 | double networkSumFrameTime; |
331 | 352 | float frameDilation; | |
353 | int currentFrame; | ||
354 | |||
332 | if (!m_scene.Active) | 355 | if (!m_scene.Active) |
333 | return; | 356 | return; |
334 | 357 | ||
335 | SimStatsPacket.StatBlock[] sb = new SimStatsPacket.StatBlock[22]; | 358 | // Create arrays to hold the statistics for this current scene, |
359 | // these will be passed to the SimExtraStatsCollector, they are also | ||
360 | // sent to the SimStats class | ||
361 | SimStatsPacket.StatBlock[] sb = new | ||
362 | SimStatsPacket.StatBlock[m_statisticArraySize]; | ||
336 | SimStatsPacket.RegionBlock rb = new SimStatsPacket.RegionBlock(); | 363 | SimStatsPacket.RegionBlock rb = new SimStatsPacket.RegionBlock(); |
337 | 364 | ||
338 | // Know what's not thread safe in Mono... modifying timers. | 365 | // Know what's not thread safe in Mono... modifying timers. |
@@ -354,21 +381,21 @@ namespace OpenSim.Region.Framework.Scenes | |||
354 | 381 | ||
355 | #region various statistic googly moogly | 382 | #region various statistic googly moogly |
356 | 383 | ||
357 | // ORIGINAL code commented out until we have time to add our own | 384 | // ORIGINAL code commented out until we have time to add our own |
358 | // statistics to the statistics window, this will be done as a | 385 | // statistics to the statistics window, this will be done as a |
359 | // new section given the title of our current project | 386 | // new section given the title of our current project |
360 | // We're going to lie about the FPS because we've been lying since 2008. The actual FPS is currently | 387 | // We're going to lie about the FPS because we've been lying since 2008. The actual FPS is currently |
361 | // locked at a maximum of 11. Maybe at some point this can change so that we're not lying. | 388 | // locked at a maximum of 11. Maybe at some point this can change so that we're not lying. |
362 | //int reportedFPS = (int)(m_fps * m_reportedFpsCorrectionFactor); | 389 | //int reportedFPS = (int)(m_fps * m_reportedFpsCorrectionFactor); |
363 | int reportedFPS = m_fps; | 390 | int reportedFPS = m_fps; |
364 | 391 | ||
365 | // save the reported value so there is something available for llGetRegionFPS | 392 | // save the reported value so there is something available for llGetRegionFPS |
366 | lastReportedSimFPS = reportedFPS / m_statsUpdateFactor; | 393 | lastReportedSimFPS = reportedFPS / m_statsUpdateFactor; |
367 | 394 | ||
368 | // ORIGINAL code commented out until we have time to add our own | 395 | // ORIGINAL code commented out until we have time to add our own |
369 | // statistics to the statistics window | 396 | // statistics to the statistics window |
370 | //float physfps = ((m_pfps / 1000)); | 397 | //float physfps = ((m_pfps / 1000)); |
371 | float physfps = m_numberPhysicsFrames; | 398 | float physfps = m_numberPhysicsFrames; |
372 | 399 | ||
373 | //if (physfps > 600) | 400 | //if (physfps > 600) |
374 | //physfps = physfps - (physfps - 600); | 401 | //physfps = physfps - (physfps - 600); |
@@ -381,6 +408,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
381 | m_rootAgents = m_scene.SceneGraph.GetRootAgentCount(); | 408 | m_rootAgents = m_scene.SceneGraph.GetRootAgentCount(); |
382 | m_childAgents = m_scene.SceneGraph.GetChildAgentCount(); | 409 | m_childAgents = m_scene.SceneGraph.GetChildAgentCount(); |
383 | m_numPrim = m_scene.SceneGraph.GetTotalObjectsCount(); | 410 | m_numPrim = m_scene.SceneGraph.GetTotalObjectsCount(); |
411 | m_numGeoPrim = m_scene.SceneGraph.GetTotalPrimObjectsCount(); | ||
412 | m_numMesh = m_scene.SceneGraph.GetTotalMeshObjectsCount(); | ||
384 | m_activePrim = m_scene.SceneGraph.GetActiveObjectsCount(); | 413 | m_activePrim = m_scene.SceneGraph.GetActiveObjectsCount(); |
385 | m_activeScripts = m_scene.SceneGraph.GetActiveScriptsCount(); | 414 | m_activeScripts = m_scene.SceneGraph.GetActiveScriptsCount(); |
386 | 415 | ||
@@ -406,11 +435,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
406 | if (framesUpdated == 0) | 435 | if (framesUpdated == 0) |
407 | framesUpdated = 1; | 436 | framesUpdated = 1; |
408 | 437 | ||
409 | for (int i = 0; i < 22; i++) | 438 | for (int i = 0; i < m_statisticArraySize; i++) |
410 | { | 439 | { |
411 | sb[i] = new SimStatsPacket.StatBlock(); | 440 | sb[i] = new SimStatsPacket.StatBlock(); |
412 | } | 441 | } |
413 | 442 | ||
414 | // Resetting the sums of the frame times to prevent any errors | 443 | // Resetting the sums of the frame times to prevent any errors |
415 | // in calculating the moving average for frame time | 444 | // in calculating the moving average for frame time |
416 | totalSumFrameTime = 0; | 445 | totalSumFrameTime = 0; |
@@ -425,12 +454,25 @@ namespace OpenSim.Region.Framework.Scenes | |||
425 | // Sum up each frame time in order to calculate the moving | 454 | // Sum up each frame time in order to calculate the moving |
426 | // average of frame time | 455 | // average of frame time |
427 | totalSumFrameTime += m_totalFrameTimeMilliseconds[i]; | 456 | totalSumFrameTime += m_totalFrameTimeMilliseconds[i]; |
428 | simulationSumFrameTime += | 457 | simulationSumFrameTime += |
429 | m_simulationFrameTimeMilliseconds[i]; | 458 | m_simulationFrameTimeMilliseconds[i]; |
430 | physicsSumFrameTime += m_physicsFrameTimeMilliseconds[i]; | 459 | physicsSumFrameTime += m_physicsFrameTimeMilliseconds[i]; |
431 | networkSumFrameTime += m_networkFrameTimeMilliseconds[i]; | 460 | networkSumFrameTime += m_networkFrameTimeMilliseconds[i]; |
432 | } | 461 | } |
433 | 462 | ||
463 | // Get the index that represents the current frame based on the next one known; go back | ||
464 | // to the last index if next one is stated to restart at 0 | ||
465 | if (m_nextLocation == 0) | ||
466 | currentFrame = m_numberFramesStored - 1; | ||
467 | else | ||
468 | currentFrame = m_nextLocation - 1; | ||
469 | |||
470 | // Calculate the frame dilation; which is currently based on the ratio between the sum of the | ||
471 | // physics and simulation rate, and the set minimum time to run a scene's frame | ||
472 | frameDilation = (float)(m_simulationFrameTimeMilliseconds[currentFrame] + | ||
473 | m_physicsFrameTimeMilliseconds[currentFrame]) / m_scene.MinFrameTicks; | ||
474 | |||
475 | // ORIGINAL code commented out until we have time to add our own | ||
434 | sb[0].StatID = (uint) Stats.TimeDilation; | 476 | sb[0].StatID = (uint) Stats.TimeDilation; |
435 | sb[0].StatValue = (Single.IsNaN(m_timeDilation)) ? 0.1f : m_timeDilation ; //((((m_timeDilation + (0.10f * statsUpdateFactor)) /10) / statsUpdateFactor)); | 477 | sb[0].StatValue = (Single.IsNaN(m_timeDilation)) ? 0.1f : m_timeDilation ; //((((m_timeDilation + (0.10f * statsUpdateFactor)) /10) / statsUpdateFactor)); |
436 | 478 | ||
@@ -455,31 +497,28 @@ namespace OpenSim.Region.Framework.Scenes | |||
455 | sb[7].StatID = (uint) Stats.ActivePrim; | 497 | sb[7].StatID = (uint) Stats.ActivePrim; |
456 | sb[7].StatValue = m_activePrim; | 498 | sb[7].StatValue = m_activePrim; |
457 | 499 | ||
458 | // ORIGINAL code commented out until we have time to add our own | 500 | // ORIGINAL code commented out until we have time to add our own |
459 | // statistics to the statistics window | 501 | // statistics to the statistics window |
460 | sb[8].StatID = (uint)Stats.FrameMS; | 502 | sb[8].StatID = (uint)Stats.FrameMS; |
461 | //sb[8].StatValue = m_frameMS / framesUpdated; | 503 | //sb[8].StatValue = m_frameMS / framesUpdated; |
462 | sb[8].StatValue = (float) totalSumFrameTime / | 504 | sb[8].StatValue = (float) totalSumFrameTime / m_numberFramesStored; |
463 | m_numberFramesStored; | ||
464 | 505 | ||
465 | sb[9].StatID = (uint)Stats.NetMS; | 506 | sb[9].StatID = (uint)Stats.NetMS; |
466 | //sb[9].StatValue = m_netMS / framesUpdated; | 507 | //sb[9].StatValue = m_netMS / framesUpdated; |
467 | sb[9].StatValue = (float) networkSumFrameTime / | 508 | sb[9].StatValue = (float) networkSumFrameTime / m_numberFramesStored; |
468 | m_numberFramesStored; | ||
469 | 509 | ||
470 | sb[10].StatID = (uint)Stats.PhysicsMS; | 510 | sb[10].StatID = (uint)Stats.PhysicsMS; |
471 | //sb[10].StatValue = m_physicsMS / framesUpdated; | 511 | //sb[10].StatValue = m_physicsMS / framesUpdated; |
472 | sb[10].StatValue = (float) physicsSumFrameTime / | 512 | sb[10].StatValue = (float) physicsSumFrameTime / m_numberFramesStored; |
473 | m_numberFramesStored; | ||
474 | 513 | ||
475 | sb[11].StatID = (uint)Stats.ImageMS ; | 514 | sb[11].StatID = (uint)Stats.ImageMS ; |
476 | sb[11].StatValue = m_imageMS / framesUpdated; | 515 | sb[11].StatValue = m_imageMS / framesUpdated; |
477 | 516 | ||
478 | sb[12].StatID = (uint)Stats.OtherMS; | 517 | sb[12].StatID = (uint)Stats.OtherMS; |
479 | //sb[12].StatValue = m_otherMS / framesUpdated; | 518 | //sb[12].StatValue = m_otherMS / framesUpdated; |
480 | sb[12].StatValue = (float) simulationSumFrameTime / | 519 | sb[12].StatValue = (float) simulationSumFrameTime / |
481 | m_numberFramesStored; | 520 | m_numberFramesStored; |
482 | 521 | ||
483 | sb[13].StatID = (uint)Stats.InPacketsPerSecond; | 522 | sb[13].StatID = (uint)Stats.InPacketsPerSecond; |
484 | sb[13].StatValue = (m_inPacketsPerSecond / m_statsUpdateFactor); | 523 | sb[13].StatValue = (m_inPacketsPerSecond / m_statsUpdateFactor); |
485 | 524 | ||
@@ -507,7 +546,28 @@ namespace OpenSim.Region.Framework.Scenes | |||
507 | sb[21].StatID = (uint)Stats.SimSpareMs; | 546 | sb[21].StatID = (uint)Stats.SimSpareMs; |
508 | sb[21].StatValue = m_spareMS / framesUpdated; | 547 | sb[21].StatValue = m_spareMS / framesUpdated; |
509 | 548 | ||
510 | for (int i = 0; i < 22; i++) | 549 | // Current ratio between the sum of physics and sim rate, and the |
550 | // minimum time to run a scene's frame | ||
551 | sb[22].StatID = (uint)Stats.FrameDilation; | ||
552 | sb[22].StatValue = frameDilation; | ||
553 | |||
554 | // Current number of users currently attemptint to login to region | ||
555 | sb[23].StatID = (uint)Stats.UsersLoggingIn; | ||
556 | sb[23].StatValue = m_usersLoggingIn; | ||
557 | |||
558 | // Total number of geometric primitives in the scene | ||
559 | sb[24].StatID = (uint)Stats.TotalGeoPrim; | ||
560 | sb[24].StatValue = m_numGeoPrim; | ||
561 | |||
562 | // Total number of mesh objects in the scene | ||
563 | sb[25].StatID = (uint)Stats.TotalMesh; | ||
564 | sb[25].StatValue = m_numMesh; | ||
565 | |||
566 | // Current number of threads that XEngine is using | ||
567 | sb[26].StatID = (uint)Stats.ThreadCount; | ||
568 | sb[26].StatValue = m_inUseThreads; | ||
569 | |||
570 | for (int i = 0; i < m_statisticArraySize; i++) | ||
511 | { | 571 | { |
512 | lastReportedSimStats[i] = sb[i].StatValue; | 572 | lastReportedSimStats[i] = sb[i].StatValue; |
513 | } | 573 | } |
@@ -554,8 +614,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
554 | { | 614 | { |
555 | // Reset the number of frames that the physics library has | 615 | // Reset the number of frames that the physics library has |
556 | // processed since the last stats report | 616 | // processed since the last stats report |
557 | m_numberPhysicsFrames = 0; | 617 | m_numberPhysicsFrames = 0; |
558 | 618 | ||
559 | m_timeDilation = 0; | 619 | m_timeDilation = 0; |
560 | m_fps = 0; | 620 | m_fps = 0; |
561 | m_pfps = 0; | 621 | m_pfps = 0; |
@@ -686,32 +746,32 @@ namespace OpenSim.Region.Framework.Scenes | |||
686 | m_otherMS += ms; | 746 | m_otherMS += ms; |
687 | } | 747 | } |
688 | 748 | ||
689 | public void addPhysicsFrame(int frames) | 749 | public void addPhysicsFrame(int frames) |
690 | { | 750 | { |
691 | // Add the number of physics frames to the correct total physics | 751 | // Add the number of physics frames to the correct total physics |
692 | // frames | 752 | // frames |
693 | m_numberPhysicsFrames += frames; | 753 | m_numberPhysicsFrames += frames; |
694 | } | 754 | } |
695 | 755 | ||
696 | public void addFrameTimeMilliseconds(double total, double simulation, | 756 | public void addFrameTimeMilliseconds(double total, double simulation, |
697 | double physics, double network) | 757 | double physics, double network) |
698 | { | 758 | { |
699 | // Save the frame times from the current frame into the appropriate | 759 | // Save the frame times from the current frame into the appropriate |
700 | // arrays | 760 | // arrays |
701 | m_totalFrameTimeMilliseconds[m_nextLocation] = total; | 761 | m_totalFrameTimeMilliseconds[m_nextLocation] = total; |
702 | m_simulationFrameTimeMilliseconds[m_nextLocation] = simulation; | 762 | m_simulationFrameTimeMilliseconds[m_nextLocation] = simulation; |
703 | m_physicsFrameTimeMilliseconds[m_nextLocation] = physics; | 763 | m_physicsFrameTimeMilliseconds[m_nextLocation] = physics; |
704 | m_networkFrameTimeMilliseconds[m_nextLocation] = network; | 764 | m_networkFrameTimeMilliseconds[m_nextLocation] = network; |
705 | 765 | ||
706 | // Update to the next location in the list | 766 | // Update to the next location in the list |
707 | m_nextLocation++; | 767 | m_nextLocation++; |
768 | |||
769 | // Since the list will begin to overwrite the oldest frame values | ||
770 | // first, the next location needs to loop back to the beginning of the | ||
771 | // list whenever it reaches the end | ||
772 | m_nextLocation = m_nextLocation % m_numberFramesStored; | ||
773 | } | ||
708 | 774 | ||
709 | // Since the list will begin to overwrite the oldest frame values | ||
710 | // first, the next location needs to loop back to the beginning of the | ||
711 | // list whenever it reaches the end | ||
712 | m_nextLocation = m_nextLocation % m_numberFramesStored; | ||
713 | } | ||
714 | |||
715 | public void AddPendingDownloads(int count) | 775 | public void AddPendingDownloads(int count) |
716 | { | 776 | { |
717 | m_pendingDownloads += count; | 777 | m_pendingDownloads += count; |
@@ -734,6 +794,31 @@ namespace OpenSim.Region.Framework.Scenes | |||
734 | AddunAckedBytes(unAckedBytes); | 794 | AddunAckedBytes(unAckedBytes); |
735 | } | 795 | } |
736 | 796 | ||
797 | public void UpdateUsersLoggingIn(bool isLoggingIn) | ||
798 | { | ||
799 | // Determine whether the user has started logging in or has completed | ||
800 | // logging into the region | ||
801 | if (isLoggingIn) | ||
802 | { | ||
803 | // The user is starting to login to the region so increment the | ||
804 | // number of users attempting to login to the region | ||
805 | m_usersLoggingIn++; | ||
806 | } | ||
807 | else | ||
808 | { | ||
809 | // The user has finished logging into the region so decrement the | ||
810 | // number of users logging into the region | ||
811 | m_usersLoggingIn--; | ||
812 | } | ||
813 | } | ||
814 | |||
815 | public void SetThreadCount(int inUseThreads) | ||
816 | { | ||
817 | // Save the new number of threads to our member variable to send to | ||
818 | // the extra stats collector | ||
819 | m_inUseThreads = inUseThreads; | ||
820 | } | ||
821 | |||
737 | #endregion | 822 | #endregion |
738 | 823 | ||
739 | public Dictionary<string, float> GetExtraSimStats() | 824 | public Dictionary<string, float> GetExtraSimStats() |
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs index 54620d1..4e383f8 100644..100755 --- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | |||
@@ -1872,6 +1872,12 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
1872 | IScriptInstance instance = GetInstance(itemID); | 1872 | IScriptInstance instance = GetInstance(itemID); |
1873 | if (instance != null) | 1873 | if (instance != null) |
1874 | instance.ApiResetScript(); | 1874 | instance.ApiResetScript(); |
1875 | |||
1876 | // Send the new number of threads that are in use by the thread | ||
1877 | // pool, I believe that by adding them to the locations where the | ||
1878 | // script is changing states that I will catch all changes to the | ||
1879 | // thread pool | ||
1880 | m_Scene.setThreadCount(m_ThreadPool.InUseThreads); | ||
1875 | } | 1881 | } |
1876 | 1882 | ||
1877 | public void ResetScript(UUID itemID) | 1883 | public void ResetScript(UUID itemID) |
@@ -1879,6 +1885,12 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
1879 | IScriptInstance instance = GetInstance(itemID); | 1885 | IScriptInstance instance = GetInstance(itemID); |
1880 | if (instance != null) | 1886 | if (instance != null) |
1881 | instance.ResetScript(m_WaitForEventCompletionOnScriptStop); | 1887 | instance.ResetScript(m_WaitForEventCompletionOnScriptStop); |
1888 | |||
1889 | // Send the new number of threads that are in use by the thread | ||
1890 | // pool, I believe that by adding them to the locations where the | ||
1891 | // script is changing states that I will catch all changes to the | ||
1892 | // thread pool | ||
1893 | m_Scene.setThreadCount(m_ThreadPool.InUseThreads); | ||
1882 | } | 1894 | } |
1883 | 1895 | ||
1884 | public void StartScript(UUID itemID) | 1896 | public void StartScript(UUID itemID) |
@@ -1888,6 +1900,12 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
1888 | instance.Start(); | 1900 | instance.Start(); |
1889 | else | 1901 | else |
1890 | m_runFlags.AddOrUpdate(itemID, true, 240); | 1902 | m_runFlags.AddOrUpdate(itemID, true, 240); |
1903 | |||
1904 | // Send the new number of threads that are in use by the thread | ||
1905 | // pool, I believe that by adding them to the locations where the | ||
1906 | // script is changing states that I will catch all changes to the | ||
1907 | // thread pool | ||
1908 | m_Scene.setThreadCount(m_ThreadPool.InUseThreads); | ||
1891 | } | 1909 | } |
1892 | 1910 | ||
1893 | public void StopScript(UUID itemID) | 1911 | public void StopScript(UUID itemID) |
@@ -1903,6 +1921,12 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
1903 | // m_log.DebugFormat("[XENGINE]: Could not find script with ID {0} to stop in {1}", itemID, World.Name); | 1921 | // m_log.DebugFormat("[XENGINE]: Could not find script with ID {0} to stop in {1}", itemID, World.Name); |
1904 | m_runFlags.AddOrUpdate(itemID, false, 240); | 1922 | m_runFlags.AddOrUpdate(itemID, false, 240); |
1905 | } | 1923 | } |
1924 | |||
1925 | // Send the new number of threads that are in use by the thread | ||
1926 | // pool, I believe that by adding them to the locations where the | ||
1927 | // script is changing states that I will catch all changes to the | ||
1928 | // thread pool | ||
1929 | m_Scene.setThreadCount(m_ThreadPool.InUseThreads); | ||
1906 | } | 1930 | } |
1907 | 1931 | ||
1908 | public DetectParams GetDetectParams(UUID itemID, int idx) | 1932 | public DetectParams GetDetectParams(UUID itemID, int idx) |
@@ -2393,6 +2417,12 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
2393 | instance.Suspend(); | 2417 | instance.Suspend(); |
2394 | // else | 2418 | // else |
2395 | // m_log.DebugFormat("[XEngine]: Could not find script with ID {0} to resume", itemID); | 2419 | // m_log.DebugFormat("[XEngine]: Could not find script with ID {0} to resume", itemID); |
2420 | |||
2421 | // Send the new number of threads that are in use by the thread | ||
2422 | // pool, I believe that by adding them to the locations where the | ||
2423 | // script is changing states that I will catch all changes to the | ||
2424 | // thread pool | ||
2425 | m_Scene.setThreadCount(m_ThreadPool.InUseThreads); | ||
2396 | } | 2426 | } |
2397 | 2427 | ||
2398 | public void ResumeScript(UUID itemID) | 2428 | public void ResumeScript(UUID itemID) |
@@ -2404,6 +2434,12 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
2404 | instance.Resume(); | 2434 | instance.Resume(); |
2405 | // else | 2435 | // else |
2406 | // m_log.DebugFormat("[XEngine]: Could not find script with ID {0} to resume", itemID); | 2436 | // m_log.DebugFormat("[XEngine]: Could not find script with ID {0} to resume", itemID); |
2437 | |||
2438 | // Send the new number of threads that are in use by the thread | ||
2439 | // pool, I believe that by adding them to the locations where the | ||
2440 | // script is changing states that I will catch all changes to the | ||
2441 | // thread pool | ||
2442 | m_Scene.setThreadCount(m_ThreadPool.InUseThreads); | ||
2407 | } | 2443 | } |
2408 | 2444 | ||
2409 | public bool HasScript(UUID itemID, out bool running) | 2445 | public bool HasScript(UUID itemID, out bool running) |
diff --git a/bin/ICSharpCode.SharpZipLib.dll b/bin/ICSharpCode.SharpZipLib.dll index 6c6a5d4..e565e3a 100644 --- a/bin/ICSharpCode.SharpZipLib.dll +++ b/bin/ICSharpCode.SharpZipLib.dll | |||
Binary files differ | |||
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 2c17022..489ee53 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 |