From 8aae9094128069b83fbf11cb77503e29fd381b25 Mon Sep 17 00:00:00 2001 From: Teravus Ovares Date: Thu, 20 Dec 2007 06:31:03 +0000 Subject: [PATCH] * Added a configuration parameter on the Grid Server to disallow forceful banlists. * Added a way for Grid based configuration parameters to (generally used in overriding functionality) to get to the regions on Registration. --- .../Framework/Communications/IGridServices.cs | 3 ++- OpenSim/Framework/GridConfig.cs | 9 +++++++ OpenSim/Framework/IRegionCommsListener.cs | 1 + OpenSim/Framework/RegionCommsListener.cs | 5 ++++ OpenSim/Grid/GridServer/GridManager.cs | 2 ++ .../Local/LocalBackEndServices.cs | 22 +++++++++++++++ .../Communications/OGS1/OGS1GridServices.cs | 27 ++++++++++++++++++- OpenSim/Region/Environment/Scenes/Scene.cs | 25 +++++++++++++++-- .../Scenes/SceneCommunicationService.cs | 9 +++++++ 9 files changed, 99 insertions(+), 4 deletions(-) diff --git a/OpenSim/Framework/Communications/IGridServices.cs b/OpenSim/Framework/Communications/IGridServices.cs index 240d9c08fe..d51f234d21 100644 --- a/OpenSim/Framework/Communications/IGridServices.cs +++ b/OpenSim/Framework/Communications/IGridServices.cs @@ -25,7 +25,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ - +using System.Collections; using System.Collections.Generic; namespace OpenSim.Framework.Communications @@ -37,6 +37,7 @@ namespace OpenSim.Framework.Communications bool DeregisterRegion(RegionInfo regionInfo); List RequestNeighbours(uint x, uint y); RegionInfo RequestNeighbourInfo(ulong regionHandle); + Dictionary GetGridSettings(); List RequestNeighbourMapBlocks(int minX, int minY, int maxX, int maxY); } diff --git a/OpenSim/Framework/GridConfig.cs b/OpenSim/Framework/GridConfig.cs index 021e6c5521..799be46274 100644 --- a/OpenSim/Framework/GridConfig.cs +++ b/OpenSim/Framework/GridConfig.cs @@ -44,9 +44,12 @@ namespace OpenSim.Framework public string DatabaseProvider = ""; + public static uint DefaultHttpPort = 8001; public uint HttpPort = DefaultHttpPort; + public string AllowForcefulBanlines = "TRUE"; + private ConfigurationMember configMember; public GridConfig(string description, string filename) @@ -89,6 +92,9 @@ namespace OpenSim.Framework configMember.addConfigurationOption("http_port", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, "Http Listener port", DefaultHttpPort.ToString(), false); + + configMember.addConfigurationOption("allow_forceful_banlines", ConfigurationOption.ConfigurationTypes.TYPE_STRING, + "Allow Forceful Banlines", "TRUE", true); } public bool handleIncomingConfiguration(string configuration_key, object configuration_result) @@ -128,6 +134,9 @@ namespace OpenSim.Framework case "http_port": HttpPort = (uint) configuration_result; break; + case "allow_forceful_banlines": + AllowForcefulBanlines = (string)configuration_result; + break; } return true; diff --git a/OpenSim/Framework/IRegionCommsListener.cs b/OpenSim/Framework/IRegionCommsListener.cs index 7aaeffe601..363ab27c1e 100644 --- a/OpenSim/Framework/IRegionCommsListener.cs +++ b/OpenSim/Framework/IRegionCommsListener.cs @@ -50,6 +50,7 @@ namespace OpenSim.Framework public delegate bool ChildAgentUpdate(ulong regionHandle, ChildAgentDataUpdate cAgentData); + public interface IRegionCommsListener diff --git a/OpenSim/Framework/RegionCommsListener.cs b/OpenSim/Framework/RegionCommsListener.cs index e8752acc00..a14677805d 100644 --- a/OpenSim/Framework/RegionCommsListener.cs +++ b/OpenSim/Framework/RegionCommsListener.cs @@ -44,6 +44,8 @@ namespace OpenSim.Framework public event CloseAgentConnection OnCloseAgentConnection; public event RegionUp OnRegionUp; public event ChildAgentUpdate OnChildAgentUpdate; + + public string debugRegionName=""; @@ -62,6 +64,9 @@ namespace OpenSim.Framework return false; } + + + public virtual bool TriggerExpectPrim(ulong regionHandle, LLUUID primID, string objData) { if (OnExpectUser != null) diff --git a/OpenSim/Grid/GridServer/GridManager.cs b/OpenSim/Grid/GridServer/GridManager.cs index 09cbe7f68a..fad9f0d603 100644 --- a/OpenSim/Grid/GridServer/GridManager.cs +++ b/OpenSim/Grid/GridServer/GridManager.cs @@ -404,6 +404,8 @@ namespace OpenSim.Grid.GridServer // New! If set, use as URL to local sim storage (ie http://remotehost/region.yap) responseData["data_uri"] = TheSim.regionDataURI; + responseData["allow_forceful_banlines"] = config.AllowForcefulBanlines; + return response; } diff --git a/OpenSim/Region/Communications/Local/LocalBackEndServices.cs b/OpenSim/Region/Communications/Local/LocalBackEndServices.cs index f57de1c488..f6137f7de1 100644 --- a/OpenSim/Region/Communications/Local/LocalBackEndServices.cs +++ b/OpenSim/Region/Communications/Local/LocalBackEndServices.cs @@ -43,6 +43,8 @@ namespace OpenSim.Region.Communications.Local private Dictionary m_remoteRegionInfoCache = new Dictionary(); + private Dictionary m_queuedGridSettings = new Dictionary(); + public string _gdebugRegionName = ""; public string gdebugRegionName @@ -218,6 +220,26 @@ namespace OpenSim.Region.Communications.Local return false; } + // This function Is only here to keep this class in line with the Grid Interface. + // It never gets called. + public virtual Dictionary GetGridSettings() + { + Dictionary returnGridSettings = new Dictionary(); + lock (m_queuedGridSettings) + { + returnGridSettings = m_queuedGridSettings; + m_queuedGridSettings.Clear(); + } + + return returnGridSettings; + } + + public virtual void SetForcefulBanlistsDisallowed(ulong regionHandle) + { + m_queuedGridSettings.Add("allow_forceful_banlines", "FALSE"); + + } + public bool TriggerRegionUp(RegionInfo region, ulong regionhandle) { if (m_regionListeners.ContainsKey(regionhandle)) diff --git a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs index 060fe28c67..7adac58eb4 100644 --- a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs +++ b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs @@ -50,6 +50,7 @@ namespace OpenSim.Region.Communications.OGS1 private LocalBackEndServices m_localBackend = new LocalBackEndServices(); private Dictionary m_remoteRegionInfoCache = new Dictionary(); private List m_knownRegions = new List(); + private Dictionary m_queuedGridSettings = new Dictionary(); public BaseHttpServer httpListener; public NetworkServersInfo serversInfo; @@ -134,7 +135,15 @@ namespace OpenSim.Region.Communications.OGS1 else { m_knownRegions = RequestNeighbours(regionInfo.RegionLocX, regionInfo.RegionLocY); - + if (GridRespData.ContainsKey("allow_forceful_banlines")) + { + + if ((string)GridRespData["allow_forceful_banlines"] != "TRUE") + { + //m_localBackend.SetForcefulBanlistsDisallowed(regionInfo.RegionHandle); + m_queuedGridSettings.Add("allow_forceful_banlines", "FALSE"); + } + } } return m_localBackend.RegisterRegion(regionInfo); @@ -144,7 +153,23 @@ namespace OpenSim.Region.Communications.OGS1 { return false; } + public virtual Dictionary GetGridSettings() + { + Dictionary returnGridSettings = new Dictionary(); + lock (m_queuedGridSettings) + { + foreach (string Dictkey in m_queuedGridSettings.Keys) + { + returnGridSettings.Add(Dictkey, m_queuedGridSettings[Dictkey]); + } + + + m_queuedGridSettings.Clear(); + } + + return returnGridSettings; + } /// /// /// diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 01d6c5aa98..6d2d31fb80 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -818,6 +818,12 @@ namespace OpenSim.Region.Environment.Scenes // These two 'commands' *must be* next to each other or sim rebooting fails. m_sceneGridService.RegisterRegion(RegionInfo); m_sceneGridService.InformNeighborsThatRegionisUp(RegionInfo); + Dictionary dGridSettings = m_sceneGridService.GetGridSettings(); + if (dGridSettings.ContainsKey("allow_forceful_banlines")) + { + if (dGridSettings["allow_forceful_banlines"] != "TRUE") + MainLog.Instance.Verbose("GRID","Grid is disabling forceful parcel banlists"); + } } /// @@ -1295,6 +1301,7 @@ namespace OpenSim.Region.Environment.Scenes m_sceneGridService.OnCloseAgentConnection += CloseConnection; m_sceneGridService.OnRegionUp += OtherRegionUp; m_sceneGridService.OnChildAgentUpdate += IncomingChildAgentDataUpdate; + m_sceneGridService.KillObject = SendKillObject; } @@ -1303,15 +1310,29 @@ namespace OpenSim.Region.Environment.Scenes /// /// public void UnRegisterReginWithComms() - { + { + m_sceneGridService.OnChildAgentUpdate -= IncomingChildAgentDataUpdate; m_sceneGridService.OnRegionUp -= OtherRegionUp; m_sceneGridService.OnExpectUser -= NewUserConnection; m_sceneGridService.OnAvatarCrossingIntoRegion -= AgentCrossing; m_sceneGridService.OnCloseAgentConnection -= CloseConnection; - + m_sceneGridService.Close(); } + public void NewIncomingGridSetting(ulong regionHandle, string key, string gvalue) + { + if (key == "allow_forceful_banlines") + { + if (gvalue == "FALSE") + { + MainLog.Instance.Verbose("INTERGRID", "Grid is disallowing forcefull banlines"); + //Ming, Do stuff here + } + } + + + } /// /// diff --git a/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs index c72e344170..b184af26a3 100644 --- a/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs +++ b/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs @@ -52,6 +52,7 @@ namespace OpenSim.Region.Environment.Scenes public event PrimCrossing OnPrimCrossingIntoRegion; public event RegionUp OnRegionUp; public event ChildAgentUpdate OnChildAgentUpdate; + public KillObjectDelegate KillObject; public string _debugRegionName = ""; @@ -101,6 +102,7 @@ namespace OpenSim.Region.Environment.Scenes { if (regionCommsHost != null) { + regionCommsHost.OnChildAgentUpdate -= ChildAgentUpdate; regionCommsHost.OnRegionUp -= newRegionUp; regionCommsHost.OnExpectUser -= NewUserConnection; @@ -168,6 +170,7 @@ namespace OpenSim.Region.Environment.Scenes OnCloseAgentConnection(regionHandle, agentID); } } + #endregion #region Inform Client of Neighbours @@ -466,5 +469,11 @@ namespace OpenSim.Region.Environment.Scenes presence.RemoveNeighbourRegion(regionHandle); } } + + public Dictionary GetGridSettings() + { + return m_commsProvider.GridService.GetGridSettings(); + } + } }