aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorMelanie2009-12-12 04:56:28 +0000
committerMelanie2009-12-12 04:56:28 +0000
commit0fdf883cbde45d48bdd1507725b7fefce66da5b4 (patch)
tree33640f0c6d02fd303bf56e0453399aa8defb3f87
parentMerge branch 'master' into careminster (diff)
parentGetting rid of SimpleRegionInfo and SerializableRegionInfo per Mel (diff)
downloadopensim-SC-0fdf883cbde45d48bdd1507725b7fefce66da5b4.zip
opensim-SC-0fdf883cbde45d48bdd1507725b7fefce66da5b4.tar.gz
opensim-SC-0fdf883cbde45d48bdd1507725b7fefce66da5b4.tar.bz2
opensim-SC-0fdf883cbde45d48bdd1507725b7fefce66da5b4.tar.xz
Merge branch 'master' into careminster
Diffstat (limited to '')
-rw-r--r--OpenSim/Framework/RegionInfo.cs181
-rw-r--r--OpenSim/Framework/SerializableRegionInfo.cs202
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs37
3 files changed, 153 insertions, 267 deletions
diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs
index c39cc03..9e00528 100644
--- a/OpenSim/Framework/RegionInfo.cs
+++ b/OpenSim/Framework/RegionInfo.cs
@@ -320,7 +320,7 @@ namespace OpenSim.Framework
320 } 320 }
321 } 321 }
322 322
323 public class RegionInfo : SimpleRegionInfo 323 public class RegionInfo
324 { 324 {
325 // private static readonly log4net.ILog m_log 325 // private static readonly log4net.ILog m_log
326 // = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); 326 // = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
@@ -356,6 +356,21 @@ namespace OpenSim.Framework
356 private int m_objectCapacity = 0; 356 private int m_objectCapacity = 0;
357 private string m_regionType = String.Empty; 357 private string m_regionType = String.Empty;
358 private RegionMeta7WindlightData m_windlight = new RegionMeta7WindlightData(); 358 private RegionMeta7WindlightData m_windlight = new RegionMeta7WindlightData();
359 protected uint m_httpPort;
360 protected string m_serverURI;
361 protected string m_regionName = String.Empty;
362 protected bool Allow_Alternate_Ports;
363 public bool m_allow_alternate_ports;
364 protected string m_externalHostName;
365 protected IPEndPoint m_internalEndPoint;
366 protected uint? m_regionLocX;
367 protected uint? m_regionLocY;
368 protected uint m_remotingPort;
369 public UUID RegionID = UUID.Zero;
370 public string RemotingAddress;
371 public UUID ScopeID = UUID.Zero;
372
373
359 // Apparently, we're applying the same estatesettings regardless of whether it's local or remote. 374 // Apparently, we're applying the same estatesettings regardless of whether it's local or remote.
360 375
361 // MT: Yes. Estates can't span trust boundaries. Therefore, it can be 376 // MT: Yes. Estates can't span trust boundaries. Therefore, it can be
@@ -436,42 +451,17 @@ namespace OpenSim.Framework
436 configMember.performConfigurationRetrieve(); 451 configMember.performConfigurationRetrieve();
437 } 452 }
438 453
439 public RegionInfo(uint regionLocX, uint regionLocY, IPEndPoint internalEndPoint, string externalUri) : 454 public RegionInfo(uint regionLocX, uint regionLocY, IPEndPoint internalEndPoint, string externalUri)
440 base(regionLocX, regionLocY, internalEndPoint, externalUri)
441 { 455 {
442 } 456 m_regionLocX = regionLocX;
443 457 m_regionLocY = regionLocY;
444 public RegionInfo()
445 {
446 }
447 458
448 public RegionInfo(SerializableRegionInfo ConvertFrom) 459 m_internalEndPoint = internalEndPoint;
449 { 460 m_externalHostName = externalUri;
450 m_regionLocX = ConvertFrom.RegionLocX;
451 m_regionLocY = ConvertFrom.RegionLocY;
452 m_internalEndPoint = ConvertFrom.InternalEndPoint;
453 m_externalHostName = ConvertFrom.ExternalHostName;
454 m_remotingPort = ConvertFrom.RemotingPort;
455 m_allow_alternate_ports = ConvertFrom.m_allow_alternate_ports;
456 RemotingAddress = ConvertFrom.RemotingAddress;
457 RegionID = UUID.Zero;
458 proxyUrl = ConvertFrom.ProxyUrl;
459 originRegionID = ConvertFrom.OriginRegionID;
460 RegionName = ConvertFrom.RegionName;
461 ServerURI = ConvertFrom.ServerURI;
462 } 461 }
463 462
464 public RegionInfo(SimpleRegionInfo ConvertFrom) 463 public RegionInfo()
465 { 464 {
466 m_regionLocX = ConvertFrom.RegionLocX;
467 m_regionLocY = ConvertFrom.RegionLocY;
468 m_internalEndPoint = ConvertFrom.InternalEndPoint;
469 m_externalHostName = ConvertFrom.ExternalHostName;
470 m_remotingPort = ConvertFrom.RemotingPort;
471 m_allow_alternate_ports = ConvertFrom.m_allow_alternate_ports;
472 RemotingAddress = ConvertFrom.RemotingAddress;
473 RegionID = UUID.Zero;
474 ServerURI = ConvertFrom.ServerURI;
475 } 465 }
476 466
477 public EstateSettings EstateSettings 467 public EstateSettings EstateSettings
@@ -549,6 +539,111 @@ namespace OpenSim.Framework
549 get { return m_regionType; } 539 get { return m_regionType; }
550 } 540 }
551 541
542 /// <summary>
543 /// The port by which http communication occurs with the region (most noticeably, CAPS communication)
544 /// </summary>
545 public uint HttpPort
546 {
547 get { return m_httpPort; }
548 set { m_httpPort = value; }
549 }
550
551 /// <summary>
552 /// A well-formed URI for the host region server (namely "http://" + ExternalHostName)
553 /// </summary>
554 public string ServerURI
555 {
556 get { return m_serverURI; }
557 set { m_serverURI = value; }
558 }
559
560 public string RegionName
561 {
562 get { return m_regionName; }
563 set { m_regionName = value; }
564 }
565
566 public uint RemotingPort
567 {
568 get { return m_remotingPort; }
569 set { m_remotingPort = value; }
570 }
571
572 /// <value>
573 /// This accessor can throw all the exceptions that Dns.GetHostAddresses can throw.
574 ///
575 /// XXX Isn't this really doing too much to be a simple getter, rather than an explict method?
576 /// </value>
577 public IPEndPoint ExternalEndPoint
578 {
579 get
580 {
581 // Old one defaults to IPv6
582 //return new IPEndPoint(Dns.GetHostAddresses(m_externalHostName)[0], m_internalEndPoint.Port);
583
584 IPAddress ia = null;
585 // If it is already an IP, don't resolve it - just return directly
586 if (IPAddress.TryParse(m_externalHostName, out ia))
587 return new IPEndPoint(ia, m_internalEndPoint.Port);
588
589 // Reset for next check
590 ia = null;
591 try
592 {
593 foreach (IPAddress Adr in Dns.GetHostAddresses(m_externalHostName))
594 {
595 if (ia == null)
596 ia = Adr;
597
598 if (Adr.AddressFamily == AddressFamily.InterNetwork)
599 {
600 ia = Adr;
601 break;
602 }
603 }
604 }
605 catch (SocketException e)
606 {
607 throw new Exception(
608 "Unable to resolve local hostname " + m_externalHostName + " innerException of type '" +
609 e + "' attached to this exception", e);
610 }
611
612 return new IPEndPoint(ia, m_internalEndPoint.Port);
613 }
614
615 set { m_externalHostName = value.ToString(); }
616 }
617
618 public string ExternalHostName
619 {
620 get { return m_externalHostName; }
621 set { m_externalHostName = value; }
622 }
623
624 public IPEndPoint InternalEndPoint
625 {
626 get { return m_internalEndPoint; }
627 set { m_internalEndPoint = value; }
628 }
629
630 public uint RegionLocX
631 {
632 get { return m_regionLocX.Value; }
633 set { m_regionLocX = value; }
634 }
635
636 public uint RegionLocY
637 {
638 get { return m_regionLocY.Value; }
639 set { m_regionLocY = value; }
640 }
641
642 public ulong RegionHandle
643 {
644 get { return Util.UIntsToLong((RegionLocX * (uint) Constants.RegionSize), (RegionLocY * (uint) Constants.RegionSize)); }
645 }
646
552 public void SetEndPoint(string ipaddr, int port) 647 public void SetEndPoint(string ipaddr, int port)
553 { 648 {
554 IPAddress tmpIP = IPAddress.Parse(ipaddr); 649 IPAddress tmpIP = IPAddress.Parse(ipaddr);
@@ -1139,5 +1234,27 @@ namespace OpenSim.Framework
1139 return regionInfo; 1234 return regionInfo;
1140 } 1235 }
1141 1236
1237 public int getInternalEndPointPort()
1238 {
1239 return m_internalEndPoint.Port;
1240 }
1241
1242 public Dictionary<string, object> ToKeyValuePairs()
1243 {
1244 Dictionary<string, object> kvp = new Dictionary<string, object>();
1245 kvp["uuid"] = RegionID.ToString();
1246 kvp["locX"] = RegionLocX.ToString();
1247 kvp["locY"] = RegionLocY.ToString();
1248 kvp["external_ip_address"] = ExternalEndPoint.Address.ToString();
1249 kvp["external_port"] = ExternalEndPoint.Port.ToString();
1250 kvp["external_host_name"] = ExternalHostName;
1251 kvp["http_port"] = HttpPort.ToString();
1252 kvp["internal_ip_address"] = InternalEndPoint.Address.ToString();
1253 kvp["internal_port"] = InternalEndPoint.Port.ToString();
1254 kvp["alternate_ports"] = m_allow_alternate_ports.ToString();
1255 kvp["server_uri"] = ServerURI;
1256
1257 return kvp;
1258 }
1142 } 1259 }
1143} 1260}
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
28using System;
29using System.Net;
30using System.Net.Sockets;
31using OpenMetaverse;
32
33namespace 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