diff options
author | John Hurliman | 2010-05-21 13:55:36 -0700 |
---|---|---|
committer | John Hurliman | 2010-05-21 13:55:36 -0700 |
commit | 93ef65c69055157e0b7d51e544abe5a1035f40f0 (patch) | |
tree | 0afcfd50591e34f0a5d7efa474f300cf09083f69 /OpenSim/Region/Framework/Scenes/Scene.cs | |
parent | minor: remove LongRunning test designator from TestAddSceneObject() since it ... (diff) | |
download | opensim-SC_OLD-93ef65c69055157e0b7d51e544abe5a1035f40f0.zip opensim-SC_OLD-93ef65c69055157e0b7d51e544abe5a1035f40f0.tar.gz opensim-SC_OLD-93ef65c69055157e0b7d51e544abe5a1035f40f0.tar.bz2 opensim-SC_OLD-93ef65c69055157e0b7d51e544abe5a1035f40f0.tar.xz |
* Moving all of the prioritization/reprioritization code into a new file Prioritizer.cs
* Simplified the interest management code to make it easier to add new policies. Prioritization and reprioritization share code paths now
* Improved the distance and front back policies to always give your avatar the highest priority
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.cs | 96 |
1 files changed, 46 insertions, 50 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index de8ecc2..f35dffc 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -58,13 +58,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
58 | 58 | ||
59 | public partial class Scene : SceneBase | 59 | public partial class Scene : SceneBase |
60 | { | 60 | { |
61 | public enum UpdatePrioritizationSchemes { | ||
62 | Time = 0, | ||
63 | Distance = 1, | ||
64 | SimpleAngularDistance = 2, | ||
65 | FrontBack = 3, | ||
66 | } | ||
67 | |||
68 | public delegate void SynchronizeSceneHandler(Scene scene); | 61 | public delegate void SynchronizeSceneHandler(Scene scene); |
69 | public SynchronizeSceneHandler SynchronizeScene = null; | 62 | public SynchronizeSceneHandler SynchronizeScene = null; |
70 | 63 | ||
@@ -388,12 +381,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
388 | private int m_lastUpdate; | 381 | private int m_lastUpdate; |
389 | private bool m_firstHeartbeat = true; | 382 | private bool m_firstHeartbeat = true; |
390 | 383 | ||
391 | private UpdatePrioritizationSchemes m_update_prioritization_scheme = UpdatePrioritizationSchemes.Time; | ||
392 | private bool m_reprioritization_enabled = true; | ||
393 | private double m_reprioritization_interval = 5000.0; | ||
394 | private double m_root_reprioritization_distance = 10.0; | ||
395 | private double m_child_reprioritization_distance = 20.0; | ||
396 | |||
397 | private object m_deleting_scene_object = new object(); | 384 | private object m_deleting_scene_object = new object(); |
398 | 385 | ||
399 | // the minimum time that must elapse before a changed object will be considered for persisted | 386 | // the minimum time that must elapse before a changed object will be considered for persisted |
@@ -401,15 +388,21 @@ namespace OpenSim.Region.Framework.Scenes | |||
401 | // the maximum time that must elapse before a changed object will be considered for persisted | 388 | // the maximum time that must elapse before a changed object will be considered for persisted |
402 | public long m_persistAfter = DEFAULT_MAX_TIME_FOR_PERSISTENCE * 10000000L; | 389 | public long m_persistAfter = DEFAULT_MAX_TIME_FOR_PERSISTENCE * 10000000L; |
403 | 390 | ||
391 | private UpdatePrioritizationSchemes m_priorityScheme = UpdatePrioritizationSchemes.Time; | ||
392 | private bool m_reprioritizationEnabled = true; | ||
393 | private double m_reprioritizationInterval = 5000.0; | ||
394 | private double m_rootReprioritizationDistance = 10.0; | ||
395 | private double m_childReprioritizationDistance = 20.0; | ||
396 | |||
404 | #endregion | 397 | #endregion |
405 | 398 | ||
406 | #region Properties | 399 | #region Properties |
407 | 400 | ||
408 | public UpdatePrioritizationSchemes UpdatePrioritizationScheme { get { return this.m_update_prioritization_scheme; } } | 401 | public UpdatePrioritizationSchemes UpdatePrioritizationScheme { get { return m_priorityScheme; } } |
409 | public bool IsReprioritizationEnabled { get { return m_reprioritization_enabled; } } | 402 | public bool IsReprioritizationEnabled { get { return m_reprioritizationEnabled; } } |
410 | public double ReprioritizationInterval { get { return m_reprioritization_interval; } } | 403 | public double ReprioritizationInterval { get { return m_reprioritizationInterval; } } |
411 | public double RootReprioritizationDistance { get { return m_root_reprioritization_distance; } } | 404 | public double RootReprioritizationDistance { get { return m_rootReprioritizationDistance; } } |
412 | public double ChildReprioritizationDistance { get { return m_child_reprioritization_distance; } } | 405 | public double ChildReprioritizationDistance { get { return m_childReprioritizationDistance; } } |
413 | 406 | ||
414 | public AgentCircuitManager AuthenticateHandler | 407 | public AgentCircuitManager AuthenticateHandler |
415 | { | 408 | { |
@@ -611,6 +604,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
611 | m_asyncSceneObjectDeleter = new AsyncSceneObjectGroupDeleter(this); | 604 | m_asyncSceneObjectDeleter = new AsyncSceneObjectGroupDeleter(this); |
612 | m_asyncSceneObjectDeleter.Enabled = true; | 605 | m_asyncSceneObjectDeleter.Enabled = true; |
613 | 606 | ||
607 | #region Region Settings | ||
608 | |||
614 | // Load region settings | 609 | // Load region settings |
615 | m_regInfo.RegionSettings = m_storageManager.DataStore.LoadRegionSettings(m_regInfo.RegionID); | 610 | m_regInfo.RegionSettings = m_storageManager.DataStore.LoadRegionSettings(m_regInfo.RegionID); |
616 | if (m_storageManager.EstateDataStore != null) | 611 | if (m_storageManager.EstateDataStore != null) |
@@ -657,6 +652,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
657 | } | 652 | } |
658 | } | 653 | } |
659 | 654 | ||
655 | #endregion Region Settings | ||
656 | |||
660 | MainConsole.Instance.Commands.AddCommand("region", false, "reload estate", | 657 | MainConsole.Instance.Commands.AddCommand("region", false, "reload estate", |
661 | "reload estate", | 658 | "reload estate", |
662 | "Reload the estate data", HandleReloadEstate); | 659 | "Reload the estate data", HandleReloadEstate); |
@@ -701,6 +698,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
701 | 698 | ||
702 | m_simulatorVersion = simulatorVersion + " (" + Util.GetRuntimeInformation() + ")"; | 699 | m_simulatorVersion = simulatorVersion + " (" + Util.GetRuntimeInformation() + ")"; |
703 | 700 | ||
701 | #region Region Config | ||
702 | |||
704 | try | 703 | try |
705 | { | 704 | { |
706 | // Region config overrides global config | 705 | // Region config overrides global config |
@@ -754,38 +753,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
754 | 753 | ||
755 | m_strictAccessControl = startupConfig.GetBoolean("StrictAccessControl", m_strictAccessControl); | 754 | m_strictAccessControl = startupConfig.GetBoolean("StrictAccessControl", m_strictAccessControl); |
756 | 755 | ||
757 | IConfig interest_management_config = m_config.Configs["InterestManagement"]; | ||
758 | if (interest_management_config != null) | ||
759 | { | ||
760 | string update_prioritization_scheme = interest_management_config.GetString("UpdatePrioritizationScheme", "Time").Trim().ToLower(); | ||
761 | switch (update_prioritization_scheme) | ||
762 | { | ||
763 | case "time": | ||
764 | m_update_prioritization_scheme = UpdatePrioritizationSchemes.Time; | ||
765 | break; | ||
766 | case "distance": | ||
767 | m_update_prioritization_scheme = UpdatePrioritizationSchemes.Distance; | ||
768 | break; | ||
769 | case "simpleangulardistance": | ||
770 | m_update_prioritization_scheme = UpdatePrioritizationSchemes.SimpleAngularDistance; | ||
771 | break; | ||
772 | case "frontback": | ||
773 | m_update_prioritization_scheme = UpdatePrioritizationSchemes.FrontBack; | ||
774 | break; | ||
775 | default: | ||
776 | m_log.Warn("[SCENE]: UpdatePrioritizationScheme was not recognized, setting to default settomg of Time"); | ||
777 | m_update_prioritization_scheme = UpdatePrioritizationSchemes.Time; | ||
778 | break; | ||
779 | } | ||
780 | |||
781 | m_reprioritization_enabled = interest_management_config.GetBoolean("ReprioritizationEnabled", true); | ||
782 | m_reprioritization_interval = interest_management_config.GetDouble("ReprioritizationInterval", 5000.0); | ||
783 | m_root_reprioritization_distance = interest_management_config.GetDouble("RootReprioritizationDistance", 10.0); | ||
784 | m_child_reprioritization_distance = interest_management_config.GetDouble("ChildReprioritizationDistance", 20.0); | ||
785 | } | ||
786 | |||
787 | m_log.Info("[SCENE]: Using the " + m_update_prioritization_scheme + " prioritization scheme"); | ||
788 | |||
789 | #region BinaryStats | 756 | #region BinaryStats |
790 | 757 | ||
791 | try | 758 | try |
@@ -822,6 +789,35 @@ namespace OpenSim.Region.Framework.Scenes | |||
822 | { | 789 | { |
823 | m_log.Warn("[SCENE]: Failed to load StartupConfig"); | 790 | m_log.Warn("[SCENE]: Failed to load StartupConfig"); |
824 | } | 791 | } |
792 | |||
793 | #endregion Region Config | ||
794 | |||
795 | #region Interest Management | ||
796 | |||
797 | IConfig interestConfig = m_config.Configs["InterestManagement"]; | ||
798 | if (interestConfig != null) | ||
799 | { | ||
800 | string update_prioritization_scheme = interestConfig.GetString("UpdatePrioritizationScheme", "Time").Trim().ToLower(); | ||
801 | |||
802 | try | ||
803 | { | ||
804 | m_priorityScheme = (UpdatePrioritizationSchemes)Enum.Parse(typeof(UpdatePrioritizationSchemes), update_prioritization_scheme, true); | ||
805 | } | ||
806 | catch (Exception) | ||
807 | { | ||
808 | m_log.Warn("[PRIORITIZER]: UpdatePrioritizationScheme was not recognized, setting to default prioritizer Time"); | ||
809 | m_priorityScheme = UpdatePrioritizationSchemes.Time; | ||
810 | } | ||
811 | |||
812 | m_reprioritizationEnabled = interestConfig.GetBoolean("ReprioritizationEnabled", true); | ||
813 | m_reprioritizationInterval = interestConfig.GetDouble("ReprioritizationInterval", 5000.0); | ||
814 | m_rootReprioritizationDistance = interestConfig.GetDouble("RootReprioritizationDistance", 10.0); | ||
815 | m_childReprioritizationDistance = interestConfig.GetDouble("ChildReprioritizationDistance", 20.0); | ||
816 | } | ||
817 | |||
818 | m_log.Info("[SCENE]: Using the " + m_priorityScheme + " prioritization scheme"); | ||
819 | |||
820 | #endregion Interest Management | ||
825 | } | 821 | } |
826 | 822 | ||
827 | /// <summary> | 823 | /// <summary> |