diff options
Diffstat (limited to 'OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs')
-rw-r--r-- | OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs | 100 |
1 files changed, 38 insertions, 62 deletions
diff --git a/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs b/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs index 8bb0fa9..10a3232 100644 --- a/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs +++ b/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs | |||
@@ -35,7 +35,6 @@ using System.Security.Cryptography.X509Certificates; | |||
35 | using System.Threading; | 35 | using System.Threading; |
36 | using System.Web; | 36 | using System.Web; |
37 | using log4net; | 37 | using log4net; |
38 | using Mono.Addins; | ||
39 | using Nini.Config; | 38 | using Nini.Config; |
40 | using OpenMetaverse; | 39 | using OpenMetaverse; |
41 | using OpenMetaverse.StructuredData; | 40 | using OpenMetaverse.StructuredData; |
@@ -76,9 +75,8 @@ namespace OpenSim.Region.CoreModules.InterGrid | |||
76 | public bool visible_to_parent; | 75 | public bool visible_to_parent; |
77 | public string teleported_into_region; | 76 | public string teleported_into_region; |
78 | } | 77 | } |
79 | 78 | ||
80 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] | 79 | public class OpenGridProtocolModule : IRegionModule |
81 | public class OpenGridProtocolModule : ISharedRegionModule | ||
82 | { | 80 | { |
83 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 81 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
84 | private List<Scene> m_scene = new List<Scene>(); | 82 | private List<Scene> m_scene = new List<Scene>(); |
@@ -94,22 +92,21 @@ namespace OpenSim.Region.CoreModules.InterGrid | |||
94 | private bool httpSSL = false; | 92 | private bool httpSSL = false; |
95 | private uint httpsslport = 0; | 93 | private uint httpsslport = 0; |
96 | private bool GridMode = false; | 94 | private bool GridMode = false; |
97 | private bool m_enabled = false; | ||
98 | private IConfig cfg = null; | ||
99 | private IConfig httpcfg = null; | ||
100 | private IConfig startupcfg = null; | ||
101 | |||
102 | #region ISharedRegionModule Members | ||
103 | 95 | ||
104 | public void Initialise(IConfigSource config) | 96 | #region IRegionModule Members |
97 | |||
98 | public void Initialise(Scene scene, IConfigSource config) | ||
105 | { | 99 | { |
100 | bool enabled = false; | ||
101 | IConfig cfg = null; | ||
102 | IConfig httpcfg = null; | ||
103 | IConfig startupcfg = null; | ||
106 | try | 104 | try |
107 | { | 105 | { |
108 | cfg = config.Configs["OpenGridProtocol"]; | 106 | cfg = config.Configs["OpenGridProtocol"]; |
109 | } | 107 | } catch (NullReferenceException) |
110 | catch (NullReferenceException) | ||
111 | { | 108 | { |
112 | m_enabled = false; | 109 | enabled = false; |
113 | } | 110 | } |
114 | 111 | ||
115 | try | 112 | try |
@@ -131,15 +128,15 @@ namespace OpenSim.Region.CoreModules.InterGrid | |||
131 | 128 | ||
132 | if (startupcfg != null) | 129 | if (startupcfg != null) |
133 | { | 130 | { |
134 | GridMode = m_enabled = startupcfg.GetBoolean("gridmode", false); | 131 | GridMode = enabled = startupcfg.GetBoolean("gridmode", false); |
135 | } | 132 | } |
136 | 133 | ||
137 | if (cfg != null) | 134 | if (cfg != null) |
138 | { | 135 | { |
139 | m_enabled = cfg.GetBoolean("ogp_enabled", false); | 136 | enabled = cfg.GetBoolean("ogp_enabled", false); |
140 | LastNameSuffix = cfg.GetString("ogp_lastname_suffix", "_EXTERNAL"); | 137 | LastNameSuffix = cfg.GetString("ogp_lastname_suffix", "_EXTERNAL"); |
141 | FirstNamePrefix = cfg.GetString("ogp_firstname_prefix", ""); | 138 | FirstNamePrefix = cfg.GetString("ogp_firstname_prefix", ""); |
142 | if (m_enabled) | 139 | if (enabled) |
143 | { | 140 | { |
144 | m_log.Warn("[OGP]: Open Grid Protocol is on, Listening for Clients on /agent/"); | 141 | m_log.Warn("[OGP]: Open Grid Protocol is on, Listening for Clients on /agent/"); |
145 | lock (m_scene) | 142 | lock (m_scene) |
@@ -168,61 +165,35 @@ namespace OpenSim.Region.CoreModules.InterGrid | |||
168 | } | 165 | } |
169 | 166 | ||
170 | } | 167 | } |
168 | // can't pick the region 'agent' because it would conflict with our agent domain handler | ||
169 | // a zero length region name would conflict with are base region seed cap | ||
170 | if (!SceneListDuplicateCheck(scene.RegionInfo.RegionName) && scene.RegionInfo.RegionName.ToLower() != "agent" && scene.RegionInfo.RegionName.Length > 0) | ||
171 | { | ||
172 | MainServer.Instance.AddLLSDHandler( | ||
173 | "/" + HttpUtility.UrlPathEncode(scene.RegionInfo.RegionName.ToLower()), | ||
174 | ProcessRegionDomainSeed); | ||
175 | } | ||
176 | |||
177 | if (!m_scene.Contains(scene)) | ||
178 | m_scene.Add(scene); | ||
171 | } | 179 | } |
172 | } | 180 | } |
173 | } | 181 | } |
174 | } | 182 | lock (m_scene) |
175 | |||
176 | public Type ReplaceableInterface | ||
177 | { | ||
178 | get { return null; } | ||
179 | } | ||
180 | |||
181 | public void AddRegion(Scene scene) | ||
182 | { | ||
183 | if (m_enabled) | ||
184 | { | 183 | { |
185 | lock (m_scene) | 184 | if (m_scene.Count == 1) |
186 | { | 185 | { |
187 | if (m_scene.Count == 1) | 186 | if (httpcfg != null) |
188 | { | 187 | { |
189 | if (httpcfg != null) | 188 | httpSSL = httpcfg.GetBoolean("http_listener_ssl", false); |
190 | { | 189 | httpsCN = httpcfg.GetString("http_listener_cn", scene.RegionInfo.ExternalHostName); |
191 | httpSSL = httpcfg.GetBoolean("http_listener_ssl", false); | 190 | if (httpsCN.Length == 0) |
192 | httpsCN = httpcfg.GetString("http_listener_cn", scene.RegionInfo.ExternalHostName); | 191 | httpsCN = scene.RegionInfo.ExternalHostName; |
193 | if (httpsCN.Length == 0) | 192 | httpsslport = (uint)httpcfg.GetInt("http_listener_sslport",((int)scene.RegionInfo.HttpPort + 1)); |
194 | httpsCN = scene.RegionInfo.ExternalHostName; | ||
195 | httpsslport = (uint)httpcfg.GetInt("http_listener_sslport", ((int)scene.RegionInfo.HttpPort + 1)); | ||
196 | } | ||
197 | } | 193 | } |
198 | } | 194 | } |
199 | // can't pick the region 'agent' because it would conflict with our agent domain handler | ||
200 | // a zero length region name would conflict with are base region seed cap | ||
201 | if (!SceneListDuplicateCheck(scene.RegionInfo.RegionName) && scene.RegionInfo.RegionName.ToLower() != "agent" && scene.RegionInfo.RegionName.Length > 0) | ||
202 | { | ||
203 | MainServer.Instance.AddLLSDHandler( | ||
204 | "/" + HttpUtility.UrlPathEncode(scene.RegionInfo.RegionName.ToLower()), | ||
205 | ProcessRegionDomainSeed); | ||
206 | } | ||
207 | |||
208 | if (!m_scene.Contains(scene)) | ||
209 | m_scene.Add(scene); | ||
210 | } | 195 | } |
211 | } | 196 | } |
212 | |||
213 | public void RegionLoaded(Scene scene) | ||
214 | { | ||
215 | } | ||
216 | |||
217 | public void RemoveRegion(Scene scene) | ||
218 | { | ||
219 | MainServer.Instance.RemoveLLSDHandler( | ||
220 | "/" + HttpUtility.UrlPathEncode(scene.RegionInfo.RegionName.ToLower()), | ||
221 | ProcessRegionDomainSeed); | ||
222 | |||
223 | if (m_scene.Contains(scene)) | ||
224 | m_scene.Remove(scene); | ||
225 | } | ||
226 | 197 | ||
227 | public void PostInitialise() | 198 | public void PostInitialise() |
228 | { | 199 | { |
@@ -238,6 +209,11 @@ namespace OpenSim.Region.CoreModules.InterGrid | |||
238 | get { return "OpenGridProtocolModule"; } | 209 | get { return "OpenGridProtocolModule"; } |
239 | } | 210 | } |
240 | 211 | ||
212 | public bool IsSharedModule | ||
213 | { | ||
214 | get { return true; } | ||
215 | } | ||
216 | |||
241 | #endregion | 217 | #endregion |
242 | 218 | ||
243 | public OSD ProcessRegionDomainSeed(string path, OSD request, string endpoint) | 219 | public OSD ProcessRegionDomainSeed(string path, OSD request, string endpoint) |