diff options
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Framework/RegionInfo.cs | 410 | ||||
-rw-r--r-- | OpenSim/Framework/SerializableRegionInfo.cs | 202 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs | 37 |
3 files changed, 151 insertions, 498 deletions
diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs index 721233d..88b62e0 100644 --- a/OpenSim/Framework/RegionInfo.cs +++ b/OpenSim/Framework/RegionInfo.cs | |||
@@ -38,238 +38,7 @@ using OpenSim.Framework.Console; | |||
38 | 38 | ||
39 | namespace OpenSim.Framework | 39 | namespace OpenSim.Framework |
40 | { | 40 | { |
41 | [Serializable] | 41 | public class RegionInfo |
42 | public class SimpleRegionInfo | ||
43 | { | ||
44 | // private static readonly log4net.ILog m_log | ||
45 | // = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); | ||
46 | |||
47 | /// <summary> | ||
48 | /// The port by which http communication occurs with the region (most noticeably, CAPS communication) | ||
49 | /// </summary> | ||
50 | public uint HttpPort | ||
51 | { | ||
52 | get { return m_httpPort; } | ||
53 | set { m_httpPort = value; } | ||
54 | } | ||
55 | protected uint m_httpPort; | ||
56 | |||
57 | /// <summary> | ||
58 | /// A well-formed URI for the host region server (namely "http://" + ExternalHostName) | ||
59 | /// </summary> | ||
60 | public string ServerURI | ||
61 | { | ||
62 | get { return m_serverURI; } | ||
63 | set { m_serverURI = value; } | ||
64 | } | ||
65 | protected string m_serverURI; | ||
66 | |||
67 | public string RegionName | ||
68 | { | ||
69 | get { return m_regionName; } | ||
70 | set { m_regionName = value; } | ||
71 | } | ||
72 | protected string m_regionName = String.Empty; | ||
73 | |||
74 | protected bool Allow_Alternate_Ports; | ||
75 | public bool m_allow_alternate_ports; | ||
76 | protected string m_externalHostName; | ||
77 | |||
78 | protected IPEndPoint m_internalEndPoint; | ||
79 | protected uint? m_regionLocX; | ||
80 | protected uint? m_regionLocY; | ||
81 | protected uint m_remotingPort; | ||
82 | public UUID RegionID = UUID.Zero; | ||
83 | public string RemotingAddress; | ||
84 | public UUID ScopeID = UUID.Zero; | ||
85 | |||
86 | public SimpleRegionInfo() | ||
87 | { | ||
88 | } | ||
89 | |||
90 | public SimpleRegionInfo(uint regionLocX, uint regionLocY, IPEndPoint internalEndPoint, string externalUri) | ||
91 | { | ||
92 | m_regionLocX = regionLocX; | ||
93 | m_regionLocY = regionLocY; | ||
94 | |||
95 | m_internalEndPoint = internalEndPoint; | ||
96 | m_externalHostName = externalUri; | ||
97 | } | ||
98 | |||
99 | public SimpleRegionInfo(uint regionLocX, uint regionLocY, string externalUri, uint port) | ||
100 | { | ||
101 | m_regionLocX = regionLocX; | ||
102 | m_regionLocY = regionLocY; | ||
103 | |||
104 | m_externalHostName = externalUri; | ||
105 | |||
106 | m_internalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), (int) port); | ||
107 | } | ||
108 | |||
109 | public SimpleRegionInfo(RegionInfo ConvertFrom) | ||
110 | { | ||
111 | m_regionName = ConvertFrom.RegionName; | ||
112 | m_regionLocX = ConvertFrom.RegionLocX; | ||
113 | m_regionLocY = ConvertFrom.RegionLocY; | ||
114 | m_internalEndPoint = ConvertFrom.InternalEndPoint; | ||
115 | m_externalHostName = ConvertFrom.ExternalHostName; | ||
116 | m_remotingPort = ConvertFrom.RemotingPort; | ||
117 | m_httpPort = ConvertFrom.HttpPort; | ||
118 | m_allow_alternate_ports = ConvertFrom.m_allow_alternate_ports; | ||
119 | RemotingAddress = ConvertFrom.RemotingAddress; | ||
120 | RegionID = UUID.Zero; | ||
121 | ServerURI = ConvertFrom.ServerURI; | ||
122 | } | ||
123 | |||
124 | public uint RemotingPort | ||
125 | { | ||
126 | get { return m_remotingPort; } | ||
127 | set { m_remotingPort = value; } | ||
128 | } | ||
129 | |||
130 | /// <value> | ||
131 | /// This accessor can throw all the exceptions that Dns.GetHostAddresses can throw. | ||
132 | /// | ||
133 | /// XXX Isn't this really doing too much to be a simple getter, rather than an explict method? | ||
134 | /// </value> | ||
135 | public IPEndPoint ExternalEndPoint | ||
136 | { | ||
137 | get | ||
138 | { | ||
139 | // Old one defaults to IPv6 | ||
140 | //return new IPEndPoint(Dns.GetHostAddresses(m_externalHostName)[0], m_internalEndPoint.Port); | ||
141 | |||
142 | IPAddress ia = null; | ||
143 | // If it is already an IP, don't resolve it - just return directly | ||
144 | if (IPAddress.TryParse(m_externalHostName, out ia)) | ||
145 | return new IPEndPoint(ia, m_internalEndPoint.Port); | ||
146 | |||
147 | // Reset for next check | ||
148 | ia = null; | ||
149 | try | ||
150 | { | ||
151 | foreach (IPAddress Adr in Dns.GetHostAddresses(m_externalHostName)) | ||
152 | { | ||
153 | if (ia == null) | ||
154 | ia = Adr; | ||
155 | |||
156 | if (Adr.AddressFamily == AddressFamily.InterNetwork) | ||
157 | { | ||
158 | ia = Adr; | ||
159 | break; | ||
160 | } | ||
161 | } | ||
162 | } | ||
163 | catch (SocketException e) | ||
164 | { | ||
165 | throw new Exception( | ||
166 | "Unable to resolve local hostname " + m_externalHostName + " innerException of type '" + | ||
167 | e + "' attached to this exception", e); | ||
168 | } | ||
169 | |||
170 | return new IPEndPoint(ia, m_internalEndPoint.Port); | ||
171 | } | ||
172 | |||
173 | set { m_externalHostName = value.ToString(); } | ||
174 | } | ||
175 | |||
176 | public string ExternalHostName | ||
177 | { | ||
178 | get { return m_externalHostName; } | ||
179 | set { m_externalHostName = value; } | ||
180 | } | ||
181 | |||
182 | public IPEndPoint InternalEndPoint | ||
183 | { | ||
184 | get { return m_internalEndPoint; } | ||
185 | set { m_internalEndPoint = value; } | ||
186 | } | ||
187 | |||
188 | public uint RegionLocX | ||
189 | { | ||
190 | get { return m_regionLocX.Value; } | ||
191 | set { m_regionLocX = value; } | ||
192 | } | ||
193 | |||
194 | public uint RegionLocY | ||
195 | { | ||
196 | get { return m_regionLocY.Value; } | ||
197 | set { m_regionLocY = value; } | ||
198 | } | ||
199 | |||
200 | public ulong RegionHandle | ||
201 | { | ||
202 | get { return Util.UIntsToLong((RegionLocX * (uint) Constants.RegionSize), (RegionLocY * (uint) Constants.RegionSize)); } | ||
203 | } | ||
204 | |||
205 | public int getInternalEndPointPort() | ||
206 | { | ||
207 | return m_internalEndPoint.Port; | ||
208 | } | ||
209 | |||
210 | public Dictionary<string, object> ToKeyValuePairs() | ||
211 | { | ||
212 | Dictionary<string, object> kvp = new Dictionary<string, object>(); | ||
213 | kvp["uuid"] = RegionID.ToString(); | ||
214 | kvp["locX"] = RegionLocX.ToString(); | ||
215 | kvp["locY"] = RegionLocY.ToString(); | ||
216 | kvp["external_ip_address"] = ExternalEndPoint.Address.ToString(); | ||
217 | kvp["external_port"] = ExternalEndPoint.Port.ToString(); | ||
218 | kvp["external_host_name"] = ExternalHostName; | ||
219 | kvp["http_port"] = HttpPort.ToString(); | ||
220 | kvp["internal_ip_address"] = InternalEndPoint.Address.ToString(); | ||
221 | kvp["internal_port"] = InternalEndPoint.Port.ToString(); | ||
222 | kvp["alternate_ports"] = m_allow_alternate_ports.ToString(); | ||
223 | kvp["server_uri"] = ServerURI; | ||
224 | |||
225 | return kvp; | ||
226 | } | ||
227 | |||
228 | public SimpleRegionInfo(Dictionary<string, object> kvp) | ||
229 | { | ||
230 | if ((kvp["external_ip_address"] != null) && (kvp["external_port"] != null)) | ||
231 | { | ||
232 | int port = 0; | ||
233 | Int32.TryParse((string)kvp["external_port"], out port); | ||
234 | IPEndPoint ep = new IPEndPoint(IPAddress.Parse((string)kvp["external_ip_address"]), port); | ||
235 | ExternalEndPoint = ep; | ||
236 | } | ||
237 | else | ||
238 | ExternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), 0); | ||
239 | |||
240 | if (kvp["external_host_name"] != null) | ||
241 | ExternalHostName = (string)kvp["external_host_name"]; | ||
242 | |||
243 | if (kvp["http_port"] != null) | ||
244 | { | ||
245 | UInt32 port = 0; | ||
246 | UInt32.TryParse((string)kvp["http_port"], out port); | ||
247 | HttpPort = port; | ||
248 | } | ||
249 | |||
250 | if ((kvp["internal_ip_address"] != null) && (kvp["internal_port"] != null)) | ||
251 | { | ||
252 | int port = 0; | ||
253 | Int32.TryParse((string)kvp["internal_port"], out port); | ||
254 | IPEndPoint ep = new IPEndPoint(IPAddress.Parse((string)kvp["internal_ip_address"]), port); | ||
255 | InternalEndPoint = ep; | ||
256 | } | ||
257 | else | ||
258 | InternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), 0); | ||
259 | |||
260 | if (kvp["alternate_ports"] != null) | ||
261 | { | ||
262 | bool alts = false; | ||
263 | Boolean.TryParse((string)kvp["alternate_ports"], out alts); | ||
264 | m_allow_alternate_ports = alts; | ||
265 | } | ||
266 | |||
267 | if (kvp["server_uri"] != null) | ||
268 | ServerURI = (string)kvp["server_uri"]; | ||
269 | } | ||
270 | } | ||
271 | |||
272 | public class RegionInfo : SimpleRegionInfo | ||
273 | { | 42 | { |
274 | // private static readonly log4net.ILog m_log | 43 | // private static readonly log4net.ILog m_log |
275 | // = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); | 44 | // = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); |
@@ -304,6 +73,19 @@ namespace OpenSim.Framework | |||
304 | private bool m_clampPrimSize = false; | 73 | private bool m_clampPrimSize = false; |
305 | private int m_objectCapacity = 0; | 74 | private int m_objectCapacity = 0; |
306 | private string m_regionType = String.Empty; | 75 | private string m_regionType = String.Empty; |
76 | protected uint m_httpPort; | ||
77 | protected string m_serverURI; | ||
78 | protected string m_regionName = String.Empty; | ||
79 | protected bool Allow_Alternate_Ports; | ||
80 | public bool m_allow_alternate_ports; | ||
81 | protected string m_externalHostName; | ||
82 | protected IPEndPoint m_internalEndPoint; | ||
83 | protected uint? m_regionLocX; | ||
84 | protected uint? m_regionLocY; | ||
85 | protected uint m_remotingPort; | ||
86 | public UUID RegionID = UUID.Zero; | ||
87 | public string RemotingAddress; | ||
88 | public UUID ScopeID = UUID.Zero; | ||
307 | 89 | ||
308 | 90 | ||
309 | // Apparently, we're applying the same estatesettings regardless of whether it's local or remote. | 91 | // Apparently, we're applying the same estatesettings regardless of whether it's local or remote. |
@@ -386,42 +168,17 @@ namespace OpenSim.Framework | |||
386 | configMember.performConfigurationRetrieve(); | 168 | configMember.performConfigurationRetrieve(); |
387 | } | 169 | } |
388 | 170 | ||
389 | public RegionInfo(uint regionLocX, uint regionLocY, IPEndPoint internalEndPoint, string externalUri) : | 171 | public RegionInfo(uint regionLocX, uint regionLocY, IPEndPoint internalEndPoint, string externalUri) |
390 | base(regionLocX, regionLocY, internalEndPoint, externalUri) | ||
391 | { | 172 | { |
392 | } | 173 | m_regionLocX = regionLocX; |
393 | 174 | m_regionLocY = regionLocY; | |
394 | public RegionInfo() | ||
395 | { | ||
396 | } | ||
397 | 175 | ||
398 | public RegionInfo(SerializableRegionInfo ConvertFrom) | 176 | m_internalEndPoint = internalEndPoint; |
399 | { | 177 | m_externalHostName = externalUri; |
400 | m_regionLocX = ConvertFrom.RegionLocX; | ||
401 | m_regionLocY = ConvertFrom.RegionLocY; | ||
402 | m_internalEndPoint = ConvertFrom.InternalEndPoint; | ||
403 | m_externalHostName = ConvertFrom.ExternalHostName; | ||
404 | m_remotingPort = ConvertFrom.RemotingPort; | ||
405 | m_allow_alternate_ports = ConvertFrom.m_allow_alternate_ports; | ||
406 | RemotingAddress = ConvertFrom.RemotingAddress; | ||
407 | RegionID = UUID.Zero; | ||
408 | proxyUrl = ConvertFrom.ProxyUrl; | ||
409 | originRegionID = ConvertFrom.OriginRegionID; | ||
410 | RegionName = ConvertFrom.RegionName; | ||
411 | ServerURI = ConvertFrom.ServerURI; | ||
412 | } | 178 | } |
413 | 179 | ||
414 | public RegionInfo(SimpleRegionInfo ConvertFrom) | 180 | public RegionInfo() |
415 | { | 181 | { |
416 | m_regionLocX = ConvertFrom.RegionLocX; | ||
417 | m_regionLocY = ConvertFrom.RegionLocY; | ||
418 | m_internalEndPoint = ConvertFrom.InternalEndPoint; | ||
419 | m_externalHostName = ConvertFrom.ExternalHostName; | ||
420 | m_remotingPort = ConvertFrom.RemotingPort; | ||
421 | m_allow_alternate_ports = ConvertFrom.m_allow_alternate_ports; | ||
422 | RemotingAddress = ConvertFrom.RemotingAddress; | ||
423 | RegionID = UUID.Zero; | ||
424 | ServerURI = ConvertFrom.ServerURI; | ||
425 | } | 182 | } |
426 | 183 | ||
427 | public EstateSettings EstateSettings | 184 | public EstateSettings EstateSettings |
@@ -484,6 +241,111 @@ namespace OpenSim.Framework | |||
484 | get { return m_regionType; } | 241 | get { return m_regionType; } |
485 | } | 242 | } |
486 | 243 | ||
244 | /// <summary> | ||
245 | /// The port by which http communication occurs with the region (most noticeably, CAPS communication) | ||
246 | /// </summary> | ||
247 | public uint HttpPort | ||
248 | { | ||
249 | get { return m_httpPort; } | ||
250 | set { m_httpPort = value; } | ||
251 | } | ||
252 | |||
253 | /// <summary> | ||
254 | /// A well-formed URI for the host region server (namely "http://" + ExternalHostName) | ||
255 | /// </summary> | ||
256 | public string ServerURI | ||
257 | { | ||
258 | get { return m_serverURI; } | ||
259 | set { m_serverURI = value; } | ||
260 | } | ||
261 | |||
262 | public string RegionName | ||
263 | { | ||
264 | get { return m_regionName; } | ||
265 | set { m_regionName = value; } | ||
266 | } | ||
267 | |||
268 | public uint RemotingPort | ||
269 | { | ||
270 | get { return m_remotingPort; } | ||
271 | set { m_remotingPort = value; } | ||
272 | } | ||
273 | |||
274 | /// <value> | ||
275 | /// This accessor can throw all the exceptions that Dns.GetHostAddresses can throw. | ||
276 | /// | ||
277 | /// XXX Isn't this really doing too much to be a simple getter, rather than an explict method? | ||
278 | /// </value> | ||
279 | public IPEndPoint ExternalEndPoint | ||
280 | { | ||
281 | get | ||
282 | { | ||
283 | // Old one defaults to IPv6 | ||
284 | //return new IPEndPoint(Dns.GetHostAddresses(m_externalHostName)[0], m_internalEndPoint.Port); | ||
285 | |||
286 | IPAddress ia = null; | ||
287 | // If it is already an IP, don't resolve it - just return directly | ||
288 | if (IPAddress.TryParse(m_externalHostName, out ia)) | ||
289 | return new IPEndPoint(ia, m_internalEndPoint.Port); | ||
290 | |||
291 | // Reset for next check | ||
292 | ia = null; | ||
293 | try | ||
294 | { | ||
295 | foreach (IPAddress Adr in Dns.GetHostAddresses(m_externalHostName)) | ||
296 | { | ||
297 | if (ia == null) | ||
298 | ia = Adr; | ||
299 | |||
300 | if (Adr.AddressFamily == AddressFamily.InterNetwork) | ||
301 | { | ||
302 | ia = Adr; | ||
303 | break; | ||
304 | } | ||
305 | } | ||
306 | } | ||
307 | catch (SocketException e) | ||
308 | { | ||
309 | throw new Exception( | ||
310 | "Unable to resolve local hostname " + m_externalHostName + " innerException of type '" + | ||
311 | e + "' attached to this exception", e); | ||
312 | } | ||
313 | |||
314 | return new IPEndPoint(ia, m_internalEndPoint.Port); | ||
315 | } | ||
316 | |||
317 | set { m_externalHostName = value.ToString(); } | ||
318 | } | ||
319 | |||
320 | public string ExternalHostName | ||
321 | { | ||
322 | get { return m_externalHostName; } | ||
323 | set { m_externalHostName = value; } | ||
324 | } | ||
325 | |||
326 | public IPEndPoint InternalEndPoint | ||
327 | { | ||
328 | get { return m_internalEndPoint; } | ||
329 | set { m_internalEndPoint = value; } | ||
330 | } | ||
331 | |||
332 | public uint RegionLocX | ||
333 | { | ||
334 | get { return m_regionLocX.Value; } | ||
335 | set { m_regionLocX = value; } | ||
336 | } | ||
337 | |||
338 | public uint RegionLocY | ||
339 | { | ||
340 | get { return m_regionLocY.Value; } | ||
341 | set { m_regionLocY = value; } | ||
342 | } | ||
343 | |||
344 | public ulong RegionHandle | ||
345 | { | ||
346 | get { return Util.UIntsToLong((RegionLocX * (uint) Constants.RegionSize), (RegionLocY * (uint) Constants.RegionSize)); } | ||
347 | } | ||
348 | |||
487 | public void SetEndPoint(string ipaddr, int port) | 349 | public void SetEndPoint(string ipaddr, int port) |
488 | { | 350 | { |
489 | IPAddress tmpIP = IPAddress.Parse(ipaddr); | 351 | IPAddress tmpIP = IPAddress.Parse(ipaddr); |
@@ -1074,5 +936,27 @@ namespace OpenSim.Framework | |||
1074 | return regionInfo; | 936 | return regionInfo; |
1075 | } | 937 | } |
1076 | 938 | ||
939 | public int getInternalEndPointPort() | ||
940 | { | ||
941 | return m_internalEndPoint.Port; | ||
942 | } | ||
943 | |||
944 | public Dictionary<string, object> ToKeyValuePairs() | ||
945 | { | ||
946 | Dictionary<string, object> kvp = new Dictionary<string, object>(); | ||
947 | kvp["uuid"] = RegionID.ToString(); | ||
948 | kvp["locX"] = RegionLocX.ToString(); | ||
949 | kvp["locY"] = RegionLocY.ToString(); | ||
950 | kvp["external_ip_address"] = ExternalEndPoint.Address.ToString(); | ||
951 | kvp["external_port"] = ExternalEndPoint.Port.ToString(); | ||
952 | kvp["external_host_name"] = ExternalHostName; | ||
953 | kvp["http_port"] = HttpPort.ToString(); | ||
954 | kvp["internal_ip_address"] = InternalEndPoint.Address.ToString(); | ||
955 | kvp["internal_port"] = InternalEndPoint.Port.ToString(); | ||
956 | kvp["alternate_ports"] = m_allow_alternate_ports.ToString(); | ||
957 | kvp["server_uri"] = ServerURI; | ||
958 | |||
959 | return kvp; | ||
960 | } | ||
1077 | } | 961 | } |
1078 | } | 962 | } |
diff --git a/OpenSim/Framework/SerializableRegionInfo.cs b/OpenSim/Framework/SerializableRegionInfo.cs deleted file mode 100644 index c3731b2..0000000 --- a/OpenSim/Framework/SerializableRegionInfo.cs +++ /dev/null | |||
@@ -1,202 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
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 | ||
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 | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Net; | ||
30 | using System.Net.Sockets; | ||
31 | using OpenMetaverse; | ||
32 | |||
33 | namespace OpenSim.Framework | ||
34 | { | ||
35 | [Serializable] | ||
36 | public class SerializableRegionInfo | ||
37 | { | ||
38 | public bool m_allow_alternate_ports; | ||
39 | protected string m_externalHostName; | ||
40 | |||
41 | /// <value> | ||
42 | /// The port by which http communication occurs with the region (most noticeably, CAPS communication) | ||
43 | /// | ||
44 | /// FIXME: Defaulting to 9000 temporarily (on the basis that this is the http port most region | ||
45 | /// servers are running) until the revision in which this change is made propogates around grids. | ||
46 | /// </value> | ||
47 | protected uint m_httpPort = 9000; | ||
48 | |||
49 | protected IPEndPoint m_internalEndPoint; | ||
50 | protected Guid m_originRegionID = UUID.Zero.Guid; | ||
51 | protected string m_proxyUrl; | ||
52 | protected uint? m_regionLocX; | ||
53 | protected uint? m_regionLocY; | ||
54 | protected string m_regionName; | ||
55 | public uint m_remotingPort; | ||
56 | protected string m_serverURI; | ||
57 | public Guid RegionID = UUID.Zero.Guid; | ||
58 | public string RemotingAddress; | ||
59 | |||
60 | /// <summary> | ||
61 | /// This is a serializable version of RegionInfo | ||
62 | /// </summary> | ||
63 | public SerializableRegionInfo() | ||
64 | { | ||
65 | } | ||
66 | |||
67 | public SerializableRegionInfo(RegionInfo ConvertFrom) | ||
68 | { | ||
69 | m_regionLocX = ConvertFrom.RegionLocX; | ||
70 | m_regionLocY = ConvertFrom.RegionLocY; | ||
71 | m_internalEndPoint = ConvertFrom.InternalEndPoint; | ||
72 | m_externalHostName = ConvertFrom.ExternalHostName; | ||
73 | m_remotingPort = ConvertFrom.RemotingPort; | ||
74 | m_httpPort = ConvertFrom.HttpPort; | ||
75 | m_allow_alternate_ports = ConvertFrom.m_allow_alternate_ports; | ||
76 | RemotingAddress = ConvertFrom.RemotingAddress; | ||
77 | m_proxyUrl = ConvertFrom.proxyUrl; | ||
78 | OriginRegionID = ConvertFrom.originRegionID; | ||
79 | RegionName = ConvertFrom.RegionName; | ||
80 | ServerURI = ConvertFrom.ServerURI; | ||
81 | } | ||
82 | |||
83 | public SerializableRegionInfo(uint regionLocX, uint regionLocY, IPEndPoint internalEndPoint, string externalUri) | ||
84 | { | ||
85 | m_regionLocX = regionLocX; | ||
86 | m_regionLocY = regionLocY; | ||
87 | |||
88 | m_internalEndPoint = internalEndPoint; | ||
89 | m_externalHostName = externalUri; | ||
90 | } | ||
91 | |||
92 | public SerializableRegionInfo(uint regionLocX, uint regionLocY, string externalUri, uint port) | ||
93 | { | ||
94 | m_regionLocX = regionLocX; | ||
95 | m_regionLocY = regionLocY; | ||
96 | |||
97 | m_externalHostName = externalUri; | ||
98 | |||
99 | m_internalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), (int) port); | ||
100 | } | ||
101 | |||
102 | public uint RemotingPort | ||
103 | { | ||
104 | get { return m_remotingPort; } | ||
105 | set { m_remotingPort = value; } | ||
106 | } | ||
107 | |||
108 | public uint HttpPort | ||
109 | { | ||
110 | get { return m_httpPort; } | ||
111 | set { m_httpPort = value; } | ||
112 | } | ||
113 | |||
114 | public IPEndPoint ExternalEndPoint | ||
115 | { | ||
116 | get | ||
117 | { | ||
118 | // Old one defaults to IPv6 | ||
119 | //return new IPEndPoint(Dns.GetHostAddresses(m_externalHostName)[0], m_internalEndPoint.Port); | ||
120 | |||
121 | IPAddress ia = null; | ||
122 | // If it is already an IP, don't resolve it - just return directly | ||
123 | if (IPAddress.TryParse(m_externalHostName, out ia)) | ||
124 | return new IPEndPoint(ia, m_internalEndPoint.Port); | ||
125 | |||
126 | // Reset for next check | ||
127 | ia = null; | ||
128 | |||
129 | |||
130 | // New method favors IPv4 | ||
131 | foreach (IPAddress Adr in Dns.GetHostAddresses(m_externalHostName)) | ||
132 | { | ||
133 | if (ia == null) | ||
134 | ia = Adr; | ||
135 | |||
136 | if (Adr.AddressFamily == AddressFamily.InterNetwork) | ||
137 | { | ||
138 | ia = Adr; | ||
139 | break; | ||
140 | } | ||
141 | } | ||
142 | |||
143 | return new IPEndPoint(ia, m_internalEndPoint.Port); | ||
144 | } | ||
145 | |||
146 | set { m_externalHostName = value.ToString(); } | ||
147 | } | ||
148 | |||
149 | public string ExternalHostName | ||
150 | { | ||
151 | get { return m_externalHostName; } | ||
152 | set { m_externalHostName = value; } | ||
153 | } | ||
154 | |||
155 | public IPEndPoint InternalEndPoint | ||
156 | { | ||
157 | get { return m_internalEndPoint; } | ||
158 | set { m_internalEndPoint = value; } | ||
159 | } | ||
160 | |||
161 | public uint RegionLocX | ||
162 | { | ||
163 | get { return m_regionLocX.Value; } | ||
164 | set { m_regionLocX = value; } | ||
165 | } | ||
166 | |||
167 | public uint RegionLocY | ||
168 | { | ||
169 | get { return m_regionLocY.Value; } | ||
170 | set { m_regionLocY = value; } | ||
171 | } | ||
172 | |||
173 | public ulong RegionHandle | ||
174 | { | ||
175 | get { return Util.UIntsToLong((RegionLocX * (uint) Constants.RegionSize), (RegionLocY * (uint) Constants.RegionSize)); } | ||
176 | } | ||
177 | |||
178 | public string ProxyUrl | ||
179 | { | ||
180 | get { return m_proxyUrl; } | ||
181 | set { m_proxyUrl = value; } | ||
182 | } | ||
183 | |||
184 | public UUID OriginRegionID | ||
185 | { | ||
186 | get { return new UUID(m_originRegionID); } | ||
187 | set { m_originRegionID = value.Guid; } | ||
188 | } | ||
189 | |||
190 | public string RegionName | ||
191 | { | ||
192 | get { return m_regionName; } | ||
193 | set { m_regionName = value; } | ||
194 | } | ||
195 | |||
196 | public string ServerURI | ||
197 | { | ||
198 | get { return m_serverURI; } | ||
199 | set { m_serverURI = value; } | ||
200 | } | ||
201 | } | ||
202 | } | ||
diff --git a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs index 3892769..e649139 100644 --- a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs +++ b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs | |||
@@ -356,8 +356,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
356 | neighbours.RemoveAll(delegate(GridRegion r) { return r.RegionID == m_regionInfo.RegionID; }); | 356 | neighbours.RemoveAll(delegate(GridRegion r) { return r.RegionID == m_regionInfo.RegionID; }); |
357 | 357 | ||
358 | return neighbours; | 358 | return neighbours; |
359 | //SimpleRegionInfo regionData = m_commsProvider.GridService.RequestNeighbourInfo() | ||
360 | //return m_commsProvider.GridService.RequestNeighbours(pRegionLocX, pRegionLocY); | ||
361 | } | 359 | } |
362 | } | 360 | } |
363 | 361 | ||
@@ -367,20 +365,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
367 | /// </summary> | 365 | /// </summary> |
368 | public void EnableNeighbourChildAgents(ScenePresence avatar, List<RegionInfo> lstneighbours) | 366 | public void EnableNeighbourChildAgents(ScenePresence avatar, List<RegionInfo> lstneighbours) |
369 | { | 367 | { |
370 | //List<SimpleRegionInfo> neighbours = new List<SimpleRegionInfo>(); | ||
371 | List<GridRegion> neighbours = new List<GridRegion>(); | 368 | List<GridRegion> neighbours = new List<GridRegion>(); |
372 | 369 | ||
373 | ////m_commsProvider.GridService.RequestNeighbours(m_regionInfo.RegionLocX, m_regionInfo.RegionLocY); | ||
374 | //for (int i = 0; i < lstneighbours.Count; i++) | ||
375 | //{ | ||
376 | // // We don't want to keep sending to regions that consistently fail on comms. | ||
377 | // if (!(lstneighbours[i].commFailTF)) | ||
378 | // { | ||
379 | // neighbours.Add(new SimpleRegionInfo(lstneighbours[i])); | ||
380 | // } | ||
381 | //} | ||
382 | // we're going to be using the above code once neighbour cache is correct. Currently it doesn't appear to be | ||
383 | // So we're temporarily going back to the old method of grabbing it from the Grid Server Every time :/ | ||
384 | if (m_regionInfo != null) | 370 | if (m_regionInfo != null) |
385 | { | 371 | { |
386 | neighbours = RequestNeighbours(avatar.Scene,m_regionInfo.RegionLocX, m_regionInfo.RegionLocY); | 372 | neighbours = RequestNeighbours(avatar.Scene,m_regionInfo.RegionLocX, m_regionInfo.RegionLocY); |
@@ -431,7 +417,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
431 | 417 | ||
432 | /// Create the necessary child agents | 418 | /// Create the necessary child agents |
433 | List<AgentCircuitData> cagents = new List<AgentCircuitData>(); | 419 | List<AgentCircuitData> cagents = new List<AgentCircuitData>(); |
434 | //foreach (SimpleRegionInfo neighbour in neighbours) | ||
435 | foreach (GridRegion neighbour in neighbours) | 420 | foreach (GridRegion neighbour in neighbours) |
436 | { | 421 | { |
437 | if (neighbour.RegionHandle != avatar.Scene.RegionInfo.RegionHandle) | 422 | if (neighbour.RegionHandle != avatar.Scene.RegionInfo.RegionHandle) |
@@ -583,7 +568,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
583 | //m_log.Info("[INTER]: " + debugRegionName + ": SceneCommunicationService: Sending InterRegion Notification that region is up " + region.RegionName); | 568 | //m_log.Info("[INTER]: " + debugRegionName + ": SceneCommunicationService: Sending InterRegion Notification that region is up " + region.RegionName); |
584 | 569 | ||
585 | for (int x = (int)region.RegionLocX - 1; x <= region.RegionLocX + 1; x++) | 570 | for (int x = (int)region.RegionLocX - 1; x <= region.RegionLocX + 1; x++) |
571 | { | ||
586 | for (int y = (int)region.RegionLocY - 1; y <= region.RegionLocY + 1; y++) | 572 | for (int y = (int)region.RegionLocY - 1; y <= region.RegionLocY + 1; y++) |
573 | { | ||
587 | if (!((x == region.RegionLocX) && (y == region.RegionLocY))) // skip this region | 574 | if (!((x == region.RegionLocX) && (y == region.RegionLocY))) // skip this region |
588 | { | 575 | { |
589 | ulong handle = Utils.UIntsToLong((uint)x * Constants.RegionSize, (uint)y * Constants.RegionSize); | 576 | ulong handle = Utils.UIntsToLong((uint)x * Constants.RegionSize, (uint)y * Constants.RegionSize); |
@@ -593,24 +580,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
593 | InformNeighborsThatRegionisUpCompleted, | 580 | InformNeighborsThatRegionisUpCompleted, |
594 | d); | 581 | d); |
595 | } | 582 | } |
596 | 583 | } | |
597 | //List<GridRegion> neighbours = new List<GridRegion>(); | 584 | } |
598 | //// This stays uncached because we don't already know about our neighbors at this point. | ||
599 | |||
600 | //neighbours = m_scene.GridService.GetNeighbours(m_regionInfo.ScopeID, m_regionInfo.RegionID); | ||
601 | //if (neighbours != null) | ||
602 | //{ | ||
603 | // for (int i = 0; i < neighbours.Count; i++) | ||
604 | // { | ||
605 | // InformNeighbourThatRegionUpDelegate d = InformNeighboursThatRegionIsUpAsync; | ||
606 | |||
607 | // d.BeginInvoke(neighbourService, region, neighbours[i].RegionHandle, | ||
608 | // InformNeighborsThatRegionisUpCompleted, | ||
609 | // d); | ||
610 | // } | ||
611 | //} | ||
612 | |||
613 | //bool val = m_commsProvider.InterRegion.RegionUp(new SerializableRegionInfo(region)); | ||
614 | } | 585 | } |
615 | 586 | ||
616 | 587 | ||