diff options
Diffstat (limited to 'OpenSim/Services')
11 files changed, 138 insertions, 80 deletions
diff --git a/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs index 4231be1..479a80e 100644 --- a/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs +++ b/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs | |||
@@ -63,12 +63,12 @@ namespace OpenSim.Services.Connectors.Hypergrid | |||
63 | 63 | ||
64 | protected override string AgentPath() | 64 | protected override string AgentPath() |
65 | { | 65 | { |
66 | return "foreignagent/"; | 66 | return "/foreignagent/"; |
67 | } | 67 | } |
68 | 68 | ||
69 | protected override string ObjectPath() | 69 | protected override string ObjectPath() |
70 | { | 70 | { |
71 | return "foreignobject/"; | 71 | return "/foreignobject/"; |
72 | } | 72 | } |
73 | 73 | ||
74 | public bool LinkRegion(GridRegion info, out UUID regionID, out ulong realHandle, out string externalName, out string imageURL, out string reason) | 74 | public bool LinkRegion(GridRegion info, out UUID regionID, out ulong realHandle, out string externalName, out string imageURL, out string reason) |
@@ -86,11 +86,12 @@ namespace OpenSim.Services.Connectors.Hypergrid | |||
86 | paramList.Add(hash); | 86 | paramList.Add(hash); |
87 | 87 | ||
88 | XmlRpcRequest request = new XmlRpcRequest("link_region", paramList); | 88 | XmlRpcRequest request = new XmlRpcRequest("link_region", paramList); |
89 | m_log.Debug("[GATEKEEPER SERVICE CONNECTOR]: Linking to " + info.ServerURI); | 89 | string uri = "http://" + ((info.ServerURI != null && info.ServerURI != string.Empty && !info.ServerURI.StartsWith("http:")) ? info.ServerURI : info.ExternalEndPoint.Address + ":" + info.HttpPort + "/"); |
90 | m_log.Debug("[GATEKEEPER SERVICE CONNECTOR]: Linking to " + uri); | ||
90 | XmlRpcResponse response = null; | 91 | XmlRpcResponse response = null; |
91 | try | 92 | try |
92 | { | 93 | { |
93 | response = request.Send(info.ServerURI, 10000); | 94 | response = request.Send(uri, 10000); |
94 | } | 95 | } |
95 | catch (Exception e) | 96 | catch (Exception e) |
96 | { | 97 | { |
@@ -107,8 +108,8 @@ namespace OpenSim.Services.Connectors.Hypergrid | |||
107 | } | 108 | } |
108 | 109 | ||
109 | hash = (Hashtable)response.Value; | 110 | hash = (Hashtable)response.Value; |
110 | foreach (Object o in hash) | 111 | //foreach (Object o in hash) |
111 | m_log.Debug(">> " + ((DictionaryEntry)o).Key + ":" + ((DictionaryEntry)o).Value); | 112 | // m_log.Debug(">> " + ((DictionaryEntry)o).Key + ":" + ((DictionaryEntry)o).Value); |
112 | try | 113 | try |
113 | { | 114 | { |
114 | bool success = false; | 115 | bool success = false; |
@@ -116,20 +117,16 @@ namespace OpenSim.Services.Connectors.Hypergrid | |||
116 | if (success) | 117 | if (success) |
117 | { | 118 | { |
118 | UUID.TryParse((string)hash["uuid"], out regionID); | 119 | UUID.TryParse((string)hash["uuid"], out regionID); |
119 | //m_log.Debug(">> HERE, uuid: " + regionID); | 120 | //m_log.Debug(">> HERE, uuid: " + uuid); |
120 | if ((string)hash["handle"] != null) | 121 | if ((string)hash["handle"] != null) |
121 | { | 122 | { |
122 | realHandle = Convert.ToUInt64((string)hash["handle"]); | 123 | realHandle = Convert.ToUInt64((string)hash["handle"]); |
123 | //m_log.Debug(">> HERE, realHandle: " + realHandle); | 124 | //m_log.Debug(">> HERE, realHandle: " + realHandle); |
124 | } | 125 | } |
125 | if (hash["region_image"] != null) { | 126 | if (hash["region_image"] != null) |
126 | imageURL = (string)hash["region_image"]; | 127 | imageURL = (string)hash["region_image"]; |
127 | //m_log.Debug(">> HERE, imageURL: " + imageURL); | 128 | if (hash["external_name"] != null) |
128 | } | ||
129 | if (hash["external_name"] != null) { | ||
130 | externalName = (string)hash["external_name"]; | 129 | externalName = (string)hash["external_name"]; |
131 | //m_log.Debug(">> HERE, externalName: " + externalName); | ||
132 | } | ||
133 | } | 130 | } |
134 | 131 | ||
135 | } | 132 | } |
@@ -191,15 +188,16 @@ namespace OpenSim.Services.Connectors.Hypergrid | |||
191 | paramList.Add(hash); | 188 | paramList.Add(hash); |
192 | 189 | ||
193 | XmlRpcRequest request = new XmlRpcRequest("get_region", paramList); | 190 | XmlRpcRequest request = new XmlRpcRequest("get_region", paramList); |
194 | //m_log.Debug("[GATEKEEPER SERVICE CONNECTOR]: contacting " + gatekeeper.ServerURI); | 191 | string uri = "http://" + ((gatekeeper.ServerURI != null && gatekeeper.ServerURI != string.Empty && !gatekeeper.ServerURI.StartsWith("http:")) ? gatekeeper.ServerURI : gatekeeper.ExternalEndPoint.Address + ":" + gatekeeper.HttpPort + "/"); |
192 | m_log.Debug("[GATEKEEPER SERVICE CONNECTOR]: contacting " + uri); | ||
195 | XmlRpcResponse response = null; | 193 | XmlRpcResponse response = null; |
196 | try | 194 | try |
197 | { | 195 | { |
198 | response = request.Send(gatekeeper.ServerURI, 10000); | 196 | response = request.Send(uri, 10000); |
199 | } | 197 | } |
200 | catch (Exception e) | 198 | catch (Exception e) |
201 | { | 199 | { |
202 | //m_log.Debug("[GATEKEEPER SERVICE CONNECTOR]: Exception " + e.Message); | 200 | m_log.Debug("[GATEKEEPER SERVICE CONNECTOR]: Exception " + e.Message); |
203 | return null; | 201 | return null; |
204 | } | 202 | } |
205 | 203 | ||
@@ -238,24 +236,21 @@ namespace OpenSim.Services.Connectors.Hypergrid | |||
238 | if (hash["region_name"] != null) | 236 | if (hash["region_name"] != null) |
239 | { | 237 | { |
240 | region.RegionName = (string)hash["region_name"]; | 238 | region.RegionName = (string)hash["region_name"]; |
241 | //m_log.Debug(">> HERE, region_name: " + region.RegionName); | 239 | //m_log.Debug(">> HERE, name: " + region.RegionName); |
242 | } | 240 | } |
243 | if (hash["hostname"] != null) | 241 | if (hash["hostname"] != null) |
244 | region.ExternalHostName = (string)hash["hostname"]; | 242 | region.ExternalHostName = (string)hash["hostname"]; |
245 | //m_log.Debug(">> HERE, hostname: " + region.ExternalHostName); | ||
246 | if (hash["http_port"] != null) | 243 | if (hash["http_port"] != null) |
247 | { | 244 | { |
248 | uint p = 0; | 245 | uint p = 0; |
249 | UInt32.TryParse((string)hash["http_port"], out p); | 246 | UInt32.TryParse((string)hash["http_port"], out p); |
250 | region.HttpPort = p; | 247 | region.HttpPort = p; |
251 | //m_log.Debug(">> HERE, http_port: " + region.HttpPort); | ||
252 | } | 248 | } |
253 | if (hash["internal_port"] != null) | 249 | if (hash["internal_port"] != null) |
254 | { | 250 | { |
255 | int p = 0; | 251 | int p = 0; |
256 | Int32.TryParse((string)hash["internal_port"], out p); | 252 | Int32.TryParse((string)hash["internal_port"], out p); |
257 | region.InternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), p); | 253 | region.InternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), p); |
258 | //m_log.Debug(">> HERE, internal_port: " + region.InternalEndPoint); | ||
259 | } | 254 | } |
260 | 255 | ||
261 | // Successful return | 256 | // Successful return |
diff --git a/OpenSim/Services/Connectors/Land/LandServiceConnector.cs b/OpenSim/Services/Connectors/Land/LandServiceConnector.cs index 4b25ac8..8143b5a 100644 --- a/OpenSim/Services/Connectors/Land/LandServiceConnector.cs +++ b/OpenSim/Services/Connectors/Land/LandServiceConnector.cs | |||
@@ -84,7 +84,8 @@ namespace OpenSim.Services.Connectors | |||
84 | if (info != null) // just to be sure | 84 | if (info != null) // just to be sure |
85 | { | 85 | { |
86 | XmlRpcRequest request = new XmlRpcRequest("land_data", paramList); | 86 | XmlRpcRequest request = new XmlRpcRequest("land_data", paramList); |
87 | XmlRpcResponse response = request.Send(info.ServerURI, 10000); | 87 | string uri = "http://" + info.ExternalEndPoint.Address + ":" + info.HttpPort + "/"; |
88 | XmlRpcResponse response = request.Send(uri, 10000); | ||
88 | if (response.IsFault) | 89 | if (response.IsFault) |
89 | { | 90 | { |
90 | m_log.ErrorFormat("[LAND CONNECTOR]: remote call returned an error: {0}", response.FaultString); | 91 | m_log.ErrorFormat("[LAND CONNECTOR]: remote call returned an error: {0}", response.FaultString); |
diff --git a/OpenSim/Services/Connectors/Neighbour/NeighbourServiceConnector.cs b/OpenSim/Services/Connectors/Neighbour/NeighbourServiceConnector.cs index 9c57a40..0a982f8 100644 --- a/OpenSim/Services/Connectors/Neighbour/NeighbourServiceConnector.cs +++ b/OpenSim/Services/Connectors/Neighbour/NeighbourServiceConnector.cs | |||
@@ -87,7 +87,7 @@ namespace OpenSim.Services.Connectors | |||
87 | 87 | ||
88 | public bool DoHelloNeighbourCall(GridRegion region, RegionInfo thisRegion) | 88 | public bool DoHelloNeighbourCall(GridRegion region, RegionInfo thisRegion) |
89 | { | 89 | { |
90 | string uri = region.ServerURI + "/region/" + thisRegion.RegionID + "/"; | 90 | string uri = "http://" + region.ExternalEndPoint.Address + ":" + region.HttpPort + "/region/" + thisRegion.RegionID + "/"; |
91 | //m_log.Debug(" >>> DoHelloNeighbourCall <<< " + uri); | 91 | //m_log.Debug(" >>> DoHelloNeighbourCall <<< " + uri); |
92 | 92 | ||
93 | WebRequest HelloNeighbourRequest = WebRequest.Create(uri); | 93 | WebRequest HelloNeighbourRequest = WebRequest.Create(uri); |
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs index 8076fab..168b233 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs | |||
@@ -145,6 +145,8 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
145 | Vector3d minPosition = new Vector3d(regionInfo.RegionLocX, regionInfo.RegionLocY, 0.0); | 145 | Vector3d minPosition = new Vector3d(regionInfo.RegionLocX, regionInfo.RegionLocY, 0.0); |
146 | Vector3d maxPosition = minPosition + new Vector3d(Constants.RegionSize, Constants.RegionSize, 4096.0); | 146 | Vector3d maxPosition = minPosition + new Vector3d(Constants.RegionSize, Constants.RegionSize, 4096.0); |
147 | 147 | ||
148 | string httpAddress = "http://" + regionInfo.ExternalHostName + ":" + regionInfo.HttpPort + "/"; | ||
149 | |||
148 | OSDMap extraData = new OSDMap | 150 | OSDMap extraData = new OSDMap |
149 | { | 151 | { |
150 | { "ServerURI", OSD.FromString(regionInfo.ServerURI) }, | 152 | { "ServerURI", OSD.FromString(regionInfo.ServerURI) }, |
@@ -166,7 +168,7 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
166 | { "Name", regionInfo.RegionName }, | 168 | { "Name", regionInfo.RegionName }, |
167 | { "MinPosition", minPosition.ToString() }, | 169 | { "MinPosition", minPosition.ToString() }, |
168 | { "MaxPosition", maxPosition.ToString() }, | 170 | { "MaxPosition", maxPosition.ToString() }, |
169 | { "Address", regionInfo.ServerURI }, | 171 | { "Address", httpAddress }, |
170 | { "Enabled", "1" }, | 172 | { "Enabled", "1" }, |
171 | { "ExtraData", OSDParser.SerializeJsonString(extraData) } | 173 | { "ExtraData", OSDParser.SerializeJsonString(extraData) } |
172 | }; | 174 | }; |
diff --git a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs index c4284eb..a5f748f 100644 --- a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs +++ b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs | |||
@@ -72,7 +72,7 @@ namespace OpenSim.Services.Connectors.Simulation | |||
72 | 72 | ||
73 | protected virtual string AgentPath() | 73 | protected virtual string AgentPath() |
74 | { | 74 | { |
75 | return "agent/"; | 75 | return "/agent/"; |
76 | } | 76 | } |
77 | 77 | ||
78 | public bool CreateAgent(GridRegion destination, AgentCircuitData aCircuit, uint flags, out string reason) | 78 | public bool CreateAgent(GridRegion destination, AgentCircuitData aCircuit, uint flags, out string reason) |
@@ -104,7 +104,26 @@ namespace OpenSim.Services.Connectors.Simulation | |||
104 | return false; | 104 | return false; |
105 | } | 105 | } |
106 | 106 | ||
107 | string uri = destination.ServerURI + AgentPath() + aCircuit.AgentID + "/"; | 107 | string uri = string.Empty; |
108 | |||
109 | // HACK -- Simian grid make it work!!! | ||
110 | if (destination.ServerURI != null && destination.ServerURI != string.Empty && !destination.ServerURI.StartsWith("http:")) | ||
111 | uri = "http://" + destination.ServerURI + AgentPath() + aCircuit.AgentID + "/"; | ||
112 | else | ||
113 | { | ||
114 | try | ||
115 | { | ||
116 | uri = "http://" + destination.ExternalEndPoint.Address + ":" + destination.HttpPort + AgentPath() + aCircuit.AgentID + "/"; | ||
117 | } | ||
118 | catch (Exception e) | ||
119 | { | ||
120 | m_log.Debug("[REMOTE SIMULATION CONNECTOR]: Unable to resolve external endpoint on agent create. Reason: " + e.Message); | ||
121 | reason = e.Message; | ||
122 | return false; | ||
123 | } | ||
124 | } | ||
125 | |||
126 | //Console.WriteLine(" >>> DoCreateChildAgentCall <<< " + uri); | ||
108 | 127 | ||
109 | AgentCreateRequest = (HttpWebRequest)WebRequest.Create(uri); | 128 | AgentCreateRequest = (HttpWebRequest)WebRequest.Create(uri); |
110 | AgentCreateRequest.Method = "POST"; | 129 | AgentCreateRequest.Method = "POST"; |
@@ -258,7 +277,17 @@ namespace OpenSim.Services.Connectors.Simulation | |||
258 | private bool UpdateAgent(GridRegion destination, IAgentData cAgentData) | 277 | private bool UpdateAgent(GridRegion destination, IAgentData cAgentData) |
259 | { | 278 | { |
260 | // Eventually, we want to use a caps url instead of the agentID | 279 | // Eventually, we want to use a caps url instead of the agentID |
261 | string uri = destination.ServerURI + AgentPath() + cAgentData.AgentID + "/"; | 280 | string uri = string.Empty; |
281 | try | ||
282 | { | ||
283 | uri = "http://" + destination.ExternalEndPoint.Address + ":" + destination.HttpPort + AgentPath() + cAgentData.AgentID + "/"; | ||
284 | } | ||
285 | catch (Exception e) | ||
286 | { | ||
287 | m_log.Debug("[REMOTE SIMULATION CONNECTOR]: Unable to resolve external endpoint on agent update. Reason: " + e.Message); | ||
288 | return false; | ||
289 | } | ||
290 | //Console.WriteLine(" >>> DoAgentUpdateCall <<< " + uri); | ||
262 | 291 | ||
263 | HttpWebRequest ChildUpdateRequest = (HttpWebRequest)WebRequest.Create(uri); | 292 | HttpWebRequest ChildUpdateRequest = (HttpWebRequest)WebRequest.Create(uri); |
264 | ChildUpdateRequest.Method = "PUT"; | 293 | ChildUpdateRequest.Method = "PUT"; |
@@ -356,7 +385,8 @@ namespace OpenSim.Services.Connectors.Simulation | |||
356 | { | 385 | { |
357 | agent = null; | 386 | agent = null; |
358 | // Eventually, we want to use a caps url instead of the agentID | 387 | // Eventually, we want to use a caps url instead of the agentID |
359 | string uri = destination.ServerURI + AgentPath() + id + "/" + destination.RegionID.ToString() + "/"; | 388 | string uri = "http://" + destination.ExternalEndPoint.Address + ":" + destination.HttpPort + AgentPath() + id + "/" + destination.RegionID.ToString() + "/"; |
389 | //Console.WriteLine(" >>> DoRetrieveRootAgentCall <<< " + uri); | ||
360 | 390 | ||
361 | HttpWebRequest request = (HttpWebRequest)WebRequest.Create(uri); | 391 | HttpWebRequest request = (HttpWebRequest)WebRequest.Create(uri); |
362 | request.Method = "GET"; | 392 | request.Method = "GET"; |
@@ -377,6 +407,7 @@ namespace OpenSim.Services.Connectors.Simulation | |||
377 | sr = new StreamReader(webResponse.GetResponseStream()); | 407 | sr = new StreamReader(webResponse.GetResponseStream()); |
378 | reply = sr.ReadToEnd().Trim(); | 408 | reply = sr.ReadToEnd().Trim(); |
379 | 409 | ||
410 | //Console.WriteLine("[REMOTE SIMULATION CONNECTOR]: ChilAgentUpdate reply was " + reply); | ||
380 | 411 | ||
381 | } | 412 | } |
382 | catch (WebException ex) | 413 | catch (WebException ex) |
@@ -397,6 +428,7 @@ namespace OpenSim.Services.Connectors.Simulation | |||
397 | OSDMap args = Util.GetOSDMap(reply); | 428 | OSDMap args = Util.GetOSDMap(reply); |
398 | if (args == null) | 429 | if (args == null) |
399 | { | 430 | { |
431 | //Console.WriteLine("[REMOTE SIMULATION CONNECTOR]: Error getting OSDMap from reply"); | ||
400 | return false; | 432 | return false; |
401 | } | 433 | } |
402 | 434 | ||
@@ -405,6 +437,7 @@ namespace OpenSim.Services.Connectors.Simulation | |||
405 | return true; | 437 | return true; |
406 | } | 438 | } |
407 | 439 | ||
440 | //Console.WriteLine("[REMOTE SIMULATION CONNECTOR]: DoRetrieveRootAgentCall returned status " + webResponse.StatusCode); | ||
408 | return false; | 441 | return false; |
409 | } | 442 | } |
410 | 443 | ||
@@ -446,8 +479,18 @@ namespace OpenSim.Services.Connectors.Simulation | |||
446 | 479 | ||
447 | public bool CloseAgent(GridRegion destination, UUID id) | 480 | public bool CloseAgent(GridRegion destination, UUID id) |
448 | { | 481 | { |
449 | string uri = destination.ServerURI + AgentPath() + id + "/" + destination.RegionID.ToString() + "/"; | 482 | string uri = string.Empty; |
483 | try | ||
484 | { | ||
485 | uri = "http://" + destination.ExternalEndPoint.Address + ":" + destination.HttpPort + AgentPath() + id + "/" + destination.RegionID.ToString() + "/"; | ||
486 | } | ||
487 | catch (Exception e) | ||
488 | { | ||
489 | m_log.Debug("[REMOTE SIMULATION CONNECTOR]: Unable to resolve external endpoint on agent close. Reason: " + e.Message); | ||
490 | return false; | ||
491 | } | ||
450 | 492 | ||
493 | //Console.WriteLine(" >>> DoCloseAgentCall <<< " + uri); | ||
451 | 494 | ||
452 | WebRequest request = WebRequest.Create(uri); | 495 | WebRequest request = WebRequest.Create(uri); |
453 | request.Method = "DELETE"; | 496 | request.Method = "DELETE"; |
@@ -495,7 +538,7 @@ namespace OpenSim.Services.Connectors.Simulation | |||
495 | public bool CreateObject(GridRegion destination, ISceneObject sog, bool isLocalCall) | 538 | public bool CreateObject(GridRegion destination, ISceneObject sog, bool isLocalCall) |
496 | { | 539 | { |
497 | string uri | 540 | string uri |
498 | = destination.ServerURI + ObjectPath() + sog.UUID + "/"; | 541 | = "http://" + destination.ExternalEndPoint.Address + ":" + destination.HttpPort + ObjectPath() + sog.UUID + "/"; |
499 | //m_log.Debug(" >>> DoCreateObjectCall <<< " + uri); | 542 | //m_log.Debug(" >>> DoCreateObjectCall <<< " + uri); |
500 | 543 | ||
501 | WebRequest ObjectCreateRequest = WebRequest.Create(uri); | 544 | WebRequest ObjectCreateRequest = WebRequest.Create(uri); |
diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index 125c2be..e7988d6 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs | |||
@@ -479,7 +479,7 @@ namespace OpenSim.Services.GridService | |||
479 | OpenSim.Data.RegionFlags flags = (OpenSim.Data.RegionFlags)Convert.ToInt32(r.Data["flags"]); | 479 | OpenSim.Data.RegionFlags flags = (OpenSim.Data.RegionFlags)Convert.ToInt32(r.Data["flags"]); |
480 | MainConsole.Instance.Output(String.Format("{0,-20} {1}\n{2,-20} {3}\n{4,-39} {5}\n\n", | 480 | MainConsole.Instance.Output(String.Format("{0,-20} {1}\n{2,-20} {3}\n{4,-39} {5}\n\n", |
481 | r.RegionName, r.RegionID, | 481 | r.RegionName, r.RegionID, |
482 | String.Format("{0},{1}", r.posX, r.posY), r.Data["serverURI"], | 482 | String.Format("{0},{1}", r.posX, r.posY), "http://" + r.Data["serverIP"].ToString() + ":" + r.Data["serverPort"].ToString(), |
483 | r.Data["owner_uuid"].ToString(), flags.ToString())); | 483 | r.Data["owner_uuid"].ToString(), flags.ToString())); |
484 | } | 484 | } |
485 | return; | 485 | return; |
diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs index 74e864b..a67404f 100644 --- a/OpenSim/Services/GridService/HypergridLinker.cs +++ b/OpenSim/Services/GridService/HypergridLinker.cs | |||
@@ -27,6 +27,7 @@ | |||
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Linq; | ||
30 | using System.Net; | 31 | using System.Net; |
31 | using System.Reflection; | 32 | using System.Reflection; |
32 | using System.Xml; | 33 | using System.Xml; |
@@ -127,7 +128,7 @@ namespace OpenSim.Services.GridService | |||
127 | if (MainConsole.Instance != null) | 128 | if (MainConsole.Instance != null) |
128 | { | 129 | { |
129 | MainConsole.Instance.Commands.AddCommand("hypergrid", false, "link-region", | 130 | MainConsole.Instance.Commands.AddCommand("hypergrid", false, "link-region", |
130 | "link-region <Xloc> <Yloc> <RegionIP> <RegionPort> [<RegionServerURI] [<RemoteRegionName>] <cr>", | 131 | "link-region <Xloc> <Yloc> <HostName>:<HttpPort>[:<RemoteRegionName>] <cr>", |
131 | "Link a hypergrid region", RunCommand); | 132 | "Link a hypergrid region", RunCommand); |
132 | MainConsole.Instance.Commands.AddCommand("hypergrid", false, "unlink-region", | 133 | MainConsole.Instance.Commands.AddCommand("hypergrid", false, "unlink-region", |
133 | "unlink-region <local name> or <HostName>:<HttpPort> <cr>", | 134 | "unlink-region <local name> or <HostName>:<HttpPort> <cr>", |
@@ -154,6 +155,11 @@ namespace OpenSim.Services.GridService | |||
154 | // From the command line link-region | 155 | // From the command line link-region |
155 | public GridRegion TryLinkRegionToCoords(UUID scopeID, string mapName, int xloc, int yloc, out string reason) | 156 | public GridRegion TryLinkRegionToCoords(UUID scopeID, string mapName, int xloc, int yloc, out string reason) |
156 | { | 157 | { |
158 | return TryLinkRegionToCoords(scopeID, mapName, xloc, yloc, UUID.Zero, out reason); | ||
159 | } | ||
160 | |||
161 | public GridRegion TryLinkRegionToCoords(UUID scopeID, string mapName, int xloc, int yloc, UUID ownerID, out string reason) | ||
162 | { | ||
157 | reason = string.Empty; | 163 | reason = string.Empty; |
158 | string host = "127.0.0.1"; | 164 | string host = "127.0.0.1"; |
159 | string portstr; | 165 | string portstr; |
@@ -189,7 +195,7 @@ namespace OpenSim.Services.GridService | |||
189 | //} | 195 | //} |
190 | 196 | ||
191 | GridRegion regInfo; | 197 | GridRegion regInfo; |
192 | bool success = TryCreateLink(scopeID, xloc, yloc, regionName, port, host, out regInfo, out reason); | 198 | bool success = TryCreateLink(scopeID, xloc, yloc, regionName, port, host, ownerID, out regInfo, out reason); |
193 | if (success) | 199 | if (success) |
194 | { | 200 | { |
195 | regInfo.RegionName = mapName; | 201 | regInfo.RegionName = mapName; |
@@ -198,7 +204,12 @@ namespace OpenSim.Services.GridService | |||
198 | 204 | ||
199 | return null; | 205 | return null; |
200 | } | 206 | } |
201 | public bool TryCreateLink(UUID scopeID, int xloc, int yloc, string externalRegionName, uint externalPort, string externalHostName, out GridRegion regInfo, out string reason) | 207 | |
208 | |||
209 | // From the command line and the 2 above | ||
210 | public bool TryCreateLink(UUID scopeID, int xloc, int yloc, | ||
211 | string externalRegionName, uint externalPort, string externalHostName, UUID ownerID, | ||
212 | out GridRegion regInfo, out string reason) | ||
202 | { | 213 | { |
203 | m_log.DebugFormat("[HYPERGRID LINKER]: Link to {0}:{1}:{2}, in {3}-{4}", externalHostName, externalPort, externalRegionName, xloc, yloc); | 214 | m_log.DebugFormat("[HYPERGRID LINKER]: Link to {0}:{1}:{2}, in {3}-{4}", externalHostName, externalPort, externalRegionName, xloc, yloc); |
204 | 215 | ||
@@ -210,13 +221,20 @@ namespace OpenSim.Services.GridService | |||
210 | regInfo.RegionLocX = xloc; | 221 | regInfo.RegionLocX = xloc; |
211 | regInfo.RegionLocY = yloc; | 222 | regInfo.RegionLocY = yloc; |
212 | regInfo.ScopeID = scopeID; | 223 | regInfo.ScopeID = scopeID; |
224 | regInfo.EstateOwner = ownerID; | ||
213 | 225 | ||
214 | // Big HACK for Simian Grid !!! | 226 | // Big HACK for Simian Grid !!! |
215 | // We need to clean up all URLs used in OpenSim !!! | 227 | // We need to clean up all URLs used in OpenSim !!! |
216 | if (externalHostName.Contains("/")) { | 228 | if (externalHostName.Contains("/")) |
217 | regInfo.ServerURI = externalHostName; | 229 | regInfo.ServerURI = externalHostName; |
218 | } else { | 230 | |
219 | regInfo.ServerURI = "http://" + externalHostName + ":" + externalPort.ToString(); | 231 | // Check for free coordinates |
232 | GridRegion region = m_GridService.GetRegionByPosition(regInfo.ScopeID, regInfo.RegionLocX, regInfo.RegionLocY); | ||
233 | if (region != null) | ||
234 | { | ||
235 | m_log.WarnFormat("[HYPERGRID LINKER]: Coordinates {0}-{1} are already occupied by region {2} with uuid {3}", regInfo.RegionLocX, regInfo.RegionLocY, region.RegionName, region.RegionID); | ||
236 | reason = "Coordinates are already in use"; | ||
237 | return false; | ||
220 | } | 238 | } |
221 | 239 | ||
222 | try | 240 | try |
@@ -240,11 +258,11 @@ namespace OpenSim.Services.GridService | |||
240 | 258 | ||
241 | if (regionID != UUID.Zero) | 259 | if (regionID != UUID.Zero) |
242 | { | 260 | { |
243 | GridRegion r = m_GridService.GetRegionByUUID(scopeID, regionID); | 261 | region = m_GridService.GetRegionByUUID(scopeID, regionID); |
244 | if (r != null) | 262 | if (region != null) |
245 | { | 263 | { |
246 | m_log.DebugFormat("[HYPERGRID LINKER]: Region already exists in coordinates {0} {1}", r.RegionLocX / Constants.RegionSize, r.RegionLocY / Constants.RegionSize); | 264 | m_log.DebugFormat("[HYPERGRID LINKER]: Region already exists in coordinates {0} {1}", region.RegionLocX / Constants.RegionSize, region.RegionLocY / Constants.RegionSize); |
247 | regInfo = r; | 265 | regInfo = region; |
248 | return true; | 266 | return true; |
249 | } | 267 | } |
250 | 268 | ||
@@ -354,17 +372,8 @@ namespace OpenSim.Services.GridService | |||
354 | { | 372 | { |
355 | // Check for regions which are not linked regions | 373 | // Check for regions which are not linked regions |
356 | List<GridRegion> hyperlinks = m_GridService.GetHyperlinks(m_ScopeID); | 374 | List<GridRegion> hyperlinks = m_GridService.GetHyperlinks(m_ScopeID); |
357 | // would like to use .Except, but doesn't seem to exist | 375 | IEnumerable<GridRegion> availableRegions = regions.Except(hyperlinks); |
358 | //IEnumerable<GridRegion> availableRegions = regions.Except(hyperlinks); | 376 | if (availableRegions.Count() == 0) |
359 | List<GridRegion> availableRegions = regions.FindAll(delegate(GridRegion region) | ||
360 | { | ||
361 | // Ewww! n^2 | ||
362 | if (hyperlinks.Find(delegate(GridRegion r) { return r.RegionID == region.RegionID; }) == null) // not hyperlink. good. | ||
363 | return true; | ||
364 | |||
365 | return false; | ||
366 | }); | ||
367 | if (availableRegions.Count == 0) | ||
368 | return false; | 377 | return false; |
369 | } | 378 | } |
370 | 379 | ||
@@ -508,16 +517,12 @@ namespace OpenSim.Services.GridService | |||
508 | int xloc, yloc; | 517 | int xloc, yloc; |
509 | uint externalPort; | 518 | uint externalPort; |
510 | string externalHostName; | 519 | string externalHostName; |
511 | string serverURI; | ||
512 | try | 520 | try |
513 | { | 521 | { |
514 | xloc = Convert.ToInt32(cmdparams[0]); | 522 | xloc = Convert.ToInt32(cmdparams[0]); |
515 | yloc = Convert.ToInt32(cmdparams[1]); | 523 | yloc = Convert.ToInt32(cmdparams[1]); |
516 | externalPort = Convert.ToUInt32(cmdparams[3]); | 524 | externalPort = Convert.ToUInt32(cmdparams[3]); |
517 | externalHostName = cmdparams[2]; | 525 | externalHostName = cmdparams[2]; |
518 | if ( cmdparams.Length == 4 ) { | ||
519 | |||
520 | } | ||
521 | //internalPort = Convert.ToUInt32(cmdparams[4]); | 526 | //internalPort = Convert.ToUInt32(cmdparams[4]); |
522 | //remotingPort = Convert.ToUInt32(cmdparams[5]); | 527 | //remotingPort = Convert.ToUInt32(cmdparams[5]); |
523 | } | 528 | } |
@@ -532,7 +537,7 @@ namespace OpenSim.Services.GridService | |||
532 | xloc = xloc * (int)Constants.RegionSize; | 537 | xloc = xloc * (int)Constants.RegionSize; |
533 | yloc = yloc * (int)Constants.RegionSize; | 538 | yloc = yloc * (int)Constants.RegionSize; |
534 | string reason = string.Empty; | 539 | string reason = string.Empty; |
535 | if (TryCreateLink(UUID.Zero, xloc, yloc, "", externalPort, externalHostName, out regInfo, out reason)) | 540 | if (TryCreateLink(UUID.Zero, xloc, yloc, "", externalPort, externalHostName, UUID.Zero, out regInfo, out reason)) |
536 | { | 541 | { |
537 | if (cmdparams.Length >= 5) | 542 | if (cmdparams.Length >= 5) |
538 | { | 543 | { |
@@ -634,8 +639,7 @@ namespace OpenSim.Services.GridService | |||
634 | xloc = xloc * (int)Constants.RegionSize; | 639 | xloc = xloc * (int)Constants.RegionSize; |
635 | yloc = yloc * (int)Constants.RegionSize; | 640 | yloc = yloc * (int)Constants.RegionSize; |
636 | string reason = string.Empty; | 641 | string reason = string.Empty; |
637 | if (TryCreateLink(UUID.Zero, xloc, yloc, "", externalPort, | 642 | if (TryCreateLink(UUID.Zero, xloc, yloc, "", externalPort, externalHostName, UUID.Zero, out regInfo, out reason)) |
638 | externalHostName, out regInfo, out reason)) | ||
639 | { | 643 | { |
640 | regInfo.RegionName = config.GetString("localName", ""); | 644 | regInfo.RegionName = config.GetString("localName", ""); |
641 | } | 645 | } |
diff --git a/OpenSim/Services/HypergridService/GatekeeperService.cs b/OpenSim/Services/HypergridService/GatekeeperService.cs index 9e96163..3f5c4f1 100644 --- a/OpenSim/Services/HypergridService/GatekeeperService.cs +++ b/OpenSim/Services/HypergridService/GatekeeperService.cs | |||
@@ -157,7 +157,7 @@ namespace OpenSim.Services.HypergridService | |||
157 | string regionimage = "regionImage" + region.RegionID.ToString(); | 157 | string regionimage = "regionImage" + region.RegionID.ToString(); |
158 | regionimage = regionimage.Replace("-", ""); | 158 | regionimage = regionimage.Replace("-", ""); |
159 | 159 | ||
160 | imageURL = region.ServerURI + "index.php?method=" + regionimage; | 160 | imageURL = "http://" + region.ExternalHostName + ":" + region.HttpPort + "/index.php?method=" + regionimage; |
161 | 161 | ||
162 | return true; | 162 | return true; |
163 | } | 163 | } |
diff --git a/OpenSim/Services/HypergridService/UserAgentService.cs b/OpenSim/Services/HypergridService/UserAgentService.cs index aed2dc8..eb6433c 100644 --- a/OpenSim/Services/HypergridService/UserAgentService.cs +++ b/OpenSim/Services/HypergridService/UserAgentService.cs | |||
@@ -136,7 +136,6 @@ namespace OpenSim.Services.HypergridService | |||
136 | m_log.DebugFormat("[USER AGENT SERVICE]: Request to login user {0} {1} (@{2}) to grid {3}", | 136 | m_log.DebugFormat("[USER AGENT SERVICE]: Request to login user {0} {1} (@{2}) to grid {3}", |
137 | agentCircuit.firstname, agentCircuit.lastname, ((clientIP == null) ? "stored IP" : clientIP.Address.ToString()), | 137 | agentCircuit.firstname, agentCircuit.lastname, ((clientIP == null) ? "stored IP" : clientIP.Address.ToString()), |
138 | gatekeeper.ExternalHostName +":"+ gatekeeper.HttpPort); | 138 | gatekeeper.ExternalHostName +":"+ gatekeeper.HttpPort); |
139 | m_log.Debug("gatekeeper serveruri -> " + gatekeeper.ServerURI ); | ||
140 | 139 | ||
141 | // Take the IP address + port of the gatekeeper (reg) plus the info of finalDestination | 140 | // Take the IP address + port of the gatekeeper (reg) plus the info of finalDestination |
142 | GridRegion region = new GridRegion(gatekeeper); | 141 | GridRegion region = new GridRegion(gatekeeper); |
@@ -146,12 +145,12 @@ namespace OpenSim.Services.HypergridService | |||
146 | region.RegionLocY = finalDestination.RegionLocY; | 145 | region.RegionLocY = finalDestination.RegionLocY; |
147 | 146 | ||
148 | // Generate a new service session | 147 | // Generate a new service session |
149 | agentCircuit.ServiceSessionID = region.ServerURI + ";" + UUID.Random(); | 148 | agentCircuit.ServiceSessionID = "http://" + region.ExternalHostName + ":" + region.HttpPort + ";" + UUID.Random(); |
150 | TravelingAgentInfo old = UpdateTravelInfo(agentCircuit, region); | 149 | TravelingAgentInfo old = UpdateTravelInfo(agentCircuit, region); |
151 | 150 | ||
152 | bool success = false; | 151 | bool success = false; |
153 | string myExternalIP = string.Empty; | 152 | string myExternalIP = string.Empty; |
154 | string gridName = gatekeeper.ServerURI; | 153 | string gridName = "http://" + gatekeeper.ExternalHostName + ":" + gatekeeper.HttpPort; |
155 | if (m_GridName == gridName) | 154 | if (m_GridName == gridName) |
156 | success = m_GatekeeperService.LoginAgent(agentCircuit, finalDestination, out reason); | 155 | success = m_GatekeeperService.LoginAgent(agentCircuit, finalDestination, out reason); |
157 | else | 156 | else |
@@ -160,7 +159,7 @@ namespace OpenSim.Services.HypergridService | |||
160 | if (!success) | 159 | if (!success) |
161 | { | 160 | { |
162 | m_log.DebugFormat("[USER AGENT SERVICE]: Unable to login user {0} {1} to grid {2}, reason: {3}", | 161 | m_log.DebugFormat("[USER AGENT SERVICE]: Unable to login user {0} {1} to grid {2}, reason: {3}", |
163 | agentCircuit.firstname, agentCircuit.lastname, region.ServerURI, reason); | 162 | agentCircuit.firstname, agentCircuit.lastname, region.ExternalHostName + ":" + region.HttpPort, reason); |
164 | 163 | ||
165 | // restore the old travel info | 164 | // restore the old travel info |
166 | lock (m_TravelingAgents) | 165 | lock (m_TravelingAgents) |
@@ -211,7 +210,7 @@ namespace OpenSim.Services.HypergridService | |||
211 | m_TravelingAgents[agentCircuit.SessionID] = travel; | 210 | m_TravelingAgents[agentCircuit.SessionID] = travel; |
212 | } | 211 | } |
213 | travel.UserID = agentCircuit.AgentID; | 212 | travel.UserID = agentCircuit.AgentID; |
214 | travel.GridExternalName = region.ServerURI; | 213 | travel.GridExternalName = "http://" + region.ExternalHostName + ":" + region.HttpPort; |
215 | travel.ServiceToken = agentCircuit.ServiceSessionID; | 214 | travel.ServiceToken = agentCircuit.ServiceSessionID; |
216 | if (old != null) | 215 | if (old != null) |
217 | travel.ClientIPAddress = old.ClientIPAddress; | 216 | travel.ClientIPAddress = old.ClientIPAddress; |
diff --git a/OpenSim/Services/Interfaces/IGridService.cs b/OpenSim/Services/Interfaces/IGridService.cs index 6d3bff7..77230a3 100644 --- a/OpenSim/Services/Interfaces/IGridService.cs +++ b/OpenSim/Services/Interfaces/IGridService.cs | |||
@@ -115,20 +115,8 @@ namespace OpenSim.Services.Interfaces | |||
115 | /// </summary> | 115 | /// </summary> |
116 | public string ServerURI | 116 | public string ServerURI |
117 | { | 117 | { |
118 | get { | 118 | get { return m_serverURI; } |
119 | if ( m_serverURI != string.Empty ) { | 119 | set { m_serverURI = value; } |
120 | return m_serverURI; | ||
121 | } else { | ||
122 | return "http://" + m_externalHostName + ":" + m_httpPort + "/"; | ||
123 | } | ||
124 | } | ||
125 | set { | ||
126 | if ( value.EndsWith("/") ) { | ||
127 | m_serverURI = value; | ||
128 | } else { | ||
129 | m_serverURI = value + '/'; | ||
130 | } | ||
131 | } | ||
132 | } | 120 | } |
133 | protected string m_serverURI; | 121 | protected string m_serverURI; |
134 | 122 | ||
@@ -176,7 +164,6 @@ namespace OpenSim.Services.Interfaces | |||
176 | 164 | ||
177 | public GridRegion() | 165 | public GridRegion() |
178 | { | 166 | { |
179 | m_serverURI = string.Empty; | ||
180 | } | 167 | } |
181 | 168 | ||
182 | public GridRegion(int regionLocX, int regionLocY, IPEndPoint internalEndPoint, string externalUri) | 169 | public GridRegion(int regionLocX, int regionLocY, IPEndPoint internalEndPoint, string externalUri) |
diff --git a/OpenSim/Services/LLLoginService/LLLoginResponse.cs b/OpenSim/Services/LLLoginService/LLLoginResponse.cs index f985ab2..0da1715 100644 --- a/OpenSim/Services/LLLoginService/LLLoginResponse.cs +++ b/OpenSim/Services/LLLoginService/LLLoginResponse.cs | |||
@@ -333,7 +333,34 @@ namespace OpenSim.Services.LLLoginService | |||
333 | 333 | ||
334 | private void FillOutSeedCap(AgentCircuitData aCircuit, GridRegion destination, IPEndPoint ipepClient) | 334 | private void FillOutSeedCap(AgentCircuitData aCircuit, GridRegion destination, IPEndPoint ipepClient) |
335 | { | 335 | { |
336 | SeedCapability = destination.ServerURI + CapsUtil.GetCapsSeedPath(aCircuit.CapsPath); | 336 | string capsSeedPath = String.Empty; |
337 | |||
338 | // Don't use the following! It Fails for logging into any region not on the same port as the http server! | ||
339 | // Kept here so it doesn't happen again! | ||
340 | // response.SeedCapability = regionInfo.ServerURI + capsSeedPath; | ||
341 | |||
342 | #region IP Translation for NAT | ||
343 | if (ipepClient != null) | ||
344 | { | ||
345 | capsSeedPath | ||
346 | = "http://" | ||
347 | + NetworkUtil.GetHostFor(ipepClient.Address, destination.ExternalHostName) | ||
348 | + ":" | ||
349 | + destination.HttpPort | ||
350 | + CapsUtil.GetCapsSeedPath(aCircuit.CapsPath); | ||
351 | } | ||
352 | else | ||
353 | { | ||
354 | capsSeedPath | ||
355 | = "http://" | ||
356 | + destination.ExternalHostName | ||
357 | + ":" | ||
358 | + destination.HttpPort | ||
359 | + CapsUtil.GetCapsSeedPath(aCircuit.CapsPath); | ||
360 | } | ||
361 | #endregion | ||
362 | |||
363 | SeedCapability = capsSeedPath; | ||
337 | } | 364 | } |
338 | 365 | ||
339 | private void SetDefaultValues() | 366 | private void SetDefaultValues() |