aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenSim/Data/MySQL/MySQLRegionData.cs4
-rw-r--r--OpenSim/Data/MySQL/Resources/GridStore.migrations7
-rw-r--r--OpenSim/Framework/Capabilities/CapsUtil.cs2
-rw-r--r--OpenSim/Framework/RegionInfo.cs39
-rw-r--r--OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs4
-rw-r--r--OpenSim/Region/Application/OpenSimBase.cs2
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs2
-rw-r--r--OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs6
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs58
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs9
-rw-r--r--OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs4
-rw-r--r--OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs4
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs1
-rw-r--r--OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs10
-rw-r--r--OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs38
-rw-r--r--OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs2
-rw-r--r--OpenSim/Services/Connectors/Land/LandServiceConnector.cs3
-rw-r--r--OpenSim/Services/Connectors/Neighbour/NeighbourServiceConnector.cs2
-rw-r--r--OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs4
-rw-r--r--OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs57
-rw-r--r--OpenSim/Services/GridService/GridService.cs2
-rw-r--r--OpenSim/Services/GridService/HypergridLinker.cs115
-rw-r--r--OpenSim/Services/HypergridService/GatekeeperService.cs6
-rw-r--r--OpenSim/Services/HypergridService/UserAgentService.cs22
-rw-r--r--OpenSim/Services/Interfaces/IGridService.cs17
-rw-r--r--OpenSim/Services/LLLoginService/LLLoginResponse.cs29
-rw-r--r--OpenSim/Services/LLLoginService/LLLoginService.cs7
27 files changed, 242 insertions, 214 deletions
diff --git a/OpenSim/Data/MySQL/MySQLRegionData.cs b/OpenSim/Data/MySQL/MySQLRegionData.cs
index efefad9..d04e3dc 100644
--- a/OpenSim/Data/MySQL/MySQLRegionData.cs
+++ b/OpenSim/Data/MySQL/MySQLRegionData.cs
@@ -212,8 +212,8 @@ namespace OpenSim.Data.MySQL
212 if (data.Data.ContainsKey("locY")) 212 if (data.Data.ContainsKey("locY"))
213 data.Data.Remove("locY"); 213 data.Data.Remove("locY");
214 214
215 if (data.RegionName.Length > 32) 215 if (data.RegionName.Length > 128)
216 data.RegionName = data.RegionName.Substring(0, 32); 216 data.RegionName = data.RegionName.Substring(0, 128);
217 217
218 string[] fields = new List<string>(data.Data.Keys).ToArray(); 218 string[] fields = new List<string>(data.Data.Keys).ToArray();
219 219
diff --git a/OpenSim/Data/MySQL/Resources/GridStore.migrations b/OpenSim/Data/MySQL/Resources/GridStore.migrations
index 523a8ac..eda6dbb 100644
--- a/OpenSim/Data/MySQL/Resources/GridStore.migrations
+++ b/OpenSim/Data/MySQL/Resources/GridStore.migrations
@@ -87,3 +87,10 @@ ALTER TABLE `regions` ADD COLUMN `Token` varchar(255) NOT NULL;
87COMMIT; 87COMMIT;
88 88
89 89
90:VERSION 8 # ------------
91
92BEGIN;
93
94alter table regions modify column regionName varchar(128) default NULL;
95
96COMMIT;
diff --git a/OpenSim/Framework/Capabilities/CapsUtil.cs b/OpenSim/Framework/Capabilities/CapsUtil.cs
index 0334e4b..faf2708 100644
--- a/OpenSim/Framework/Capabilities/CapsUtil.cs
+++ b/OpenSim/Framework/Capabilities/CapsUtil.cs
@@ -41,7 +41,7 @@ namespace OpenSim.Framework.Capabilities
41 /// <returns></returns> 41 /// <returns></returns>
42 public static string GetCapsSeedPath(string capsObjectPath) 42 public static string GetCapsSeedPath(string capsObjectPath)
43 { 43 {
44 return "/CAPS/" + capsObjectPath + "0000/"; 44 return "CAPS/" + capsObjectPath + "0000/";
45 } 45 }
46 46
47 /// <summary> 47 /// <summary>
diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs
index 806142f..d154bff 100644
--- a/OpenSim/Framework/RegionInfo.cs
+++ b/OpenSim/Framework/RegionInfo.cs
@@ -117,8 +117,20 @@ namespace OpenSim.Framework
117 /// </summary> 117 /// </summary>
118 public string ServerURI 118 public string ServerURI
119 { 119 {
120 get { return m_serverURI; } 120 get {
121 set { m_serverURI = value; } 121 if ( m_serverURI != string.Empty ) {
122 return m_serverURI;
123 } else {
124 return "http://" + m_externalHostName + ":" + m_httpPort + "/";
125 }
126 }
127 set {
128 if ( value.EndsWith("/") ) {
129 m_serverURI = value;
130 } else {
131 m_serverURI = value + '/';
132 }
133 }
122 } 134 }
123 protected string m_serverURI; 135 protected string m_serverURI;
124 136
@@ -143,6 +155,7 @@ namespace OpenSim.Framework
143 155
144 public SimpleRegionInfo() 156 public SimpleRegionInfo()
145 { 157 {
158 m_serverURI = string.Empty;
146 } 159 }
147 160
148 public SimpleRegionInfo(uint regionLocX, uint regionLocY, IPEndPoint internalEndPoint, string externalUri) 161 public SimpleRegionInfo(uint regionLocX, uint regionLocY, IPEndPoint internalEndPoint, string externalUri)
@@ -152,6 +165,7 @@ namespace OpenSim.Framework
152 165
153 m_internalEndPoint = internalEndPoint; 166 m_internalEndPoint = internalEndPoint;
154 m_externalHostName = externalUri; 167 m_externalHostName = externalUri;
168 m_serverURI = string.Empty;
155 } 169 }
156 170
157 public SimpleRegionInfo(uint regionLocX, uint regionLocY, string externalUri, uint port) 171 public SimpleRegionInfo(uint regionLocX, uint regionLocY, string externalUri, uint port)
@@ -162,6 +176,7 @@ namespace OpenSim.Framework
162 m_externalHostName = externalUri; 176 m_externalHostName = externalUri;
163 177
164 m_internalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), (int) port); 178 m_internalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), (int) port);
179 m_serverURI = string.Empty;
165 } 180 }
166 181
167 public SimpleRegionInfo(RegionInfo ConvertFrom) 182 public SimpleRegionInfo(RegionInfo ConvertFrom)
@@ -451,6 +466,7 @@ namespace OpenSim.Framework
451 configMember = 466 configMember =
452 new ConfigurationMember(xmlNode, description, loadConfigurationOptions, handleIncomingConfiguration, !skipConsoleConfig); 467 new ConfigurationMember(xmlNode, description, loadConfigurationOptions, handleIncomingConfiguration, !skipConsoleConfig);
453 configMember.performConfigurationRetrieve(); 468 configMember.performConfigurationRetrieve();
469 m_serverURI = string.Empty;
454 } 470 }
455 471
456 public RegionInfo(uint regionLocX, uint regionLocY, IPEndPoint internalEndPoint, string externalUri) 472 public RegionInfo(uint regionLocX, uint regionLocY, IPEndPoint internalEndPoint, string externalUri)
@@ -460,10 +476,12 @@ namespace OpenSim.Framework
460 476
461 m_internalEndPoint = internalEndPoint; 477 m_internalEndPoint = internalEndPoint;
462 m_externalHostName = externalUri; 478 m_externalHostName = externalUri;
479 m_serverURI = string.Empty;
463 } 480 }
464 481
465 public RegionInfo() 482 public RegionInfo()
466 { 483 {
484 m_serverURI = string.Empty;
467 } 485 }
468 486
469 public EstateSettings EstateSettings 487 public EstateSettings EstateSettings
@@ -553,10 +571,23 @@ namespace OpenSim.Framework
553 /// <summary> 571 /// <summary>
554 /// A well-formed URI for the host region server (namely "http://" + ExternalHostName) 572 /// A well-formed URI for the host region server (namely "http://" + ExternalHostName)
555 /// </summary> 573 /// </summary>
574
556 public string ServerURI 575 public string ServerURI
557 { 576 {
558 get { return m_serverURI; } 577 get {
559 set { m_serverURI = value; } 578 if ( m_serverURI != string.Empty ) {
579 return m_serverURI;
580 } else {
581 return "http://" + m_externalHostName + ":" + m_httpPort + "/";
582 }
583 }
584 set {
585 if ( value.EndsWith("/") ) {
586 m_serverURI = value;
587 } else {
588 m_serverURI = value + '/';
589 }
590 }
560 } 591 }
561 592
562 public string RegionName 593 public string RegionName
diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
index 30505f6..3c58a7d 100644
--- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
+++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
@@ -348,7 +348,7 @@ namespace OpenSim.Framework.Servers.HttpServer
348 { 348 {
349 try 349 try
350 { 350 {
351// m_log.Debug("[BASE HTTP SERVER]: Handling request to " + request.RawUrl); 351 //m_log.Debug("[BASE HTTP SERVER]: Handling request to " + request.RawUrl);
352 352
353 Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US", true); 353 Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US", true);
354 354
@@ -376,7 +376,7 @@ namespace OpenSim.Framework.Servers.HttpServer
376 string path = request.RawUrl; 376 string path = request.RawUrl;
377 string handlerKey = GetHandlerKey(request.HttpMethod, path); 377 string handlerKey = GetHandlerKey(request.HttpMethod, path);
378 378
379// m_log.DebugFormat("[BASE HTTP SERVER]: Handling {0} request for {1}", request.HttpMethod, path); 379 //m_log.DebugFormat("[BASE HTTP SERVER]: Handling {0} request for {1}", request.HttpMethod, path);
380 380
381 if (TryGetStreamHandler(handlerKey, out requestHandler)) 381 if (TryGetStreamHandler(handlerKey, out requestHandler))
382 { 382 {
diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs
index 6a7272d..05fa331 100644
--- a/OpenSim/Region/Application/OpenSimBase.cs
+++ b/OpenSim/Region/Application/OpenSimBase.cs
@@ -336,8 +336,8 @@ namespace OpenSim
336 //regionInfo.originRegionID = regionInfo.RegionID; 336 //regionInfo.originRegionID = regionInfo.RegionID;
337 337
338 // set initial ServerURI 338 // set initial ServerURI
339 regionInfo.ServerURI = "http://" + regionInfo.ExternalHostName + ":" + regionInfo.InternalEndPoint.Port;
340 regionInfo.HttpPort = m_httpServerPort; 339 regionInfo.HttpPort = m_httpServerPort;
340 regionInfo.ServerURI = "http://" + regionInfo.ExternalHostName + ":" + regionInfo.HttpPort.ToString() + "/";
341 341
342 regionInfo.osSecret = m_osSecret; 342 regionInfo.osSecret = m_osSecret;
343 343
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
index 6985449..7396c2d 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
@@ -648,7 +648,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
648 IClientAPI client; 648 IClientAPI client;
649 if (!m_scene.TryGetClient(address, out client) || !(client is LLClientView)) 649 if (!m_scene.TryGetClient(address, out client) || !(client is LLClientView))
650 { 650 {
651 //m_log.Debug("[LLUDPSERVER]: Received a " + packet.Type + " packet from an unrecognized source: " + address + " in " + m_scene.RegionInfo.RegionName); 651 m_log.Debug("[LLUDPSERVER]: Received a " + packet.Type + " packet from an unrecognized source: " + address + " in " + m_scene.RegionInfo.RegionName);
652 return; 652 return;
653 } 653 }
654 654
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs
index d8e0f96..80adc46 100644
--- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs
@@ -598,7 +598,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
598 try 598 try
599 { 599 {
600 600
601 XmlRpcResponse GridResp = GridReq.Send("http://" + reginfo.ExternalHostName + ":" + reginfo.HttpPort, 3000); 601 XmlRpcResponse GridResp = GridReq.Send(reginfo.ServerURI, 3000);
602 602
603 Hashtable responseData = (Hashtable)GridResp.Value; 603 Hashtable responseData = (Hashtable)GridResp.Value;
604 604
@@ -620,8 +620,8 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
620 } 620 }
621 catch (WebException e) 621 catch (WebException e)
622 { 622 {
623 m_log.ErrorFormat("[GRID INSTANT MESSAGE]: Error sending message to http://{0}:{1} the host didn't respond ({2})", 623 m_log.ErrorFormat("[GRID INSTANT MESSAGE]: Error sending message to {0}} the host didn't respond ({2})",
624 reginfo.ExternalHostName, reginfo.HttpPort, e.Message); 624 reginfo.ServerURI, e.Message);
625 } 625 }
626 626
627 return false; 627 return false;
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
index aa7a1cd..b5da625 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
@@ -197,9 +197,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
197 sp.ControllingClient.SendTeleportFailed("Problem at destination"); 197 sp.ControllingClient.SendTeleportFailed("Problem at destination");
198 return; 198 return;
199 } 199 }
200 200 m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Final destination is x={0} y={1} {2}@{3}",
201 m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Final destination is x={0} y={1} uuid={2}", 201 finalDestination.RegionLocX / Constants.RegionSize, finalDestination.RegionLocY / Constants.RegionSize, finalDestination.RegionID, finalDestination.ServerURI);
202 finalDestination.RegionLocX / Constants.RegionSize, finalDestination.RegionLocY / Constants.RegionSize, finalDestination.RegionID);
203 202
204 // Check that these are not the same coordinates 203 // Check that these are not the same coordinates
205 if (finalDestination.RegionLocX == sp.Scene.RegionInfo.RegionLocX && 204 if (finalDestination.RegionLocX == sp.Scene.RegionInfo.RegionLocX &&
@@ -255,8 +254,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
255 } 254 }
256 255
257 m_log.DebugFormat( 256 m_log.DebugFormat(
258 "[ENTITY TRANSFER MODULE]: Request Teleport to {0}:{1}:{2}/{3}", 257 "[ENTITY TRANSFER MODULE]: Request Teleport to {0} ({1}) {2}/{3}",
259 reg.ExternalHostName, reg.HttpPort, finalDestination.RegionName, position); 258 reg.ServerURI, finalDestination.ServerURI, finalDestination.RegionName, position);
260 259
261 uint newRegionX = (uint)(reg.RegionHandle >> 40); 260 uint newRegionX = (uint)(reg.RegionHandle >> 40);
262 uint newRegionY = (((uint)(reg.RegionHandle)) >> 8); 261 uint newRegionY = (((uint)(reg.RegionHandle)) >> 8);
@@ -328,43 +327,21 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
328 327
329 // OK, it got this agent. Let's close some child agents 328 // OK, it got this agent. Let's close some child agents
330 sp.CloseChildAgents(newRegionX, newRegionY); 329 sp.CloseChildAgents(newRegionX, newRegionY);
331 330 IClientIPEndpoint ipepClient;
332 if (NeedsNewAgent(oldRegionX, newRegionX, oldRegionY, newRegionY)) 331 if (NeedsNewAgent(oldRegionX, newRegionX, oldRegionY, newRegionY))
333 { 332 {
334 //sp.ControllingClient.SendTeleportProgress(teleportFlags, "Creating agent..."); 333 //sp.ControllingClient.SendTeleportProgress(teleportFlags, "Creating agent...");
335
336 #region IP Translation for NAT 334 #region IP Translation for NAT
337 IClientIPEndpoint ipepClient; 335 // Uses ipepClient above
338 if (sp.ClientView.TryGet(out ipepClient)) 336 if (sp.ClientView.TryGet(out ipepClient))
339 { 337 {
340 capsPath 338 endPoint.Address = NetworkUtil.GetIPFor(ipepClient.EndPoint, endPoint.Address);
341 = "http://"
342 + NetworkUtil.GetHostFor(ipepClient.EndPoint, finalDestination.ExternalHostName)
343 + ":"
344 + finalDestination.HttpPort
345 + CapsUtil.GetCapsSeedPath(agentCircuit.CapsPath);
346 }
347 else
348 {
349 capsPath
350 = "http://"
351 + finalDestination.ExternalHostName
352 + ":"
353 + finalDestination.HttpPort
354 + CapsUtil.GetCapsSeedPath(agentCircuit.CapsPath);
355 } 339 }
356 #endregion 340 #endregion
341 capsPath = finalDestination.ServerURI + CapsUtil.GetCapsSeedPath(agentCircuit.CapsPath);
357 342
358 if (eq != null) 343 if (eq != null)
359 { 344 {
360 #region IP Translation for NAT
361 // Uses ipepClient above
362 if (sp.ClientView.TryGet(out ipepClient))
363 {
364 endPoint.Address = NetworkUtil.GetIPFor(ipepClient.EndPoint, endPoint.Address);
365 }
366 #endregion
367
368 eq.EnableSimulator(destinationHandle, endPoint, sp.UUID); 345 eq.EnableSimulator(destinationHandle, endPoint, sp.UUID);
369 346
370 // ES makes the client send a UseCircuitCode message to the destination, 347 // ES makes the client send a UseCircuitCode message to the destination,
@@ -383,8 +360,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
383 else 360 else
384 { 361 {
385 agentCircuit.CapsPath = sp.Scene.CapsModule.GetChildSeed(sp.UUID, reg.RegionHandle); 362 agentCircuit.CapsPath = sp.Scene.CapsModule.GetChildSeed(sp.UUID, reg.RegionHandle);
386 capsPath = "http://" + finalDestination.ExternalHostName + ":" + finalDestination.HttpPort 363 capsPath = finalDestination.ServerURI + CapsUtil.GetCapsSeedPath(agentCircuit.CapsPath);
387 + "/CAPS/" + agentCircuit.CapsPath + "0000/";
388 } 364 }
389 365
390 // Expect avatar crossing is a heavy-duty function at the destination. 366 // Expect avatar crossing is a heavy-duty function at the destination.
@@ -518,8 +494,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
518 494
519 protected virtual void SetCallbackURL(AgentData agent, RegionInfo region) 495 protected virtual void SetCallbackURL(AgentData agent, RegionInfo region)
520 { 496 {
521 agent.CallbackURI = "http://" + region.ExternalHostName + ":" + region.HttpPort + 497 agent.CallbackURI = region.ServerURI + "agent/" + agent.AgentID.ToString() + "/" + region.RegionID.ToString() + "/release/";
522 "/agent/" + agent.AgentID.ToString() + "/" + region.RegionID.ToString() + "/release/"; 498 m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Set callback URL to {0}", agent.CallbackURI);
523 499
524 } 500 }
525 501
@@ -863,8 +839,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
863 cAgent.Position = pos; 839 cAgent.Position = pos;
864 if (isFlying) 840 if (isFlying)
865 cAgent.ControlFlags |= (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY; 841 cAgent.ControlFlags |= (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY;
866 cAgent.CallbackURI = "http://" + m_scene.RegionInfo.ExternalHostName + ":" + m_scene.RegionInfo.HttpPort + 842 cAgent.CallbackURI = m_scene.RegionInfo.ServerURI +
867 "/agent/" + agent.UUID.ToString() + "/" + m_scene.RegionInfo.RegionID.ToString() + "/release/"; 843 "agent/" + agent.UUID.ToString() + "/" + m_scene.RegionInfo.RegionID.ToString() + "/release/";
868 844
869 if (!m_scene.SimulationService.UpdateAgent(neighbourRegion, cAgent)) 845 if (!m_scene.SimulationService.UpdateAgent(neighbourRegion, cAgent))
870 { 846 {
@@ -889,10 +865,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
889 neighbourRegion.RegionHandle); 865 neighbourRegion.RegionHandle);
890 return agent; 866 return agent;
891 } 867 }
892 // TODO Should construct this behind a method 868 string capsPath = neighbourRegion.ServerURI + CapsUtil.GetCapsSeedPath(agentcaps);
893 string capsPath =
894 "http://" + neighbourRegion.ExternalHostName + ":" + neighbourRegion.HttpPort
895 + "/CAPS/" + agentcaps /*circuitdata.CapsPath*/ + "0000/";
896 869
897 m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Sending new CAPS seed url {0} to client {1}", capsPath, agent.UUID); 870 m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Sending new CAPS seed url {0} to client {1}", capsPath, agent.UUID);
898 871
@@ -1222,8 +1195,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1222 y = y / Constants.RegionSize; 1195 y = y / Constants.RegionSize;
1223 m_log.Debug("[ENTITY TRANSFER MODULE]: Starting to inform client about neighbour " + x + ", " + y + "(" + endPoint.ToString() + ")"); 1196 m_log.Debug("[ENTITY TRANSFER MODULE]: Starting to inform client about neighbour " + x + ", " + y + "(" + endPoint.ToString() + ")");
1224 1197
1225 string capsPath = "http://" + reg.ExternalHostName + ":" + reg.HttpPort 1198 string capsPath = reg.ServerURI + CapsUtil.GetCapsSeedPath(a.CapsPath);
1226 + "/CAPS/" + a.CapsPath + "0000/";
1227 1199
1228 string reason = String.Empty; 1200 string reason = String.Empty;
1229 1201
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs
index 47898cc..c75bc0a 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs
@@ -123,7 +123,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
123 if ((flags & (int)OpenSim.Data.RegionFlags.Hyperlink) != 0) 123 if ((flags & (int)OpenSim.Data.RegionFlags.Hyperlink) != 0)
124 { 124 {
125 m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Destination region {0} is hyperlink", region.RegionID); 125 m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Destination region {0} is hyperlink", region.RegionID);
126 return m_GatekeeperConnector.GetHyperlinkRegion(region, region.RegionID); 126 GridRegion real_destination = m_GatekeeperConnector.GetHyperlinkRegion(region, region.RegionID);
127 m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: GetFinalDestination serveruri -> {0}", real_destination.ServerURI);
128 return real_destination;
127 } 129 }
128 return region; 130 return region;
129 } 131 }
@@ -149,6 +151,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
149 151
150 protected override bool CreateAgent(ScenePresence sp, GridRegion reg, GridRegion finalDestination, AgentCircuitData agentCircuit, uint teleportFlags, out string reason, out bool logout) 152 protected override bool CreateAgent(ScenePresence sp, GridRegion reg, GridRegion finalDestination, AgentCircuitData agentCircuit, uint teleportFlags, out string reason, out bool logout)
151 { 153 {
154 m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: CreateAgent {0} {1}", reg.ServerURI, finalDestination.ServerURI);
152 reason = string.Empty; 155 reason = string.Empty;
153 logout = false; 156 logout = false;
154 int flags = m_aScene.GridService.GetRegionFlags(m_aScene.RegionInfo.ScopeID, reg.RegionID); 157 int flags = m_aScene.GridService.GetRegionFlags(m_aScene.RegionInfo.ScopeID, reg.RegionID);
@@ -240,7 +243,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
240 string url = aCircuit.ServiceURLs["HomeURI"].ToString(); 243 string url = aCircuit.ServiceURLs["HomeURI"].ToString();
241 IUserAgentService security = new UserAgentServiceConnector(url); 244 IUserAgentService security = new UserAgentServiceConnector(url);
242 return security.VerifyClient(aCircuit.SessionID, token); 245 return security.VerifyClient(aCircuit.SessionID, token);
243 } 246 }
247 else
248 m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Agent {0} {1} does not have a HomeURI OH NO!", aCircuit.firstname, aCircuit.lastname);
244 249
245 return false; 250 return false;
246 } 251 }
diff --git a/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs b/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs
index fd0e879..2dd7767 100644
--- a/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs
+++ b/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs
@@ -595,12 +595,12 @@ namespace OpenSim.Region.CoreModules.InterGrid
595 // DEPRECATED 595 // DEPRECATED
596 responseMap["seed_capability"] 596 responseMap["seed_capability"]
597 = OSD.FromString( 597 = OSD.FromString(
598 regionCapsHttpProtocol + httpaddr + ":" + reg.HttpPort + CapsUtil.GetCapsSeedPath(userCap.CapsObjectPath)); 598 regionCapsHttpProtocol + httpaddr + ":" + reg.HttpPort + "/" + CapsUtil.GetCapsSeedPath(userCap.CapsObjectPath));
599 599
600 // REPLACEMENT 600 // REPLACEMENT
601 responseMap["region_seed_capability"] 601 responseMap["region_seed_capability"]
602 = OSD.FromString( 602 = OSD.FromString(
603 regionCapsHttpProtocol + httpaddr + ":" + reg.HttpPort + CapsUtil.GetCapsSeedPath(userCap.CapsObjectPath)); 603 regionCapsHttpProtocol + httpaddr + ":" + reg.HttpPort + "/" + CapsUtil.GetCapsSeedPath(userCap.CapsObjectPath));
604 604
605 responseMap["rez_avatar"] = OSD.FromString(rezHttpProtocol + httpaddr + ":" + urlport + rezAvatarPath); 605 responseMap["rez_avatar"] = OSD.FromString(rezHttpProtocol + httpaddr + ":" + urlport + rezAvatarPath);
606 responseMap["rez_avatar/rez"] = OSD.FromString(rezHttpProtocol + httpaddr + ":" + urlport + rezAvatarPath); 606 responseMap["rez_avatar/rez"] = OSD.FromString(rezHttpProtocol + httpaddr + ":" + urlport + rezAvatarPath);
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
index 3e478b0..9869f4a 100644
--- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
+++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
@@ -147,7 +147,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
147 147
148 string regionimage = "regionImage" + m_scene.RegionInfo.RegionID.ToString(); 148 string regionimage = "regionImage" + m_scene.RegionInfo.RegionID.ToString();
149 regionimage = regionimage.Replace("-", ""); 149 regionimage = regionimage.Replace("-", "");
150 m_log.Info("[WORLD MAP]: JPEG Map location: http://" + m_scene.RegionInfo.ExternalEndPoint.Address.ToString() + ":" + m_scene.RegionInfo.HttpPort.ToString() + "/index.php?method=" + regionimage); 150 m_log.Info("[WORLD MAP]: JPEG Map location: " + m_scene.RegionInfo.ServerURI + "/index.php?method=" + regionimage);
151 151
152 MainServer.Instance.AddHTTPHandler(regionimage, OnHTTPGetMapImage); 152 MainServer.Instance.AddHTTPHandler(regionimage, OnHTTPGetMapImage);
153 MainServer.Instance.AddLLSDHandler( 153 MainServer.Instance.AddLLSDHandler(
@@ -579,7 +579,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
579 579
580 if (mreg != null) 580 if (mreg != null)
581 { 581 {
582 httpserver = "http://" + mreg.ExternalEndPoint.Address.ToString() + ":" + mreg.HttpPort + "/MAP/MapItems/" + regionhandle.ToString(); 582 httpserver = mreg.ServerURI + "MAP/MapItems/" + regionhandle.ToString();
583 lock (m_cachedRegionMapItemsAddress) 583 lock (m_cachedRegionMapItemsAddress)
584 { 584 {
585 if (!m_cachedRegionMapItemsAddress.ContainsKey(regionhandle)) 585 if (!m_cachedRegionMapItemsAddress.ContainsKey(regionhandle))
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 792115a..e48b92b 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -3826,6 +3826,7 @@ namespace OpenSim.Region.Framework.Scenes
3826 } 3826 }
3827 3827
3828 ScenePresence childAgentUpdate = WaitGetScenePresence(cAgentData.AgentID); 3828 ScenePresence childAgentUpdate = WaitGetScenePresence(cAgentData.AgentID);
3829
3829 if (childAgentUpdate != null) 3830 if (childAgentUpdate != null)
3830 { 3831 {
3831 childAgentUpdate.ChildAgentDataUpdate(cAgentData); 3832 childAgentUpdate.ChildAgentDataUpdate(cAgentData);
diff --git a/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs b/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs
index f64a079..a5ec4f2 100644
--- a/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs
+++ b/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs
@@ -124,6 +124,8 @@ namespace OpenSim.Server.Handlers.Hypergrid
124 UUID uuid = UUID.Zero; 124 UUID uuid = UUID.Zero;
125 string regionname = string.Empty; 125 string regionname = string.Empty;
126 string gatekeeper_host = string.Empty; 126 string gatekeeper_host = string.Empty;
127 string gatekeeper_serveruri = string.Empty;
128 string destination_serveruri = string.Empty;
127 int gatekeeper_port = 0; 129 int gatekeeper_port = 0;
128 IPEndPoint client_ipaddress = null; 130 IPEndPoint client_ipaddress = null;
129 131
@@ -131,8 +133,13 @@ namespace OpenSim.Server.Handlers.Hypergrid
131 gatekeeper_host = args["gatekeeper_host"].AsString(); 133 gatekeeper_host = args["gatekeeper_host"].AsString();
132 if (args.ContainsKey("gatekeeper_port") && args["gatekeeper_port"] != null) 134 if (args.ContainsKey("gatekeeper_port") && args["gatekeeper_port"] != null)
133 Int32.TryParse(args["gatekeeper_port"].AsString(), out gatekeeper_port); 135 Int32.TryParse(args["gatekeeper_port"].AsString(), out gatekeeper_port);
136 if (args.ContainsKey("gatekeeper_serveruri") && args["gatekeeper_serveruri"] !=null)
137 gatekeeper_serveruri = args["gatekeeper_serveruri"];
138 if (args.ContainsKey("destination_serveruri") && args["destination_serveruri"] !=null)
139 destination_serveruri = args["destination_serveruri"];
134 140
135 GridRegion gatekeeper = new GridRegion(); 141 GridRegion gatekeeper = new GridRegion();
142 gatekeeper.ServerURI = gatekeeper_serveruri;
136 gatekeeper.ExternalHostName = gatekeeper_host; 143 gatekeeper.ExternalHostName = gatekeeper_host;
137 gatekeeper.HttpPort = (uint)gatekeeper_port; 144 gatekeeper.HttpPort = (uint)gatekeeper_port;
138 gatekeeper.InternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), 0); 145 gatekeeper.InternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), 0);
@@ -173,7 +180,8 @@ namespace OpenSim.Server.Handlers.Hypergrid
173 destination.RegionLocX = x; 180 destination.RegionLocX = x;
174 destination.RegionLocY = y; 181 destination.RegionLocY = y;
175 destination.RegionName = regionname; 182 destination.RegionName = regionname;
176 183 destination.ServerURI = destination_serveruri;
184
177 AgentCircuitData aCircuit = new AgentCircuitData(); 185 AgentCircuitData aCircuit = new AgentCircuitData();
178 try 186 try
179 { 187 {
diff --git a/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs
index 479a80e..85c1380 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,12 +86,11 @@ 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 string uri = "http://" + ((info.ServerURI != null && info.ServerURI != string.Empty && !info.ServerURI.StartsWith("http:")) ? info.ServerURI : info.ExternalEndPoint.Address + ":" + info.HttpPort + "/"); 89 m_log.Debug("[GATEKEEPER SERVICE CONNECTOR]: Linking to " + info.ServerURI);
90 m_log.Debug("[GATEKEEPER SERVICE CONNECTOR]: Linking to " + uri);
91 XmlRpcResponse response = null; 90 XmlRpcResponse response = null;
92 try 91 try
93 { 92 {
94 response = request.Send(uri, 10000); 93 response = request.Send(info.ServerURI, 10000);
95 } 94 }
96 catch (Exception e) 95 catch (Exception e)
97 { 96 {
@@ -117,16 +116,20 @@ namespace OpenSim.Services.Connectors.Hypergrid
117 if (success) 116 if (success)
118 { 117 {
119 UUID.TryParse((string)hash["uuid"], out regionID); 118 UUID.TryParse((string)hash["uuid"], out regionID);
120 //m_log.Debug(">> HERE, uuid: " + uuid); 119 //m_log.Debug(">> HERE, uuid: " + regionID);
121 if ((string)hash["handle"] != null) 120 if ((string)hash["handle"] != null)
122 { 121 {
123 realHandle = Convert.ToUInt64((string)hash["handle"]); 122 realHandle = Convert.ToUInt64((string)hash["handle"]);
124 //m_log.Debug(">> HERE, realHandle: " + realHandle); 123 //m_log.Debug(">> HERE, realHandle: " + realHandle);
125 } 124 }
126 if (hash["region_image"] != null) 125 if (hash["region_image"] != null) {
127 imageURL = (string)hash["region_image"]; 126 imageURL = (string)hash["region_image"];
128 if (hash["external_name"] != null) 127 //m_log.Debug(">> HERE, imageURL: " + imageURL);
128 }
129 if (hash["external_name"] != null) {
129 externalName = (string)hash["external_name"]; 130 externalName = (string)hash["external_name"];
131 //m_log.Debug(">> HERE, externalName: " + externalName);
132 }
130 } 133 }
131 134
132 } 135 }
@@ -188,12 +191,11 @@ namespace OpenSim.Services.Connectors.Hypergrid
188 paramList.Add(hash); 191 paramList.Add(hash);
189 192
190 XmlRpcRequest request = new XmlRpcRequest("get_region", paramList); 193 XmlRpcRequest request = new XmlRpcRequest("get_region", paramList);
191 string uri = "http://" + ((gatekeeper.ServerURI != null && gatekeeper.ServerURI != string.Empty && !gatekeeper.ServerURI.StartsWith("http:")) ? gatekeeper.ServerURI : gatekeeper.ExternalEndPoint.Address + ":" + gatekeeper.HttpPort + "/"); 194 m_log.Debug("[GATEKEEPER SERVICE CONNECTOR]: contacting " + gatekeeper.ServerURI);
192 m_log.Debug("[GATEKEEPER SERVICE CONNECTOR]: contacting " + uri);
193 XmlRpcResponse response = null; 195 XmlRpcResponse response = null;
194 try 196 try
195 { 197 {
196 response = request.Send(uri, 10000); 198 response = request.Send(gatekeeper.ServerURI, 10000);
197 } 199 }
198 catch (Exception e) 200 catch (Exception e)
199 { 201 {
@@ -236,21 +238,31 @@ namespace OpenSim.Services.Connectors.Hypergrid
236 if (hash["region_name"] != null) 238 if (hash["region_name"] != null)
237 { 239 {
238 region.RegionName = (string)hash["region_name"]; 240 region.RegionName = (string)hash["region_name"];
239 //m_log.Debug(">> HERE, name: " + region.RegionName); 241 //m_log.Debug(">> HERE, region_name: " + region.RegionName);
240 } 242 }
241 if (hash["hostname"] != null) 243 if (hash["hostname"] != null) {
242 region.ExternalHostName = (string)hash["hostname"]; 244 region.ExternalHostName = (string)hash["hostname"];
245 //m_log.Debug(">> HERE, hostname: " + region.ExternalHostName);
246 }
243 if (hash["http_port"] != null) 247 if (hash["http_port"] != null)
244 { 248 {
245 uint p = 0; 249 uint p = 0;
246 UInt32.TryParse((string)hash["http_port"], out p); 250 UInt32.TryParse((string)hash["http_port"], out p);
247 region.HttpPort = p; 251 region.HttpPort = p;
252 //m_log.Debug(">> HERE, http_port: " + region.HttpPort);
248 } 253 }
249 if (hash["internal_port"] != null) 254 if (hash["internal_port"] != null)
250 { 255 {
251 int p = 0; 256 int p = 0;
252 Int32.TryParse((string)hash["internal_port"], out p); 257 Int32.TryParse((string)hash["internal_port"], out p);
253 region.InternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), p); 258 region.InternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), p);
259 //m_log.Debug(">> HERE, internal_port: " + region.InternalEndPoint);
260 }
261
262 if (hash["server_uri"] != null)
263 {
264 region.ServerURI = (string) hash["server_uri"];
265 //m_log.Debug(">> HERE, server_uri: " + region.ServerURI);
254 } 266 }
255 267
256 // Successful return 268 // Successful return
diff --git a/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs
index 247dd7e..0c41935 100644
--- a/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs
@@ -232,12 +232,14 @@ namespace OpenSim.Services.Connectors.Hypergrid
232 m_log.Debug("[USER AGENT CONNECTOR]: PackAgentCircuitData failed with exception: " + e.Message); 232 m_log.Debug("[USER AGENT CONNECTOR]: PackAgentCircuitData failed with exception: " + e.Message);
233 } 233 }
234 // Add the input arguments 234 // Add the input arguments
235 args["gatekeeper_serveruri"] = OSD.FromString(gatekeeper.ServerURI);
235 args["gatekeeper_host"] = OSD.FromString(gatekeeper.ExternalHostName); 236 args["gatekeeper_host"] = OSD.FromString(gatekeeper.ExternalHostName);
236 args["gatekeeper_port"] = OSD.FromString(gatekeeper.HttpPort.ToString()); 237 args["gatekeeper_port"] = OSD.FromString(gatekeeper.HttpPort.ToString());
237 args["destination_x"] = OSD.FromString(destination.RegionLocX.ToString()); 238 args["destination_x"] = OSD.FromString(destination.RegionLocX.ToString());
238 args["destination_y"] = OSD.FromString(destination.RegionLocY.ToString()); 239 args["destination_y"] = OSD.FromString(destination.RegionLocY.ToString());
239 args["destination_name"] = OSD.FromString(destination.RegionName); 240 args["destination_name"] = OSD.FromString(destination.RegionName);
240 args["destination_uuid"] = OSD.FromString(destination.RegionID.ToString()); 241 args["destination_uuid"] = OSD.FromString(destination.RegionID.ToString());
242 args["destination_serveruri"] = OSD.FromString(destination.ServerURI);
241 243
242 // 10/3/2010 244 // 10/3/2010
243 // I added the client_ip up to the regular AgentCircuitData, so this doesn't need to be here. 245 // I added the client_ip up to the regular AgentCircuitData, so this doesn't need to be here.
diff --git a/OpenSim/Services/Connectors/Land/LandServiceConnector.cs b/OpenSim/Services/Connectors/Land/LandServiceConnector.cs
index 539b2cc..10499e2 100644
--- a/OpenSim/Services/Connectors/Land/LandServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Land/LandServiceConnector.cs
@@ -84,8 +84,7 @@ 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 string uri = "http://" + info.ExternalEndPoint.Address + ":" + info.HttpPort + "/"; 87 XmlRpcResponse response = request.Send(info.ServerURI, 10000);
88 XmlRpcResponse response = request.Send(uri, 10000);
89 if (response.IsFault) 88 if (response.IsFault)
90 { 89 {
91 m_log.ErrorFormat("[LAND CONNECTOR]: remote call returned an error: {0}", response.FaultString); 90 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 0a982f8..9c57a40 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 = "http://" + region.ExternalEndPoint.Address + ":" + region.HttpPort + "/region/" + thisRegion.RegionID + "/"; 90 string uri = region.ServerURI + "/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 4fc2a6d..f86eba3 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs
@@ -147,8 +147,6 @@ namespace OpenSim.Services.Connectors.SimianGrid
147 Vector3d minPosition = new Vector3d(regionInfo.RegionLocX, regionInfo.RegionLocY, 0.0); 147 Vector3d minPosition = new Vector3d(regionInfo.RegionLocX, regionInfo.RegionLocY, 0.0);
148 Vector3d maxPosition = minPosition + new Vector3d(Constants.RegionSize, Constants.RegionSize, 4096.0); 148 Vector3d maxPosition = minPosition + new Vector3d(Constants.RegionSize, Constants.RegionSize, 4096.0);
149 149
150 string httpAddress = "http://" + regionInfo.ExternalHostName + ":" + regionInfo.HttpPort + "/";
151
152 OSDMap extraData = new OSDMap 150 OSDMap extraData = new OSDMap
153 { 151 {
154 { "ServerURI", OSD.FromString(regionInfo.ServerURI) }, 152 { "ServerURI", OSD.FromString(regionInfo.ServerURI) },
@@ -170,7 +168,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
170 { "Name", regionInfo.RegionName }, 168 { "Name", regionInfo.RegionName },
171 { "MinPosition", minPosition.ToString() }, 169 { "MinPosition", minPosition.ToString() },
172 { "MaxPosition", maxPosition.ToString() }, 170 { "MaxPosition", maxPosition.ToString() },
173 { "Address", httpAddress }, 171 { "Address", regionInfo.ServerURI },
174 { "Enabled", "1" }, 172 { "Enabled", "1" },
175 { "ExtraData", OSDParser.SerializeJsonString(extraData) } 173 { "ExtraData", OSDParser.SerializeJsonString(extraData) }
176 }; 174 };
diff --git a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs
index 1730b95..415c6ea 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,26 +104,7 @@ namespace OpenSim.Services.Connectors.Simulation
104 return false; 104 return false;
105 } 105 }
106 106
107 string uri = string.Empty; 107 string uri = destination.ServerURI + AgentPath() + aCircuit.AgentID + "/";
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.Error("[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);
127 108
128 AgentCreateRequest = (HttpWebRequest)WebRequest.Create(uri); 109 AgentCreateRequest = (HttpWebRequest)WebRequest.Create(uri);
129 AgentCreateRequest.Method = "POST"; 110 AgentCreateRequest.Method = "POST";
@@ -277,17 +258,8 @@ namespace OpenSim.Services.Connectors.Simulation
277 private bool UpdateAgent(GridRegion destination, IAgentData cAgentData) 258 private bool UpdateAgent(GridRegion destination, IAgentData cAgentData)
278 { 259 {
279 // Eventually, we want to use a caps url instead of the agentID 260 // Eventually, we want to use a caps url instead of the agentID
280 string uri = string.Empty; 261
281 try 262 string uri = destination.ServerURI + AgentPath() + cAgentData.AgentID + "/";
282 {
283 uri = "http://" + destination.ExternalEndPoint.Address + ":" + destination.HttpPort + AgentPath() + cAgentData.AgentID + "/";
284 }
285 catch (Exception e)
286 {
287 m_log.Warn("[REMOTE SIMULATION CONNECTOR]: Unable to resolve external endpoint on agent update. Reason: " + e.Message);
288 return false;
289 }
290 //Console.WriteLine(" >>> DoAgentUpdateCall <<< " + uri);
291 263
292 HttpWebRequest ChildUpdateRequest = (HttpWebRequest)WebRequest.Create(uri); 264 HttpWebRequest ChildUpdateRequest = (HttpWebRequest)WebRequest.Create(uri);
293 ChildUpdateRequest.Method = "PUT"; 265 ChildUpdateRequest.Method = "PUT";
@@ -387,8 +359,7 @@ namespace OpenSim.Services.Connectors.Simulation
387 agent = null; 359 agent = null;
388 if (ext == null) return false; 360 if (ext == null) return false;
389 // Eventually, we want to use a caps url instead of the agentID 361 // Eventually, we want to use a caps url instead of the agentID
390 string uri = "http://" + destination.ExternalEndPoint.Address + ":" + destination.HttpPort + AgentPath() + id + "/" + destination.RegionID.ToString() + "/"; 362 string uri = destination.ServerURI + AgentPath() + id + "/" + destination.RegionID.ToString() + "/";
391 //Console.WriteLine(" >>> DoRetrieveRootAgentCall <<< " + uri);
392 363
393 HttpWebRequest request = (HttpWebRequest)WebRequest.Create(uri); 364 HttpWebRequest request = (HttpWebRequest)WebRequest.Create(uri);
394 request.Method = "GET"; 365 request.Method = "GET";
@@ -409,7 +380,6 @@ namespace OpenSim.Services.Connectors.Simulation
409 sr = new StreamReader(webResponse.GetResponseStream()); 380 sr = new StreamReader(webResponse.GetResponseStream());
410 reply = sr.ReadToEnd().Trim(); 381 reply = sr.ReadToEnd().Trim();
411 382
412 //Console.WriteLine("[REMOTE SIMULATION CONNECTOR]: ChilAgentUpdate reply was " + reply);
413 383
414 } 384 }
415 catch (WebException ex) 385 catch (WebException ex)
@@ -430,7 +400,6 @@ namespace OpenSim.Services.Connectors.Simulation
430 OSDMap args = Util.GetOSDMap(reply); 400 OSDMap args = Util.GetOSDMap(reply);
431 if (args == null) 401 if (args == null)
432 { 402 {
433 //Console.WriteLine("[REMOTE SIMULATION CONNECTOR]: Error getting OSDMap from reply");
434 return false; 403 return false;
435 } 404 }
436 405
@@ -439,7 +408,6 @@ namespace OpenSim.Services.Connectors.Simulation
439 return true; 408 return true;
440 } 409 }
441 410
442 //Console.WriteLine("[REMOTE SIMULATION CONNECTOR]: DoRetrieveRootAgentCall returned status " + webResponse.StatusCode);
443 return false; 411 return false;
444 } 412 }
445 413
@@ -481,18 +449,7 @@ namespace OpenSim.Services.Connectors.Simulation
481 449
482 private bool CloseAgent(GridRegion destination, UUID id, bool ChildOnly) 450 private bool CloseAgent(GridRegion destination, UUID id, bool ChildOnly)
483 { 451 {
484 string uri = string.Empty; 452 string uri = destination.ServerURI + AgentPath() + id + "/" + destination.RegionID.ToString() + "/";
485 try
486 {
487 uri = "http://" + destination.ExternalEndPoint.Address + ":" + destination.HttpPort + AgentPath() + id + "/" + destination.RegionID.ToString() + "/";
488 }
489 catch (Exception e)
490 {
491 m_log.Warn("[REMOTE SIMULATION CONNECTOR]: Unable to resolve external endpoint on agent close. Reason: " + e.Message);
492 return false;
493 }
494
495 //Console.WriteLine(" >>> DoCloseAgentCall <<< " + uri);
496 453
497 WebRequest request = WebRequest.Create(uri); 454 WebRequest request = WebRequest.Create(uri);
498 request.Method = "DELETE"; 455 request.Method = "DELETE";
@@ -554,7 +511,7 @@ namespace OpenSim.Services.Connectors.Simulation
554 IPEndPoint ext = destination.ExternalEndPoint; 511 IPEndPoint ext = destination.ExternalEndPoint;
555 if (ext == null) return false; 512 if (ext == null) return false;
556 string uri 513 string uri
557 = "http://" + destination.ExternalEndPoint.Address + ":" + destination.HttpPort + ObjectPath() + sog.UUID + "/"; 514 = destination.ServerURI + ObjectPath() + sog.UUID + "/";
558 //m_log.Debug(" >>> DoCreateObjectCall <<< " + uri); 515 //m_log.Debug(" >>> DoCreateObjectCall <<< " + uri);
559 516
560 WebRequest ObjectCreateRequest = WebRequest.Create(uri); 517 WebRequest ObjectCreateRequest = WebRequest.Create(uri);
diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs
index e7988d6..125c2be 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), "http://" + r.Data["serverIP"].ToString() + ":" + r.Data["serverPort"].ToString(), 482 String.Format("{0},{1}", r.posX, r.posY), r.Data["serverURI"],
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 a67404f..d5d0195 100644
--- a/OpenSim/Services/GridService/HypergridLinker.cs
+++ b/OpenSim/Services/GridService/HypergridLinker.cs
@@ -127,15 +127,18 @@ namespace OpenSim.Services.GridService
127 127
128 if (MainConsole.Instance != null) 128 if (MainConsole.Instance != null)
129 { 129 {
130 MainConsole.Instance.Commands.AddCommand("hypergrid", false, "link-region",
131 "link-region <Xloc> <Yloc> <ServerURI> [<RemoteRegionName>]",
132 "Link a HyperGrid Region", RunCommand);
130 MainConsole.Instance.Commands.AddCommand("hypergrid", false, "link-region", 133 MainConsole.Instance.Commands.AddCommand("hypergrid", false, "link-region",
131 "link-region <Xloc> <Yloc> <HostName>:<HttpPort>[:<RemoteRegionName>] <cr>", 134 "link-region <Xloc> <Yloc> <RegionIP> <RegionPort> [<RemoteRegionName>]",
132 "Link a hypergrid region", RunCommand); 135 "Link a hypergrid region (deprecated)", RunCommand);
133 MainConsole.Instance.Commands.AddCommand("hypergrid", false, "unlink-region", 136 MainConsole.Instance.Commands.AddCommand("hypergrid", false, "unlink-region",
134 "unlink-region <local name> or <HostName>:<HttpPort> <cr>", 137 "unlink-region <local name>",
135 "Unlink a hypergrid region", RunCommand); 138 "Unlink a hypergrid region", RunCommand);
136 MainConsole.Instance.Commands.AddCommand("hypergrid", false, "link-mapping", "link-mapping [<x> <y>] <cr>", 139 MainConsole.Instance.Commands.AddCommand("hypergrid", false, "link-mapping", "link-mapping [<x> <y>]",
137 "Set local coordinate to map HG regions to", RunCommand); 140 "Set local coordinate to map HG regions to", RunCommand);
138 MainConsole.Instance.Commands.AddCommand("hypergrid", false, "show hyperlinks", "show hyperlinks <cr>", 141 MainConsole.Instance.Commands.AddCommand("hypergrid", false, "show hyperlinks", "show hyperlinks",
139 "List the HG regions", HandleShow); 142 "List the HG regions", HandleShow);
140 } 143 }
141 } 144 }
@@ -204,30 +207,37 @@ namespace OpenSim.Services.GridService
204 207
205 return null; 208 return null;
206 } 209 }
207 210
208 211 public bool TryCreateLink(UUID scopeID, int xloc, int yloc, string remoteRegionName, uint externalPort, string externalHostName, UUID ownerID, out GridRegion regInfo, out string reason)
209 // From the command line and the 2 above 212 {
210 public bool TryCreateLink(UUID scopeID, int xloc, int yloc, 213 return TryCreateLink(scopeID, xloc, yloc, remoteRegionName, externalPort, externalHostName, null, ownerID, out regInfo, out reason);
211 string externalRegionName, uint externalPort, string externalHostName, UUID ownerID, 214 }
212 out GridRegion regInfo, out string reason) 215
216 public bool TryCreateLink(UUID scopeID, int xloc, int yloc, string remoteRegionName, uint externalPort, string externalHostName, string serverURI, UUID ownerID, out GridRegion regInfo, out string reason)
213 { 217 {
214 m_log.DebugFormat("[HYPERGRID LINKER]: Link to {0}:{1}:{2}, in {3}-{4}", externalHostName, externalPort, externalRegionName, xloc, yloc); 218 m_log.DebugFormat("[HYPERGRID LINKER]: Link to {0}:{1}:{2}, in {3}-{4}", externalHostName, externalPort, remoteRegionName, xloc, yloc);
215 219
216 reason = string.Empty; 220 reason = string.Empty;
217 regInfo = new GridRegion(); 221 regInfo = new GridRegion();
218 regInfo.RegionName = externalRegionName; 222 if ( externalPort > 0)
219 regInfo.HttpPort = externalPort; 223 regInfo.HttpPort = externalPort;
220 regInfo.ExternalHostName = externalHostName; 224 else
225 regInfo.HttpPort = 0;
226 if ( externalHostName != null)
227 regInfo.ExternalHostName = externalHostName;
228 else
229 regInfo.ExternalHostName = "0.0.0.0";
230 if ( serverURI != null)
231 regInfo.ServerURI = serverURI;
232
233 if ( remoteRegionName != string.Empty )
234 regInfo.RegionName = remoteRegionName;
235
221 regInfo.RegionLocX = xloc; 236 regInfo.RegionLocX = xloc;
222 regInfo.RegionLocY = yloc; 237 regInfo.RegionLocY = yloc;
223 regInfo.ScopeID = scopeID; 238 regInfo.ScopeID = scopeID;
224 regInfo.EstateOwner = ownerID; 239 regInfo.EstateOwner = ownerID;
225 240
226 // Big HACK for Simian Grid !!!
227 // We need to clean up all URLs used in OpenSim !!!
228 if (externalHostName.Contains("/"))
229 regInfo.ServerURI = externalHostName;
230
231 // Check for free coordinates 241 // Check for free coordinates
232 GridRegion region = m_GridService.GetRegionByPosition(regInfo.ScopeID, regInfo.RegionLocX, regInfo.RegionLocY); 242 GridRegion region = m_GridService.GetRegionByPosition(regInfo.ScopeID, regInfo.RegionLocX, regInfo.RegionLocY);
233 if (region != null) 243 if (region != null)
@@ -267,9 +277,14 @@ namespace OpenSim.Services.GridService
267 } 277 }
268 278
269 regInfo.RegionID = regionID; 279 regInfo.RegionID = regionID;
270 if (regInfo.RegionName == string.Empty)
271 regInfo.RegionName = regInfo.ExternalHostName;
272 280
281 if ( externalName == string.Empty )
282 regInfo.RegionName = regInfo.ServerURI;
283 else
284 regInfo.RegionName = externalName;
285
286 m_log.Debug("[HYPERGRID LINKER]: naming linked region " + regInfo.RegionName);
287
273 // Try get the map image 288 // Try get the map image
274 //regInfo.TerrainImage = m_GatekeeperConnector.GetMapImage(regionID, imageURL); 289 //regInfo.TerrainImage = m_GatekeeperConnector.GetMapImage(regionID, imageURL);
275 // I need a texture that works for this... the one I tried doesn't seem to be working 290 // I need a texture that works for this... the one I tried doesn't seem to be working
@@ -316,13 +331,6 @@ namespace OpenSim.Services.GridService
316 } 331 }
317 } 332 }
318 333
319 //foreach (GridRegion r in m_HyperlinkRegions.Values)
320 //{
321 // m_log.DebugFormat("XXX Comparing {0}:{1} with {2}:{3}", host, port, r.ExternalHostName, r.HttpPort);
322 // if (host.Equals(r.ExternalHostName) && (port == r.HttpPort))
323 // regInfo = r;
324 //}
325
326 if (regInfo != null) 334 if (regInfo != null)
327 { 335 {
328 RemoveHyperlinkRegion(regInfo.RegionID); 336 RemoveHyperlinkRegion(regInfo.RegionID);
@@ -442,6 +450,21 @@ namespace OpenSim.Services.GridService
442 RunHGCommand(command, cmdparams); 450 RunHGCommand(command, cmdparams);
443 451
444 } 452 }
453
454 private void RunLinkRegionCommand(string[] cmdparams)
455 {
456 int xloc, yloc;
457 string serverURI;
458 string remoteName = null;
459 xloc = Convert.ToInt32(cmdparams[0]) * (int)Constants.RegionSize;
460 yloc = Convert.ToInt32(cmdparams[1]) * (int)Constants.RegionSize;
461 serverURI = cmdparams[2];
462 if (cmdparams.Length == 4)
463 remoteName = cmdparams[3];
464 string reason = string.Empty;
465 GridRegion regInfo;
466 TryCreateLink(UUID.Zero, xloc, yloc, remoteName, 0, null, serverURI, UUID.Zero, out regInfo, out reason);
467 }
445 468
446 private void RunHGCommand(string command, string[] cmdparams) 469 private void RunHGCommand(string command, string[] cmdparams)
447 { 470 {
@@ -465,6 +488,18 @@ namespace OpenSim.Services.GridService
465 } 488 }
466 else if (command.Equals("link-region")) 489 else if (command.Equals("link-region"))
467 { 490 {
491 if (cmdparams.Length > 0 && cmdparams.Length < 5)
492 {
493 RunLinkRegionCommand(cmdparams);
494 }
495 else
496 {
497 LinkRegionCmdUsage();
498 }
499 return;
500 }
501 else if (command.Equals("link-region"))
502 {
468 if (cmdparams.Length < 3) 503 if (cmdparams.Length < 3)
469 { 504 {
470 if ((cmdparams.Length == 1) || (cmdparams.Length == 2)) 505 if ((cmdparams.Length == 1) || (cmdparams.Length == 2))
@@ -478,7 +513,11 @@ namespace OpenSim.Services.GridService
478 return; 513 return;
479 } 514 }
480 515
481 if (cmdparams[2].Contains(":")) 516 //this should be the prefererred way of setting up hg links now
517 if ( cmdparams[2].StartsWith("http") && ( cmdparams.Length >= 3 && cmdparams.Length <= 5 )) {
518 RunLinkRegionCommand(cmdparams);
519 }
520 else if (cmdparams[2].Contains(":"))
482 { 521 {
483 // New format 522 // New format
484 int xloc, yloc; 523 int xloc, yloc;
@@ -517,12 +556,16 @@ namespace OpenSim.Services.GridService
517 int xloc, yloc; 556 int xloc, yloc;
518 uint externalPort; 557 uint externalPort;
519 string externalHostName; 558 string externalHostName;
559 string serverURI;
520 try 560 try
521 { 561 {
522 xloc = Convert.ToInt32(cmdparams[0]); 562 xloc = Convert.ToInt32(cmdparams[0]);
523 yloc = Convert.ToInt32(cmdparams[1]); 563 yloc = Convert.ToInt32(cmdparams[1]);
524 externalPort = Convert.ToUInt32(cmdparams[3]); 564 externalPort = Convert.ToUInt32(cmdparams[3]);
525 externalHostName = cmdparams[2]; 565 externalHostName = cmdparams[2];
566 if ( cmdparams.Length == 4 ) {
567
568 }
526 //internalPort = Convert.ToUInt32(cmdparams[4]); 569 //internalPort = Convert.ToUInt32(cmdparams[4]);
527 //remotingPort = Convert.ToUInt32(cmdparams[5]); 570 //remotingPort = Convert.ToUInt32(cmdparams[5]);
528 } 571 }
@@ -537,7 +580,7 @@ namespace OpenSim.Services.GridService
537 xloc = xloc * (int)Constants.RegionSize; 580 xloc = xloc * (int)Constants.RegionSize;
538 yloc = yloc * (int)Constants.RegionSize; 581 yloc = yloc * (int)Constants.RegionSize;
539 string reason = string.Empty; 582 string reason = string.Empty;
540 if (TryCreateLink(UUID.Zero, xloc, yloc, "", externalPort, externalHostName, UUID.Zero, out regInfo, out reason)) 583 if (TryCreateLink(UUID.Zero, xloc, yloc, string.Empty, externalPort, externalHostName, UUID.Zero, out regInfo, out reason))
541 { 584 {
542 if (cmdparams.Length >= 5) 585 if (cmdparams.Length >= 5)
543 { 586 {
@@ -551,7 +594,7 @@ namespace OpenSim.Services.GridService
551 } 594 }
552 else if (command.Equals("unlink-region")) 595 else if (command.Equals("unlink-region"))
553 { 596 {
554 if (cmdparams.Length < 1) 597 if (cmdparams.Length < 1 || cmdparams.Length > 1)
555 { 598 {
556 UnlinkRegionCmdUsage(); 599 UnlinkRegionCmdUsage();
557 return; 600 return;
@@ -639,7 +682,7 @@ namespace OpenSim.Services.GridService
639 xloc = xloc * (int)Constants.RegionSize; 682 xloc = xloc * (int)Constants.RegionSize;
640 yloc = yloc * (int)Constants.RegionSize; 683 yloc = yloc * (int)Constants.RegionSize;
641 string reason = string.Empty; 684 string reason = string.Empty;
642 if (TryCreateLink(UUID.Zero, xloc, yloc, "", externalPort, externalHostName, UUID.Zero, out regInfo, out reason)) 685 if (TryCreateLink(UUID.Zero, xloc, yloc, string.Empty, externalPort, externalHostName, UUID.Zero, out regInfo, out reason))
643 { 686 {
644 regInfo.RegionName = config.GetString("localName", ""); 687 regInfo.RegionName = config.GetString("localName", "");
645 } 688 }
@@ -651,14 +694,14 @@ namespace OpenSim.Services.GridService
651 694
652 private void LinkRegionCmdUsage() 695 private void LinkRegionCmdUsage()
653 { 696 {
654 MainConsole.Instance.Output("Usage: link-region <Xloc> <Yloc> <HostName>:<HttpPort>[:<RemoteRegionName>]"); 697 MainConsole.Instance.Output("Usage: link-region <Xloc> <Yloc> <ServerURI> [<RemoteRegionName>]");
655 MainConsole.Instance.Output("Usage: link-region <Xloc> <Yloc> <HostName> <HttpPort> [<LocalName>]"); 698 MainConsole.Instance.Output("Usage (deprecated): link-region <Xloc> <Yloc> <HostName>:<HttpPort>[:<RemoteRegionName>]");
699 MainConsole.Instance.Output("Usage (deprecated): link-region <Xloc> <Yloc> <HostName> <HttpPort> [<LocalName>]");
656 MainConsole.Instance.Output("Usage: link-region <URI_of_xml> [<exclude>]"); 700 MainConsole.Instance.Output("Usage: link-region <URI_of_xml> [<exclude>]");
657 } 701 }
658 702
659 private void UnlinkRegionCmdUsage() 703 private void UnlinkRegionCmdUsage()
660 { 704 {
661 MainConsole.Instance.Output("Usage: unlink-region <HostName>:<HttpPort>");
662 MainConsole.Instance.Output("Usage: unlink-region <LocalName>"); 705 MainConsole.Instance.Output("Usage: unlink-region <LocalName>");
663 } 706 }
664 707
diff --git a/OpenSim/Services/HypergridService/GatekeeperService.cs b/OpenSim/Services/HypergridService/GatekeeperService.cs
index 0aa5352..05be7b8 100644
--- a/OpenSim/Services/HypergridService/GatekeeperService.cs
+++ b/OpenSim/Services/HypergridService/GatekeeperService.cs
@@ -87,6 +87,8 @@ namespace OpenSim.Services.HypergridService
87 //m_WelcomeMessage = serverConfig.GetString("WelcomeMessage", "Welcome to OpenSim!"); 87 //m_WelcomeMessage = serverConfig.GetString("WelcomeMessage", "Welcome to OpenSim!");
88 m_AllowTeleportsToAnyRegion = serverConfig.GetBoolean("AllowTeleportsToAnyRegion", true); 88 m_AllowTeleportsToAnyRegion = serverConfig.GetBoolean("AllowTeleportsToAnyRegion", true);
89 m_ExternalName = serverConfig.GetString("ExternalName", string.Empty); 89 m_ExternalName = serverConfig.GetString("ExternalName", string.Empty);
90 if (m_ExternalName != string.Empty && !m_ExternalName.EndsWith("/"))
91 m_ExternalName = m_ExternalName + "/";
90 92
91 Object[] args = new Object[] { config }; 93 Object[] args = new Object[] { config };
92 m_GridService = ServerUtils.LoadPlugin<IGridService>(gridService, args); 94 m_GridService = ServerUtils.LoadPlugin<IGridService>(gridService, args);
@@ -118,7 +120,7 @@ namespace OpenSim.Services.HypergridService
118 { 120 {
119 regionID = UUID.Zero; 121 regionID = UUID.Zero;
120 regionHandle = 0; 122 regionHandle = 0;
121 externalName = m_ExternalName; 123 externalName = m_ExternalName + ((regionName != string.Empty) ? " " + regionName : "");
122 imageURL = string.Empty; 124 imageURL = string.Empty;
123 reason = string.Empty; 125 reason = string.Empty;
124 126
@@ -157,7 +159,7 @@ namespace OpenSim.Services.HypergridService
157 string regionimage = "regionImage" + region.RegionID.ToString(); 159 string regionimage = "regionImage" + region.RegionID.ToString();
158 regionimage = regionimage.Replace("-", ""); 160 regionimage = regionimage.Replace("-", "");
159 161
160 imageURL = "http://" + region.ExternalHostName + ":" + region.HttpPort + "/index.php?method=" + regionimage; 162 imageURL = region.ServerURI + "index.php?method=" + regionimage;
161 163
162 return true; 164 return true;
163 } 165 }
diff --git a/OpenSim/Services/HypergridService/UserAgentService.cs b/OpenSim/Services/HypergridService/UserAgentService.cs
index eb6433c..3519250 100644
--- a/OpenSim/Services/HypergridService/UserAgentService.cs
+++ b/OpenSim/Services/HypergridService/UserAgentService.cs
@@ -101,6 +101,8 @@ namespace OpenSim.Services.HypergridService
101 serverConfig = config.Configs["GatekeeperService"]; 101 serverConfig = config.Configs["GatekeeperService"];
102 m_GridName = serverConfig.GetString("ExternalName", string.Empty); 102 m_GridName = serverConfig.GetString("ExternalName", string.Empty);
103 } 103 }
104 else if (!m_GridName.EndsWith("/"))
105 m_GridName = m_GridName + "/";
104 } 106 }
105 } 107 }
106 108
@@ -134,23 +136,27 @@ namespace OpenSim.Services.HypergridService
134 public bool LoginAgentToGrid(AgentCircuitData agentCircuit, GridRegion gatekeeper, GridRegion finalDestination, IPEndPoint clientIP, out string reason) 136 public bool LoginAgentToGrid(AgentCircuitData agentCircuit, GridRegion gatekeeper, GridRegion finalDestination, IPEndPoint clientIP, out string reason)
135 { 137 {
136 m_log.DebugFormat("[USER AGENT SERVICE]: Request to login user {0} {1} (@{2}) to grid {3}", 138 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()), 139 agentCircuit.firstname, agentCircuit.lastname, ((clientIP == null) ? "stored IP" : clientIP.Address.ToString()), gatekeeper.ServerURI);
138 gatekeeper.ExternalHostName +":"+ gatekeeper.HttpPort);
139
140 // 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
141 GridRegion region = new GridRegion(gatekeeper); 141 GridRegion region = new GridRegion(gatekeeper);
142 region.ServerURI = gatekeeper.ServerURI;
143 region.ExternalHostName = finalDestination.ExternalHostName;
144 region.InternalEndPoint = finalDestination.InternalEndPoint;
142 region.RegionName = finalDestination.RegionName; 145 region.RegionName = finalDestination.RegionName;
143 region.RegionID = finalDestination.RegionID; 146 region.RegionID = finalDestination.RegionID;
144 region.RegionLocX = finalDestination.RegionLocX; 147 region.RegionLocX = finalDestination.RegionLocX;
145 region.RegionLocY = finalDestination.RegionLocY; 148 region.RegionLocY = finalDestination.RegionLocY;
146 149
147 // Generate a new service session 150 // Generate a new service session
148 agentCircuit.ServiceSessionID = "http://" + region.ExternalHostName + ":" + region.HttpPort + ";" + UUID.Random(); 151 agentCircuit.ServiceSessionID = region.ServerURI + ";" + UUID.Random();
149 TravelingAgentInfo old = UpdateTravelInfo(agentCircuit, region); 152 TravelingAgentInfo old = UpdateTravelInfo(agentCircuit, region);
150 153
151 bool success = false; 154 bool success = false;
152 string myExternalIP = string.Empty; 155 string myExternalIP = string.Empty;
153 string gridName = "http://" + gatekeeper.ExternalHostName + ":" + gatekeeper.HttpPort; 156 string gridName = gatekeeper.ServerURI;
157
158 m_log.DebugFormat("[USER AGENT SERVICE]: m_grid - {0}, gn - {1}", m_GridName, gridName);
159
154 if (m_GridName == gridName) 160 if (m_GridName == gridName)
155 success = m_GatekeeperService.LoginAgent(agentCircuit, finalDestination, out reason); 161 success = m_GatekeeperService.LoginAgent(agentCircuit, finalDestination, out reason);
156 else 162 else
@@ -159,7 +165,7 @@ namespace OpenSim.Services.HypergridService
159 if (!success) 165 if (!success)
160 { 166 {
161 m_log.DebugFormat("[USER AGENT SERVICE]: Unable to login user {0} {1} to grid {2}, reason: {3}", 167 m_log.DebugFormat("[USER AGENT SERVICE]: Unable to login user {0} {1} to grid {2}, reason: {3}",
162 agentCircuit.firstname, agentCircuit.lastname, region.ExternalHostName + ":" + region.HttpPort, reason); 168 agentCircuit.firstname, agentCircuit.lastname, region.ServerURI, reason);
163 169
164 // restore the old travel info 170 // restore the old travel info
165 lock (m_TravelingAgents) 171 lock (m_TravelingAgents)
@@ -210,7 +216,7 @@ namespace OpenSim.Services.HypergridService
210 m_TravelingAgents[agentCircuit.SessionID] = travel; 216 m_TravelingAgents[agentCircuit.SessionID] = travel;
211 } 217 }
212 travel.UserID = agentCircuit.AgentID; 218 travel.UserID = agentCircuit.AgentID;
213 travel.GridExternalName = "http://" + region.ExternalHostName + ":" + region.HttpPort; 219 travel.GridExternalName = region.ServerURI;
214 travel.ServiceToken = agentCircuit.ServiceSessionID; 220 travel.ServiceToken = agentCircuit.ServiceSessionID;
215 if (old != null) 221 if (old != null)
216 travel.ClientIPAddress = old.ClientIPAddress; 222 travel.ClientIPAddress = old.ClientIPAddress;
diff --git a/OpenSim/Services/Interfaces/IGridService.cs b/OpenSim/Services/Interfaces/IGridService.cs
index 8cf846b..f569fc8 100644
--- a/OpenSim/Services/Interfaces/IGridService.cs
+++ b/OpenSim/Services/Interfaces/IGridService.cs
@@ -115,8 +115,20 @@ namespace OpenSim.Services.Interfaces
115 /// </summary> 115 /// </summary>
116 public string ServerURI 116 public string ServerURI
117 { 117 {
118 get { return m_serverURI; } 118 get {
119 set { m_serverURI = value; } 119 if ( m_serverURI != string.Empty ) {
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 }
120 } 132 }
121 protected string m_serverURI; 133 protected string m_serverURI;
122 134
@@ -164,6 +176,7 @@ namespace OpenSim.Services.Interfaces
164 176
165 public GridRegion() 177 public GridRegion()
166 { 178 {
179 m_serverURI = string.Empty;
167 } 180 }
168 181
169 public GridRegion(int regionLocX, int regionLocY, IPEndPoint internalEndPoint, string externalUri) 182 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 011cad8..e98cc22 100644
--- a/OpenSim/Services/LLLoginService/LLLoginResponse.cs
+++ b/OpenSim/Services/LLLoginService/LLLoginResponse.cs
@@ -339,34 +339,7 @@ namespace OpenSim.Services.LLLoginService
339 339
340 private void FillOutSeedCap(AgentCircuitData aCircuit, GridRegion destination, IPEndPoint ipepClient) 340 private void FillOutSeedCap(AgentCircuitData aCircuit, GridRegion destination, IPEndPoint ipepClient)
341 { 341 {
342 string capsSeedPath = String.Empty; 342 SeedCapability = destination.ServerURI + CapsUtil.GetCapsSeedPath(aCircuit.CapsPath);
343
344 // Don't use the following! It Fails for logging into any region not on the same port as the http server!
345 // Kept here so it doesn't happen again!
346 // response.SeedCapability = regionInfo.ServerURI + capsSeedPath;
347
348 #region IP Translation for NAT
349 if (ipepClient != null)
350 {
351 capsSeedPath
352 = "http://"
353 + NetworkUtil.GetHostFor(ipepClient.Address, destination.ExternalHostName)
354 + ":"
355 + destination.HttpPort
356 + CapsUtil.GetCapsSeedPath(aCircuit.CapsPath);
357 }
358 else
359 {
360 capsSeedPath
361 = "http://"
362 + destination.ExternalHostName
363 + ":"
364 + destination.HttpPort
365 + CapsUtil.GetCapsSeedPath(aCircuit.CapsPath);
366 }
367 #endregion
368
369 SeedCapability = capsSeedPath;
370 } 343 }
371 344
372 private void SetDefaultValues() 345 private void SetDefaultValues()
diff --git a/OpenSim/Services/LLLoginService/LLLoginService.cs b/OpenSim/Services/LLLoginService/LLLoginService.cs
index 335c7e7..1749836 100644
--- a/OpenSim/Services/LLLoginService/LLLoginService.cs
+++ b/OpenSim/Services/LLLoginService/LLLoginService.cs
@@ -593,6 +593,7 @@ namespace OpenSim.Services.LLLoginService
593 593
594 private GridRegion FindForeignRegion(string domainName, uint port, string regionName, out GridRegion gatekeeper) 594 private GridRegion FindForeignRegion(string domainName, uint port, string regionName, out GridRegion gatekeeper)
595 { 595 {
596 m_log.Debug("[LLLOGIN SERVICE]: attempting to findforeignregion " + domainName + ":" + port.ToString() + ":" + regionName);
596 gatekeeper = new GridRegion(); 597 gatekeeper = new GridRegion();
597 gatekeeper.ExternalHostName = domainName; 598 gatekeeper.ExternalHostName = domainName;
598 gatekeeper.HttpPort = port; 599 gatekeeper.HttpPort = port;
@@ -658,11 +659,9 @@ namespace OpenSim.Services.LLLoginService
658 gatekeeper = new GridRegion(destination); 659 gatekeeper = new GridRegion(destination);
659 gatekeeper.ExternalHostName = hostName; 660 gatekeeper.ExternalHostName = hostName;
660 gatekeeper.HttpPort = (uint)port; 661 gatekeeper.HttpPort = (uint)port;
661 662 gatekeeper.ServerURI = m_GatekeeperURL;
662 }
663 else // login to foreign grid
664 {
665 } 663 }
664 m_log.Debug("[LLLOGIN SERVICE]: no gatekeeper detected..... using " + m_GatekeeperURL);
666 } 665 }
667 666
668 bool success = false; 667 bool success = false;