aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJonathan Freedman2010-10-21 23:22:15 -0400
committerJonathan Freedman2010-10-21 23:22:15 -0400
commitd4144bedb81346301162f1e20266561fea7b621e (patch)
treef33876acc79e1a5b688d95cc41628446d70297fa
parentMerge branch 'master' of git://opensimulator.org/git/opensim (diff)
downloadopensim-SC_OLD-d4144bedb81346301162f1e20266561fea7b621e.zip
opensim-SC_OLD-d4144bedb81346301162f1e20266561fea7b621e.tar.gz
opensim-SC_OLD-d4144bedb81346301162f1e20266561fea7b621e.tar.bz2
opensim-SC_OLD-d4144bedb81346301162f1e20266561fea7b621e.tar.xz
* change the data exchanged within hypergrid transactions
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs2
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs8
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs5
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs5
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs2
-rw-r--r--OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs10
-rw-r--r--OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs35
-rw-r--r--OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs2
-rw-r--r--OpenSim/Services/GridService/HypergridLinker.cs73
-rw-r--r--OpenSim/Services/HypergridService/UserAgentService.cs10
10 files changed, 108 insertions, 44 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
index cb298fd..624814a 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
@@ -631,7 +631,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
631 IClientAPI client; 631 IClientAPI client;
632 if (!m_scene.TryGetClient(address, out client) || !(client is LLClientView)) 632 if (!m_scene.TryGetClient(address, out client) || !(client is LLClientView))
633 { 633 {
634 //m_log.Debug("[LLUDPSERVER]: Received a " + packet.Type + " packet from an unrecognized source: " + address + " in " + m_scene.RegionInfo.RegionName); 634 m_log.Debug("[LLUDPSERVER]: Received a " + packet.Type + " packet from an unrecognized source: " + address + " in " + m_scene.RegionInfo.RegionName);
635 return; 635 return;
636 } 636 }
637 637
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
index 54cc80f..925af3f 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
@@ -197,8 +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 m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Final destination is x={0} y={1} uuid={2}", 200 m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Final destination is x={0} y={1} {2}@{3}",
201 finalDestination.RegionLocX / Constants.RegionSize, finalDestination.RegionLocY / Constants.RegionSize, finalDestination.RegionID); 201 finalDestination.RegionLocX / Constants.RegionSize, finalDestination.RegionLocY / Constants.RegionSize, finalDestination.RegionID, finalDestination.ServerURI);
202 202
203 // Check that these are not the same coordinates 203 // Check that these are not the same coordinates
204 if (finalDestination.RegionLocX == sp.Scene.RegionInfo.RegionLocX && 204 if (finalDestination.RegionLocX == sp.Scene.RegionInfo.RegionLocX &&
@@ -254,8 +254,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
254 } 254 }
255 255
256 m_log.DebugFormat( 256 m_log.DebugFormat(
257 "[ENTITY TRANSFER MODULE]: Request Teleport to {0}:{1}:{2}/{3}", 257 "[ENTITY TRANSFER MODULE]: Request Teleport to {0} ({1}) {2}/{3}",
258 reg.ExternalHostName, reg.HttpPort, finalDestination.RegionName, position); 258 reg.ServerURI, finalDestination.ServerURI, finalDestination.RegionName, position);
259 259
260 uint newRegionX = (uint)(reg.RegionHandle >> 40); 260 uint newRegionX = (uint)(reg.RegionHandle >> 40);
261 uint newRegionY = (((uint)(reg.RegionHandle)) >> 8); 261 uint newRegionY = (((uint)(reg.RegionHandle)) >> 8);
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs
index 1ac7508..9a275ae 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.Debug("GetfinalDestination serveruri -> " + 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.Debug("CreateAgent " + 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);
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 0cfc235..2750168 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -3740,9 +3740,12 @@ namespace OpenSim.Region.Framework.Scenes
3740 3740
3741 // We have to wait until the viewer contacts this region after receiving EAC. 3741 // We have to wait until the viewer contacts this region after receiving EAC.
3742 // That calls AddNewClient, which finally creates the ScenePresence 3742 // That calls AddNewClient, which finally creates the ScenePresence
3743 m_log.Debug("ICADU -> pre wait");
3743 ScenePresence childAgentUpdate = WaitGetScenePresence(cAgentData.AgentID); 3744 ScenePresence childAgentUpdate = WaitGetScenePresence(cAgentData.AgentID);
3745 m_log.Debug("ICADU -> post wait");
3744 if (childAgentUpdate != null) 3746 if (childAgentUpdate != null)
3745 { 3747 {
3748 m_log.Debug("ICADU -> not child agent!");
3746 childAgentUpdate.ChildAgentDataUpdate(cAgentData); 3749 childAgentUpdate.ChildAgentDataUpdate(cAgentData);
3747 return true; 3750 return true;
3748 } 3751 }
@@ -3758,7 +3761,7 @@ namespace OpenSim.Region.Framework.Scenes
3758 /// <returns>true if we handled it.</returns> 3761 /// <returns>true if we handled it.</returns>
3759 public virtual bool IncomingChildAgentDataUpdate(AgentPosition cAgentData) 3762 public virtual bool IncomingChildAgentDataUpdate(AgentPosition cAgentData)
3760 { 3763 {
3761 //m_log.Debug(" XXX Scene IncomingChildAgentDataUpdate POSITION in " + RegionInfo.RegionName); 3764 m_log.Debug(" XXX Scene IncomingChildAgentDataUpdate POSITION in " + RegionInfo.RegionName);
3762 ScenePresence childAgentUpdate = GetScenePresence(cAgentData.AgentID); 3765 ScenePresence childAgentUpdate = GetScenePresence(cAgentData.AgentID);
3763 if (childAgentUpdate != null) 3766 if (childAgentUpdate != null)
3764 { 3767 {
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index c223b4b..68ac178 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -2925,7 +2925,7 @@ namespace OpenSim.Region.Framework.Scenes
2925 2925
2926 public void ChildAgentDataUpdate(AgentData cAgentData) 2926 public void ChildAgentDataUpdate(AgentData cAgentData)
2927 { 2927 {
2928 //m_log.Debug(" >>> ChildAgentDataUpdate <<< " + Scene.RegionInfo.RegionName); 2928 m_log.Debug(" >>> ChildAgentDataUpdate <<< " + Scene.RegionInfo.RegionName);
2929 if (!IsChildAgent) 2929 if (!IsChildAgent)
2930 return; 2930 return;
2931 2931
diff --git a/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs b/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs
index a1bcba6..a5ec4f2 100644
--- a/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs
+++ b/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs
@@ -124,7 +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 server_uri = string.Empty; 127 string gatekeeper_serveruri = string.Empty;
128 string destination_serveruri = string.Empty;
128 int gatekeeper_port = 0; 129 int gatekeeper_port = 0;
129 IPEndPoint client_ipaddress = null; 130 IPEndPoint client_ipaddress = null;
130 131
@@ -132,8 +133,13 @@ namespace OpenSim.Server.Handlers.Hypergrid
132 gatekeeper_host = args["gatekeeper_host"].AsString(); 133 gatekeeper_host = args["gatekeeper_host"].AsString();
133 if (args.ContainsKey("gatekeeper_port") && args["gatekeeper_port"] != null) 134 if (args.ContainsKey("gatekeeper_port") && args["gatekeeper_port"] != null)
134 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"];
135 140
136 GridRegion gatekeeper = new GridRegion(); 141 GridRegion gatekeeper = new GridRegion();
142 gatekeeper.ServerURI = gatekeeper_serveruri;
137 gatekeeper.ExternalHostName = gatekeeper_host; 143 gatekeeper.ExternalHostName = gatekeeper_host;
138 gatekeeper.HttpPort = (uint)gatekeeper_port; 144 gatekeeper.HttpPort = (uint)gatekeeper_port;
139 gatekeeper.InternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), 0); 145 gatekeeper.InternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), 0);
@@ -174,8 +180,8 @@ namespace OpenSim.Server.Handlers.Hypergrid
174 destination.RegionLocX = x; 180 destination.RegionLocX = x;
175 destination.RegionLocY = y; 181 destination.RegionLocY = y;
176 destination.RegionName = regionname; 182 destination.RegionName = regionname;
183 destination.ServerURI = destination_serveruri;
177 184
178
179 AgentCircuitData aCircuit = new AgentCircuitData(); 185 AgentCircuitData aCircuit = new AgentCircuitData();
180 try 186 try
181 { 187 {
diff --git a/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs
index 4231be1..70bafda 100644
--- a/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs
@@ -116,19 +116,19 @@ namespace OpenSim.Services.Connectors.Hypergrid
116 if (success) 116 if (success)
117 { 117 {
118 UUID.TryParse((string)hash["uuid"], out regionID); 118 UUID.TryParse((string)hash["uuid"], out regionID);
119 //m_log.Debug(">> HERE, uuid: " + regionID); 119 m_log.Debug(">> HERE, uuid: " + regionID);
120 if ((string)hash["handle"] != null) 120 if ((string)hash["handle"] != null)
121 { 121 {
122 realHandle = Convert.ToUInt64((string)hash["handle"]); 122 realHandle = Convert.ToUInt64((string)hash["handle"]);
123 //m_log.Debug(">> HERE, realHandle: " + realHandle); 123 m_log.Debug(">> HERE, realHandle: " + realHandle);
124 } 124 }
125 if (hash["region_image"] != null) { 125 if (hash["region_image"] != null) {
126 imageURL = (string)hash["region_image"]; 126 imageURL = (string)hash["region_image"];
127 //m_log.Debug(">> HERE, imageURL: " + imageURL); 127 m_log.Debug(">> HERE, imageURL: " + imageURL);
128 } 128 }
129 if (hash["external_name"] != null) { 129 if (hash["external_name"] != null) {
130 externalName = (string)hash["external_name"]; 130 externalName = (string)hash["external_name"];
131 //m_log.Debug(">> HERE, externalName: " + externalName); 131 m_log.Debug(">> HERE, externalName: " + externalName);
132 } 132 }
133 } 133 }
134 134
@@ -191,7 +191,7 @@ namespace OpenSim.Services.Connectors.Hypergrid
191 paramList.Add(hash); 191 paramList.Add(hash);
192 192
193 XmlRpcRequest request = new XmlRpcRequest("get_region", paramList); 193 XmlRpcRequest request = new XmlRpcRequest("get_region", paramList);
194 //m_log.Debug("[GATEKEEPER SERVICE CONNECTOR]: contacting " + gatekeeper.ServerURI); 194 m_log.Debug("[GATEKEEPER SERVICE CONNECTOR]: contacting " + gatekeeper.ServerURI);
195 XmlRpcResponse response = null; 195 XmlRpcResponse response = null;
196 try 196 try
197 { 197 {
@@ -199,7 +199,7 @@ namespace OpenSim.Services.Connectors.Hypergrid
199 } 199 }
200 catch (Exception e) 200 catch (Exception e)
201 { 201 {
202 //m_log.Debug("[GATEKEEPER SERVICE CONNECTOR]: Exception " + e.Message); 202 m_log.Debug("[GATEKEEPER SERVICE CONNECTOR]: Exception " + e.Message);
203 return null; 203 return null;
204 } 204 }
205 205
@@ -221,41 +221,48 @@ namespace OpenSim.Services.Connectors.Hypergrid
221 GridRegion region = new GridRegion(); 221 GridRegion region = new GridRegion();
222 222
223 UUID.TryParse((string)hash["uuid"], out region.RegionID); 223 UUID.TryParse((string)hash["uuid"], out region.RegionID);
224 //m_log.Debug(">> HERE, uuid: " + region.RegionID); 224 m_log.Debug(">> HERE, uuid: " + region.RegionID);
225 int n = 0; 225 int n = 0;
226 if (hash["x"] != null) 226 if (hash["x"] != null)
227 { 227 {
228 Int32.TryParse((string)hash["x"], out n); 228 Int32.TryParse((string)hash["x"], out n);
229 region.RegionLocX = n; 229 region.RegionLocX = n;
230 //m_log.Debug(">> HERE, x: " + region.RegionLocX); 230 m_log.Debug(">> HERE, x: " + region.RegionLocX);
231 } 231 }
232 if (hash["y"] != null) 232 if (hash["y"] != null)
233 { 233 {
234 Int32.TryParse((string)hash["y"], out n); 234 Int32.TryParse((string)hash["y"], out n);
235 region.RegionLocY = n; 235 region.RegionLocY = n;
236 //m_log.Debug(">> HERE, y: " + region.RegionLocY); 236 m_log.Debug(">> HERE, y: " + region.RegionLocY);
237 } 237 }
238 if (hash["region_name"] != null) 238 if (hash["region_name"] != null)
239 { 239 {
240 region.RegionName = (string)hash["region_name"]; 240 region.RegionName = (string)hash["region_name"];
241 //m_log.Debug(">> HERE, region_name: " + region.RegionName); 241 m_log.Debug(">> HERE, region_name: " + region.RegionName);
242 } 242 }
243 if (hash["hostname"] != null) 243 if (hash["hostname"] != null) {
244 region.ExternalHostName = (string)hash["hostname"]; 244 region.ExternalHostName = (string)hash["hostname"];
245 //m_log.Debug(">> HERE, hostname: " + region.ExternalHostName); 245 m_log.Debug(">> HERE, hostname: " + region.ExternalHostName);
246 }
246 if (hash["http_port"] != null) 247 if (hash["http_port"] != null)
247 { 248 {
248 uint p = 0; 249 uint p = 0;
249 UInt32.TryParse((string)hash["http_port"], out p); 250 UInt32.TryParse((string)hash["http_port"], out p);
250 region.HttpPort = p; 251 region.HttpPort = p;
251 //m_log.Debug(">> HERE, http_port: " + region.HttpPort); 252 m_log.Debug(">> HERE, http_port: " + region.HttpPort);
252 } 253 }
253 if (hash["internal_port"] != null) 254 if (hash["internal_port"] != null)
254 { 255 {
255 int p = 0; 256 int p = 0;
256 Int32.TryParse((string)hash["internal_port"], out p); 257 Int32.TryParse((string)hash["internal_port"], out p);
257 region.InternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), p); 258 region.InternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), p);
258 //m_log.Debug(">> HERE, internal_port: " + region.InternalEndPoint); 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);
259 } 266 }
260 267
261 // 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/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs
index 74e864b..c273d21 100644
--- a/OpenSim/Services/GridService/HypergridLinker.cs
+++ b/OpenSim/Services/GridService/HypergridLinker.cs
@@ -126,11 +126,12 @@ namespace OpenSim.Services.GridService
126 126
127 if (MainConsole.Instance != null) 127 if (MainConsole.Instance != null)
128 { 128 {
129 MainConsole.Instance.Commands.AddCommand("hypergrid", false, "link-region", 129 MainConsole.Instance.Commands.AddCommand("hypergrid", false, "link-region", "link-region <Xloc> <Yloc> <ServerURI> [<RemoteRegionName>]", "Link a HyperGrid Region", RunCommand);
130 "link-region <Xloc> <Yloc> <RegionIP> <RegionPort> [<RegionServerURI] [<RemoteRegionName>] <cr>", 130 MainConsole.Instance.Commands.AddCommand("hypergrid", false, "legacy-link-region",
131 "Link a hypergrid region", RunCommand); 131 "legacy-link-region <Xloc> <Yloc> <RegionIP> <RegionPort> [<RemoteRegionName>]",
132 "Link a hypergrid region (deprecated)", 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>",
134 "Unlink a hypergrid region", RunCommand); 135 "Unlink a hypergrid region", RunCommand);
135 MainConsole.Instance.Commands.AddCommand("hypergrid", false, "link-mapping", "link-mapping [<x> <y>] <cr>", 136 MainConsole.Instance.Commands.AddCommand("hypergrid", false, "link-mapping", "link-mapping [<x> <y>] <cr>",
136 "Set local coordinate to map HG regions to", RunCommand); 137 "Set local coordinate to map HG regions to", RunCommand);
@@ -198,27 +199,33 @@ namespace OpenSim.Services.GridService
198 199
199 return null; 200 return null;
200 } 201 }
202
201 public bool TryCreateLink(UUID scopeID, int xloc, int yloc, string externalRegionName, uint externalPort, string externalHostName, out GridRegion regInfo, out string reason) 203 public bool TryCreateLink(UUID scopeID, int xloc, int yloc, string externalRegionName, uint externalPort, string externalHostName, out GridRegion regInfo, out string reason)
202 { 204 {
205 return TryCreateLink(scopeID, xloc, yloc, externalRegionName, externalPort, externalHostName, null, out regInfo, out reason);
206 }
207
208 public bool TryCreateLink(UUID scopeID, int xloc, int yloc, string externalRegionName, uint externalPort, string externalHostName, string serverURI, out GridRegion regInfo, out string reason)
209 {
203 m_log.DebugFormat("[HYPERGRID LINKER]: Link to {0}:{1}:{2}, in {3}-{4}", externalHostName, externalPort, externalRegionName, xloc, yloc); 210 m_log.DebugFormat("[HYPERGRID LINKER]: Link to {0}:{1}:{2}, in {3}-{4}", externalHostName, externalPort, externalRegionName, xloc, yloc);
204 211
205 reason = string.Empty; 212 reason = string.Empty;
206 regInfo = new GridRegion(); 213 regInfo = new GridRegion();
207 regInfo.RegionName = externalRegionName; 214 if ( externalPort > 0)
208 regInfo.HttpPort = externalPort; 215 regInfo.HttpPort = externalPort;
209 regInfo.ExternalHostName = externalHostName; 216 else
217 regInfo.HttpPort = 0;
218 if ( externalHostName != null)
219 regInfo.ExternalHostName = externalHostName;
220 else
221 regInfo.ExternalHostName = "0.0.0.0";
222 if ( serverURI != null)
223 regInfo.ServerURI = serverURI;
224
210 regInfo.RegionLocX = xloc; 225 regInfo.RegionLocX = xloc;
211 regInfo.RegionLocY = yloc; 226 regInfo.RegionLocY = yloc;
212 regInfo.ScopeID = scopeID; 227 regInfo.ScopeID = scopeID;
213 228
214 // Big HACK for Simian Grid !!!
215 // We need to clean up all URLs used in OpenSim !!!
216 if (externalHostName.Contains("/")) {
217 regInfo.ServerURI = externalHostName;
218 } else {
219 regInfo.ServerURI = "http://" + externalHostName + ":" + externalPort.ToString();
220 }
221
222 try 229 try
223 { 230 {
224 regInfo.InternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), (int)0); 231 regInfo.InternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), (int)0);
@@ -249,9 +256,14 @@ namespace OpenSim.Services.GridService
249 } 256 }
250 257
251 regInfo.RegionID = regionID; 258 regInfo.RegionID = regionID;
252 if (regInfo.RegionName == string.Empty)
253 regInfo.RegionName = regInfo.ExternalHostName;
254 259
260 if ( externalName == string.Empty )
261 regInfo.RegionName = regInfo.ServerURI;
262 else
263 regInfo.RegionName = externalName;
264
265 m_log.Debug("naming linked region " + regInfo.RegionName);
266
255 // Try get the map image 267 // Try get the map image
256 //regInfo.TerrainImage = m_GatekeeperConnector.GetMapImage(regionID, imageURL); 268 //regInfo.TerrainImage = m_GatekeeperConnector.GetMapImage(regionID, imageURL);
257 // I need a texture that works for this... the one I tried doesn't seem to be working 269 // I need a texture that works for this... the one I tried doesn't seem to be working
@@ -433,6 +445,21 @@ namespace OpenSim.Services.GridService
433 RunHGCommand(command, cmdparams); 445 RunHGCommand(command, cmdparams);
434 446
435 } 447 }
448
449 private void RunLinkRegionCommand(string[] cmdparams)
450 {
451 int xloc, yloc;
452 string serverURI;
453 string remoteName = null;
454 xloc = Convert.ToInt32(cmdparams[0]) * (int)Constants.RegionSize;
455 yloc = Convert.ToInt32(cmdparams[1]) * (int)Constants.RegionSize;
456 serverURI = cmdparams[2];
457 if (cmdparams.Length == 4)
458 remoteName = cmdparams[3];
459 string reason = string.Empty;
460 GridRegion regInfo;
461 TryCreateLink(UUID.Zero, xloc, yloc, remoteName, 0, null, serverURI, out regInfo, out reason);
462 }
436 463
437 private void RunHGCommand(string command, string[] cmdparams) 464 private void RunHGCommand(string command, string[] cmdparams)
438 { 465 {
@@ -456,6 +483,18 @@ namespace OpenSim.Services.GridService
456 } 483 }
457 else if (command.Equals("link-region")) 484 else if (command.Equals("link-region"))
458 { 485 {
486 if (cmdparams.Length > 0 && cmdparams.Length < 5)
487 {
488 RunLinkRegionCommand(cmdparams);
489 }
490 else
491 {
492 LinkRegionCmdUsage();
493 }
494 return;
495 }
496 else if (command.Equals("legacy-link-region"))
497 {
459 if (cmdparams.Length < 3) 498 if (cmdparams.Length < 3)
460 { 499 {
461 if ((cmdparams.Length == 1) || (cmdparams.Length == 2)) 500 if ((cmdparams.Length == 1) || (cmdparams.Length == 2))
diff --git a/OpenSim/Services/HypergridService/UserAgentService.cs b/OpenSim/Services/HypergridService/UserAgentService.cs
index aed2dc8..eb19fe2 100644
--- a/OpenSim/Services/HypergridService/UserAgentService.cs
+++ b/OpenSim/Services/HypergridService/UserAgentService.cs
@@ -134,12 +134,14 @@ namespace OpenSim.Services.HypergridService
134 public bool LoginAgentToGrid(AgentCircuitData agentCircuit, GridRegion gatekeeper, GridRegion finalDestination, IPEndPoint clientIP, out string reason) 134 public bool LoginAgentToGrid(AgentCircuitData agentCircuit, GridRegion gatekeeper, GridRegion finalDestination, IPEndPoint clientIP, out string reason)
135 { 135 {
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()), gatekeeper.ServerURI);
138 gatekeeper.ExternalHostName +":"+ gatekeeper.HttpPort);
139 m_log.Debug("gatekeeper serveruri -> " + gatekeeper.ServerURI );
140 138
139 m_log.Debug("LATG final server uri -> " + finalDestination.ServerURI );
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);
142 region.ServerURI = gatekeeper.ServerURI;
143 region.ExternalHostName = finalDestination.ExternalHostName;
144 region.InternalEndPoint = finalDestination.InternalEndPoint;
143 region.RegionName = finalDestination.RegionName; 145 region.RegionName = finalDestination.RegionName;
144 region.RegionID = finalDestination.RegionID; 146 region.RegionID = finalDestination.RegionID;
145 region.RegionLocX = finalDestination.RegionLocX; 147 region.RegionLocX = finalDestination.RegionLocX;
@@ -149,6 +151,8 @@ namespace OpenSim.Services.HypergridService
149 agentCircuit.ServiceSessionID = region.ServerURI + ";" + UUID.Random(); 151 agentCircuit.ServiceSessionID = region.ServerURI + ";" + UUID.Random();
150 TravelingAgentInfo old = UpdateTravelInfo(agentCircuit, region); 152 TravelingAgentInfo old = UpdateTravelInfo(agentCircuit, region);
151 153
154 m_log.Debug("region ServerURI -> " + region.ServerURI);
155
152 bool success = false; 156 bool success = false;
153 string myExternalIP = string.Empty; 157 string myExternalIP = string.Empty;
154 string gridName = gatekeeper.ServerURI; 158 string gridName = gatekeeper.ServerURI;