diff options
Diffstat (limited to 'OpenSim/Region/Communications/OGS1')
-rw-r--r-- | OpenSim/Region/Communications/OGS1/OGS1GridServices.cs | 54 |
1 files changed, 34 insertions, 20 deletions
diff --git a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs index 1264052..1a9584a 100644 --- a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs +++ b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs | |||
@@ -30,9 +30,12 @@ using System; | |||
30 | using System.Collections; | 30 | using System.Collections; |
31 | using System.Collections.Generic; | 31 | using System.Collections.Generic; |
32 | using System.Net; | 32 | using System.Net; |
33 | using System.Net.Sockets; | ||
33 | using System.Runtime.Remoting; | 34 | using System.Runtime.Remoting; |
34 | using System.Runtime.Remoting.Channels; | 35 | using System.Runtime.Remoting.Channels; |
35 | using System.Runtime.Remoting.Channels.Tcp; | 36 | using System.Runtime.Remoting.Channels.Tcp; |
37 | using System.Security.Authentication; | ||
38 | |||
36 | using libsecondlife; | 39 | using libsecondlife; |
37 | using Nwc.XmlRpc; | 40 | using Nwc.XmlRpc; |
38 | using OpenSim.Framework; | 41 | using OpenSim.Framework; |
@@ -78,7 +81,7 @@ namespace OpenSim.Region.Communications.OGS1 | |||
78 | // Login / Authentication | 81 | // Login / Authentication |
79 | 82 | ||
80 | GridParams["authkey"] = serversInfo.GridSendKey; | 83 | GridParams["authkey"] = serversInfo.GridSendKey; |
81 | GridParams["UUID"] = regionInfo.SimUUID.ToStringHyphenated(); | 84 | GridParams["UUID"] = regionInfo.RegionID.ToStringHyphenated(); |
82 | GridParams["sim_ip"] = regionInfo.ExternalHostName; | 85 | GridParams["sim_ip"] = regionInfo.ExternalHostName; |
83 | GridParams["sim_port"] = regionInfo.InternalEndPoint.Port.ToString(); | 86 | GridParams["sim_port"] = regionInfo.InternalEndPoint.Port.ToString(); |
84 | GridParams["region_locx"] = regionInfo.RegionLocX.ToString(); | 87 | GridParams["region_locx"] = regionInfo.RegionLocX.ToString(); |
@@ -115,12 +118,12 @@ namespace OpenSim.Region.Communications.OGS1 | |||
115 | /// </summary> | 118 | /// </summary> |
116 | /// <param name="regionInfo"></param> | 119 | /// <param name="regionInfo"></param> |
117 | /// <returns></returns> | 120 | /// <returns></returns> |
118 | public List<RegionInfo> RequestNeighbours(RegionInfo regionInfo) | 121 | public List<SimpleRegionInfo> RequestNeighbours(uint x, uint y) |
119 | { | 122 | { |
120 | 123 | ||
121 | Hashtable respData = MapBlockQuery((int)regionInfo.RegionLocX - 1, (int)regionInfo.RegionLocY - 1, (int)regionInfo.RegionLocX + 1, (int)regionInfo.RegionLocY + 1); | 124 | Hashtable respData = MapBlockQuery((int)x - 1, (int)y - 1, (int)x + 1, (int)y + 1); |
122 | 125 | ||
123 | List<RegionInfo> neighbours = new List<RegionInfo>(); | 126 | List<SimpleRegionInfo> neighbours = new List<SimpleRegionInfo>(); |
124 | 127 | ||
125 | foreach (ArrayList neighboursList in respData.Values) | 128 | foreach (ArrayList neighboursList in respData.Values) |
126 | { | 129 | { |
@@ -128,27 +131,20 @@ namespace OpenSim.Region.Communications.OGS1 | |||
128 | { | 131 | { |
129 | uint regX = Convert.ToUInt32(neighbourData["x"]); | 132 | uint regX = Convert.ToUInt32(neighbourData["x"]); |
130 | uint regY = Convert.ToUInt32(neighbourData["y"]); | 133 | uint regY = Convert.ToUInt32(neighbourData["y"]); |
131 | if ((regionInfo.RegionLocX != regX) || (regionInfo.RegionLocY != regY)) | 134 | if ((x != regX) || (y != regY)) |
132 | { | 135 | { |
136 | |||
133 | string simIp = (string)neighbourData["sim_ip"]; | 137 | string simIp = (string)neighbourData["sim_ip"]; |
134 | 138 | ||
135 | uint port = Convert.ToUInt32(neighbourData["sim_port"]); | 139 | int port = Convert.ToInt32(neighbourData["sim_port"]); |
136 | string externalUri = (string)neighbourData["sim_uri"]; | 140 | string externalUri = (string)neighbourData["sim_uri"]; |
137 | 141 | ||
138 | string externalIpStr = OpenSim.Framework.Utilities.Util.GetHostFromDNS(simIp).ToString(); | 142 | string externalIpStr = OpenSim.Framework.Utilities.Util.GetHostFromDNS(simIp).ToString(); |
139 | IPEndPoint neighbourInternalEndPoint = new IPEndPoint(IPAddress.Parse(externalIpStr), (int)port); | 143 | SimpleRegionInfo sri = new SimpleRegionInfo(regX, regY, simIp, port); |
140 | string neighbourExternalUri = externalUri; | 144 | sri.RemotingPort = Convert.ToUInt32(neighbourData["remoting_port"]); |
141 | RegionInfo neighbour = new RegionInfo(regX, regY, neighbourInternalEndPoint, externalIpStr); | 145 | sri.RegionID = new LLUUID((string)neighbourData["uuid"]); |
142 | |||
143 | //OGS1 | ||
144 | //neighbour.RegionHandle = (ulong)n["regionhandle"]; is now calculated locally | ||
145 | |||
146 | neighbour.RegionName = (string)neighbourData["name"]; | ||
147 | 146 | ||
148 | //OGS1+ | 147 | neighbours.Add(sri); |
149 | neighbour.SimUUID = new LLUUID((string)neighbourData["uuid"]); | ||
150 | |||
151 | neighbours.Add(neighbour); | ||
152 | } | 148 | } |
153 | } | 149 | } |
154 | } | 150 | } |
@@ -199,7 +195,7 @@ namespace OpenSim.Region.Communications.OGS1 | |||
199 | regionInfo.RemotingPort = Convert.ToUInt32((string)responseData["remoting_port"]); | 195 | regionInfo.RemotingPort = Convert.ToUInt32((string)responseData["remoting_port"]); |
200 | regionInfo.RemotingAddress = internalIpStr; | 196 | regionInfo.RemotingAddress = internalIpStr; |
201 | 197 | ||
202 | regionInfo.SimUUID = new LLUUID((string)responseData["region_UUID"]); | 198 | regionInfo.RegionID = new LLUUID((string)responseData["region_UUID"]); |
203 | regionInfo.RegionName = (string)responseData["region_name"]; | 199 | regionInfo.RegionName = (string)responseData["region_name"]; |
204 | 200 | ||
205 | return regionInfo; | 201 | return regionInfo; |
@@ -365,6 +361,7 @@ namespace OpenSim.Region.Communications.OGS1 | |||
365 | OGS1InterRegionRemoting remObject = (OGS1InterRegionRemoting)Activator.GetObject( | 361 | OGS1InterRegionRemoting remObject = (OGS1InterRegionRemoting)Activator.GetObject( |
366 | typeof(OGS1InterRegionRemoting), | 362 | typeof(OGS1InterRegionRemoting), |
367 | "tcp://" + regInfo.RemotingAddress + ":" + regInfo.RemotingPort + "/InterRegions"); | 363 | "tcp://" + regInfo.RemotingAddress + ":" + regInfo.RemotingPort + "/InterRegions"); |
364 | |||
368 | if (remObject != null) | 365 | if (remObject != null) |
369 | { | 366 | { |
370 | retValue = remObject.InformRegionOfChildAgent(regionHandle, agentData); | 367 | retValue = remObject.InformRegionOfChildAgent(regionHandle, agentData); |
@@ -386,10 +383,27 @@ namespace OpenSim.Region.Communications.OGS1 | |||
386 | MainLog.Instance.Error("Remoting Error: Unable to connect to remote region.\n" + e.ToString()); | 383 | MainLog.Instance.Error("Remoting Error: Unable to connect to remote region.\n" + e.ToString()); |
387 | return false; | 384 | return false; |
388 | } | 385 | } |
389 | catch | 386 | catch (SocketException e) |
387 | { | ||
388 | MainLog.Instance.Error("Socket Error: Unable to connect to remote region.\n" + e.ToString()); | ||
389 | return false; | ||
390 | } | ||
391 | catch (InvalidCredentialException e) | ||
392 | { | ||
393 | MainLog.Instance.Error("Invalid Credentials: Unable to connect to remote region.\n" + e.ToString()); | ||
394 | return false; | ||
395 | } | ||
396 | catch (AuthenticationException e) | ||
397 | { | ||
398 | MainLog.Instance.Error("Authentication exception: Unable to connect to remote region.\n" + e.ToString()); | ||
399 | return false; | ||
400 | } | ||
401 | catch (Exception e) | ||
390 | { | 402 | { |
403 | MainLog.Instance.Error("Unknown exception: Unable to connect to remote region.\n" + e.ToString()); | ||
391 | return false; | 404 | return false; |
392 | } | 405 | } |
406 | return true; | ||
393 | } | 407 | } |
394 | 408 | ||
395 | /// <summary> | 409 | /// <summary> |